Skip to content

Commit

Permalink
Issue 11609 fixes (#13216)
Browse files Browse the repository at this point in the history
* #11609 : Updating DB scripts. Adding upgrade task to create intermediate table and other minor changes.

* #11609 added first draft for add/edit workflow action

* #11609 almost code done for save/edit workflow actions associated to the scheme

* #11609 the add action and action to step are done

* #11609 Added the delete steps and dependencies/minor fixes for transactions, etc

* #11609 delete action from step done in the ui/ajax and endpoint

* #11609 Added the deletes for the UI

* #12960 changes for reorder done

* #13104 Added the new field requires lock options that supports locked, unlocked and both choices

* #12960 added the scripts changes for all dbs

* #12960 added changes for the workflow, action and step new relationships

* #12960 notes and fixes

* #12960 fixing the IT test

* #12960 code review feedback

* #11691 added changes for the new endpoint for getting content type schemes

* #12960 added changes for h2 and mysql

* #12960 added the changes for the show_on column

* #12960 adding changes for the showOn

* #12960 changes for show on functionality

* resolving the error of the missing schemeid

* solving issue with content resource test

* Fixing the Task04305UpdateWorkflowActionTable

* Reverting to master configuration

* #12960 fixing postgres and oracle UT

* #11609 fixes for 11609

* #11609 configuration rollback

* #11609 fixes by code review
  • Loading branch information
jdotcms authored and jgambarios committed Dec 15, 2017
1 parent 53f5a78 commit 2fe3e6c
Show file tree
Hide file tree
Showing 24 changed files with 929 additions and 217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.dotcms.contenttype.model.type.BaseContentType;
import com.dotcms.contenttype.model.type.ContentType;
import com.dotcms.contenttype.model.type.ContentTypeBuilder;
import com.dotcms.repackage.javax.ws.rs.HEAD;
import com.dotcms.repackage.javax.ws.rs.client.Client;
import com.dotcms.repackage.javax.ws.rs.client.ClientBuilder;
import com.dotcms.repackage.javax.ws.rs.client.Entity;
Expand Down
2 changes: 1 addition & 1 deletion dotCMS/src/main/enterprise
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public final Response findSchemes(@Context final HttpServletRequest request,
@NoCache
@Produces({MediaType.APPLICATION_JSON, "application/javascript"})
public final Response findAllSchemesAndSchemesByContentType(@Context final HttpServletRequest request,
@PathParam("contentTypeId") final String contentTypeId) {
@PathParam("contentTypeId") final String contentTypeId) {

final InitDataObject initDataObject = this.webResource.init
(null, true, request, true, null);
Expand Down Expand Up @@ -625,4 +625,4 @@ public final Response reorderAction(@Context final HttpServletRequest request,

return response;
} // reorderAction
} // E:O:F:WorkflowResource.
} // E:O:F:WorkflowResource.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import com.dotcms.repackage.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.dotcms.repackage.javax.validation.constraints.NotNull;
import com.dotcms.rest.api.Validated;
import com.dotmarketing.portlets.workflows.model.WorkflowAction;
import com.dotmarketing.portlets.workflows.model.WorkflowStatus;

import java.util.Collections;
import java.util.List;
import java.util.Set;

@JsonDeserialize(builder = WorkflowActionForm.Builder.class)
public class WorkflowActionForm extends Validated {
Expand All @@ -30,7 +32,7 @@ public class WorkflowActionForm extends Validated {
@NotNull
private final boolean requiresCheckout;
@NotNull
private final RequiresCheckoutOption requiresCheckoutOption;
private final Set<WorkflowStatus> showOn;
@NotNull
private final boolean actionRoleHierarchyForAssign;
private final boolean roleHierarchyForAssign;
Expand Down Expand Up @@ -75,8 +77,8 @@ public boolean isRequiresCheckout() {
return requiresCheckout;
}

public RequiresCheckoutOption getRequiresCheckoutOption() {
return requiresCheckoutOption;
public Set<WorkflowStatus> getShowOn() {
return Collections.unmodifiableSet(showOn);
}

public boolean isActionRoleHierarchyForAssign() {
Expand Down Expand Up @@ -104,12 +106,14 @@ public String toString() {
return "WorkflowActionForm{" +
"actionId='" + actionId + '\'' +
", schemeId='" + schemeId + '\'' +
", stepId='" + stepId + '\'' +
", actionName='" + actionName + '\'' +
", whoCanUse=" + whoCanUse +
", actionIcon='" + actionIcon + '\'' +
", actionAssignable=" + actionAssignable +
", actionCommentable=" + actionCommentable +
", requiresCheckoutOption=" + requiresCheckoutOption +
", requiresCheckout=" + requiresCheckout +
", showOn=" + showOn +
", actionRoleHierarchyForAssign=" + actionRoleHierarchyForAssign +
", roleHierarchyForAssign=" + roleHierarchyForAssign +
", actionNextStep='" + actionNextStep + '\'' +
Expand All @@ -128,7 +132,7 @@ public WorkflowActionForm(final Builder builder) {
this.actionIcon = builder.actionIcon;
this.actionCommentable = builder.actionCommentable;
this.requiresCheckout = builder.requiresCheckout;
this.requiresCheckoutOption = valueOf(builder.requiresCheckoutOption);
this.showOn = builder.showOn;
this.actionNextStep = builder.actionNextStep;
this.actionNextAssign = builder.actionNextAssign;
this.actionCondition = builder.actionCondition;
Expand All @@ -138,32 +142,7 @@ public WorkflowActionForm(final Builder builder) {
this.checkValid();
}

private RequiresCheckoutOption valueOf (final String option) {

try {
return RequiresCheckoutOption.valueOf(option.toUpperCase());
} catch (Throwable e) {
return RequiresCheckoutOption.BOTH;
}
}

public enum RequiresCheckoutOption {

LOCKED(WorkflowAction.LOCKED),
UNLOCKED(WorkflowAction.UNLOCKED),
BOTH(WorkflowAction.LOCKED_OR_UNLOCKED);

private final String name;
RequiresCheckoutOption (final String name) {
this.name = name;
}

public String getName() {
return name;
};
}

public static final class Builder {
public static final class Builder {

@JsonProperty()
private String actionId;
Expand All @@ -187,8 +166,6 @@ public static final class Builder {
@JsonProperty(required = true)
private boolean requiresCheckout;
@JsonProperty(required = true)
private String requiresCheckoutOption;
@JsonProperty(required = true)
private boolean actionRoleHierarchyForAssign;
@JsonProperty(required = true)
private String actionNextStep;
Expand All @@ -197,6 +174,15 @@ public static final class Builder {
@JsonProperty()
private String actionCondition;

@JsonProperty(required = true)
private Set<WorkflowStatus> showOn;


public Builder showOn(Set<WorkflowStatus> showOn) {
this.showOn = showOn;
return this;
}

public Builder stepId(String stepId) {
this.stepId = stepId;
return this;
Expand Down Expand Up @@ -242,11 +228,6 @@ public Builder requiresCheckout(boolean requiresCheckout) {
return this;
}

public Builder requiresCheckoutOption(String requiresCheckoutOption) {
this.requiresCheckoutOption = requiresCheckoutOption;
return this;
}

public Builder actionRoleHierarchyForAssign(boolean actionRoleHierarchyForAssign) {
this.actionRoleHierarchyForAssign = actionRoleHierarchyForAssign;
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.dotcms.workflow.form;

import com.dotcms.repackage.com.fasterxml.jackson.annotation.JsonProperty;
import com.dotcms.repackage.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.dotcms.repackage.javax.validation.constraints.NotNull;
import com.dotcms.rest.api.Validated;

@JsonDeserialize(builder = WorkflowReorderActionStepForm.Builder.class)
public class WorkflowReorderActionStepForm extends Validated {

@NotNull
private final String actionId;

@NotNull
private final String stepId;

@NotNull
private final int order;

public String getActionId() {
return actionId;
}

public String getStepId() {
return stepId;
}

public int getOrder() {
return order;
}

@Override
public String toString() {
return "WorkflowReorderActionStepForm{" +
"actionId='" + actionId + '\'' +
", stepId='" + stepId + '\'' +
", order=" + order +
'}';
}

public WorkflowReorderActionStepForm(final Builder builder) {

this.actionId = builder.actionId;
this.stepId = builder.stepId;
this.order = builder.order;
this.checkValid();
}

public static final class Builder {

@JsonProperty(required = true)
private String actionId;
@JsonProperty(required = true)
private String stepId;
@JsonProperty(required = true)
private int order;

public Builder actionId(String actionId) {
this.actionId = actionId;
return this;
}

public Builder stepId(String stepId) {
this.stepId = stepId;
return this;
}

public Builder order(int order) {
this.order = order;
return this;
}


public WorkflowReorderActionStepForm build() {

return new WorkflowReorderActionStepForm(this);
}
}
}
Loading

0 comments on commit 2fe3e6c

Please sign in to comment.