package com.fp.simple.dto.metadata; import java.io.PrintWriter; import java.io.StringWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import com.fp.dto.AbstractDataTransport; /** * Class ProcessInstanceMeta encargada de. * * @author gfiallos */ public class ProcessInstanceMeta extends AbstractDataTransport { /** serialVersionUID. */ private static final long serialVersionUID = 1L; /** El valor de activity. */ private String activity; /** El valor de h. */ private Integer h; /** El valor de name. */ private String name; /** El valor de pMetaId. */ private Long pmetaid; /** El valor de pid. */ private long pid; /** El valor de sub. */ private List sub = new ArrayList(); /** El valor de type. */ private String type; /** El valor de variables. */ private Map variables = new HashMap(); /** El valor de version. */ private String version; /** El valor de w. */ private Integer w; /** El valor de work item. */ private long workItem; /** El valor de x. */ private Integer x; /** El valor de y. */ private Integer y; /** * Crea una nueva instancia de process instance meta. * * @param pPID the pID */ public ProcessInstanceMeta(long pPID) { this.pid = pPID; } /** * Clona la entidad TgeneAccount * * @see com.fp.dto.hb.HibernateBean#cloneMe() */ @Override public Object cloneMe() throws CloneNotSupportedException { ProcessInstanceMeta p = (ProcessInstanceMeta) this.clone(); return p; } /** * Adiciona un sub process. * * @param pSub the sub */ public void addSubProcess(ProcessInstanceMeta pSub) { this.sub.add(pSub); } /** * Entrega el valor de activity. * * @return Valor de activity */ public String getActivity() { return this.activity; } /** * Entrega el valor de h. * * @return Valor de h */ public Integer getH() { return this.h; } /** * Entrega el valor de name. * * @return Valor de name */ public String getName() { return this.name; } /** * Entrega el valor de: pmetaid * @return Long */ public Long getPmetaid() { return this.pmetaid; } /** * Fija el valor de: pmetaid * @param pmetaid Valor a fijar en el atributo */ public void setPmetaid(Long pmetaid) { this.pmetaid = pmetaid; } /** * Entrega el valor de pid. * * @return Valor de pid */ public long getPid() { return this.pid; } /** * Entrega el valor de sub. * * @return Valor de sub */ public List getSub() { return this.sub; } /** * Entrega el valor de type. * * @return Valor de type */ public String getType() { return this.type; } /** * Entrega el valor de variables. * * @return Valor de variables */ public Map getVariables() { return this.variables; } /** * Entrega el valor de version. * * @return Valor de version */ public String getVersion() { return this.version; } /** * Entrega el valor de w. * * @return Valor de w */ public Integer getW() { return this.w; } /** * Entrega el valor de workItem. * * @return Valor de workItem */ public long getWorkItem() { return this.workItem; } /** * Entrega el valor de x. * * @return Valor de x */ public Integer getX() { return this.x; } /** * Entrega el valor de y. * * @return Valor de y */ public Integer getY() { return this.y; } /** * Fija un nuevo valor en activity. * * @param pActivity the new el valor de activity */ public void setActivity(String pActivity) { this.activity = pActivity; } /** * Fija un nuevo valor en h. * * @param pH es el valor nuevo de h */ public void setH(Integer pH) { this.h = pH; } /** * Fija un nuevo valor en name. * * @param pName es el valor nuevo de name */ public void setName(String pName) { this.name = pName; } /** * Fija un nuevo valor en type. * * @param pType es el valor nuevo de type */ public void setType(String pType) { this.type = pType; } /** * Fija un nuevo valor en version. * * @param pVersion the new el valor de version */ public void setVersion(String pVersion) { this.version = pVersion; } /** * Fija un nuevo valor en w. * * @param pW es el valor nuevo de w */ public void setW(Integer pW) { this.w = pW; } /** * Fija un nuevo valor en workItem. * * @param pWorkItem the new el valor de work item */ public void setWorkItem(long pWorkItem) { this.workItem = pWorkItem; } /** * Fija un nuevo valor en x. * * @param pX the new el valor de x */ public void setX(Integer pX) { this.x = pX; } /** * Fija un nuevo valor en y. * * @param pY the new el valor de y */ public void setY(Integer pY) { this.y = pY; } /** * To string. * * @return string */ @Override public String toString() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.printf("[%s-%s(%s)-%s] (%d,%d) [%d,%d]", this.name, this.version, this.activity, this.pid, this.x, this.y, this.w, this.h); if (!this.variables.isEmpty()) { pw.println(); pw.println("vars:"); for (Entry var : this.variables.entrySet()) { pw.println(); pw.printf("%s=%s", var.getKey(), var.getValue()); } } if (this.workItem != 0) { pw.println(); pw.printf("WorkItem %s", this.workItem); } for (ProcessInstanceMeta pim : this.sub) { pw.println(); pw.printf("%s", pim); } pw.close(); return sw.toString(); } }