private void buildRequesters() { requesters = sampleRequesterDAO.getRequestersForSampleId(sampleId); for (SampleRequester requester : requesters) { if (requester.getRequesterTypeId() == Requester.PERSON.getId()) { Person person = personDAO.getPersonById(String.valueOf(requester.getRequesterId())); personService = new PersonService(person); } else if (requester.getRequesterTypeId() == Requester.ORGANIZATION.getId()) { organization = organizationDAO.getOrganizationById(String.valueOf(requester.getRequesterId())); } } }
static { RequesterTypeDAO requesterTypeDAO = new RequesterTypeDAOImpl(); RequesterType requesterType = requesterTypeDAO.getRequesterTypeByName("organization"); Requester.ORGANIZATION.setId( requesterType != null ? Long.parseLong(requesterType.getId()) : -1L); requesterType = requesterTypeDAO.getRequesterTypeByName("provider"); Requester.PERSON.setId(requesterType != null ? Long.parseLong(requesterType.getId()) : -1L); OrganizationType orgType = new OrganizationTypeDAOImpl().getOrganizationTypeByName(REFERRAL_ORG_TYPE); REFERRAL_ORG_TYPE_ID = orgType == null ? null : orgType.getId(); }