use of org.akaza.openclinica.domain.datamap.DiscrepancyNote in project OpenClinica by OpenClinica.
the class DiscrepancyNoteDao method findChildQueriesByItemData.
public List<DiscrepancyNote> findChildQueriesByItemData(Integer itemDataId) {
Query q = getCurrentSession().createQuery(findChildQueriesByItemData);
q.setParameter("itemDataId", itemDataId);
return ((List<DiscrepancyNote>) q.list());
}
use of org.akaza.openclinica.domain.datamap.DiscrepancyNote in project OpenClinica by OpenClinica.
the class EnketoUrlService method buildQueryElement.
public QueriesBean buildQueryElement(ItemData itemdata) {
QueriesBean queryElement = new QueriesBean();
List<QueryBean> queryBeans = new ArrayList<>();
List<LogBean> logBeans = new ArrayList<LogBean>();
List<DiscrepancyNote> dns = discrepancyNoteDao.findChildQueriesByItemData(itemdata.getItemDataId());
int i = 0;
for (DiscrepancyNote dn : dns) {
i++;
QueryBean query = new QueryBean();
query.setId(String.valueOf(i));
query.setAssigned_to(dn.getUserAccountByOwnerId().getUserName());
query.setComment(escapedValue(dn.getDetailedNotes()));
query.setStatus(dn.getResolutionStatus().getName().toLowerCase());
DateTime dateTime = new DateTime(dn.getDateCreated());
query.setDate_time(convertDateFormat(dateTime));
query.setNotify(false);
query.setUser(dn.getUserAccountByOwnerId().getUserName());
query.setType(COMMENT);
queryBeans.add(query);
}
AuditLogEvent auditLog = new AuditLogEvent();
auditLog.setEntityId(new Integer(itemdata.getItemDataId()));
auditLog.setAuditTable(ITEMDATA);
ArrayList<AuditLogEvent> auditLogEvents = auditLogEventDao.findByParam(auditLog, null);
for (AuditLogEvent audit : auditLogEvents) {
LogBean logBean = new LogBean();
String oldValue = audit.getOldValue() != null ? audit.getOldValue() : "";
String newValue = audit.getNewValue() != null ? audit.getNewValue() : "";
logBean.setMessage("Value Changed from \"" + escapedValue(oldValue) + "\" to \"" + escapedValue(newValue) + "\"");
DateTime dateTime = new DateTime(audit.getAuditDate());
logBean.setDate_time(convertDateFormat(dateTime));
UserAccount uAccount = userAccountDao.findById(audit.getUserAccount().getUserId());
logBean.setUser(uAccount.getUserName());
logBean.setAssigned_to(uAccount.getUserName());
logBean.setType(AUDIT);
logBeans.add(logBean);
}
queryElement.setQueries(queryBeans);
queryElement.setLogs(logBeans);
if (queryElement.getQueries().size() != 0 || queryElement.getLogs().size() != 0)
return queryElement;
else
return null;
}
Aggregations