List of usage examples for com.liferay.portal.kernel.util GetterUtil getString
public static String getString(String value, String defaultValue)
From source file:au.com.permeance.utility.propertiesviewer.portlets.PropertiesViewerPortlet.java
License:Open Source License
@Override public void serveResource(final ResourceRequest resourceRequest, final ResourceResponse resourceResponse) throws IOException, PortletException { try {/*w w w . j av a 2 s . c o m*/ ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); String portletId = portletDisplay.getId(); PermissionChecker checker = PermissionThreadLocal.getPermissionChecker(); if (checker != null && (checker.isCompanyAdmin() || checker.isOmniadmin() || PortletPermissionUtil.contains(checker, portletId, ActionKeys.VIEW))) { UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(resourceRequest); String exportType = GetterUtil .getString(uploadRequest.getParameter(PropertiesViewerConstants.PARAM_EXPORTTYPE), "all"); String exportSection = GetterUtil.getString( uploadRequest.getParameter(PropertiesViewerConstants.PARAM_EXPORTSECTION), "system"); String term = GetterUtil.getString( uploadRequest.getParameter(PropertiesViewerConstants.PARAM_SEARCH), StringPool.BLANK); boolean passwordSafe = GetterUtil.getBoolean( uploadRequest.getParameter(PropertiesViewerConstants.PARAM_PASSWORDSAFE), false); String filename = PropertiesViewerConstants.SECTION_SYSTEM; Properties toOutput = PropertiesSearchUtil.createSortedProperties(); if (PropertiesViewerConstants.SECTION_SYSTEM.equals(exportSection)) { if (PropertiesViewerConstants.TYPE_ALL.equals(exportType) || term.length() == 0) { toOutput = PropertiesSearchUtil.searchSystemProperties(toOutput, StringPool.BLANK); } else { // search filename += PropertiesViewerConstants.FILE_SEARCH; toOutput = PropertiesSearchUtil.searchSystemProperties(toOutput, term); } if (passwordSafe) { filterPasswordSafe(toOutput); filename += PropertiesViewerConstants.FILE_PASSWORDSAFE; } } else if (PropertiesViewerConstants.SECTION_PORTAL.equals(exportSection)) { // portal filename = PropertiesViewerConstants.SECTION_PORTAL; if (PropertiesViewerConstants.TYPE_ALL.equals(exportType) || term.length() == 0) { toOutput = PropertiesSearchUtil.searchPortalProperties(toOutput, StringPool.BLANK); } else { // search filename += PropertiesViewerConstants.FILE_SEARCH; toOutput = PropertiesSearchUtil.searchPortalProperties(toOutput, term); } if (passwordSafe) { filterPasswordSafe(toOutput); filename += PropertiesViewerConstants.FILE_PASSWORDSAFE; } } else if (PropertiesViewerConstants.SECTION_UPLOAD.equals(exportSection)) { // uploaded filename = PropertiesViewerConstants.FILE_FORMATTED; File uploaded = uploadRequest.getFile(PropertiesViewerConstants.PARAM_FILE); if (uploaded != null) { FileInputStream fis = new FileInputStream(uploaded); try { toOutput.load(fis); } finally { try { if (fis != null) { fis.close(); } } catch (Exception e) { } } } } else { throw new PortletException(PropertiesViewerConstants.EXCEPTION_INVALID_OPERATION); } resourceResponse.setContentType(PropertiesViewerConstants.PROPERTIES_MIME_TYPE); resourceResponse.addProperty(HttpHeaders.CACHE_CONTROL, PropertiesViewerConstants.CACHE_HEADER_VALUE); resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + filename + ".properties"); toOutput.store(resourceResponse.getPortletOutputStream(), StringPool.BLANK); } } catch (IOException e) { throw e; } catch (PortletException e) { throw e; } catch (Exception e) { throw new PortletException(e); } }
From source file:br.com.petrobras.ddm.type.region.internal.RegionDDMFormFieldRenderer.java
License:Open Source License
protected DDMFormFieldOptions getDDMFormFieldOptions(DDMFormField ddmFormField) { String dataSourceType = GetterUtil.getString(ddmFormField.getProperty("dataSourceType"), "manual"); if (Objects.equals(dataSourceType, "manual")) { return ddmFormField.getDDMFormFieldOptions(); }//from w w w . jav a 2 s . c om return new DDMFormFieldOptions(); }
From source file:br.com.petrobras.ddm.type.region.internal.RegionDDMFormFieldValueRenderer.java
License:Open Source License
protected boolean isManualDataSourceType(DDMFormField ddmFormField) { String dataSourceType = GetterUtil.getString(ddmFormField.getProperty("dataSourceType"), "manual"); if (Objects.equals(dataSourceType, "manual")) { return true; }/* w w w . j av a 2 s. c om*/ return false; }
From source file:com.ext.portlet.epsos.EpsosHelperService.java
private EpsosHelperService() { epsosWebServiceURL = GetterUtil.getString(GnPropsUtil.get("portalb", "epsos.webservice.url"), ""); defaultUserName = GetterUtil.getString(GnPropsUtil.get("portalb", "epsos.webservice.username"), ""); defaultPassword = GetterUtil.getString(GnPropsUtil.get("portalb", "epsos.webservice.password"), ""); mainPatientIdType = GetterUtil.getString(GnPropsUtil.get("portalb", "epsos.patient.identifier.main.type"), "PI"); }
From source file:com.ext.portlet.epsos.EpsosHelperService.java
public EhrPatientClientDto createPatFilter(PatientSearchForm searchForm) { EhrPatientClientDto patFilter = new EhrPatientClientDto(); if (Validator.isNotNull(searchForm.getSurName())) patFilter.setFamilyName(searchForm.getSurName()); if (Validator.isNotNull(searchForm.getGivenName())) patFilter.setGivenName(searchForm.getGivenName()); if (Validator.isNotNull(searchForm.getBirthDate())) { try {//from www.j a va 2 s . c o m Date date = EpsosHelperService.dateFormat.parse(searchForm.getBirthDate()); GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); cal.setTime(date); XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); patFilter.setBirthdate(xmlCal); } catch (Exception e) { } } if (Validator.isNotNull(searchForm.getSex())) patFilter.setSex(searchForm.getSex()); if (Validator.isNotNull(searchForm.getStreet())) patFilter.setStreetAddress(searchForm.getStreet()); if (Validator.isNotNull(searchForm.getZipCode())) patFilter.setZip(searchForm.getZipCode()); if (Validator.isNotNull(searchForm.getCity())) patFilter.setCity(searchForm.getCity()); if (Validator.isNotNull(searchForm.getCountry())) patFilter.setCountry(searchForm.getCountry()); // Identifier criteria if (Validator.isNotNull(searchForm.country)) { String DEFAULT_PATIENT_IDS = GetterUtil.getString( GnPropsUtil.get("portalb", "epsos.search.patient.ids.default"), "ssnNumber,driversLicense,accountNumber"); //String[] countryPatientIds = GetterUtil.getString(GnPropsUtil.get("portalb", "epsos.search.patient.ids."+searchForm.country), DEFAULT_PATIENT_IDS).split(","); EpsosHelperImpl eh = new EpsosHelperImpl(); Vector countryPatientIds = EpsosHelperService.getInstance() .getCountryIdsFromCS(searchForm.getCountry()); // Vector<StrutsFormFields> fields = eh.getFieldsForCountryFromNCP(searchForm.getCountry()); // String mainPIDType = GetterUtil.getString(GnPropsUtil.get("portalb", "epsos.patient.identifier.main.type"), "PI"); // // if (Validator.isNotNull(searchForm.getPid())) { // EhrPIDClientDto pidDto = new EhrPIDClientDto(); // pidDto.setPatientID(searchForm.getPid()); // pidDto.setPatientIDType(mainPIDType); // // String RRI_OID = GetterUtil.getString(GnPropsUtil.get("portalb", "RRI." + searchForm.getCountry()), ""); // EhrDomainClientDto domain = new EhrDomainClientDto(); // domain.setAuthUniversalID(RRI_OID); // pidDto.setDomain(domain); // // patFilter.getPid().add(pidDto); // } String idType = ""; if (countryPatientIds != null && countryPatientIds.size() > 0) { int i = 1; for (int j = 0; j < countryPatientIds.size(); j++) //for (String idType: countryPatientIds) { SearchMask sm = (SearchMask) countryPatientIds.get(j); idType = sm.getDomain(); if (idType != null && !idType.equals("none") && Validator.isNotNull(searchForm.getPid(i))) { EhrPIDClientDto pidDto = new EhrPIDClientDto(); pidDto.setPatientID(searchForm.getPid(i)); //pidDto.setPatientIDType(idType); EhrDomainClientDto domain = new EhrDomainClientDto(); domain.setAuthUniversalID(idType); pidDto.setDomain(domain); patFilter.getPid().add(pidDto); } i++; } } } if (Validator.isNotNull(searchForm.getSsnNumber())) patFilter.setSsnNumber(searchForm.getSsnNumber()); if (Validator.isNotNull(searchForm.getDriversLicense())) patFilter.setDrivingLicense(searchForm.getDriversLicense()); if (Validator.isNotNull(searchForm.getAccountNumber())) patFilter.setAccountNumber(searchForm.getAccountNumber()); return patFilter; }
From source file:com.ext.portlet.epsos.EpsosHelperService.java
public EhrPatientClientDto getPatientFromID(SpiritEhrWsClientInterface webservice, String patID, String patIDType, String country, String patids) throws EhrException_Exception { EhrPatientClientDto patFilter = null; try {//from w w w . ja v a2 s . co m patFilter = new EhrPatientClientDto(); EhrPIDClientDto pidDto = new EhrPIDClientDto(); if (Validator.isNull(patids)) { pidDto.setPatientID(patID); pidDto.setPatientIDType(patIDType); patFilter.setCountry(country); String RRI_OID = GetterUtil.getString(GnPropsUtil.get("portalb", "RRI." + country), ""); EhrDomainClientDto domain = new EhrDomainClientDto(); domain.setAuthUniversalID(RRI_OID); pidDto.setDomain(domain); patFilter.getPid().add(pidDto); } else { String[] pats = patids.split(EPSOS_PATID_DEL2); for (int j = 0; j < pats.length; j++) { String[] patIdentifiers = pats[j].split(EPSOS_PATID_DEL1); for (int i = 0; i < patIdentifiers.length; i++) { pidDto.setPatientID(patIdentifiers[0]); pidDto.setPatientIDType(patIdentifiers[1]); pidDto.setEhrPIDType(Integer.parseInt(patIdentifiers[5])); patFilter.setCountry(country); // String RRI_OID = GetterUtil.getString(GnPropsUtil.get("portalb", "RRI." + country), ""); EhrDomainClientDto domain = new EhrDomainClientDto(); domain.setAuthUniversalID(patIdentifiers[2]); domain.setAuthUniversalIDType(patIdentifiers[3]); domain.setAuthNamespaceID(patIdentifiers[4]); pidDto.setDomain(domain); patFilter.getPid().add(pidDto); } } } } catch (Exception e) { return null; } List<EhrPatientClientDto> result = null; try { result = webservice.queryPatients(patFilter); } catch (Exception e) { _log.error("Error quering specific patient"); } if (result != null && result.size() > 0) { return result.get(0); } else { return null; } }
From source file:com.ext.portlet.epsos.EpsosHelperService.java
public XdsQArgsDocument getArgsForDP() { XdsQArgsDocument qArgs = new XdsQArgsDocument(); String fc_cs = GetterUtil.getString(GnPropsUtil.get("portalb", "ed.coding.scheme"), "2.16.840.1.113883.6.1"); String fc_nr = GetterUtil.getString(GnPropsUtil.get("portalb", "ed.code"), "60593-1"); String fc_v = GetterUtil.getString(GnPropsUtil.get("portalb", "ed.epsos.coding.scheme"), "urn:epsos:ep:dis:2010"); qArgs.getDocumentStatus().add("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Approved"); IheClassificationClientDto classC = new IheClassificationClientDto(); classC.setNodeRepresentation(fc_nr); classC.setValue(fc_v);//from ww w. ja v a 2s .c om classC.getSchema().add(fc_cs); qArgs.getClassCodes().add(classC); return qArgs; }
From source file:com.ext.portlet.epsos.EpsosHelperService.java
public XdsQArgsDocument getArgsForC() { XdsQArgsDocument qArgs = new XdsQArgsDocument(); String fc_cs = GetterUtil.getString(GnPropsUtil.get("portalb", "pc.coding.scheme"), "2.16.840.1.113883.6.1"); String fc_nr = GetterUtil.getString(GnPropsUtil.get("portalb", "pc.code"), "57016-8"); String fc_v = GetterUtil.getString(GnPropsUtil.get("portalb", "pc.epsos.coding.scheme"), "urn:ihe:iti:bppc:2007"); qArgs.getDocumentStatus().add("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Approved"); IheClassificationClientDto classC = new IheClassificationClientDto(); classC.setNodeRepresentation(fc_nr); classC.setValue(fc_v);/*from w w w. j a va 2 s.c o m*/ classC.getSchema().add(fc_cs); qArgs.getClassCodes().add(classC); return qArgs; }
From source file:com.ext.portlet.epsos.EpsosHelperService.java
public XdsQArgsDocument getArgsForEP() { XdsQArgsDocument qArgs = new XdsQArgsDocument(); String fc_cs = GetterUtil.getString(GnPropsUtil.get("portalb", "ep.coding.scheme"), "2.16.840.1.113883.6.1"); String fc_nr = GetterUtil.getString(GnPropsUtil.get("portalb", "ep.code"), "57833-6"); String fc_v = GetterUtil.getString(GnPropsUtil.get("portalb", "ep.epsos.coding.scheme"), "urn:epSOS:ep:pre:2010"); qArgs.getDocumentStatus().add("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Approved"); IheClassificationClientDto classC = new IheClassificationClientDto(); classC.setNodeRepresentation(fc_nr); classC.setValue(fc_v);//from w ww . ja v a 2 s . co m classC.getSchema().add(fc_cs); qArgs.getClassCodes().add(classC); return qArgs; }
From source file:com.ext.portlet.epsos.EpsosHelperService.java
public XdsQArgsDocument getArgsForPS() { XdsQArgsDocument qArgs = new XdsQArgsDocument(); String fc_cs = GetterUtil.getString(GnPropsUtil.get("portalb", "ps.coding.scheme"), "2.16.840.1.113883.6.1"); String fc_nr = GetterUtil.getString(GnPropsUtil.get("portalb", "ps.code"), "60591-5"); String fc_v = GetterUtil.getString(GnPropsUtil.get("portalb", "ps.epsos.coding.scheme"), "urn:epSOS:ps:ps:2010"); qArgs.getDocumentStatus().add("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Approved"); IheClassificationClientDto classC = new IheClassificationClientDto(); classC.setNodeRepresentation(fc_nr); classC.setValue(fc_v);/*from w ww. ja v a2 s. co m*/ classC.getSchema().add(fc_cs); qArgs.getClassCodes().add(classC); return qArgs; }