diff --git a/config/alfresco/content-publishing-context.xml b/config/alfresco/content-publishing-context.xml index 0943c2ac94..4b2aeb87a4 100644 --- a/config/alfresco/content-publishing-context.xml +++ b/config/alfresco/content-publishing-context.xml @@ -119,4 +119,93 @@ + + + + + + + + + + ${server.transaction.mode.readOnly} + ${server.transaction.mode.default} + + + + + + + org.alfresco.service.cmr.publishing.PublishingService + + + + + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.readOnly} + ${server.transaction.mode.default} + + + + + + + org.alfresco.service.cmr.publishing.channels.ChannelService + + + + + + + + + + + + + + + + + + + + + {http://www.alfresco.org/model/content/1.0}content + + + + + + + + + + + + diff --git a/config/alfresco/messages/publishing-service.properties b/config/alfresco/messages/publishing-service.properties index c3582bdfeb..5f4ca0c27a 100644 --- a/config/alfresco/messages/publishing-service.properties +++ b/config/alfresco/messages/publishing-service.properties @@ -1 +1,15 @@ # Publish service externalised display strings +publishing.channelNotFound=Unable to find specified publishing channel: {0} +publishing.neitherNameNorIdSpecified=Neither channel name nor identifier has been specified + +publish-content.title=Publish +publish-content.description=Publish content to a publishing channel +publish-content.publish-channel-name.display-label=Channel to publish content to +publish-content.publish-channel-id.display-label=Channel to publish content to +publish-content.unpublish.display-label=Unpublish +publish-content.status-update.display-label=Status update +publish-content.include-link-in-status-update.display-label=Append link to status update +publish-content.status-update-channel-names.display-label=Channels to post status update to +publish-content.status-update-channel-ids.display-label=Channels to post status update to +publish-content.scheduled-time.display-label=Time to publish +publish-content.comment.display-label=Comment diff --git a/source/java/org/alfresco/repo/publishing/PublishContentActionExecuter.java b/source/java/org/alfresco/repo/publishing/PublishContentActionExecuter.java new file mode 100644 index 0000000000..84a6e1a774 --- /dev/null +++ b/source/java/org/alfresco/repo/publishing/PublishContentActionExecuter.java @@ -0,0 +1,279 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.publishing; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.action.ParameterizedItem; +import org.alfresco.service.cmr.action.ParameterizedItemDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.publishing.PublishingDetails; +import org.alfresco.service.cmr.publishing.PublishingService; +import org.alfresco.service.cmr.publishing.channels.Channel; +import org.alfresco.service.cmr.publishing.channels.ChannelService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.rule.RuleServiceException; + +/** + * This class defines an action that publishes or unpublishes the acted-upon + * node to a specified publishing channel. + * + * @author Brian + * @since 4.0 + */ +public class PublishContentActionExecuter extends ActionExecuterAbstractBase +{ + public final static String NAME = "publish_content"; + + /** + * A single-valued, optional text parameter that names the publishing + * channel to which the specified content is to be published. Although this + * is optional, one of either "publish-channel-name" or "publish-channel-id" + * MUST be specified. If both are specified then "publish-channel-id" takes + * precedence. + * + * @see PublishContentActionExecuter#PARAM_PUBLISH_CHANNEL_ID + */ + public final static String PARAM_PUBLISH_CHANNEL_NAME = "publish-channel-name"; + + /** + * A single-valued, optional text parameter that identifies the publishing + * channel to which the specified content is to be published. Although this + * is optional, one of either "publish-channel-name" or "publish-channel-id" + * MUST be specified. If both are specified then "publish-channel-id" takes + * precedence. + * + * @see PublishContentActionExecuter#PARAM_PUBLISH_CHANNEL_NAME + */ + public final static String PARAM_PUBLISH_CHANNEL_ID = "publish-channel-id"; + + /** + * A single-valued, optional boolean parameter that indicates whether the + * node being acted on should be unpublished (true) or published (false, the + * default). + */ + public final static String PARAM_UNPUBLISH = "unpublish"; + + /** + * A single-valued, optional text parameter that specifies the text of a + * status update that is to be sent to the specified channels upon + * successful publication + * + * @see PublishContentActionExecuter#PARAM_STATUS_UPDATE_CHANNEL_NAMES + */ + public final static String PARAM_STATUS_UPDATE = "status-update"; + + /** + * A single-valued, optional boolean parameter that specifies whether a link + * to the published content should be appended (in shortened form) to the + * status update. Defaults to true if not set. + * + * @see PublishContentActionExecuter#PARAM_STATUS_UPDATE_CHANNEL_NAMES + * @see PublishContentActionExecuter#PARAM_STATUS_UPDATE + */ + public final static String PARAM_INCLUDE_LINK_IN_STATUS_UPDATE = "include-link-in-status-update"; + + /** + * A multi-valued, optional text parameter that identifies by name the + * publishing channels to which the status update (if any) should be sent. + * If both this parameter and the "status-update-channel-ids" parameter are + * given values then they are combined. + * + * @see PublishContentActionExecuter#PARAM_STATUS_UPDATE + * @see PublishContentActionExecuter#PARAM_STATUS_UPDATE_CHANNEL_IDS + */ + public final static String PARAM_STATUS_UPDATE_CHANNEL_NAMES = "status-update-channel-names"; + + /** + * A multi-valued, optional text parameter that identifies the publishing + * channels to which the status update (if any) should be sent. If both this + * parameter and the "status-update-channel-names" parameter are given + * values then they are combined. + * + * @see PublishContentActionExecuter#PARAM_STATUS_UPDATE + * @see PublishContentActionExecuter#PARAM_STATUS_UPDATE_CHANNEL_NAMES + */ + public final static String PARAM_STATUS_UPDATE_CHANNEL_IDS = "status-update-channel-ids"; + + /** + * A single-valued, optional datetime parameter that specifies when the + * publish should happen. + */ + public final static String PARAM_SCHEDULED_TIME = "scheduled-time"; + + /** + * A single-valued, optional text parameter that is stored on the publishing + * event that is created by this action. + */ + public final static String PARAM_COMMENT = "comment"; + + private static final String MSG_CHANNEL_NOT_FOUND = "publishing.channelNotFound"; + private static final String MSG_NEITHER_CHANNEL_NAME_NOR_ID_SPECIFIED = "publishing.neitherNameNorIdSpecified"; + + private PublishingService publishingService; + private ChannelService channelService; + + public void setPublishingService(PublishingService publishingService) + { + this.publishingService = publishingService; + } + + public void setChannelService(ChannelService channelService) + { + this.channelService = channelService; + } + + @SuppressWarnings("unchecked") + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + Boolean isUnpublish = (Boolean) action.getParameterValue(PARAM_UNPUBLISH); + boolean unpublish = ((isUnpublish == null) || isUnpublish); + String publishChannelId = (String) action.getParameterValue(PARAM_PUBLISH_CHANNEL_ID); + String publishChannelName = (String) action.getParameterValue(PARAM_PUBLISH_CHANNEL_NAME); + String statusUpdate = (String) action.getParameterValue(PARAM_STATUS_UPDATE); + List statusUpdateChannelNames = buildStringList(action.getParameterValue(PARAM_STATUS_UPDATE_CHANNEL_NAMES)); + List statusUpdateChannelIds = buildStringList(action.getParameterValue(PARAM_STATUS_UPDATE_CHANNEL_IDS)); + Boolean includeLinkInStatusUpdate = (Boolean) action.getParameterValue(PARAM_INCLUDE_LINK_IN_STATUS_UPDATE); + boolean appendLink = ((includeLinkInStatusUpdate == null) || includeLinkInStatusUpdate); + Date scheduledTime = (Date) action.getParameterValue(PARAM_SCHEDULED_TIME); + String comment = (String) action.getParameterValue(PARAM_COMMENT); + + Channel publishChannel = publishChannelId == null ? channelService.getChannelByName(publishChannelName) : + channelService.getChannelById(publishChannelId); + if (publishChannel != null) + { + PublishingDetails details = publishingService.createPublishingDetails(); + details.setPublishChannelId(publishChannel.getId()); + if (unpublish) + { + details.addNodesToUnpublish(actionedUponNodeRef); + } + else + { + details.addNodesToPublish(actionedUponNodeRef); + } + if (statusUpdateChannelNames != null) + { + for (String statusUpdateChannelName : statusUpdateChannelNames) + { + Channel statusUpdateChannel = channelService.getChannelByName(statusUpdateChannelName); + if (statusUpdateChannel != null) + { + details.addStatusUpdateChannels(statusUpdateChannel.getId()); + } + } + } + if (statusUpdateChannelIds != null) + { + for (String statusUpdateChannelId : statusUpdateChannelIds) + { + Channel statusUpdateChannel = channelService.getChannelById(statusUpdateChannelId); + if (statusUpdateChannel != null) + { + details.addStatusUpdateChannels(statusUpdateChannel.getId()); + } + } + } + if (!details.getStatusUpdateChannels().isEmpty()) + { + details.setStatusMessage(statusUpdate); + if (appendLink) + { + details.setStatusNodeToLinkTo(actionedUponNodeRef); + } + } + if (scheduledTime != null) + { + Calendar cal = Calendar.getInstance(); + cal.setTime(scheduledTime); + details.setSchedule(cal); + } + details.setComment(comment); + publishingService.scheduleNewEvent(details); + } + else + { + throw new AlfrescoRuntimeException(MSG_CHANNEL_NOT_FOUND, new Object[] { publishChannelId == null ? publishChannelName : publishChannelId}); + } + } + + private List buildStringList(Serializable parameterValue) + { + List result = null; + if (parameterValue != null && String.class.isAssignableFrom(parameterValue.getClass())) + { + String[] split = ((String)parameterValue).split(","); + result = Arrays.asList(split); + } + return result; + } + + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_PUBLISH_CHANNEL_NAME, DataTypeDefinition.TEXT, false, + getParamDisplayLabel(PARAM_PUBLISH_CHANNEL_NAME), false)); + + paramList.add(new ParameterDefinitionImpl(PARAM_PUBLISH_CHANNEL_ID, DataTypeDefinition.TEXT, false, + getParamDisplayLabel(PARAM_PUBLISH_CHANNEL_ID), false, "ac-publishing-channels")); + + paramList.add(new ParameterDefinitionImpl(PARAM_UNPUBLISH, DataTypeDefinition.BOOLEAN, false, + getParamDisplayLabel(PARAM_UNPUBLISH), false)); + + paramList.add(new ParameterDefinitionImpl(PARAM_STATUS_UPDATE, DataTypeDefinition.TEXT, false, + getParamDisplayLabel(PARAM_STATUS_UPDATE), false)); + + paramList.add(new ParameterDefinitionImpl(PARAM_INCLUDE_LINK_IN_STATUS_UPDATE, DataTypeDefinition.BOOLEAN, + false, getParamDisplayLabel(PARAM_INCLUDE_LINK_IN_STATUS_UPDATE), false)); + + paramList.add(new ParameterDefinitionImpl(PARAM_STATUS_UPDATE_CHANNEL_NAMES, DataTypeDefinition.TEXT, false, + getParamDisplayLabel(PARAM_STATUS_UPDATE_CHANNEL_NAMES), true)); + + paramList.add(new ParameterDefinitionImpl(PARAM_STATUS_UPDATE_CHANNEL_IDS, DataTypeDefinition.TEXT, false, + getParamDisplayLabel(PARAM_STATUS_UPDATE_CHANNEL_IDS), true, "ac-status-update-channels")); + + paramList.add(new ParameterDefinitionImpl(PARAM_SCHEDULED_TIME, DataTypeDefinition.DATETIME, false, + getParamDisplayLabel(PARAM_SCHEDULED_TIME), false)); + + paramList.add(new ParameterDefinitionImpl(PARAM_COMMENT, DataTypeDefinition.TEXT, false, + getParamDisplayLabel(PARAM_COMMENT), false)); + } + + @Override + protected void checkMandatoryProperties(ParameterizedItem ruleItem, ParameterizedItemDefinition ruleItemDefinition) + { + super.checkMandatoryProperties(ruleItem, ruleItemDefinition); + String publishChannelName = (String) ruleItem.getParameterValue(PARAM_PUBLISH_CHANNEL_NAME); + String publishChannelId = (String) ruleItem.getParameterValue(PARAM_PUBLISH_CHANNEL_ID); + if (publishChannelId == null && publishChannelName == null) + { + throw new RuleServiceException(MSG_NEITHER_CHANNEL_NAME_NOR_ID_SPECIFIED); + } + } +} diff --git a/source/java/org/alfresco/repo/publishing/PublishEventActionTest.java b/source/java/org/alfresco/repo/publishing/PublishEventActionTest.java index 3eae9621ea..d0cfddbb12 100644 --- a/source/java/org/alfresco/repo/publishing/PublishEventActionTest.java +++ b/source/java/org/alfresco/repo/publishing/PublishEventActionTest.java @@ -406,7 +406,7 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest private NodeRef publishNode(NodeRef source, String message, boolean publish) { PublishingDetails details = publishingService.createPublishingDetails(); - details.setPublishChannel(channel.getId()); + details.setPublishChannelId(channel.getId()); if (publish) { details.addNodesToPublish(source); diff --git a/source/java/org/alfresco/repo/publishing/PublishingChannelParameterConstraint.java b/source/java/org/alfresco/repo/publishing/PublishingChannelParameterConstraint.java new file mode 100644 index 0000000000..e0ab3dd509 --- /dev/null +++ b/source/java/org/alfresco/repo/publishing/PublishingChannelParameterConstraint.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +package org.alfresco.repo.publishing; + +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.alfresco.repo.action.constraint.BaseParameterConstraint; +import org.alfresco.service.cmr.publishing.channels.Channel; +import org.alfresco.service.cmr.publishing.channels.ChannelService; + +/** + * Action parameter constraint that constrains to list of publishing channels + * + * @see PublishContentActionExecuter + * @author Brian + * @since 4.0 + */ +public class PublishingChannelParameterConstraint extends BaseParameterConstraint +{ + public static final String NAME = "ac-publishing-channels"; + + private ChannelService channelService; + + public void setChannelService(ChannelService channelService) + { + this.channelService = channelService; + } + + /** + * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() + */ + protected Map getAllowableValuesImpl() + { + List channels = channelService.getPublishingChannels(false); + Map result = new TreeMap(); + for (Channel channel : channels) + { + result.put(channel.getId(), channel.getName()); + } + return result; + } + +} diff --git a/source/java/org/alfresco/repo/publishing/PublishingDetailsImpl.java b/source/java/org/alfresco/repo/publishing/PublishingDetailsImpl.java index d9f93096c5..e3a404bde7 100644 --- a/source/java/org/alfresco/repo/publishing/PublishingDetailsImpl.java +++ b/source/java/org/alfresco/repo/publishing/PublishingDetailsImpl.java @@ -84,7 +84,7 @@ public class PublishingDetailsImpl implements PublishingDetails /** * {@inheritDoc} */ - public PublishingDetails setPublishChannel(String publishChannelId) + public PublishingDetails setPublishChannelId(String publishChannelId) { this.publishChannelId = publishChannelId; return this; diff --git a/source/java/org/alfresco/repo/publishing/PublishingEventHelperTest.java b/source/java/org/alfresco/repo/publishing/PublishingEventHelperTest.java index ae8921dfcf..7b30533de8 100644 --- a/source/java/org/alfresco/repo/publishing/PublishingEventHelperTest.java +++ b/source/java/org/alfresco/repo/publishing/PublishingEventHelperTest.java @@ -194,7 +194,7 @@ public class PublishingEventHelperTest PublishingDetails details = new PublishingDetailsImpl() .setSchedule(schedule) - .setPublishChannel(channelId) + .setPublishChannelId(channelId) .setComment(comment); NodeRef result = helper.createNode(queue, details); diff --git a/source/java/org/alfresco/repo/publishing/PublishingIntegratedTest.java b/source/java/org/alfresco/repo/publishing/PublishingIntegratedTest.java index f1f0247909..2e1f34252e 100644 --- a/source/java/org/alfresco/repo/publishing/PublishingIntegratedTest.java +++ b/source/java/org/alfresco/repo/publishing/PublishingIntegratedTest.java @@ -89,7 +89,7 @@ public class PublishingIntegratedTest extends BaseSpringTest PublishingDetails details = publishingService.createPublishingDetails() .addNodesToPublish(nodes) - .setPublishChannel(channel.getId()) + .setPublishChannelId(channel.getId()) .setSchedule(schedule); String eventId = publishingService.scheduleNewEvent(details); @@ -124,7 +124,7 @@ public class PublishingIntegratedTest extends BaseSpringTest PublishingDetails details = publishingService.createPublishingDetails() .addNodesToPublish(nodes) - .setPublishChannel(channel.getId()) + .setPublishChannelId(channel.getId()) .setSchedule(schedule); String eventId = publishingService.scheduleNewEvent(details); PublishingEvent event = publishingService.getPublishingEvent(eventId); diff --git a/source/java/org/alfresco/repo/publishing/PublishingQueueImplTest.java b/source/java/org/alfresco/repo/publishing/PublishingQueueImplTest.java index 88ebec9d93..9374e70dd2 100644 --- a/source/java/org/alfresco/repo/publishing/PublishingQueueImplTest.java +++ b/source/java/org/alfresco/repo/publishing/PublishingQueueImplTest.java @@ -77,7 +77,7 @@ public class PublishingQueueImplTest extends AbstractPublishingIntegrationTest PublishingDetails details = publishingService.createPublishingDetails() .addNodesToPublish(firstNode, secondNode) - .setPublishChannel(channelId) + .setPublishChannelId(channelId) .setSchedule(schedule) .setComment(comment); @@ -143,7 +143,7 @@ public class PublishingQueueImplTest extends AbstractPublishingIntegrationTest List statusChannels = Arrays.asList("test://channel/Channel1", "test://channel/Channel2", "test://channel/Channel3" ); String message = "The message"; PublishingDetails details = publishingService.createPublishingDetails() - .setPublishChannel(channelId) + .setPublishChannelId(channelId) .addNodesToPublish(firstNode, secondNode) .setStatusMessage(message) .setStatusNodeToLinkTo(secondNode) @@ -182,7 +182,7 @@ public class PublishingQueueImplTest extends AbstractPublishingIntegrationTest // Publish an event PublishingDetails details = publishingService.createPublishingDetails(); details.addNodesToPublish(firstNode, secondNode); - details.setPublishChannel(publishChannel.getId()); + details.setPublishChannelId(publishChannel.getId()); try { testHelper.scheduleEvent1Year(details); diff --git a/source/java/org/alfresco/repo/publishing/StatusUpdateChannelParameterConstraint.java b/source/java/org/alfresco/repo/publishing/StatusUpdateChannelParameterConstraint.java new file mode 100644 index 0000000000..635e07fd53 --- /dev/null +++ b/source/java/org/alfresco/repo/publishing/StatusUpdateChannelParameterConstraint.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +package org.alfresco.repo.publishing; + +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.alfresco.repo.action.constraint.BaseParameterConstraint; +import org.alfresco.service.cmr.publishing.channels.Channel; +import org.alfresco.service.cmr.publishing.channels.ChannelService; + +/** + * Action parameter constraint that constrains value to a list of publishing channels that support status updates + * + * @see PublishContentActionExecuter + * @author Brian + * @since 4.0 + */ +public class StatusUpdateChannelParameterConstraint extends BaseParameterConstraint +{ + public static final String NAME = "ac-status-update-channels"; + + private ChannelService channelService; + + public void setChannelService(ChannelService channelService) + { + this.channelService = channelService; + } + + /** + * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() + */ + protected Map getAllowableValuesImpl() + { + List channels = channelService.getStatusUpdateChannels(false); + Map result = new TreeMap(); + for (Channel channel : channels) + { + result.put(channel.getId(), channel.getName()); + } + return result; + } + +} diff --git a/source/java/org/alfresco/service/cmr/publishing/PublishingDetails.java b/source/java/org/alfresco/service/cmr/publishing/PublishingDetails.java index cdb493c4c7..4c5d03a2ec 100644 --- a/source/java/org/alfresco/service/cmr/publishing/PublishingDetails.java +++ b/source/java/org/alfresco/service/cmr/publishing/PublishingDetails.java @@ -42,7 +42,7 @@ public interface PublishingDetails PublishingDetails addNodesToPublish(Collection nodesToPublish); - PublishingDetails setPublishChannel(String channelId); + PublishingDetails setPublishChannelId(String channelId); PublishingDetails setComment(String comment); diff --git a/source/java/org/alfresco/service/cmr/publishing/PublishingService.java b/source/java/org/alfresco/service/cmr/publishing/PublishingService.java index b9dfbee78d..6ccfb1a3ce 100644 --- a/source/java/org/alfresco/service/cmr/publishing/PublishingService.java +++ b/source/java/org/alfresco/service/cmr/publishing/PublishingService.java @@ -20,6 +20,8 @@ package org.alfresco.service.cmr.publishing; import java.util.List; +import org.alfresco.service.Auditable; +import org.alfresco.service.NotAuditable; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -36,6 +38,7 @@ public interface PublishingService * identifier or null if no such publishing event can * be located */ + @NotAuditable PublishingEvent getPublishingEvent(String id); /** @@ -43,6 +46,7 @@ public interface PublishingService * @param publishedNode The node that was published. * @return A list of {@link PublishingEvent}s. */ + @NotAuditable List getPublishEventsForNode(NodeRef publishedNode); /** @@ -50,6 +54,7 @@ public interface PublishingService * @param unpublishedNode The node that was unpublished. * @return A list of {@link PublishingEvent}s. */ + @NotAuditable List getUnpublishEventsForNode(NodeRef unpublishedNode); /** @@ -60,6 +65,7 @@ public interface PublishingService * * @param id The identifier of the publishing event that is to be cancelled. */ + @Auditable(parameters={"id"}) void cancelPublishingEvent(String id); /** @@ -67,6 +73,7 @@ public interface PublishingService * a call to the {@link PublishingQueue#scheduleNewEvent(PublishingDetails)} operation. * @return A publishing package that can be populated before being placed on the publishing queue. */ + @NotAuditable PublishingDetails createPublishingDetails(); /** @@ -74,5 +81,6 @@ public interface PublishingService * @param publishingDetails The publishing package that is to be enqueued * @return The identifier of the newly scheduled event */ + @Auditable String scheduleNewEvent(PublishingDetails publishingDetails); } diff --git a/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java b/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java index 254c2db0e0..bd0ee3d488 100644 --- a/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java +++ b/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java @@ -24,6 +24,8 @@ import java.util.List; import java.util.Map; import org.alfresco.repo.publishing.AbstractChannelType; +import org.alfresco.service.Auditable; +import org.alfresco.service.NotAuditable; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; @@ -39,6 +41,7 @@ public interface ChannelService * @param channelType The channel type to be registered. * @throws IllegalArgumentException if a channel type is already registered that has the same identifier as the supplied one */ + @NotAuditable void register(AbstractChannelType channelType); /** @@ -46,12 +49,14 @@ public interface ChannelService * @param id The identifier of the channel type to be retrieved * @return A ChannelType object that represents the channel type with the specified identifier */ + @NotAuditable ChannelType getChannelType(String id); /** * Retrieve all the registered channel types * @return A list of ChannelType objects, each representing a channel type registered with this channel service */ + @NotAuditable List getChannelTypes(); /** @@ -62,12 +67,14 @@ public interface ChannelService * @param properties Any additional properties that are to be saved as part of the new channel. * @return A Channel object corresponding to the newly created channel. */ + @Auditable(parameters={"channelTypeId", "name"}) Channel createChannel(String channelTypeId, String name, Map properties); /** * Remove the specified channel. * @param channel The channel to delete. */ + @Auditable void deleteChannel(Channel channel); /** @@ -75,6 +82,7 @@ public interface ChannelService * @param channel The channel that is to be renamed. * @param newName The new name of the channel */ + @Auditable(parameters={"newName"}) void renameChannel(Channel channel, String newName); /** @@ -83,12 +91,14 @@ public interface ChannelService * @param properties The properties to set on the channel. These are blended with the current properties * on the channel. Any that aren't currently set will be added, others will be updated. */ + @Auditable void updateChannel(Channel channel, Map properties); /** * Retrieve all the channels. * @return A list of Channel objects, each one representing a channel that exists within the specified Share site. */ + @NotAuditable List getChannels(); /** @@ -96,6 +106,7 @@ public interface ChannelService * @param channelName The name of the channel * @return The specified Channel objects or null if the specified channel does not exist. */ + @NotAuditable Channel getChannelByName(String channelName); /** @@ -103,6 +114,7 @@ public interface ChannelService * @param id The string value of the channel {@link NodeRef}. * @return The specified Channel objects or null if the specified channel does not exist. */ + @NotAuditable Channel getChannelById(String id); /** @@ -110,20 +122,25 @@ public interface ChannelService * @param nodeToPublish * @return */ + @NotAuditable List getRelevantPublishingChannels(NodeRef nodeToPublish); /** * Returns a list of all the channels that are capable of publishing in the specified Share site. - * @param filterByPublishPermission TODO + * @param filterByPublishPermission If true then the returned channels are filtered to include only those + * to which the authenticated user can publish * @return */ + @NotAuditable List getPublishingChannels(boolean filterByPublishPermission); /** * Returns all {@link Channel}s cpaable of performing a status update for the given Share Site. - * @param filterByPublishPermission TODO + * @param filterByPublishPermission If true then the returned channels are filtered to include only those + * to which the authenticated user can post status updates * @return */ + @NotAuditable List getStatusUpdateChannels(boolean filterByPublishPermission); }