use of org.asqatasun.entity.audit.Audit in project Asqatasun by Asqatasun.
the class ActInfoFactory method getActInfo.
/**
* @param act
* @return an ActInfo instance that handles displayable act data
*/
public ActInfo getActInfo(Act act) {
ActInfo actInfo = new ActInfo();
actInfo.setDate(act.getEndDate());
if (act.getAudit() != null) {
Audit audit = act.getAudit();
actInfo.setAuditId(audit.getId().intValue());
actInfo.setScope(act.getScope().getCode().name());
WebResource wr = audit.getSubject();
if (wr != null) {
actInfo.setUrl(wr.getURL());
}
// cas automatique
if (audit.getStatus().equals(AuditStatus.COMPLETED) || audit.getStatus().equals(AuditStatus.MANUAL_INITIALIZING) || audit.getStatus().equals(AuditStatus.MANUAL_ANALYSE_IN_PROGRESS) || audit.getStatus().equals(AuditStatus.MANUAL_COMPLETED)) {
actInfo.setWeightedMark(statisticsDataService.getMarkByWebResourceAndAudit(wr, false, false).intValue());
actInfo.setRawMark(statisticsDataService.getMarkByWebResourceAndAudit(wr, true, false).intValue());
if (actInfo.getRawMark() == -1) {
actInfo.setRawMark(0);
}
actInfo.setStatus(TgolKeyStore.COMPLETED_KEY);
} else if (!contentDataService.hasContent(audit)) {
actInfo.setStatus(TgolKeyStore.ERROR_LOADING_KEY);
} else if (!contentDataService.hasAdaptedSSP(audit)) {
actInfo.setStatus(TgolKeyStore.ERROR_ADAPTING_KEY);
} else {
actInfo.setStatus(TgolKeyStore.ERROR_UNKNOWN_KEY);
}
// cas manual
actInfo.setManual(audit.getStatus().equals(AuditStatus.MANUAL_INITIALIZING) || audit.getStatus().equals(AuditStatus.MANUAL_ANALYSE_IN_PROGRESS) || audit.getStatus().equals(AuditStatus.MANUAL_COMPLETED));
if (actInfo.isManual()) {
actInfo.setDateManual(audit.getManualAuditDateOfCreation());
actInfo.setWeightedMarkManual(statisticsDataService.getMarkByWebResourceAndAudit(wr, false, true).intValue());
actInfo.setRawMarkManual(statisticsDataService.getMarkByWebResourceAndAudit(wr, true, true).intValue());
if (audit.getStatus().equals(AuditStatus.MANUAL_COMPLETED)) {
actInfo.setStatusManual(TgolKeyStore.COMPLETED_KEY);
} else if (audit.getStatus().equals(AuditStatus.MANUAL_ANALYSE_IN_PROGRESS) || audit.getStatus().equals(AuditStatus.MANUAL_INITIALIZING)) {
actInfo.setStatusManual(TgolKeyStore.ONGOING_KEY);
} else {
actInfo.setStatusManual(TgolKeyStore.ERROR_UNKNOWN_KEY);
}
}
setActInfoReferential(actInfo, audit);
}
return actInfo;
}
Aggregations