maia/.svn/pristine/2d/2deeddf1da23e2934e7f16945ed...

600 lines
13 KiB
Plaintext
Executable File

/*
*
*/
package com.fp.simple.dto;
import java.io.Serializable;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
// TODO: Auto-generated Javadoc
/**
* Class TaskInfo encargada de.
*
* @author gfiallos
*/
public class TaskInfo implements Serializable {
/** serialVersionUID. */
private static final long serialVersionUID = 1L;
/** El valor de action. */
private String action;
/** El valor de aditional data. */
private Map<Object, Object> aditionalData = new HashMap<Object, Object>();
/** El valor de company. */
private Integer company;
/** El valor de completed. */
private Timestamp completed;
/** El valor de created. */
private Timestamp created;
/** El valor de expected time. */
private long expectedTime;
/** El valor de group id. */
private String groupId;
/** El valor de journal id. */
private String journalId;
/** El valor de module. */
private String module;
/** El valor de response. */
private String response;
/** El valor de rule code. */
private String ruleCode;
/** El valor de rule code default. */
private String ruleCodeDefault;
/** El valor de started. */
private Timestamp started;
/** El valor de task id. */
private long taskId;
/** Nombre de la tarea. */
private String tname;
/** El valor de transaction. */
private Integer transaction;
/** El valor de user id. */
private String userId;
/** El valor de version. */
private Integer version;
/** El valor de internal code. */
private Object internalCode;
/**
* Paquete clase a ejecutar, se utiliza para obtener el codigo de usuario o grupo responsable de ejecutar uana tarea
*/
private String classCode;
/**
* Codigo de mensaje asociado a la tarea se utiliza para presentar en el agenda del usuario.
*/
private Integer messageCode;
/**
* Entrega el valor de internalCode.
*
* @return Valor de internalCode
*/
public Object getInternalCode() {
return internalCode;
}
/**
* Fija un nuevo valor en internalCode.
*
* @param pInternalCode nuevo valor para internalCode
*/
public void setInternalCode(Object pInternalCode) {
internalCode = pInternalCode;
}
/** El valor de kind. */
private Kind kind;
/**
* Entrega el valor de kind.
*
* @return Valor de kind
*/
public Kind getKind() {
return kind;
}
/**
* Fija un nuevo valor en kind.
*
* @param pKind nuevo valor para kind
*/
public void setKind(Kind pKind) {
kind = pKind;
}
/**
* Obtiene el valor de action.
*
* @return Valor de action
*/
public String getAction() {
return action;
}
/**
* Entrega el valor de aditionalData.
*
* @return Valor de aditionalData
*/
public Map<Object, Object> getAditionalData() {
return aditionalData;
}
/**
* Entrega el valor de company.
*
* @return Valor de company
*/
public Integer getCompany() {
return company;
}
/**
* Entrega el valor de completed.
*
* @return Valor de completed
*/
public Timestamp getCompleted() {
return completed;
}
/**
* Entrega el valor de created.
*
* @return Valor de created
*/
public Timestamp getCreated() {
return created;
}
/**
* Entrega el valor de spectedTime.
*
* @return Valor de spectedTime
*/
public long getExpectedTime() {
return expectedTime;
}
/**
* Obtiene el valor de group id.
*
* @return Valor de group id
*/
public String getGroupId() {
return groupId;
}
/**
* Entrega el valor de journalId.
*
* @return Valor de journalId
*/
public String getJournalId() {
return journalId;
}
/**
* Entrega el valor de module.
*
* @return Valor de module
*/
public String getModule() {
return module;
}
/**
* Obtiene el valor de response.
*
* @return Valor de response
*/
public String getResponse() {
return response;
}
/**
* Entrega el valor de ruleCode.
*
* @return Valor de ruleCode
*/
public String getRuleCode() {
return ruleCode;
}
/**
* Entrega el valor de ruleCodeDefault.
*
* @return Valor de ruleCodeDefault
*/
public String getRuleCodeDefault() {
return ruleCodeDefault;
}
/**
* Entrega el valor de started.
*
* @return Valor de started
*/
public Timestamp getStarted() {
return started;
}
/**
* Entrega el valor de taskId.
*
* @return Valor de taskId
*/
public long getTaskId() {
return taskId;
}
/**
* Entrega el valor de transaction.
*
* @return Valor de transaction
*/
public Integer getTransaction() {
return transaction;
}
/**
* Obtiene el valor de user id.
*
* @return Valor de user id
*/
public String getUserId() {
return userId;
}
/**
* Entrega el valor de version.
*
* @return Valor de version
*/
public Integer getVersion() {
return version;
}
/**
* Fija el valor de action.
*
* @param pAction the new el valor de action
*/
public void setAction(String pAction) {
action = pAction;
}
/**
* Fija un nuevo valor en aditionalData.
*
* @param pAditionalData the new el valor de aditional data
*/
public void setAditionalData(Map<Object, Object> pAditionalData) {
aditionalData = pAditionalData;
}
/**
* Fija un nuevo valor en company.
*
* @param pCompany the new el valor de company
*/
public void setCompany(Integer pCompany) {
company = pCompany;
}
/**
* Fija un nuevo valor en completed.
*
* @param pCompleted the new el valor de completed
*/
public void setCompleted(Timestamp pCompleted) {
completed = pCompleted;
}
/**
* Fija un nuevo valor en created.
*
* @param pCreated the new el valor de created
*/
public void setCreated(Timestamp pCreated) {
created = pCreated;
}
/**
* Fija un nuevo valor en spectedTime.
*
* @param pSpectedTime the new el valor de expected time
*/
public void setExpectedTime(long pSpectedTime) {
expectedTime = pSpectedTime;
}
/**
* Fija el valor de group id.
*
* @param pGroupId the new el valor de group id
*/
public void setGroupId(String pGroupId) {
groupId = pGroupId;
}
/**
* Fija un nuevo valor en journalId.
*
* @param pJournalId the new el valor de journal id
*/
public void setJournalId(String pJournalId) {
journalId = pJournalId;
}
/**
* Fija un nuevo valor en module
*
* @param pModule nuevo valor para module
*/
public void setModule(String pModule) {
module = pModule;
}
/**
* Fija el valor de response.
*
* @param pResponse the new el valor de response
*/
public void setResponse(String pResponse) {
response = pResponse;
}
/**
* Fija un nuevo valor en ruleCode.
*
* @param pRuleCode the new el valor de rule code
*/
public void setRuleCode(String pRuleCode) {
ruleCode = pRuleCode;
}
/**
* Fija un nuevo valor en ruleCodeDefault.
*
* @param pRuleCodeDefault the new el valor de rule code default
*/
public void setRuleCodeDefault(String pRuleCodeDefault) {
ruleCodeDefault = pRuleCodeDefault;
}
/**
* Fija un nuevo valor en started.
*
* @param pStarted the new el valor de started
*/
public void setStarted(Timestamp pStarted) {
started = pStarted;
}
/**
* Fija un nuevo valor en taskId.
*
* @param pTaskId the new el valor de task id
*/
public void setTaskId(long pTaskId) {
taskId = pTaskId;
}
/**
* Entrega el valor de: tname
*
* @return String
*/
public String getTname() {
return tname;
}
/**
* Fija el valor de: tname
*
* @param tname
*/
public void setTname(String tname) {
this.tname = tname;
}
/**
* Fija un nuevo valor en transaction.
*
* @param pTransaction the new el valor de transaction
*/
public void setTransaction(Integer pTransaction) {
transaction = pTransaction;
}
/**
* Fija el valor de user id.
*
* @param pUserId the new el valor de user id
*/
public void setUserId(String pUserId) {
userId = pUserId;
}
/**
* Fija un nuevo valor en version.
*
* @param pVersion the new el valor de version
*/
public void setVersion(Integer pVersion) {
version = pVersion;
}
/**
* Obtiene el valor de real time.
*
* @param pTime the time
* @return Valor de real time
* @throws Exception la exception
*/
public long getRealTime(long pTime) throws Exception {
if (created == null) {
return 0L;
}
long lcreated = created.getTime();
long lcompleted = lcreated;
if (completed != null) {
lcompleted = completed.getTime();
} else {
lcompleted = pTime; // System.currentTimeMillis();
}
return lcompleted - lcreated;
}
/**
* Obtiene el valor de real time.
*
* @return Valor de real time
* @throws Exception la exception
*/
public long getRealTime() throws Exception {
if (created == null) {
return 0L;
}
long lcreated = created.getTime();
long lcompleted = lcreated;
if (completed != null) {
lcompleted = completed.getTime();
} else {
lcompleted = System.currentTimeMillis();
}
return lcompleted - lcreated;
}
/**
* Convert.
*
* @param pTime the time
* @return string
* @throws Exception la exception
*/
protected String convert(Long pTime) throws Exception {
DecimalFormat df = new DecimalFormat("00");
return df.format(Double.valueOf(pTime / 60000).intValue()) + ":" + df.format(pTime % 60);
}
/**
* Obtiene el valor de real time string.
*
* @param pTime the time
* @return Valor de real time string
* @throws Exception la exception
*/
public String getRealTimeString(long pTime) throws Exception {
return this.convert(this.getRealTime(pTime));
}
/**
* Obtiene el valor de real time string.
*
* @return Valor de real time string
* @throws Exception la exception
*/
public String getRealTimeString() throws Exception {
return this.convert(this.getRealTime());
}
/**
* Obtiene el valor de expected time string.
*
* @return Valor de expected time string
* @throws Exception la exception
*/
public String getExpectedTimeString() throws Exception {
return this.convert(this.getExpectedTime());
}
/**
* Entrega el valor de: classCode
*
* @return String
*/
public String getClassCode() {
return classCode;
}
/**
* Fija el valor de: classCode
*
* @param classCode
*/
public void setClassCode(String classCode) {
this.classCode = classCode;
}
/**
* Entrega el valor de: messageCode
*
* @return Integer
*/
public Integer getMessageCode() {
return messageCode;
}
/**
* Fija el valor de: messageCode
*
* @param messageCode
*/
public void setMessageCode(Integer messageCode) {
this.messageCode = messageCode;
}
/**
* Update data.
*
* @param pData the data
*/
public void updateData(Map<String, Object> pData) {
for (Entry<Object, Object> e : aditionalData.entrySet()) {
pData.put("" + e.getKey(), e.getValue());
}
}
/**
* To string.
*
* @return string
*/
@Override
public String toString() {
return "TaskInfo [taskid=" + taskId + ", tname=" + tname + ", action=" + action + ", aditionalData=" + aditionalData + ", module=" + module
+ ", response=" + response + ", ruleCode=" + ruleCode + ", expectedTime=" + expectedTime + ", transaction=" + transaction
+ ", userId=" + userId + ", version=" + version + "]";
}
}