All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jk.services.client.workflow.models.PayloadModel Maven / Gradle / Ivy

There is a newer version: 7.0.0-M7
Show newest version
package com.jk.services.client.workflow.models;

import java.beans.Transient;
import java.io.Serializable;
import java.sql.Timestamp;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jk.core.util.JK;
import com.jk.core.util.JKObjectUtil;

public class PayloadModel implements Serializable {
	private Integer id;
	private String payload;
	private String status;
	private String role;
	private String creator;
	private Timestamp timestamp;
	private String originalAction;
	private String approveLabel;
	private String approveNextStatus;
	private String rejectLabel;
	private String rejectNextStatus;
	private boolean active;
	private String workflowClass;
	
	@JsonIgnore
	private Object object;

	public PayloadModel withId(Integer id) {
		this.id = id;
		return this;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getId() {
		return this.id;
	}

	public PayloadModel withPayload(String payload) {
		this.payload = payload;
		return this;
	}

	public void setPayload(String payload) {
		this.payload = payload;
	}

	public String getPayload() {
		return this.payload;
	}

	public PayloadModel withStatus(String status) {
		this.status = status;
		return this;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getStatus() {
		return this.status;
	}

	public PayloadModel withRole(String role) {
		this.role = role;
		return this;
	}

	public void setRole(String role) {
		this.role = role;
	}

	public String getRole() {
		return this.role;
	}

	public PayloadModel withCreator(String creator) {
		this.creator = creator;
		return this;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public String getCreator() {
		return this.creator;
	}

	public PayloadModel withTimestamp(Timestamp timestamp) {
		this.timestamp = timestamp;
		return this;
	}

	public void setTimestamp(Timestamp timestamp) {
		this.timestamp = timestamp;
	}

	public Timestamp getTimestamp() {
		return this.timestamp;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		return this.getId().equals(((PayloadModel) obj).getId());
	}

	@Override
	public int hashCode() {
		if (this.id == null) {
			return toString().hashCode();
		}
		return this.id.hashCode();
	}

	public PayloadModel withOriginalAction(String originalAction) {
		this.originalAction = originalAction;
		return this;
	}

	public void setOriginalAction(String originalAction) {
		this.originalAction = originalAction;
	}

	public String getOriginalAction() {
		return this.originalAction;
	}

	public String getApproveLabel() {
		return approveLabel;
	}

	public void setApproveLabel(String approveLabel) {
		this.approveLabel = approveLabel;
	}

	public PayloadModel withApproveLabel(String approveLabel) {
		this.approveLabel = approveLabel;
		return this;
	}
	
	public String getApproveNextStatus() {
		return approveNextStatus;
	}

	public void setApproveNextStatus(String approveNextStatus) {
		this.approveNextStatus = approveNextStatus;
	}

	public PayloadModel withApproveNextStatus(String approveNextStatus) {
		this.approveNextStatus = approveNextStatus;
		return this;
	}

	public String getRejectLabel() {
		return rejectLabel;
	}

	public void setRejectLabel(String rejectLabel) {
		this.rejectLabel = rejectLabel;
	}

	public PayloadModel withRejectLabel(String rejectLabel) {
		this.rejectLabel = rejectLabel;
		return this;
	}
	
	public String getRejectNextStatus() {
		return rejectNextStatus;
	}

	public void setRejectNextStatus(String rejectNextStatus) {
		this.rejectNextStatus = rejectNextStatus;
	}

	public PayloadModel withRejectNextStatus(String rejectNextStatus) {
		this.rejectNextStatus = rejectNextStatus;
		return this;
	}
	
	@Override
	public String toString() {
		StringBuffer buf = new StringBuffer();
		buf.append(this.id).append(",");
		buf.append(this.payload).append(",");
		buf.append(this.status).append(",");
		buf.append(this.role).append(",");
		buf.append(this.creator).append(",");
		buf.append(this.timestamp).append(",");
		return buf.toString();
	}

	public boolean isActive() {
		return active;
	}

	public PayloadModel withActive(boolean active) {
		this.active = active;
		return this;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	public Object getObject() {
		if(object==null) {
			if(getWorkflowClass()!=null) {
				object=JKObjectUtil.jsonToObject(payload, JK.getClass(getWorkflowClass()));
			}
		}
		return object;
	}

	public void setObject(Object object) {
		this.object = object;
	}

	public String getWorkflowClass() {
		return workflowClass;
	}

	public void setWorkflowClass(String workflowClass) {
		this.workflowClass = workflowClass;
	}

	public PayloadModel withWorkflowClass(String workflowClass) {
		this.workflowClass = workflowClass;
		return this;
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy