public VelocityContext getBioCollectionLabelContext(BioCollection bioCollection) { VelocityContext velocityContext = new VelocityContext(); LinkSubjectStudy linkSubjectStudy = null; try { linkSubjectStudy = iArkCommonService.getSubjectByUID( bioCollection.getLinkSubjectStudy().getSubjectUID(), bioCollection.getStudy()); } catch (EntityNotFoundException e) { log.error(e.getMessage()); } try { bioCollection = iBioCollectionDao.getBioCollection(bioCollection.getId()); } catch (EntityNotFoundException e) { log.error(e.getMessage()); } String subjectUid = linkSubjectStudy.getSubjectUID(); // ArkFunction arkFunction = // iArkCommonService.getArkFunctionByName(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_LIMS_COLLECTION); ArkFunction arkFunction = iArkCommonService.getArkFunctionByName( au.org.theark.core.Constants.FUNCTION_KEY_VALUE_LIMS_CUSTOM_FIELD); // Custom field name "FAMILYID" BioCollectionCustomFieldData bioCollectionCustomFieldData = iBioCollectionDao.getBioCollectionCustomFieldData(bioCollection, arkFunction, "FAMILYID"); String familyId = bioCollectionCustomFieldData.getTextDataValue(); // Custom field name "ASRBNO" bioCollectionCustomFieldData = iBioCollectionDao.getBioCollectionCustomFieldData(bioCollection, arkFunction, "ASRBNO"); String asrbno = bioCollectionCustomFieldData.getTextDataValue(); String collectionDate = new String(); if (bioCollection.getCollectionDate() != null) { collectionDate = simpleDateFormat.format(bioCollection.getCollectionDate()); } String refDoctor = new String(); if (bioCollection.getRefDoctor() != null) { refDoctor = bioCollection.getRefDoctor(); } String dateOfBirth = new String(); if (bioCollection.getLinkSubjectStudy().getPerson().getDateOfBirth() != null) { dateOfBirth = simpleDateFormat.format(bioCollection.getLinkSubjectStudy().getPerson().getDateOfBirth()); } String sex = new String(); if (bioCollection.getLinkSubjectStudy().getPerson().getGenderType() != null) { sex = bioCollection.getLinkSubjectStudy().getPerson().getGenderType().getName(); } String collectionID = bioCollection.getBiocollectionUid(); String subjectFirstName = linkSubjectStudy.getPerson().getFirstName(); String subjectLastName = linkSubjectStudy.getPerson().getLastName(); String initials = subjectFirstName.charAt(0) + "" + subjectLastName.charAt(0); velocityContext.put("initials", initials); velocityContext.put("firstName", subjectFirstName); velocityContext.put("lastName", subjectLastName); velocityContext.put("collectionID", collectionID); velocityContext.put("subjectUid", subjectUid); velocityContext.put("familyId", familyId); velocityContext.put("asrbno", asrbno); velocityContext.put("collectionDate", collectionDate); velocityContext.put("refDoctor", refDoctor); velocityContext.put("dateOfBirth", dateOfBirth); velocityContext.put("sex", sex); return velocityContext; }