Class WorkflowServiceImpl
java.lang.Object
org.craftercms.studio.impl.v1.service.workflow.WorkflowServiceImpl
- All Implemented Interfaces:
WorkflowService,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
public class WorkflowServiceImpl
extends Object
implements WorkflowService, org.springframework.context.ApplicationContextAware
workflow service implementation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ActivityStreamServiceInternalprotected org.springframework.context.ApplicationContextprotected AuditServiceInternalstatic final Stringprotected ContentServiceprotected ContentServiceInternalprotected DependencyServiceprotected DeploymentServiceprotected DmPublishServiceprotected ItemServiceInternalprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected NotificationServiceprotected PublishServiceInternalprotected SecurityServiceprotected ServicesConfigprotected SiteServiceprotected StudioConfigurationprotected UserServiceInternalprotected WorkflowProcessorprotected WorkflowServiceInternal -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_cancelWorkflow(String site, String path) protected List<DmDependencyTO> addDependenciesForSubmitForApproval(String site, List<DmDependencyTO> submittedItems, SimpleDateFormat format, String globalScheduledDate) protected List<DmDependencyTO> addDependenciesForSubmittedItems(String site, List<DmDependencyTO> submittedItems, SimpleDateFormat format, String globalScheduledDate) protected voidaddInProgressItems(ContentItemTO item, List<ContentItemTO> categoryItems, DmContentItemComparator comparator, boolean inProgressOnly) protected booleanaddToQueue(boolean submitted, boolean inProgressOnly, boolean includeInProgress) add the current item to the queue?protected voidaddToQueue(String site, GoLiveQueue queue, GoLiveQueue inProcessQueue, ContentItemTO item, Item workflowItem) protected voidapplyDeleteDependencyRule(String site, WorkflowServiceImpl.SubmitPackage pack, DmDependencyTO dmDependencyTO) protected ResultTOapprove(String site, String request, WorkflowServiceImpl.Operation operation) approve workflows and schedule them as specified in the requestprotected ResultTOapprove_new(String site, String request, WorkflowServiceImpl.Operation operation) approve workflows and schedule them as specified in the requestprotected ResultTOapproveWithoutDependencies(String site, String request, WorkflowServiceImpl.Operation operation) approve workflows and schedule them as specified in the requestprotected booleanareEqual(ZonedDateTime oldDate, ZonedDateTime newDate) protected booleancheckParentExistsInSubmitPackForDelete(List<String> paths, String path) protected voidcleanUrisFromWorkflow(Set<String> uris, String site) @javax.validation.Valid booleancleanWorkflow(String url, String site) deleteInTransaction(String site, List<String> itemsToDelete, String approver) protected voiddoDelete(String site, List<DmDependencyTO> submittedItems, String approver) protected voiddoSubmit(String site, String dependency, ZonedDateTime scheduledDate, boolean sendEmail, String user, String submissionComment, String environment) voidfillQueue(String site, GoLiveQueue goLiveQueue, GoLiveQueue inProcessQueue) protected List<ContentItemTO> getCategoryItems(String site) get the top category items that to be displayed in UIprotected List<DmDependencyTO> getChildrenForRenamedItem(String site, DmDependencyTO renameItem) getGoLiveItems(String site, String sort, boolean ascending) protected List<ContentItemTO> getGoLiveItems(String site, DmContentItemComparator comparator) getInProgressItems(String site, String sort, boolean ascending, boolean inProgressOnly) protected List<ContentItemTO> getInProgressItems(String site, DmContentItemComparator comparator, boolean inProgressOnly) protected List<DmDependencyTO> getRefAndChildOfDiffDateFromParent(String site, List<DmDependencyTO> submittedItems, boolean removeInPages) protected List<DmDependencyTO> getRefAndChildOfDiffDateFromParent_new(String site, List<DmDependencyTO> submittedItems, boolean removeInPages) protected ZonedDateTimegetScheduledDate(String site, SimpleDateFormat format, String dateStr) parse the given dateprotected StringgetScheduleLabel(WorkflowServiceImpl.SubmitPackage submitPackage, WorkflowServiceImpl.SubmitPackage dependencyPack) protected DmDependencyTOgetSubmittedItem(String site, String itemPath, SimpleDateFormat format, String globalSchDate, Set<String> processedDependencies) protected DmDependencyTOgetSubmittedItem(String site, net.sf.json.JSONObject item, SimpleDateFormat format, String globalSchDate) get a submitted item from a JSON itemprotected DmDependencyTOgetSubmittedItem_new(String site, String itemPath, SimpleDateFormat format, String globalSchDate) protected DmDependencyTOgetSubmittedItemApproveWithoutDependencies(String site, String itemPath, SimpleDateFormat format, String globalSchDate) protected List<DmDependencyTO> getSubmittedItems(String site, net.sf.json.JSONArray items, SimpleDateFormat format, String schDate) get submitted items from JSON requestgetWorkflowAffectedPathsInternal(String site, String path) @Valid ResultTOapprove workflows and schedule them as specified in the request@Valid ResultTOapprove workflows and schedule them as specified in the requestprotected voidgoLive(String site, List<DmDependencyTO> submittedItems, String approver, MultiChannelPublishingContext mcpContext) approve workflows and schedule them as specified in the requestprotected voidgoLivePackage(String site, WorkflowServiceImpl.SubmitPackage submitpackage, DmDependencyTO dmDependencyTO, boolean isNotScheduled, WorkflowServiceImpl.SubmitPackage dependencyPackage, String approver, Set<String> rescheduledUris, Set<String> processedUris) groupByDate(List<DmDependencyTO> submittedItems, ZonedDateTime now) protected voidhandleReferences(String site, WorkflowServiceImpl.SubmitPackage submitpackage, DmDependencyTO dmDependencyTO, Set<String> rescheduledUris, Set<String> processedUris) booleanprotected booleanisItemRenamed(String site, DmDependencyTO item) @javax.validation.Valid booleanisRescheduleRequest(DmDependencyTO dependencyTO, String site) voidpreScheduleDelete(Set<String> urisToDelete, ZonedDateTime scheduleDate, GoLiveContext context) @Valid ResultTOprotected voidprotected void@javax.validation.Valid booleanremoveFromWorkflow(String site, String path, boolean cancelWorkflow) cancel the workflow pending on the given item.protected booleanremoveFromWorkflow(String site, String path, Set<String> processedPaths, boolean cancelWorkflow) protected List<DmDependencyTO> removeSubmitToDeleteChildrenForGoLive(DmDependencyTO dependencyTO, WorkflowServiceImpl.Operation operation) removes the child items which are in submit to delete state from submitted items as these have to be routed for deletion.protected voidresolveSubmittedPaths(String site, DmDependencyTO item, List<String> submittedPaths, Set<String> processedPaths) voidsetActivityStreamServiceInternal(ActivityStreamServiceInternal activityStreamServiceInternal) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetAuditServiceInternal(AuditServiceInternal auditServiceInternal) voidsetContentService(ContentService contentService) voidsetContentServiceInternal(ContentServiceInternal contentServiceInternal) voidsetDependencyService(DependencyService dependencyService) voidsetDeploymentService(DeploymentService deploymentService) voidsetDmPublishService(DmPublishService dmPublishService) voidsetItemServiceInternal(ItemServiceInternal itemServiceInternal) voidsetNotificationService(NotificationService notificationService) voidsetPublishServiceInternal(PublishServiceInternal publishServiceInternal) voidsetSecurityService(SecurityService securityService) voidsetServicesConfig(ServicesConfig servicesConfig) voidsetSiteService(SiteService siteService) voidsetStudioConfiguration(StudioConfiguration studioConfiguration) voidsetUserServiceInternal(UserServiceInternal userServiceInternal) voidsetWorkflowProcessor(WorkflowProcessor workflowProcessor) voidsetWorkflowServiceInternal(WorkflowServiceInternal workflowServiceInternal) protected ResultTOsubmitForApproval(String site, String submittedBy, String request, boolean delete) @Valid ResultTOsubmitToGoLive(String site, String username, String request) submitToGoLive(List<DmDependencyTO> submittedItems, ZonedDateTime scheduledDate, boolean sendEmail, boolean submitForDeletion, RequestContext requestContext, String submissionComment, String environment)
-
Field Details
-
JSON_KEY_ITEMS
-
JSON_KEY_SCHEDULED_DATE
-
JSON_KEY_SCHEDULE
-
JSON_KEY_IS_NOW
-
JSON_KEY_PUBLISH_CHANNEL
-
JSON_KEY_STATUS_SET
-
JSON_KEY_STATUS_MESSAGE
-
JSON_KEY_SUBMISSION_COMMENT
-
JSON_KEY_URI
-
JSON_KEY_DELETED
-
JSON_KEY_SUBMITTED_FOR_DELETION
-
JSON_KEY_SUBMITTED
-
JSON_KEY_IN_PROGRESS
-
JSON_KEY_IN_REFERENCE
-
JSON_KEY_COMPONENTS
-
JSON_KEY_DOCUMENTS
-
JSON_KEY_ASSETS
-
JSON_KEY_RENDERING_TEMPLATES
-
JSON_KEY_DELETED_ITEMS
-
JSON_KEY_CHILDREN
-
JSON_KEY_SEND_EMAIL
-
JSON_KEY_REASON
-
JSON_KEY_ENVIRONMENT
-
COMPLETE_SUBMIT_TO_GO_LIVE_MSG
- See Also:
-
servicesConfig
-
deploymentService
-
contentService
-
dependencyService
-
dmPublishService
-
securityService
-
siteService
-
workflowProcessor
-
notificationService
-
studioConfiguration
-
auditServiceInternal
-
itemServiceInternal
-
userServiceInternal
-
workflowServiceInternal
-
contentServiceInternal
-
publishServiceInternal
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
activityStreamServiceInternal
-
-
Constructor Details
-
WorkflowServiceImpl
public WorkflowServiceImpl()
-
-
Method Details
-
submitToGoLive
- Specified by:
submitToGoLivein interfaceWorkflowService
-
submitForApproval
-
submitToGoLive
protected List<DmError> submitToGoLive(List<DmDependencyTO> submittedItems, ZonedDateTime scheduledDate, boolean sendEmail, boolean submitForDeletion, RequestContext requestContext, String submissionComment, String environment) throws ServiceLayerException - Throws:
ServiceLayerException
-
doSubmit
protected void doSubmit(String site, String dependency, ZonedDateTime scheduledDate, boolean sendEmail, String user, String submissionComment, String environment) throws ServiceLayerException, UserNotFoundException -
getGoLiveItems
@Valid public @Valid Map<String,Object> getGoLiveItems(String site, String sort, boolean ascending) throws ServiceLayerException - Specified by:
getGoLiveItemsin interfaceWorkflowService- Throws:
ServiceLayerException
-
getGoLiveItems
protected List<ContentItemTO> getGoLiveItems(String site, DmContentItemComparator comparator) throws ServiceLayerException - Throws:
ServiceLayerException
-
getCategoryItems
get the top category items that to be displayed in UI- Parameters:
site-
-
fillQueue
- Specified by:
fillQueuein interfaceWorkflowService
-
addToQueue
protected void addToQueue(String site, GoLiveQueue queue, GoLiveQueue inProcessQueue, ContentItemTO item, Item workflowItem) -
getInProgressItems
@Valid public @Valid Map<String,Object> getInProgressItems(String site, String sort, boolean ascending, boolean inProgressOnly) - Specified by:
getInProgressItemsin interfaceWorkflowService
-
getInProgressItems
protected List<ContentItemTO> getInProgressItems(String site, DmContentItemComparator comparator, boolean inProgressOnly) -
addInProgressItems
protected void addInProgressItems(ContentItemTO item, List<ContentItemTO> categoryItems, DmContentItemComparator comparator, boolean inProgressOnly) -
addToQueue
protected boolean addToQueue(boolean submitted, boolean inProgressOnly, boolean includeInProgress) add the current item to the queue?- Parameters:
submitted-inProgressOnly-includeInProgress-- Returns:
- true if added to queue
-
removeFromWorkflow
@Valid public @javax.validation.Valid boolean removeFromWorkflow(String site, String path, boolean cancelWorkflow) throws ServiceLayerException, UserNotFoundException Description copied from interface:WorkflowServicecancel the workflow pending on the given item.- Specified by:
removeFromWorkflowin interfaceWorkflowService- Parameters:
site- site identifierpath- path of the contentcancelWorkflow- cancel the pending workflow instance this content belongs to?- Returns:
- true if success, otherwise false
- Throws:
ServiceLayerException- general service errorUserNotFoundException
-
removeFromWorkflow
protected boolean removeFromWorkflow(String site, String path, Set<String> processedPaths, boolean cancelWorkflow) throws ServiceLayerException, UserNotFoundException -
_cancelWorkflow
protected void _cancelWorkflow(String site, String path) throws ServiceLayerException, UserNotFoundException -
getWorkflowAffectedPathsInternal
protected List<String> getWorkflowAffectedPathsInternal(String site, String path) throws ServiceLayerException, UserNotFoundException -
goDelete
approve workflows and schedule them as specified in the request- Specified by:
goDeletein interfaceWorkflowService- Parameters:
site- site identifierrequest- request body- Returns:
- call result
-
approve
approve workflows and schedule them as specified in the request- Parameters:
site- site identifierrequest- request bodyoperation- operation- Returns:
- call result
-
approve_new
protected ResultTO approve_new(String site, String request, WorkflowServiceImpl.Operation operation) approve workflows and schedule them as specified in the request- Parameters:
site- site identifierrequest- request bodyoperation- operation- Returns:
- call result
-
approveWithoutDependencies
protected ResultTO approveWithoutDependencies(String site, String request, WorkflowServiceImpl.Operation operation) approve workflows and schedule them as specified in the request- Parameters:
site- site identifierrequest- request bodyoperation- operation- Returns:
- call result
-
getSubmittedItem
protected DmDependencyTO getSubmittedItem(String site, net.sf.json.JSONObject item, SimpleDateFormat format, String globalSchDate) throws net.sf.json.JSONException, ServiceLayerException get a submitted item from a JSON item- Parameters:
site-item-format-- Returns:
- submitted item
- Throws:
net.sf.json.JSONExceptionServiceLayerException
-
getSubmittedItem
protected DmDependencyTO getSubmittedItem(String site, String itemPath, SimpleDateFormat format, String globalSchDate, Set<String> processedDependencies) throws net.sf.json.JSONException - Throws:
net.sf.json.JSONException
-
getSubmittedItem_new
protected DmDependencyTO getSubmittedItem_new(String site, String itemPath, SimpleDateFormat format, String globalSchDate) throws net.sf.json.JSONException - Throws:
net.sf.json.JSONException
-
getSubmittedItemApproveWithoutDependencies
protected DmDependencyTO getSubmittedItemApproveWithoutDependencies(String site, String itemPath, SimpleDateFormat format, String globalSchDate) throws net.sf.json.JSONException - Throws:
net.sf.json.JSONException
-
getSubmittedItems
protected List<DmDependencyTO> getSubmittedItems(String site, net.sf.json.JSONArray items, SimpleDateFormat format, String schDate) throws net.sf.json.JSONException, ServiceLayerException get submitted items from JSON request- Parameters:
site-items-format-- Returns:
- submitted items
- Throws:
net.sf.json.JSONExceptionServiceLayerException
-
removeSubmitToDeleteChildrenForGoLive
protected List<DmDependencyTO> removeSubmitToDeleteChildrenForGoLive(DmDependencyTO dependencyTO, WorkflowServiceImpl.Operation operation) removes the child items which are in submit to delete state from submitted items as these have to be routed for deletion. it applies to GoLive operation.- Parameters:
dependencyTO-operation-
-
doDelete
protected void doDelete(String site, List<DmDependencyTO> submittedItems, String approver) throws ServiceLayerException - Throws:
ServiceLayerException
-
groupByDate
public Map<ZonedDateTime,List<DmDependencyTO>> groupByDate(List<DmDependencyTO> submittedItems, ZonedDateTime now) - Specified by:
groupByDatein interfaceWorkflowService
-
handleReferences
protected void handleReferences(String site, WorkflowServiceImpl.SubmitPackage submitpackage, DmDependencyTO dmDependencyTO, Set<String> rescheduledUris, Set<String> processedUris) -
areEqual
-
applyDeleteDependencyRule
protected void applyDeleteDependencyRule(String site, WorkflowServiceImpl.SubmitPackage pack, DmDependencyTO dmDependencyTO) -
getScheduledDate
parse the given date- Parameters:
site-format-dateStr-- Returns:
- date
-
removeChildFromSubmitPackForDelete
-
checkParentExistsInSubmitPackForDelete
-
getRefAndChildOfDiffDateFromParent
protected List<DmDependencyTO> getRefAndChildOfDiffDateFromParent(String site, List<DmDependencyTO> submittedItems, boolean removeInPages) throws ServiceLayerException - Throws:
ServiceLayerException
-
getRefAndChildOfDiffDateFromParent_new
protected List<DmDependencyTO> getRefAndChildOfDiffDateFromParent_new(String site, List<DmDependencyTO> submittedItems, boolean removeInPages) -
addDependenciesForSubmittedItems
protected List<DmDependencyTO> addDependenciesForSubmittedItems(String site, List<DmDependencyTO> submittedItems, SimpleDateFormat format, String globalScheduledDate) throws ServiceLayerException - Throws:
ServiceLayerException
-
addDependenciesForSubmitForApproval
protected List<DmDependencyTO> addDependenciesForSubmitForApproval(String site, List<DmDependencyTO> submittedItems, SimpleDateFormat format, String globalScheduledDate) throws ServiceLayerException - Throws:
ServiceLayerException
-
resolveSubmittedPaths
protected void resolveSubmittedPaths(String site, DmDependencyTO item, List<String> submittedPaths, Set<String> processedPaths) throws ServiceLayerException - Throws:
ServiceLayerException
-
getChildrenForRenamedItem
-
preScheduleDelete
public void preScheduleDelete(Set<String> urisToDelete, ZonedDateTime scheduleDate, GoLiveContext context) - Specified by:
preScheduleDeletein interfaceWorkflowService
-
preDelete
public List<String> preDelete(Set<String> urisToDelete, GoLiveContext context, Set<String> rescheduledUris) throws ServiceLayerException, UserNotFoundException - Specified by:
preDeletein interfaceWorkflowService- Throws:
ServiceLayerExceptionUserNotFoundException
-
deleteInTransaction
-
cleanUrisFromWorkflow
protected void cleanUrisFromWorkflow(Set<String> uris, String site) throws ServiceLayerException, UserNotFoundException -
goLive
approve workflows and schedule them as specified in the request- Specified by:
goLivein interfaceWorkflowService- Parameters:
site-request-- Returns:
- call result
- Throws:
ServiceLayerException
-
cleanWorkflow
@Valid public @javax.validation.Valid boolean cleanWorkflow(String url, String site) throws ServiceLayerException, UserNotFoundException - Specified by:
cleanWorkflowin interfaceWorkflowService- Throws:
ServiceLayerExceptionUserNotFoundException
-
goLive
protected void goLive(String site, List<DmDependencyTO> submittedItems, String approver, MultiChannelPublishingContext mcpContext) approve workflows and schedule them as specified in the request- Parameters:
site-
-
goLivePackage
protected void goLivePackage(String site, WorkflowServiceImpl.SubmitPackage submitpackage, DmDependencyTO dmDependencyTO, boolean isNotScheduled, WorkflowServiceImpl.SubmitPackage dependencyPackage, String approver, Set<String> rescheduledUris, Set<String> processedUris) -
getScheduleLabel
protected String getScheduleLabel(WorkflowServiceImpl.SubmitPackage submitPackage, WorkflowServiceImpl.SubmitPackage dependencyPack) -
isRescheduleRequest
@Valid public @javax.validation.Valid boolean isRescheduleRequest(DmDependencyTO dependencyTO, String site) - Specified by:
isRescheduleRequestin interfaceWorkflowService
-
reject
- Specified by:
rejectin interfaceWorkflowService- Throws:
ServiceLayerException
-
reject
protected void reject(String site, List<DmDependencyTO> submittedItems, String reason, String approver) throws ServiceLayerException, UserNotFoundException -
isItemRenamed
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
setServicesConfig
-
setDependencyService
-
setContentService
-
setDeploymentService
-
setDmPublishService
-
setSecurityService
-
setSiteService
-
setWorkflowProcessor
-
setNotificationService
-
setStudioConfiguration
-
setAuditServiceInternal
-
setItemServiceInternal
-
setUserServiceInternal
-
setWorkflowServiceInternal
-
setContentServiceInternal
-
setPublishServiceInternal
-
setActivityStreamServiceInternal
public void setActivityStreamServiceInternal(ActivityStreamServiceInternal activityStreamServiceInternal) -
isEnablePublishingWithoutDependencies
public boolean isEnablePublishingWithoutDependencies()
-