br.com.jarch.bpm.model.BaseTaskBean Maven / Gradle / Ivy
package br.com.jarch.bpm.model;
import br.com.jarch.model.TaskBean;
import br.com.jarch.bpm.type.QuantityTaskType;
import br.com.jarch.annotation.JArchConfiguration;
import br.com.jarch.annotation.JArchTaskBean;
import br.com.jarch.util.BundleUtils;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
/**
* Created by wagner.araujo on 4/4/17.
*/
@JArchTaskBean
@JArchConfiguration(generateSearch = false)
public abstract class BaseTaskBean implements IBaseTaskBean {
private TaskBean task;
private QuantityTaskType quantityType = QuantityTaskType.SUCCESS;
private String quantityLabel = BundleUtils.messageBundle("label.espera");
private String quantityUnity = BundleUtils.messageBundle("label.dia");
private String quantityUnitys = BundleUtils.messageBundle("label.dias");
private Long quantityValue;
// private String order1;
// private String order2;
// private String order3;
private List listDetail = new ArrayList<>();
@Override
public String getId() {
return task == null ? null : task.getId();
}
@Override
public String getAssignee() {
return task == null ? null : task.getAssignee();
}
@Override
public String getName() {
return task == null ? null : task.getName();
}
@Override
public Long getQuantityValue() {
if (quantityValue == null && task != null) {
quantityValue = ChronoUnit.DAYS.between(LocalDate.now(), task.getCreated());
if (quantityValue < 0) {
quantityValue *= -1;
}
}
return quantityValue;
}
@Override
public void setQuantityValue(Long quantityValue) {
this.quantityValue = quantityValue;
}
@Override
public QuantityTaskType getQuantityType() {
return quantityType;
}
@Override
public void setQuantityType(QuantityTaskType quantityType) {
this.quantityType = quantityType;
}
@Override
public String getClassCssLabelQuantity() {
return quantityType.getClassCss();
}
@Override
public List getListDetail() {
return listDetail;
}
@Override
public void addDetail(BaseTaskDetailBean detail) {
listDetail.add(detail);
}
public String getDetails(){
String details = "";
for (BaseTaskDetailBean item: getListDetail()){
details += "\n" +
"\n" + item.getField() + ": " + item.getValue() + "" +
// "\n" + item.getValue() + "" +
"\n";
}
return details;
}
@Override
public TaskBean getTask() {
return task;
}
@Override
public void setTask(TaskBean task) {
this.task = task;
}
@Override
public String getQuantityLabel() {
return quantityLabel;
}
@Override
public void setQuantityLabel(String quantityLabel) {
this.quantityLabel = quantityLabel;
}
@Override
public String getQuantityUnity() {
return quantityUnity;
}
@Override
public void setQuantityUnity(String quantityUnity) {
this.quantityUnity = quantityUnity;
}
@Override
public String getQuantityUnitys() {
return quantityUnitys;
}
@Override
public void setQuantityUnitys(String quantityUnitys) {
this.quantityUnitys = quantityUnitys;
}
// @Override
// public String getOrder1() {
// return order1;
// }
// @Override
// public void setOrder1(String order1) {
// this.order1 = order1;
// }
// @Override
// public String getOrder2() {
// return order2;
// }
// @Override
// public void setOrder2(String order2) {
// this.order2 = order2;
// }
// @Override
// public String getOrder3() {
// return order3;
// }
// @Override
// public void setOrder3(String order3) {
// this.order3 = order3;
// }
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy