Skip to content

Commit

Permalink
#13395 fixed copy and save content (#13556)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdotcms authored and jgambarios committed Feb 5, 2018
1 parent e358e63 commit 93245d1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ public void executeAction(final WorkflowProcessor processor,
checkoutContentlet.setInode(inode);
checkoutContentlet.setProperty(Contentlet.WORKFLOW_IN_PROGRESS, Boolean.TRUE);

final Contentlet contentletNew = this.contentletAPI.checkin
(checkoutContentlet, processor.getContentletDependencies());
final Contentlet contentletNew = (null != processor.getContentletDependencies())?
this.contentletAPI.checkin(checkoutContentlet, processor.getContentletDependencies()):
this.contentletAPI.checkin(checkoutContentlet, processor.getUser(), false);

processor.setContentlet(contentletNew);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.dotmarketing.business.APILocator;
import com.dotmarketing.business.Role;
import com.dotmarketing.exception.DotDataException;
import com.dotmarketing.portlets.contentlet.model.Contentlet;
import com.dotmarketing.portlets.contentlet.model.ContentletDependencies;
import com.dotmarketing.portlets.workflows.business.DotWorkflowException;
Expand Down Expand Up @@ -157,12 +158,17 @@ public WorkflowProcessor(Contentlet contentlet, User firingUser) {
workflowMessage = contentlet.getStringProperty(Contentlet.WORKFLOW_COMMENTS_KEY);
}

if (null == contentStep) {

contentStep = this.findFirstStepByScheme (action.getSchemeId());
}

nextStep = (action.isNextStepCurrentStep())?
contentStep:getWorkflowAPI().findStep(action.getNextStep());
step = contentStep;
actionClasses = getWorkflowAPI().findActionClasses(action);
if(null == scheme) {
scheme = getWorkflowAPI().findScheme(step.getSchemeId());
scheme = getWorkflowAPI().findScheme(action.getSchemeId());
}

if(task != null && UtilMethods.isSet(task.getId())){
Expand All @@ -174,6 +180,11 @@ public WorkflowProcessor(Contentlet contentlet, User firingUser) {
}
}

private WorkflowStep findFirstStepByScheme(final String schemeId) throws DotDataException {

return getWorkflowAPI().findSteps(getWorkflowAPI().findScheme(schemeId)).stream().findFirst().orElse(null);
}

/**
* Searches and returns a WorkflowAction using a given workflow action id, if the Processor
* already have associated an action the existing action will be returned and no search will be
Expand Down

0 comments on commit 93245d1

Please sign in to comment.