List of usage examples for org.apache.shiro SecurityUtils getSubject
public static Subject getSubject()
From source file:au.org.theark.disease.web.component.disease.form.DetailForm.java
License:Open Source License
protected void onCancel(AjaxRequestTarget target) { Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); Study study = iArkCommonService.getStudy(sessionStudyId); DiseaseVO diseaseVO = new DiseaseVO(); diseaseVO.getDisease().setStudy(study); containerForm.setModelObject(diseaseVO); }
From source file:au.org.theark.disease.web.component.disease.form.DetailForm.java
License:Open Source License
@Override protected void onSave(Form<DiseaseVO> containerForm, AjaxRequestTarget target) { Long studyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); if (studyId == null) { // No study in context this.error("There is no study selected. Please select a study to manage diseases."); processErrors(target);/*from w ww. j a v a 2 s .com*/ } else { Disease disease = containerForm.getModelObject().getDisease(); disease.setStudy(iArkCommonService.getStudy(studyId)); disease.setGenes(new HashSet<Gene>(containerForm.getModelObject().getSelectedGenes())); disease.setCustomFields( new HashSet<CustomField>(containerForm.getModelObject().getSelectedCustomFields())); if (isNew()) { iArkDiseaseService.save(disease); } else { iArkDiseaseService.update(disease); } //Populating containerForm's Model Object for next render. List<Gene> availableGenes = iArkDiseaseService.getAvailableGenesForStudy(disease.getStudy()); List<Gene> selectedGenes = new ArrayList<Gene>(disease.getGenes()); CustomField criteria = new CustomField(); criteria.setStudy(disease.getStudy()); criteria.setArkFunction(iArkCommonService .getArkFunctionByName(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_DISEASE_CUSTOM_FIELDS)); List<CustomField> selectedCustomFields = new ArrayList<CustomField>(disease.getCustomFields()); List<CustomField> availableCustomFields = iArkCommonService.getCustomFieldList(criteria); containerForm.getModelObject().setAvailableGenes(availableGenes); containerForm.getModelObject().setSelectedGenes(selectedGenes); containerForm.getModelObject().setAvailableCustomFields(availableCustomFields); containerForm.getModelObject().setSelectedCustomFields(selectedCustomFields); target.add(arkCrudContainerVO.getDetailPanelContainer()); } }
From source file:au.org.theark.disease.web.component.disease.SearchResultListPanel.java
License:Open Source License
private AjaxLink buildLink(final DiseaseVO disease) { ArkBusyAjaxLink link = new ArkBusyAjaxLink("disease.name.link") { @Override/*w w w . j a va 2 s. c om*/ public void onClick(AjaxRequestTarget target) { Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); Study study = iArkCommonService.getStudy(sessionStudyId); List<Gene> availableGenes = iArkDiseaseService.getAvailableGenesForStudy(study); List<Gene> selectedGenes = new ArrayList<Gene>(disease.getDisease().getGenes()); CustomField criteria = new CustomField(); criteria.setStudy(study); criteria.setArkFunction(iArkCommonService.getArkFunctionByName( au.org.theark.core.Constants.FUNCTION_KEY_VALUE_DISEASE_CUSTOM_FIELDS)); List<CustomField> selectedCustomFields = new ArrayList<CustomField>( disease.getDisease().getCustomFields()); List<CustomField> availableCustomFields = iArkCommonService.getCustomFieldList(criteria); ArkCRUDHelper.preProcessDetailPanelOnSearchResults(target, arkCrudContainerVO); containerForm.setModelObject(disease); containerForm.getModelObject().setAvailableGenes(availableGenes); containerForm.getModelObject().setSelectedGenes(selectedGenes); containerForm.getModelObject().setAvailableCustomFields(availableCustomFields); containerForm.getModelObject().setSelectedCustomFields(selectedCustomFields); } }; Label nameLinkLabel = new Label("disease.name", disease.getDisease().getName()); link.add(nameLinkLabel); return link; }
From source file:au.org.theark.disease.web.component.gene.SearchResultListPanel.java
License:Open Source License
private AjaxLink buildLink(final GeneVO geneVO) { ArkBusyAjaxLink link = new ArkBusyAjaxLink("disease.name") { @Override//from ww w . ja v a 2s. co m public void onClick(AjaxRequestTarget target) { Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); List<Disease> availableDiseases = iArkDiseaseService .getAvailableDiseasesForStudy(iArkCommonService.getStudy(sessionStudyId)); List<Disease> selectedDiseases = new ArrayList<Disease>(geneVO.getGene().getDiseases()); ArkCRUDHelper.preProcessDetailPanelOnSearchResults(target, arkCrudContainerVO); containerForm.setModelObject(geneVO); containerForm.getModelObject().setAvailableDiseases(availableDiseases); containerForm.getModelObject().setSelectedDiseases(selectedDiseases); } }; Label nameLinkLabel = new Label("gene.name", geneVO.getGene().getName()); link.add(nameLinkLabel); return link; }
From source file:au.org.theark.geno.web.component.table.GenoTableContainerPanel.java
License:Open Source License
@SuppressWarnings("unchecked") protected void prerenderContextCheck() { sessionPersonId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.PERSON_CONTEXT_ID); sessionStudyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); if ((sessionStudyId != null) && (sessionPersonId != null)) { String sessionPersonType = (String) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.PERSON_TYPE); if (sessionPersonType.equals(au.org.theark.core.Constants.PERSON_CONTEXT_TYPE_SUBJECT)) { Person person;//w w w .j ava 2 s . com boolean contextLoaded = false; try { person = studyService.getPerson(sessionPersonId); Study study = iArkCommonService.getStudy(sessionStudyId); contextLoaded = true; } catch (EntityNotFoundException e) { log.error(e.getMessage()); } catch (ArkSystemException e) { log.error(e.getMessage()); } if (contextLoaded) { arkCrudContainerVO.getDetailPanelContainer().setVisible(true); } } } }
From source file:au.org.theark.geno.web.component.tableeditor.TableEditorContainerPanel.java
License:Open Source License
@SuppressWarnings("unchecked") protected void prerenderContextCheck() { // Get the Person in Context and determine the Person Type sessionStudyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); log.info("sessionStudyID: " + sessionStudyId); if (sessionStudyId != null) { Study study = iArkCommonService.getStudy(sessionStudyId); arkCrudContainerVO.getDetailPanelContainer().setVisible(true); }//from ww w. jav a 2 s.c o m }
From source file:au.org.theark.lims.util.BioCustomFieldUploadValidator.java
License:Open Source License
public BioCustomFieldUploadValidator() { super();/*from ww w .j a v a2 s. com*/ Subject currentUser = SecurityUtils.getSubject(); studyId = (Long) currentUser.getSession().getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); this.study = iArkCommonService.getStudy(studyId); this.existantSubjectUIDRows = new HashSet<Integer>(); this.nonExistantUIDs = new HashSet<Integer>(); this.errorCells = new HashSet<ArkGridCell>(); simpleDateFormat.setLenient(false); }
From source file:au.org.theark.lims.util.BioCustomFieldUploadValidator.java
License:Open Source License
@SuppressWarnings("unchecked") public BioCustomFieldUploadValidator(IArkCommonService iArkCommonService, ILimsService iLimsService) { super();/*from w w w .ja va 2s . com*/ this.iArkCommonService = iArkCommonService; this.iLimsService = iLimsService; Subject currentUser = SecurityUtils.getSubject(); studyId = (Long) currentUser.getSession().getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); this.study = iArkCommonService.getStudy(studyId); this.existantSubjectUIDRows = new HashSet<Integer>(); this.nonExistantUIDs = new HashSet<Integer>(); this.errorCells = new HashSet<ArkGridCell>(); simpleDateFormat.setLenient(false); }
From source file:au.org.theark.lims.util.BiospecimenUploadReport.java
License:Open Source License
public void appendDetails(Upload studyUpload) { append("Study: "); appendAndNewLine(studyUpload.getStudy().getName()); append("User ID: "); appendAndNewLine(SecurityUtils.getSubject().getPrincipal().toString()); append("Filename: "); appendAndNewLine(studyUpload.getFilename()); append("File Format: "); appendAndNewLine(studyUpload.getFileFormat().getName()); append("Delimiter Type "); appendAndNewLine(studyUpload.getDelimiterType().getName()); }
From source file:au.org.theark.lims.util.SubjectUploadReport.java
License:Open Source License
public void appendDetails(Upload studyUpload, String studyName) { append("Study: "); appendAndNewLine(studyName);/*from www. j av a 2 s . com*/ append("UserID: "); appendAndNewLine(SecurityUtils.getSubject().getPrincipal().toString()); append("Filename: "); appendAndNewLine(studyUpload.getFilename()); append("File Format: "); appendAndNewLine(studyUpload.getFileFormat().getName()); append("Delimiter Type "); appendAndNewLine(studyUpload.getDelimiterType().getName()); }