DataObjectImpl
- 目录
- 概述
- 需求:
- 设计思路
- 实现思路分析
- 1.DataObjectImpl
- 2.DeadLetterJobQueryImpl
- 3.DeploymentQueryImpl
- 4.Direction
- 5.DynamicBpmnServiceImpl
- 参考资料和推荐阅读
Survive by day and develop by night.
talk for import biz , show your perfect code,full busy,skip hardness,make a better result,wait for change,challenge Survive.
happy for hardess to solve denpendies.
目录
概述
DataObjectImpl的是一个非常常见的需求。
需求:
设计思路
实现思路分析
1.DataObjectImpl
private String name;
private Object value;
private String description;
private String localizedName;
private String localizedDescription;
private String dataObjectDefinitionKey;
private String type;
public DataObjectImpl(String name, Object value, String description, String type, String localizedName,
String localizedDescription, String dataObjectDefinitionKey) {
this.name = name;
this.value = value;
this.type = type;
this.description = description;
this.localizedName = localizedName;
this.localizedDescription = localizedDescription;
this.dataObjectDefinitionKey = dataObjectDefinitionKey;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLocalizedName() {
if (localizedName != null && localizedName.length() > 0) {
return localizedName;
} else {
return name;
}
}
public void setLocalizedName(String localizedName) {
this.localizedName = localizedName;
}
public String getDescription() {
if (localizedDescription != null && localizedDescription.length() > 0) {
return localizedDescription;
} else {
return description;
}
}
public void setDescription(String description) {
this.description = description;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDataObjectDefinitionKey() {
return dataObjectDefinitionKey;
}
public void setDataObjectDefinitionKey(String dataObjectDefinitionKey) {
this.dataObjectDefinitionKey = dataObjectDefinitionKey;
}
}
2.DeadLetterJobQueryImpl
public class DeadLetterJobQueryImpl extends AbstractQuery<DeadLetterJobQuery, Job> implements DeadLetterJobQuery, Serializable {
private static final long serialVersionUID = 1L;
protected String id;
protected String processInstanceId;
protected String executionId;
protected String processDefinitionId;
protected boolean executable;
protected boolean onlyTimers;
protected boolean onlyMessages;
protected Date duedateHigherThan;
protected Date duedateLowerThan;
protected Date duedateHigherThanOrEqual;
protected Date duedateLowerThanOrEqual;
protected boolean withException;
protected String exceptionMessage;
protected String tenantId;
protected String tenantIdLike;
protected boolean withoutTenantId;
public DeadLetterJobQueryImpl() {
}
public DeadLetterJobQueryImpl(CommandContext commandContext) {
super(commandContext);
}
public DeadLetterJobQueryImpl(CommandExecutor commandExecutor) {
super(commandExecutor);
}
public DeadLetterJobQueryImpl jobId(String jobId) {
if (jobId == null) {
throw new ActivitiIllegalArgumentException("Provided job id is null");
}
this.id = jobId;
return this;
}
public DeadLetterJobQueryImpl processInstanceId(String processInstanceId) {
if (processInstanceId == null) {
throw new ActivitiIllegalArgumentException("Provided process instance id is null");
}
this.processInstanceId = processInstanceId;
return this;
}
public DeadLetterJobQueryImpl processDefinitionId(String processDefinitionId) {
if (processDefinitionId == null) {
throw new ActivitiIllegalArgumentException("Provided process definition id is null");
}
this.processDefinitionId = processDefinitionId;
return this;
}
public DeadLetterJobQueryImpl executionId(String executionId) {
if (executionId == null) {
throw new ActivitiIllegalArgumentException("Provided execution id is null");
}
this.executionId = executionId;
return this;
}
public DeadLetterJobQueryImpl executable() {
executable = true;
return this;
}
public DeadLetterJobQueryImpl timers() {
if (onlyMessages) {
throw new ActivitiIllegalArgumentException("Cannot combine onlyTimers() with onlyMessages() in the same query");
}
this.onlyTimers = true;
return this;
}
public DeadLetterJobQueryImpl messages() {
if (onlyTimers) {
throw new ActivitiIllegalArgumentException("Cannot combine onlyTimers() with onlyMessages() in the same query");
}
this.onlyMessages = true;
return this;
}
public DeadLetterJobQueryImpl duedateHigherThan(Date date) {
if (date == null) {
throw new ActivitiIllegalArgumentException("Provided date is null");
}
this.duedateHigherThan = date;
return this;
}
public DeadLetterJobQueryImpl duedateLowerThan(Date date) {
if (date == null) {
throw new ActivitiIllegalArgumentException("Provided date is null");
}
this.duedateLowerThan = date;
return this;
}
public DeadLetterJobQueryImpl duedateHigherThen(Date date) {
return duedateHigherThan(date);
}
public DeadLetterJobQueryImpl duedateHigherThenOrEquals(Date date) {
if (date == null) {
throw new ActivitiIllegalArgumentException("Provided date is null");
}
this.duedateHigherThanOrEqual = date;
return this;
}
public DeadLetterJobQueryImpl duedateLowerThen(Date date) {
return duedateLowerThan(date);
}
public DeadLetterJobQueryImpl duedateLowerThenOrEquals(Date date) {
if (date == null) {
throw new ActivitiIllegalArgumentException("Provided date is null");
}
this.duedateLowerThanOrEqual = date;
return this;
}
public DeadLetterJobQueryImpl withException() {
this.withException = true;
return this;
}
public DeadLetterJobQueryImpl exceptionMessage(String exceptionMessage) {
if (exceptionMessage == null) {
throw new ActivitiIllegalArgumentException("Provided exception message is null");
}
this.exceptionMessage = exceptionMessage;
return this;
}
public DeadLetterJobQueryImpl jobTenantId(String tenantId) {
if (tenantId == null) {
throw new ActivitiIllegalArgumentException("job is null");
}
this.tenantId = tenantId;
return this;
}
public DeadLetterJobQueryImpl jobTenantIdLike(String tenantIdLike) {
if (tenantIdLike == null) {
throw new ActivitiIllegalArgumentException("job is null");
}
this.tenantIdLike = tenantIdLike;
return this;
}
3.DeploymentQueryImpl
public class DeploymentQueryImpl extends AbstractQuery<DeploymentQuery, Deployment> implements DeploymentQuery, Serializable {
private static final long serialVersionUID = 1L;
protected String deploymentId;
protected String name;
protected String nameLike;
protected String category;
protected String categoryLike;
protected String categoryNotEquals;
protected String key;
protected String keyLike;
protected String tenantId;
protected String tenantIdLike;
protected boolean withoutTenantId;
protected String processDefinitionKey;
protected String processDefinitionKeyLike;
protected boolean latest;
protected boolean latestVersion;
public DeploymentQueryImpl() {
}
public DeploymentQueryImpl(CommandContext commandContext) {
super(commandContext);
}
public DeploymentQueryImpl(CommandExecutor commandExecutor) {
super(commandExecutor);
}
public DeploymentQueryImpl deploymentId(String deploymentId) {
if (deploymentId == null) {
throw new ActivitiIllegalArgumentException("Deployment id is null");
}
this.deploymentId = deploymentId;
return this;
}
public DeploymentQueryImpl deploymentName(String deploymentName) {
if (deploymentName == null) {
throw new ActivitiIllegalArgumentException("deploymentName is null");
}
this.name = deploymentName;
return this;
}
public DeploymentQueryImpl deploymentNameLike(String nameLike) {
if (nameLike == null) {
throw new ActivitiIllegalArgumentException("deploymentNameLike is null");
}
this.nameLike = nameLike;
return this;
}
public DeploymentQueryImpl deploymentCategory(String deploymentCategory) {
if (deploymentCategory == null) {
throw new ActivitiIllegalArgumentException("deploymentCategory is null");
}
this.category = deploymentCategory;
return this;
}
public DeploymentQueryImpl deploymentCategoryLike(String categoryLike) {
if (categoryLike == null) {
throw new ActivitiIllegalArgumentException("deploymentCategoryLike is null");
}
this.categoryLike = categoryLike;
return this;
}
public DeploymentQueryImpl deploymentCategoryNotEquals(String deploymentCategoryNotEquals) {
if (deploymentCategoryNotEquals == null) {
throw new ActivitiIllegalArgumentException("deploymentCategoryExclude is null");
}
this.categoryNotEquals = deploymentCategoryNotEquals;
return this;
}
public DeploymentQueryImpl deploymentKey(String deploymentKey) {
if (deploymentKey == null) {
throw new ActivitiIllegalArgumentException("deploymentKey is null");
}
this.key = deploymentKey;
return this;
}
public DeploymentQueryImpl deploymentKeyLike(String deploymentKeyLike) {
if (deploymentKeyLike == null) {
throw new ActivitiIllegalArgumentException("deploymentKeyLike is null");
}
this.keyLike = deploymentKeyLike;
return this;
}
public DeploymentQueryImpl deploymentTenantId(String tenantId) {
if (tenantId == null) {
throw new ActivitiIllegalArgumentException("deploymentTenantId is null");
}
this.tenantId = tenantId;
return this;
}
public DeploymentQueryImpl deploymentTenantIdLike(String tenantIdLike) {
if (tenantIdLike == null) {
throw new ActivitiIllegalArgumentException("deploymentTenantIdLike is null");
}
this.tenantIdLike = tenantIdLike;
return this;
}
public DeploymentQueryImpl deploymentWithoutTenantId() {
this.withoutTenantId = true;
return this;
}
public DeploymentQueryImpl processDefinitionKey(String key) {
if (key == null) {
throw new ActivitiIllegalArgumentException("key is null");
}
this.processDefinitionKey = key;
return this;
}
public DeploymentQueryImpl processDefinitionKeyLike(String keyLike) {
if (keyLike == null) {
throw new ActivitiIllegalArgumentException("keyLike is null");
}
this.processDefinitionKeyLike = keyLike;
return this;
}
public DeploymentQueryImpl latest() {
if (key == null) {
throw new ActivitiIllegalArgumentException("latest can only be used together with a deployment key");
}
this.latest = true;
return this;
}
@Override
public DeploymentQuery latestVersion() {
this.latestVersion = true;
return this;
}
4.Direction
public class Direction {
private static final Map<String, Direction> directions = new HashMap<String, Direction>();
public static final Direction ASCENDING = new Direction("asc");
public static final Direction DESCENDING = new Direction("desc");
private String name;
public Direction(String name) {
this.name = name;
directions.put(name, this);
}
public String getName() {
return name;
}
public static Direction findByName(String directionName) {
return directions.get(directionName);
}
}
5.DynamicBpmnServiceImpl
public class DynamicBpmnServiceImpl extends ServiceImpl implements DynamicBpmnService, DynamicBpmnConstants {
public DynamicBpmnServiceImpl(ProcessEngineConfigurationImpl processEngineConfiguration) {
super(processEngineConfiguration);
}
public ObjectNode getProcessDefinitionInfo(String processDefinitionId) {
return commandExecutor.execute(new GetProcessDefinitionInfoCmd(processDefinitionId));
}
public void saveProcessDefinitionInfo(String processDefinitionId, ObjectNode infoNode) {
commandExecutor.execute(new SaveProcessDefinitionInfoCmd(processDefinitionId, infoNode));
}
public ObjectNode changeServiceTaskClassName(String id, String className) {
ObjectNode infoNode = processEngineConfiguration.getObjectMapper().createObjectNode();
changeServiceTaskClassName(id, className, infoNode);
return infoNode;
}
public void changeServiceTaskClassName(String id, String className, ObjectNode infoNode) {
setElementProperty(id, SERVICE_TASK_CLASS_NAME, className, infoNode);
}
public ObjectNode changeServiceTaskExpression(String id, String expression) {
ObjectNode infoNode = processEngineConfiguration.getObjectMapper().createObjectNode();
changeServiceTaskExpression(id, expression, infoNode);
return infoNode;
}
public void changeServiceTaskExpression(String id, String expression, ObjectNode infoNode) {
setElementProperty(id, SERVICE_TASK_EXPRESSION, expression, infoNode);
}
public ObjectNode changeServiceTaskDelegateExpression(String id, String expression) {
ObjectNode infoNode = processEngineConfiguration.getObjectMapper().createObjectNode();
changeServiceTaskDelegateExpression(id, expression, infoNode);
return infoNode;
}
public void changeServiceTaskDelegateExpression(String id, String expression, ObjectNode infoNode) {
setElementProperty(id, SERVICE_TASK_DELEGATE_EXPRESSION, expression, infoNode);
}
public ObjectNode changeScriptTaskScript(String id, String script) {
ObjectNode infoNode = processEngineConfiguration.getObjectMapper().createObjectNode();
changeScriptTaskScript(id, script, infoNode);
return infoNode;
}
public void changeScriptTaskScript(String id, String script, ObjectNode infoNode) {
setElementProperty(id, SCRIPT_TASK_SCRIPT, script, infoNode);
}
public ObjectNode changeUserTaskName(String id, String name) {
ObjectNode infoNode = processEngineConfiguration.getObjectMapper().createObjectNode();
changeUserTaskName(id, name, infoNode);
return infoNode;
}
public void changeUserTaskName(String id, String name, ObjectNode infoNode) {
setElementProperty(id, USER_TASK_NAME, name, infoNode);
}
public ObjectNode changeUserTaskDescription(String id, String description) {
ObjectNode infoNode = processEngineConfiguration.getObjectMapper().createObjectNode();
changeUserTaskDescription(id, description, infoNode);
return infoNode;
}
public void changeUserTaskDescription(String id, String description, ObjectNode infoNode) {
setElementProperty(id, USER_TASK_DESCRIPTION, description, infoNode);
}
public ObjectNode changeUserTaskDueDate(String id, String dueDate) {
ObjectNode infoNode = processEngineConfiguration.getObjectMapper().createObjectNode();
changeUserTaskDueDate(id, dueDate, infoNode);
return infoNode;
}
public void changeUserTaskDueDate(String id, String dueDate, ObjectNode infoNode) {
setElementProperty(id, USER_TASK_DUEDATE, dueDate, infoNode);
}
public ObjectNode changeUserTaskPriority(String id, String priority) {
ObjectNode infoNode = processEngineConfiguration.getObjectMapper().createObjectNode();
changeUserTaskPriority(id, priority, infoNode);
return infoNode;
}
public void changeUserTaskPriority(String id, String priority, ObjectNode infoNode) {
setElementProperty(id, USER_TASK_PRIORITY, priority, infoNode);
}
public ObjectNode changeUserTaskCategory(String id, String category) {
ObjectNode infoNode = processEngineConfiguration.getObjectMapper().createObjectNode();
changeUserTaskCategory(id, category, infoNode);
return infoNode;
}
public void changeUserTaskCategory(String id, String category, ObjectNode infoNode) {
setElementProperty(id, USER_TASK_CATEGORY, category, infoNode);
}
public ObjectNode changeUserTaskFormKey(String id, String formKey) {
参考资料和推荐阅读
[1].www.activity.org
欢迎阅读,各位老铁,如果对你有帮助,点个赞加个关注呗!~