List of usage examples for org.apache.wicket.ajax AjaxRequestTarget add
void add(Component... components);
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
private void initBiospecimenUidPadCharDdc() { List<BiospecimenUidPadChar> biospecimenUidPadChars = new ArrayList<BiospecimenUidPadChar>(0); biospecimenUidPadChars = iArkCommonService.getBiospecimenUidPadChars(); ChoiceRenderer<BiospecimenUidPadChar> choiceRenderer = new ChoiceRenderer<BiospecimenUidPadChar>( Constants.NAME, Constants.ID); biospecimenUidPadCharDdc = new DropDownChoice<BiospecimenUidPadChar>( "biospecimenUidTemplate.biospecimenUidPadChar", biospecimenUidPadChars, choiceRenderer); biospecimenUidPadCharDdc.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override/*from ww w. ja v a 2 s . co m*/ protected void onUpdate(AjaxRequestTarget target) { biospecimenUidExampleTxt = getBiospecimenUidExample(); target.add(biospecimenUidExampleLbl); } }); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
private void initParentStudyDdc() { List<Study> parentStudyListForUser = new ArrayList<Study>(0); ChoiceRenderer<Study> choiceRenderer = new ChoiceRenderer<Study>(Constants.NAME, Constants.ID); parentStudyDdc = new DropDownChoice<Study>("study.parentStudy", parentStudyListForUser, choiceRenderer) { private static final long serialVersionUID = 1L; @Override// www .j a va 2 s.com protected void onBeforeRender() { this.setChoices(getParentStudyList()); super.onBeforeRender(); } }; /* * If a parent study was selected, then reset the AutoGeneration of Subject UID and Biospecimen for this study and disable it in the front end */ parentStudyDdc.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { Study study = containerForm.getModelObject().getStudy(); Study parentStudy = parentStudyDdc.getModelObject(); if (parentStudy != null && (parentStudy.getId() != study.getId())) { parentStudy = iArkCommonService.getStudy(parentStudy.getId()); // Set auto-generated patterns to that of the parent study study.setAutoGenerateSubjectUid(parentStudy.getAutoGenerateSubjectUid()); study.setAutoGenerateBiocollectionUid(parentStudy.getAutoGenerateBiocollectionUid()); study.setAutoGenerateBiospecimenUid(parentStudy.getAutoGenerateBiospecimenUid()); study.setSubjectUidPrefix(parentStudy.getSubjectUidPrefix()); study.setSubjectUidToken(parentStudy.getSubjectUidToken()); study.setSubjectUidPadChar(parentStudy.getSubjectUidPadChar()); study.setSubjectUidStart(parentStudy.getSubjectUidStart()); subjectUidExampleTxt = iArkCommonService.getSubjectUidExample(parentStudy); // Set BioCollection template BioCollectionUidTemplate parentBioCollectionUidTemplate = iArkCommonService .getBioCollectionUidTemplate(parentStudy); if (parentBioCollectionUidTemplate != null) { BioCollectionUidTemplate bioCollectionUidTemplate = new BioCollectionUidTemplate(); bioCollectionUidTemplate.setBioCollectionUidPrefix( parentBioCollectionUidTemplate.getBioCollectionUidPrefix()); bioCollectionUidTemplate.setBioCollectionUidToken( parentBioCollectionUidTemplate.getBioCollectionUidToken()); bioCollectionUidTemplate.setBioCollectionUidPadChar( parentBioCollectionUidTemplate.getBioCollectionUidPadChar()); bioCollectionUidTemplate.setStudy(study); containerForm.getModelObject().setBioCollectionUidTemplate(bioCollectionUidTemplate); bioCollectionUidExampleTxt = getBiocollectionUidExample(); } else { containerForm.getModelObject().setBioCollectionUidTemplate(new BioCollectionUidTemplate()); initBioCollectionUid(); } // Set Biospecimen template BiospecimenUidTemplate parentBiospecimenUidTemplate = iArkCommonService .getBiospecimenUidTemplate(parentStudy); if (parentBiospecimenUidTemplate != null) { BiospecimenUidTemplate biospecimenUidTemplate = new BiospecimenUidTemplate(); biospecimenUidTemplate .setBiospecimenUidPrefix(parentBiospecimenUidTemplate.getBiospecimenUidPrefix()); biospecimenUidTemplate .setBiospecimenUidToken(parentBiospecimenUidTemplate.getBiospecimenUidToken()); biospecimenUidTemplate .setBiospecimenUidPadChar(parentBiospecimenUidTemplate.getBiospecimenUidPadChar()); biospecimenUidTemplate.setStudy(study); containerForm.getModelObject().setBiospecimenUidTemplate(biospecimenUidTemplate); biospecimenUidExampleTxt = getBiospecimenUidExample(); } else { containerForm.getModelObject().setBiospecimenUidTemplate(new BiospecimenUidTemplate()); initBiospecimenUid(); } autoGenSubIdChkBox.setEnabled(false); autoGenBiocollectionIdChkBox.setEnabled(false); autoGenBiospecimenIdChkBox.setEnabled(false); subjectUidContainer.setEnabled(false); biospecimenUidContainer.setEnabled(false); bioCollectionUidContainer.setEnabled(false); } else { // Reset to defaults if "Choose One" selected again containerForm.getModelObject().getStudy().setAutoGenerateSubjectUid(new Boolean("false")); containerForm.getModelObject().getStudy().setSubjectUidPrefix(new String("")); containerForm.getModelObject().getStudy().setSubjectUidToken(new SubjectUidToken()); containerForm.getModelObject().getStudy().setSubjectUidPadChar(new SubjectUidPadChar()); containerForm.getModelObject().getStudy().setSubjectUidStart(null); initSubjectUid(); containerForm.getModelObject().setBioCollectionUidTemplate(new BioCollectionUidTemplate()); initBioCollectionUid(); containerForm.getModelObject().setBiospecimenUidTemplate(new BiospecimenUidTemplate()); initBiospecimenUid(); autoGenSubIdChkBox.setEnabled(true); autoGenBiocollectionIdChkBox.setEnabled(true); autoGenBiospecimenIdChkBox.setEnabled(true); subjectUidContainer.setEnabled(true); subjectUidStartTxtFld.setEnabled(true); biospecimenUidContainer.setEnabled(true); bioCollectionUidContainer.setEnabled(true); subjectUidExampleLbl.setDefaultModelObject(new String("")); bioCollectionUidExampleLbl.setDefaultModelObject(new String("")); biospecimenUidExampleLbl.setDefaultModelObject(new String("")); } subjectUidContainer.addOrReplace(subjectUidPrefixTxtFld); subjectUidContainer.addOrReplace(subjectUidTokenTxtFld); subjectUidContainer.addOrReplace(subjectUidTokenDpChoices); subjectUidContainer.addOrReplace(subjectUidPadCharsDpChoices); subjectUidContainer.addOrReplace(subjectUidStartTxtFld); subjectUidContainer.addOrReplace(subjectUidExampleLbl); studyCrudVO.getDetailPanelFormContainer().addOrReplace(subjectUidContainer); bioCollectionUidContainer.addOrReplace(bioCollectionUidTokenDdc); bioCollectionUidContainer.addOrReplace(bioCollectionUidPrefixTxtFld); bioCollectionUidContainer.addOrReplace(bioCollectionUidPadCharDdc); bioCollectionUidContainer.addOrReplace(bioCollectionUidExampleLbl); studyCrudVO.getDetailPanelFormContainer().addOrReplace(bioCollectionUidContainer); biospecimenUidContainer.addOrReplace(biospecimenUidTokenDdc); biospecimenUidContainer.addOrReplace(biospecimenUidPrefixTxtFld); biospecimenUidContainer.addOrReplace(biospecimenUidPadCharDdc); biospecimenUidContainer.addOrReplace(biospecimenUidExampleLbl); studyCrudVO.getDetailPanelFormContainer().addOrReplace(biospecimenUidContainer); // Repaint target.add(autoGenSubIdChkBox); target.add(autoGenBiocollectionIdChkBox); target.add(autoGenBiospecimenIdChkBox); target.add(subjectUidContainer); target.add(subjectUidTokenDpChoices); target.add(subjectUidExampleLbl); target.add(bioCollectionUidContainer); target.add(bioCollectionUidExampleLbl); target.add(biospecimenUidContainer); target.add(biospecimenUidExampleLbl); } }); parentStudyContainer = new WebMarkupContainer("parentStudyContainer"); parentStudyContainer.setOutputMarkupId(true); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
private void initSubjectUidTokenDropDown() { List<SubjectUidToken> subjectUidTokenList = iArkCommonService.getListOfSubjectUidToken(); ChoiceRenderer<SubjectUidToken> defaultChoiceRenderer = new ChoiceRenderer<SubjectUidToken>(Constants.NAME, Constants.STUDY_STATUS_KEY); subjectUidTokenDpChoices = new DropDownChoice<SubjectUidToken>( au.org.theark.study.web.Constants.SUBJECT_UID_TOKEN, subjectUidTokenList, defaultChoiceRenderer); subjectUidTokenDpChoices.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override//ww w .ja v a2 s . c o m protected void onUpdate(AjaxRequestTarget target) { subjectUidExampleTxt = getSubjectUidExample(); target.add(subjectUidExampleLbl); } }); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
private void initSubjectUidPadCharsDropDown() { List<SubjectUidPadChar> subjectUidPadCharList = iArkCommonService.getListOfSubjectUidPadChar(); ChoiceRenderer<SubjectUidPadChar> defaultChoiceRenderer = new ChoiceRenderer<SubjectUidPadChar>( Constants.NAME, Constants.STUDY_STATUS_KEY); subjectUidPadCharsDpChoices = new DropDownChoice<SubjectUidPadChar>( au.org.theark.study.web.Constants.SUBJECT_UID_PADCHAR, subjectUidPadCharList, defaultChoiceRenderer);//from w w w. java2 s . c om subjectUidPadCharsDpChoices.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { subjectUidExampleTxt = getSubjectUidExample(); target.add(subjectUidExampleLbl); } }); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
private void processSaveUpdate(StudyModelVO studyModel, AjaxRequestTarget target) throws EntityExistsException, UnAuthorizedOperation, ArkSystemException, EntityCannotBeRemoved, CannotRemoveArkModuleException { Collection<ModuleVO> moduleVoCollection = studyModel.getModulesSelected(); // Convert to Set<String> this can be removed later by changing the interface Set<String> moduleList = new HashSet<String>(); for (ModuleVO moduleVO : moduleVoCollection) { moduleList.add(moduleVO.getModule()); }//from w w w. j av a 2 s . c o m studyModel.setLmcSelectedApps(moduleList); if (studyModel.getStudy() != null && studyModel.getStudy().getId() == null) { Set<String> moduleNames = new HashSet<String>(); for (ArkModule arkModule : studyModel.getSelectedArkModules()) { moduleNames.add(arkModule.getName()); } // Always assign Study module if (moduleNames.isEmpty()) { moduleNames.add(ModuleConstants.ARK_MODULE_STUDY); } ArkUserVO arkUserVo = new ArkUserVO(); String currentUser = (String) SecurityUtils.getSubject().getPrincipal(); arkUserVo = iArkCommonService.getDefaultAdministratorRoles(currentUser, studyModel.getStudy(), moduleNames); if (!arkUserVo.getUserName().isEmpty()) { // Create new study and assign the current user iStudyService.createStudy(studyModel, arkUserVo); this.info("Study: " + studyModel.getStudy().getName().toUpperCase() + " has been saved with default Administrator roles to the modules selected."); } else { // Create new study by default, without assignment of user iStudyService.createStudy(studyModel); this.info("Study: " + studyModel.getStudy().getName().toUpperCase() + " has been saved."); } subjectUidExampleTxt = getSubjectUidExample(); target.add(subjectUidExampleLbl); onSavePostProcess(target, studyCrudVO); studyCrudVO.getSummaryContainer().setVisible(true);// added as part of refactoring } else { // Update iStudyService.updateStudy(studyModel); subjectUidExampleTxt = getSubjectUidExample(); target.add(subjectUidExampleLbl); this.info("Update of Study: " + studyModel.getStudy().getName().toUpperCase() + " was successful."); onSavePostProcess(target, studyCrudVO); studyCrudVO.getSummaryContainer().setVisible(true); } SecurityUtils.getSubject().getSession().setAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID, studyModel.getStudy().getId()); SecurityUtils.getSubject().getSession().removeAttribute(au.org.theark.core.Constants.PERSON_CONTEXT_ID); SecurityUtils.getSubject().getSession().removeAttribute(au.org.theark.core.Constants.PERSON_TYPE); containerForm.getModelObject().setStudy(studyModel.getStudy()); // Set Study into context items ContextHelper contextHelper = new ContextHelper(); contextHelper.resetContextLabel(target, studyCrudVO.getArkContextMarkup()); contextHelper.setStudyContextLabel(target, studyModel.getStudy().getName(), studyCrudVO.getArkContextMarkup()); // Refresh Study Logo in header studyHelper = new StudyHelper(); studyHelper.setStudyLogo(studyModel.getStudy(), target, studyCrudVO.getStudyNameMarkup(), studyCrudVO.getStudyLogoMarkup()); target.add(studyCrudVO.getDetailPanelContainer()); target.add(studyCrudVO.getStudyLogoMarkup()); // Update summary long totalSubjects = iArkCommonService.getCountOfSubjects(studyModel.getStudy()); long totalSubjectsOfParent = iArkCommonService.getCountOfSubjects(studyModel.getStudy().getParentStudy()); studyModel.setTotalSubjects(totalSubjects); studyModel.setTotalSubjectsOfParent(totalSubjectsOfParent); target.add(totalSubjectsLabel); target.add(subjectUidContainer); target.add(bioCollectionUidContainer); target.add(biospecimenUidContainer); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
@Override protected void processErrors(AjaxRequestTarget target) { fileUploadField.clearInput(); target.add(fileUploadField); target.add(feedBackPanel); }
From source file:au.org.theark.study.web.component.managestudy.form.SearchForm.java
License:Open Source License
/** * Constructor/*w w w .j a v a 2 s. c o m*/ * * @param id * @param model * @param studyCrudContainerVO * @param containerForm */ public SearchForm(String id, CompoundPropertyModel<StudyModelVO> studyModelVOCpm, StudyCrudContainerVO studyCrudContainerVO, final FeedbackPanel feedbackPanel, Container containerForm) { super(id, studyModelVOCpm, feedbackPanel, studyCrudContainerVO); this.containerForm = containerForm; this.studyCrudContainerVO = studyCrudContainerVO; this.feedbackPanel = feedbackPanel; setMultiPart(true); cpmModel = studyModelVOCpm; initialiseSearchForm(); addSearchComponentsToForm(); newButton.replaceWith(new ArkBusyAjaxButton(Constants.NEW) { private static final long serialVersionUID = 1666656098281624401L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { // Make the details panel visible, disabling delete button (if found) // AjaxButton ajaxButton = (AjaxButton) editButtonContainer.get("delete"); AjaxButton ajaxButton = (AjaxButton) arkCrudContainerVO.getEditButtonContainer().get("delete"); if (ajaxButton != null) { ajaxButton.setEnabled(false); target.add(ajaxButton); } // Call abstract method onNew(target); } @Override public boolean isVisible() { //log.debug("SecurityUtils.getSubject()" + SecurityUtils.getSubject().getPrincipal().toString()); return SecurityUtils.getSubject().hasRole(RoleConstants.ARK_ROLE_SUPER_ADMINISTATOR); } @Override protected void onError(final AjaxRequestTarget target, Form<?> form) { target.add(feedbackPanel); } }); }
From source file:au.org.theark.study.web.component.managestudy.form.SearchForm.java
License:Open Source License
@SuppressWarnings("unchecked") protected void onSearch(AjaxRequestTarget target) { try {/*from ww w . j a v a 2 s . c o m*/ List<Study> studyListForUser = new ArrayList<Study>(0); // Search study Study searchStudyCriteria = containerForm.getModelObject().getStudy(); Subject currentUser = SecurityUtils.getSubject(); ArkUser arkUser = iArkCommonService.getArkUser(currentUser.getPrincipal().toString()); ArkUserVO arkUserVo = new ArkUserVO(); arkUserVo.setArkUserEntity(arkUser); arkUserVo.setStudy(searchStudyCriteria); studyListForUser = iArkCommonService.getStudyListForUser(arkUserVo); if (studyListForUser.size() == 0) { containerForm.getModelObject().setStudyList(studyListForUser); this.info("There are no records that matched your query. Please modify your filter"); target.add(feedbackPanel); } containerForm.getModelObject().setStudyList(studyListForUser); studyCrudContainerVO.getPageableListView().removeAll(); studyCrudContainerVO.getSearchResultPanelContainer().setVisible(true); target.add(studyCrudContainerVO.getSearchResultPanelContainer()); } catch (EntityNotFoundException e) { log.error(e.getMessage()); this.error("There are no records that matched your query. Please modify your filter"); target.add(feedbackPanel); } }
From source file:au.org.theark.study.web.component.managestudy.form.SearchForm.java
License:Open Source License
@SuppressWarnings("unchecked") protected void onNew(AjaxRequestTarget target) { containerForm.setModelObject(new StudyModelVO()); Collection<ArkModule> availableArkModules = new ArrayList<ArkModule>(); availableArkModules = iArkCommonService.getEntityList(ArkModule.class); // Hide Admin and Reporting modules from "Available" view availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_ADMIN)); //availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_REPORTING)); containerForm.getModelObject().setAvailableArkModules(availableArkModules);// ArkModule from database not LDAP. Collection<ArkModule> selectedArkModules = new ArrayList<ArkModule>(); selectedArkModules.add(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_STUDY)); selectedArkModules.add(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_SUBJECT)); containerForm.getModelObject().setSelectedArkModules(selectedArkModules); // Hide Summary details on new studyCrudContainerVO.getSummaryContainer().setVisible(false); target.add(studyCrudContainerVO.getSummaryContainer()); // Show upload item for new Study studyCrudContainerVO.getStudyLogoMarkup().setVisible(true); studyCrudContainerVO.getStudyLogoUploadContainer().setVisible(true); StudyHelper studyHelper = new StudyHelper(); studyHelper.setStudyLogo(containerForm.getModelObject().getStudy(), target, studyCrudContainerVO.getStudyNameMarkup(), studyCrudContainerVO.getStudyLogoMarkup()); target.add(studyCrudContainerVO.getStudyLogoMarkup()); target.add(studyCrudContainerVO.getStudyLogoUploadContainer()); // Clear context items ContextHelper contextHelper = new ContextHelper(); contextHelper.resetContextLabel(target, studyCrudContainerVO.getArkContextMarkup()); studyNameTxtFld.setEnabled(true);/*from ww w . j a v a2 s . com*/ // Default boolean selections containerForm.getModelObject().getStudy().setAutoGenerateSubjectUid(false); containerForm.getModelObject().getStudy().setAutoConsent(false); // TODO: Suggest moving some of this "onNew" code into DetailPanel/DetailForm's onBeforeRender(..) // Disable SubjectUID pattern fields by default for New study WebMarkupContainer wmc = (WebMarkupContainer) studyCrudContainerVO.getDetailPanelContainer(); DetailPanel detailsPanel = (DetailPanel) wmc.get("detailPanel"); DetailForm detailForm = (DetailForm) detailsPanel.get("detailForm"); WebMarkupContainer autoSubjectUidcontainer = detailForm.getAutoSubjectUidContainer(); WebMarkupContainer autoBiocollectionContainer = detailForm.getAutoBiocollectionUidContainer(); WebMarkupContainer autoBiospecimenContainer = detailForm.getAutoBiospecimenUidContainer(); WebMarkupContainer subjectUidcontainer = detailForm.getSubjectUidContainer(); // Example auto-generated SubjectUID to "AAA-0000000001" on new containerForm.getModelObject().setSubjectUidExample(Constants.SUBJECTUID_EXAMPLE); Label subjectUidExampleLbl = detailForm.getSubjectUidExampleLbl(); subjectUidExampleLbl.setDefaultModelObject(containerForm.getModelObject().getSubjectUidExample()); target.add(subjectUidExampleLbl); autoSubjectUidcontainer.setEnabled(true); autoBiocollectionContainer.setEnabled(true); autoBiospecimenContainer.setEnabled(true); subjectUidcontainer.setEnabled(false); target.add(subjectUidcontainer); preProcessDetailPanel(target); }
From source file:au.org.theark.study.web.component.managestudy.SearchResultListPanel.java
License:Open Source License
private AjaxLink<Study> buildLink(final Study study, final WebMarkupContainer searchResultsContainer) { ArkBusyAjaxLink<Study> link = new ArkBusyAjaxLink<Study>("studyName") { private static final long serialVersionUID = 1L; @SuppressWarnings("unchecked") @Override//from w w w . ja va2 s . c o m public void onClick(AjaxRequestTarget target) { Subject currentUser = SecurityUtils.getSubject(); // Place the selected study in session context for the user SecurityUtils.getSubject().getSession().setAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID, study.getId()); SecurityUtils.getSubject().getSession() .removeAttribute(au.org.theark.core.Constants.PERSON_CONTEXT_ID); SecurityUtils.getSubject().getSession().removeAttribute(au.org.theark.core.Constants.PERSON_TYPE); // Clear out any Subject UID placed in session via LIMS SecurityUtils.getSubject().getSession().removeAttribute(au.org.theark.core.Constants.SUBJECTUID); // Force clearing of Cache to re-load roles for the user for the study arkLdapRealm.clearCachedAuthorizationInfo(currentUser.getPrincipals()); aafRealm.clearCachedAuthorizationInfo(currentUser.getPrincipals()); Study searchStudy = iArkCommonService.getStudy(study.getId()); /************** * this is code which must not be commented out...was to be utilized to deal with data from WAGER ... //TODO ASAP Dont leave this nasty hack here iArkCommonService.convertLimsBiospecimenCustomDataValuesToKeysForThisStudy(searchStudy);~~~ //TODO ASAP Dont leave this nasty hack here iArkCommonService.convertLimsBiocollectionCustomDataValuesToKeysForThisStudy(searchStudy);~~~ ************/ Study parentStudy = searchStudy.getParentStudy(); // Check if the study has been linked to a Main Study and if so get a reference to the main study. // studyContainerForm.getModelObject().setLinkedToStudy(linkedToStudy) studyContainerForm.getModelObject().setStudy(searchStudy); studyContainerForm.getModelObject() .setSubjectUidExample(iArkCommonService.getSubjectUidExample(searchStudy)); WebMarkupContainer wmc = (WebMarkupContainer) studyCrudContainerVO.getDetailPanelContainer(); DetailPanel detailsPanel = (DetailPanel) wmc.get("detailPanel"); DetailForm detailForm = (DetailForm) detailsPanel.get("detailForm"); // All SubjectUID generator fields grouped within a container(s) WebMarkupContainer autoSubjectUidcontainer = detailForm.getAutoSubjectUidContainer(); WebMarkupContainer autoBiocollectionUidcontainer = detailForm.getAutoBiocollectionUidContainer(); WebMarkupContainer autoBiospecimenUidcontainer = detailForm.getAutoBiospecimenUidContainer(); WebMarkupContainer subjectUidcontainer = detailForm.getSubjectUidContainer(); // Disable all SubjectUID generation fields if subjects exist or is a child study if (iArkCommonService.studyHasSubjects(searchStudy) || parentStudy != null) { autoSubjectUidcontainer.setEnabled(false); subjectUidcontainer.setEnabled(false); } else { autoSubjectUidcontainer.setEnabled(true); if (studyContainerForm.getModelObject().getStudy().getAutoGenerateSubjectUid()) { subjectUidcontainer.setEnabled(true); } else { subjectUidcontainer.setEnabled(false); } } // Enable bioSpecimenUidContainer if there are no biospecimens created as yet WebMarkupContainer biospecimenUidContainer = detailForm.getBiospecimenUidContainer(); if (iArkCommonService.studyHasBiospecimen(studyContainerForm.getModelObject().getStudy())) { biospecimenUidContainer.setEnabled(false); autoBiospecimenUidcontainer.setEnabled(false); } else { biospecimenUidContainer.setEnabled(parentStudy == null); autoBiospecimenUidcontainer.setEnabled(parentStudy == null); } WebMarkupContainer bioCollectionUidContainer = detailForm.getBioCollectionUidContainer(); if (iArkCommonService.studyHasBioCollection(studyContainerForm.getModelObject().getStudy())) { bioCollectionUidContainer.setEnabled(false); autoBiocollectionUidcontainer.setEnabled(false); } else { bioCollectionUidContainer.setEnabled(parentStudy == null); autoBiocollectionUidcontainer.setEnabled(parentStudy == null); } // Get the Source Modules from database Collection<ArkModule> availableArkModules = iArkCommonService.getEntityList(ArkModule.class); // Hide Admin and Reporting modules from "Available" view availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_ADMIN)); //availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_REPORTING)); // Get the Modules for the Study from database Collection<ArkModule> arkModulesLinkedToStudy = iArkCommonService .getArkModulesLinkedWithStudy(searchStudy); studyContainerForm.getModelObject().setAvailableArkModules(availableArkModules); studyContainerForm.getModelObject().setSelectedArkModules(arkModulesLinkedToStudy); // Store module names linked to study in session for (Iterator iterator = arkModulesLinkedToStudy.iterator(); iterator.hasNext();) { ArkModule arkModule = (ArkModule) iterator.next(); SecurityUtils.getSubject().getSession().setAttribute(arkModule.getName(), arkModule.getName()); } studyCrudContainerVO.getSummaryContainer().setVisible(true); // Set Study Logo studyHelper = new StudyHelper(); studyHelper.setStudyLogo(searchStudy, target, studyCrudContainerVO.getStudyNameMarkup(), studyCrudContainerVO.getStudyLogoMarkup()); // Set Context items ContextHelper contextHelper = new ContextHelper(); contextHelper.resetContextLabel(target, studyCrudContainerVO.getArkContextMarkup()); contextHelper.setStudyContextLabel(target, searchStudy.getName(), studyCrudContainerVO.getArkContextMarkup()); target.add(studyCrudContainerVO.getSummaryContainer()); ArkCRUDHelper.preProcessDetailPanelOnSearchResults(target, studyCrudContainerVO); // Example auto-generated SubjectUID Label subjectUidExampleLbl = detailForm.getSubjectUidExampleLbl(); // Get the Biospecimen UID Pattern if present for the given study BiospecimenUidTemplate biospecimentUidTemplate = null; // Get the BioCollection UID pattern if present BioCollectionUidTemplate bioCollectionUidTemplate = null; if (parentStudy == null || searchStudy == parentStudy) { subjectUidExampleLbl.setDefaultModelObject(iArkCommonService.getSubjectUidExample(searchStudy)); biospecimentUidTemplate = iArkCommonService.getBiospecimenUidTemplate(searchStudy); bioCollectionUidTemplate = iArkCommonService.getBioCollectionUidTemplate(searchStudy); } else { // Disable parent study drop down detailForm.getLinkedToStudyDDContainer().setEnabled(false); subjectUidExampleLbl.setDefaultModelObject(iArkCommonService.getSubjectUidExample(parentStudy)); biospecimentUidTemplate = iArkCommonService.getBiospecimenUidTemplate(parentStudy); bioCollectionUidTemplate = iArkCommonService.getBioCollectionUidTemplate(parentStudy); } if (biospecimentUidTemplate != null) { studyContainerForm.getModelObject().setBiospecimenUidTemplate(biospecimentUidTemplate); } if (bioCollectionUidTemplate != null) { studyContainerForm.getModelObject().setBioCollectionUidTemplate(bioCollectionUidTemplate); } target.add(subjectUidExampleLbl); boolean isChildStudy = (parentStudy != null && parentStudy != searchStudy); detailForm.getSubjectFileUploadContainer().setVisible(isChildStudy); detailForm.getSubjectFileUploadContainer().setEnabled(isChildStudy); long totalSubjects = iArkCommonService.getCountOfSubjects(searchStudy); long totalSubjectsOfParent = iArkCommonService.getCountOfSubjects(searchStudy.getParentStudy()); studyContainerForm.getModelObject().setTotalSubjects(totalSubjects); studyContainerForm.getModelObject().setTotalSubjectsOfParent(totalSubjectsOfParent); // Refresh base container form to remove any feedBack messages target.add(autoSubjectUidcontainer); target.add(subjectUidcontainer); target.add(autoBiocollectionUidcontainer); target.add(bioCollectionUidContainer); target.add(autoBiospecimenUidcontainer); target.add(biospecimenUidContainer); target.add(studyContainerForm); target.add(moduleTabbedPanel); } }; // Add the label for the link Label studyNameLinkLabel = new Label("studyNameLink", study.getName()); link.add(studyNameLinkLabel); return link; }