Search in sources :

Example 1 with DiscrepancyNoteType

use of org.akaza.openclinica.domain.datamap.DiscrepancyNoteType in project OpenClinica by OpenClinica.

the class QueryServiceImpl method createQuery.

private DiscrepancyNote createQuery(QueryServiceHelperBean helperBean, QueryBean queryBean) throws Exception {
    DiscrepancyNote dn = new DiscrepancyNote();
    dn.setStudy(helperBean.getContainer().getStudy());
    dn.setEntityType("itemData");
    dn.setDescription("description");
    dn.setDetailedNotes(queryBean.getComment());
    dn.setDiscrepancyNoteType(new DiscrepancyNoteType(3));
    String user = queryBean.getUser();
    if (user == null) {
        dn.setUserAccountByOwnerId(helperBean.getContainer().getUser());
    } else {
        UserAccount userAccountByOwnerId = userAccountDao.findByUserName(user);
        dn.setUserAccountByOwnerId(userAccountByOwnerId);
    }
    setResolutionStatus(queryBean, dn);
    String assignedTo = "";
    if (queryBean.getComment().startsWith("Automatic query for:")) {
        assignedTo = helperBean.getContainer().getUser().getUserName();
    } else {
        assignedTo = queryBean.getAssigned_to();
    }
    if (!StringUtils.isEmpty(assignedTo)) {
        UserAccount userAccount = userAccountDao.findByUserName(assignedTo);
        helperBean.setUserAccount(userAccount);
        dn.setUserAccount(userAccount);
    }
    // create itemData when a query is created without an autosaved itemdata
    if (helperBean.getItemData() == null) {
        helperBean.setItemData(createBlankItemData(helperBean));
    }
    dn.setDateCreated(new Date());
    return dn;
}
Also used : DiscrepancyNote(org.akaza.openclinica.domain.datamap.DiscrepancyNote) DiscrepancyNoteType(org.akaza.openclinica.domain.datamap.DiscrepancyNoteType) UserAccount(org.akaza.openclinica.domain.user.UserAccount) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 DiscrepancyNote (org.akaza.openclinica.domain.datamap.DiscrepancyNote)1 DiscrepancyNoteType (org.akaza.openclinica.domain.datamap.DiscrepancyNoteType)1 UserAccount (org.akaza.openclinica.domain.user.UserAccount)1