public List<DataUpload> getImports() { Organization org = DB.getOrganizationDAO().findById(this.organizationId, false); List<DataUpload> du = new ArrayList<DataUpload>(); if (this.userId > -1) { User u = DB.getUserDAO().findById(userId, false); du = DB.getDataUploadDAO().findByOrganizationUser(org, u); // check transform status and set boolean here return du; } du = DB.getDataUploadDAO().findByOrganization(org); if (du == null) return Collections.emptyList(); // log.debug("startImport:"+startImport+" maxImports:"+maxImports); return du; }
/** * Select which uploads are involved in this item Panel call Use it to retrieve items or item * count !! 3 cases: - For a specific upload: the uploadID > 1 - For an organization all items * (the "normal" case) organizationId > -1 userId == -1 - For a specific user in an org: * organizationId and userId > -1 * * @return */ private List<DataUpload> findUploads() { List<DataUpload> result = Collections.emptyList(); if (getUploadId() > -1) { log.debug("Items by Upload " + uploadId); result = new ArrayList<DataUpload>(); DataUpload du = DB.getDataUploadDAO().getById(getUploadId(), false); result.add(du); } else { Organization org = DB.getOrganizationDAO().findById(organizationId, false); if (org != null) { if (getUserId() > -1) { log.debug("Items by User " + userId + " and Org " + organizationId); User user = DB.getUserDAO().findById(this.userId, false); result = DB.getDataUploadDAO().getByUserOrg(user, org); } else { log.debug("Items by Org " + organizationId); result = org.getDataUploads(); } } } return result; }
public void setOrganizationId(long organizationId) { this.organizationId = organizationId; this.o = DB.getOrganizationDAO().findById(organizationId, false); }