List of usage examples for org.apache.shiro SecurityUtils getSubject
public static Subject getSubject()
From source file:au.org.theark.registry.web.component.invoice.form.DetailForm.java
License:Open Source License
@Override protected void onSave(Form<Pipeline> containerForm, AjaxRequestTarget target) { // Long personSessionId = (Long) SecurityUtils.getSubject().getSession().getAttribute(au.org.theark.core.Constants.PERSON_CONTEXT_ID); //StringBuffer feedBackMessageStr = new StringBuffer(); Long studyId = (Long) SecurityUtils.getSubject().getSession().getAttribute(Constants.STUDY_CONTEXT_ID); Study study = iArkCommonService.getStudy(studyId); containerForm.getModelObject().setStudy(study); if (containerForm.getModelObject() != null && containerForm.getModelObject().getId() == null) { iArkCommonService.createPipeline(containerForm.getModelObject()); this.saveInformation(); //this.info("Pipeline saved"); } else {/*from w w w . j av a 2 s . c o m*/ iArkCommonService.updatePipeline(containerForm.getModelObject()); this.updateInformation(); //this.info("Pipeline updated"); } target.add(feedBackPanel); }
From source file:au.org.theark.registry.web.component.invoice.form.SearchForm.java
License:Open Source License
public SearchForm(String id, CompoundPropertyModel<Pipeline> model, PageableListView<Pipeline> listView, FeedbackPanel feedBackPanel, ArkCrudContainerVO arkCrudContainerVO) { super(id, model, feedBackPanel, arkCrudContainerVO); this.cpmModel = model; this.listView = listView; initialiseFieldForm();/*from w w w. ja v a2 s .c o m*/ Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); disableSearchForm(sessionStudyId, "There is no study selected. Please select a study."); }
From source file:au.org.theark.registry.web.component.invoice.ProcessResultListPanel.java
License:Open Source License
private AjaxLink buildLink(final Process process) { ArkBusyAjaxLink link = new ArkBusyAjaxLink("processLink") { @Override/* ww w . ja v a 2 s. co m*/ public void onClick(AjaxRequestTarget target) { Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); //subject.getLinkSubjectStudy().setStudy(iArkCommonService.getStudy(sessionStudyId)); //ArkCRUDHelper.preProcessDetailPanelOnSearchResults(target, arkCrudContainerVO); //POPUP FOR DETAILS //target.appendJavaScript("alert('popup for process details');"); arkCrudContainerVO = new ArkCrudContainerVO(); ProcessContainerForm processContainerForm = new ProcessContainerForm("content", new CompoundPropertyModel<Process>(process)); //add(processContainerForm); processDetailPanel = new ProcessDetailPanel("detailContainer", feedBackPanel, arkCrudContainerVO, processContainerForm); processDetailPanel.initialisePanel(); //processContainerForm.add(processDetailPanel); DetailPanel dp = new DetailPanel("content", feedBackPanel, arkCrudContainerVO, containerForm); dp.initialisePanel(); PageableListView<Pipeline> listView = null; SearchPanel sp = new SearchPanel("content", feedBackPanel, listView, containerForm, arkCrudContainerVO); sp.initialisePanel(); //target.appendJavaScript("alert('Process : " + process.getName() + "');"); List<ProcessInput> list = iArkCommonService.getProcessInputsForProcess(process); StringBuilder processInputDetails = new StringBuilder(); for (Iterator iterator = list.iterator(); iterator.hasNext();) { ProcessInput processInput = (ProcessInput) iterator.next(); processInputDetails.append("FileHash: "); processInputDetails.append(processInput.getInputFileHash()); processInputDetails.append("<br>"); processInputDetails.append("Input Location: "); processInputDetails.append(processInput.getinputFileLocation()); processInputDetails.append("<br>"); processInputDetails.append("File type: "); processInputDetails.append(processInput.getInputFileType()); processInputDetails.append("<br>"); processInputDetails.append("Input Kept: "); processInputDetails.append(processInput.getInputKept()); processInputDetails.append("<br>"); processInputDetails.append("Input Server: "); processInputDetails.append(processInput.getInputServer()); } target.appendJavaScript("alert('ProcessInput Details : " + processInputDetails + "');"); List<ProcessOutput> list2 = iArkCommonService.getProcessOutputsForProcess(process); StringBuilder processOutputDetails = new StringBuilder(); for (Iterator iterator = list2.iterator(); iterator.hasNext();) { ProcessOutput processOutput = (ProcessOutput) iterator.next(); processOutputDetails.append("File Location: "); processOutputDetails.append(processOutput.getOutputFileLocation()); processOutputDetails.append("<br>"); processOutputDetails.append("File Hash: "); processOutputDetails.append(processOutput.getOutputFileHash()); processOutputDetails.append("<br>"); processOutputDetails.append("File type: "); processOutputDetails.append(processOutput.getOutputFileType()); processOutputDetails.append("<br>"); processOutputDetails.append("Output Kept: "); processOutputDetails.append(processOutput.getOutputKept()); processOutputDetails.append("<br>"); processOutputDetails.append("Output Server: "); processOutputDetails.append(processOutput.getOutputServer()); } target.appendJavaScript("alert('ProcessOutput Details : " + processOutputDetails + "');"); // Set the modalWindow title and content //modalWindow.setTitle("Edit Process Details"); //modalWindow.setContent(new EmptyPanel("content")); modalWindow.show(target); // arkCrudContainerVO.getDetailPanelContainer().replaceWith(processDetailPanel); ArkCRUDHelper.preProcessDetailPanelOnSearchResults(target, arkCrudContainerVO); } }; Label nameLinkLabel = new Label("process", process.getName()); link.add(nameLinkLabel); return link; }
From source file:au.org.theark.registry.web.component.invoice.SearchResultListPanel.java
License:Open Source License
private AjaxLink buildLink(final Pipeline pipeline) { ArkBusyAjaxLink link = new ArkBusyAjaxLink("pipelineLink") { @Override/*from w w w.j a v a2 s . c om*/ public void onClick(AjaxRequestTarget target) { Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); //subject.getLinkSubjectStudy().setStudy(iArkCommonService.getStudy(sessionStudyId)); containerForm.setModelObject(pipeline); ArkCRUDHelper.preProcessDetailPanelOnSearchResults(target, arkCrudContainerVO); } }; Label nameLinkLabel = new Label("pipeline", pipeline.getName()); link.add(nameLinkLabel); return link; }
From source file:au.org.theark.report.service.ReportServiceImpl.java
License:Open Source License
public List<Study> getStudyList() throws EntityNotFoundException { Study searchStudyCriteria = new Study(); Subject currentUser = SecurityUtils.getSubject(); ArkUser arkUser = arkCommonService.getArkUser(currentUser.getPrincipal().toString()); ArkUserVO arkUserVo = new ArkUserVO(); arkUserVo.setArkUserEntity(arkUser); arkUserVo.setStudy(searchStudyCriteria); return arkCommonService.getStudyListForUser(arkUserVo); }
From source file:au.org.theark.report.web.component.dataextraction.DataExtractionContainerPanel.java
License:Open Source License
protected WebMarkupContainer initialiseSearchResults() { searchResultPanel = new SearchResultListPanel("searchResults", arkCrudContainerVO, containerForm); iModel = new LoadableDetachableModel<Object>() { private static final long serialVersionUID = 1L; @Override// w w w. ja v a 2s . com protected Object load() { Long studySessionId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); if (isActionPermitted() && studySessionId != null) { Study studyInContext = iArkCommonService.getStudy(studySessionId); cpModel.getObject().getSearch().setStudy(studyInContext); //containerForm.getModelObject().setListOfSearchesForResultList(iArkCommonService.getSearchesForThisStudy(studyInContext)); containerForm.getModelObject().setListOfSearchesForResultList( iArkCommonService.getSearchesForSearch(cpModel.getObject().getSearch())); } //pageableListView.removeAll(); return containerForm.getModelObject().getListOfSearchesForResultList(); //.getStudyCompList(); } }; pageableListView = searchResultPanel.buildPageableListView(iModel); pageableListView.setReuseItems(true); AjaxPagingNavigator pageNavigator = new AjaxPagingNavigator("navigator", pageableListView); searchResultPanel.add(pageNavigator); searchResultPanel.add(pageableListView); searchResultPanel.setOutputMarkupId(true); arkCrudContainerVO.getSearchResultPanelContainer().add(searchResultPanel); return arkCrudContainerVO.getSearchResultPanelContainer(); }
From source file:au.org.theark.report.web.component.dataextraction.filter.form.QueryFilterForm.java
License:Open Source License
public QueryFilterForm(String id, IModel<QueryFilterListVO> model, ModalWindow modalWindowFilter, ModalWindow modalWindowEncoded, ArkCrudContainerVO arkCrudContainerVO) { super(id, model); Long studySessionId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); final Study study = iArkCommonService.getStudy(studySessionId); model.getObject().setStudy(study);/*from ww w. j a v a 2 s . c o m*/ List<QueryFilterVO> queryFilterVOs = iArkCommonService.getQueryFilterVOs(model.getObject().getSearch()); model.getObject().setQueryFilterVOs(queryFilterVOs); //model.getObject().setQueryFilterVOs(iArkCommonService.getQueryFilter(search)); this.feedbackPanel = new FeedbackPanel("feedback"); feedbackPanel.setOutputMarkupId(true); setMultiPart(true); this.modalWindowFilter = modalWindowFilter; this.modalWindowEncoded = modalWindowEncoded; this.classModel = model; this.arkCrudContainerVO = arkCrudContainerVO; add(feedbackPanel); }
From source file:au.org.theark.report.web.component.dataextraction.form.DetailForm.java
License:Open Source License
@Override protected void onSave(Form<SearchVO> containerForm, AjaxRequestTarget target) { Long studyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); Study study = iArkCommonService.getStudy(studyId); try {//from w ww. ja v a 2s .c om containerForm.getModelObject().getSearch().setStudy(study); containerForm.getModelObject().getSearch().setStatus("READY TO RUN"); containerForm.getModelObject().getSearch().setFinishTime(null); //Add to fix bug ARK-1581 containerForm.getModelObject().getSearch().setIncludeGeno(false); FileUpload subjectFileUpload = fileUploadField.getFileUpload(); List<SubjectVO> selectedSubjects = iArkCommonService.matchSubjectsFromInputFile(subjectFileUpload, study); if (containerForm.getModelObject().getSearch().getId() == null) { iArkCommonService.create(containerForm.getModelObject()); iArkCommonService.createSearchSubjects(containerForm.getModelObject().getSearch(), selectedSubjects); createSearchFile(); this.saveInformation(); //this.info("Search " + containerForm.getModelObject().getSearch().getName() + " was created successfully"); processErrors(target); } else { iArkCommonService.update(containerForm.getModelObject()); iArkCommonService.createSearchSubjects(containerForm.getModelObject().getSearch(), selectedSubjects); createSearchFile(); this.updateInformation(); //this.info("Search " + containerForm.getModelObject().getSearch().getName() + " was updated successfully"); processErrors(target); } onSavePostProcess(target); } catch (EntityExistsException e) { this.error("A search with the same name already exists for this study."); processErrors(target); } }
From source file:au.org.theark.report.web.component.dataextraction.form.DetailForm.java
License:Open Source License
@SuppressWarnings("unchecked") private void initPhenoDataSetFieldDisplaysModulePalette() { CompoundPropertyModel<SearchVO> searchCPM = (CompoundPropertyModel<SearchVO>) containerForm.getModel(); IChoiceRenderer<String> renderer = new ChoiceRenderer<String>("descriptiveNameIncludingCFGName", "id"); PropertyModel<Collection<PhenoDataSetFieldDisplay>> selectedPhenoDataSetFieldDisplaysPm = new PropertyModel<Collection<PhenoDataSetFieldDisplay>>( searchCPM, "selectedPhenoDataSetFieldDisplays");// "selectedDemographicFields"); Long studyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); Study study = iArkCommonService.getStudy(studyId); // Long arkFunctionId // = (Long)//from w ww . j a v a 2 s . co m // SecurityUtils.getSubject().getSession().getAttribute(au.org.theark.core.Constants.ARK_FUNCTION_KEY); ArkFunction arkFunction = iArkCommonService .getArkFunctionByName(Constants.FUNCTION_KEY_VALUE_DATA_DICTIONARY); Collection<PhenoDataSetFieldDisplay> availablePhenoDataSetFieldDisplays = iPhenoService .getPhenoFieldDisplaysIn(study, arkFunction); //iArkCommonService.getCustomFieldDisplaysIn(study, arkFunction); containerForm.getModelObject().setAvailablePhenoDataSetFieldDisplays(availablePhenoDataSetFieldDisplays); PropertyModel<Collection<PhenoDataSetFieldDisplay>> availablePhenoDataSetFieldDisplaysPm = new PropertyModel<Collection<PhenoDataSetFieldDisplay>>( searchCPM, "availablePhenoDataSetFieldDisplays"); phenoDatasetFieldDisplaysToReturnPalette = new ArkPalette("selectedPhenoDataSetFieldDisplays", selectedPhenoDataSetFieldDisplaysPm, availablePhenoDataSetFieldDisplaysPm, renderer, PALETTE_ROWS, false); phenoDatasetFieldDisplaysToReturnPalette.setOutputMarkupId(true); }
From source file:au.org.theark.report.web.component.dataextraction.form.DetailForm.java
License:Open Source License
@SuppressWarnings("unchecked") private void initSubjectCustomFieldDisplaysModulePalette() { CompoundPropertyModel<SearchVO> searchCPM = (CompoundPropertyModel<SearchVO>) containerForm.getModel(); IChoiceRenderer<String> renderer = new ChoiceRenderer<String>("customField.name", "id"); PropertyModel<Collection<CustomFieldDisplay>> selectedSubjectCustomFieldDisplaysPm = new PropertyModel<Collection<CustomFieldDisplay>>( searchCPM, "selectedSubjectCustomFieldDisplays");// "selectedDemographicFields"); Long studyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); Study study = iArkCommonService.getStudy(studyId); // Long arkFunctionId // = (Long)//from w ww. j av a 2 s. c om // SecurityUtils.getSubject().getSession().getAttribute(au.org.theark.core.Constants.ARK_FUNCTION_KEY); ArkFunction arkFunction = iArkCommonService .getArkFunctionByName(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_SUBJECT_CUSTOM_FIELD); Collection<CustomFieldDisplay> availableSubjectCustomFieldDisplays = iArkCommonService .getCustomFieldDisplaysIn(study, arkFunction); containerForm.getModelObject().setAvailableSubjectCustomFieldDisplays(availableSubjectCustomFieldDisplays); PropertyModel<Collection<CustomFieldDisplay>> availableSubjectCustomFieldDisplayPm = new PropertyModel<Collection<CustomFieldDisplay>>( searchCPM, "availableSubjectCustomFieldDisplays"); subjectCustomFieldDisplaysToReturnPalette = new ArkPalette("selectedSubjectCustomFieldDisplays", selectedSubjectCustomFieldDisplaysPm, availableSubjectCustomFieldDisplayPm, renderer, PALETTE_ROWS, false); subjectCustomFieldDisplaysToReturnPalette.setOutputMarkupId(true); }