List of usage examples for com.liferay.portal.kernel.util GetterUtil getBoolean
public static boolean getBoolean(String value, boolean 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 {//from w w w.j a v a 2 s .co 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:com.cd.learning.hook.MBUtil.java
License:Open Source License
public static boolean isAllowAnonymousPosting(PortletPreferences preferences) { return GetterUtil.getBoolean(preferences.getValue("allowAnonymousPosting", null), GetterUtil.getBoolean(PropsUtil.get(PropsKeys.MESSAGE_BOARDS_ANONYMOUS_POSTING_ENABLED))); }
From source file:com.crm.report.util.ReportPreferences.java
License:Open Source License
public static boolean isShowParameterPage(PortletPreferences preferences) { return GetterUtil.getBoolean(preferences.getValue("show-parameter-page", ""), false); }
From source file:com.ext.portlet.epsos.EpsosHelperService.java
public final List<PolicySetGroup> getCurrentOrganizationPatientConsent(EhrPatientClientDto patient, HttpServletRequest request) {// w w w.j av a 2 s . co m List<PolicySetGroup> result = null; SpiritUserClientDto usr = (SpiritUserClientDto) request.getSession() .getAttribute(EPSOS_LOGIN_INFORMATION_ATTRIBUTE); String countryA = patient.getCountry(); String countryB = getHomeOrganizationCountry(usr); if (usr != null && countryA != null && countryB != null) { // call document query webservice, with consent format code to see if such a document exists SpiritEhrWsClientInterface webservice = this.getWebService(request); try { EpsosHelperService.getInstance().createLog("QUERY POLICY SETS:" + patient.getGivenName(), usr); result = webservice.queryPolicySetsForPatient(patient).getGroupList(); EpsosHelperService.getInstance() .createLog("QUERY POLICY SETS: FOUND " + result.size() + " " + patient.getGivenName(), usr); } catch (Exception e1) { if (e1 instanceof EhrException_Exception) { return null; // no consent found } } boolean denyConsent = GetterUtil .getBoolean(GnPropsUtil.get("portalb", "epsos.always.show.consent.denied"), false); if (denyConsent) return null; // for demo purposes, even if a consent is found, return NONE to force new consent creation /** * * XdsQArgsDocument qArgs = new XdsQArgsDocument(); // format codes for consent documents is urn:ihe:iti:bppc-sd:2007 ^^ 1.3.6.1.4.1.19376.1.2.3 IheClassificationClientDto formatCode = new IheClassificationClientDto(); formatCode.setNodeRepresentation("urn:ihe:iti:bppc-sd:2007"); formatCode.setValue("urn:ihe:iti:bppc:2007"); formatCode.getSchema().add("1.3.6.1.4.1.19376.1.2.3"); qArgs.getFormatCodes().add(formatCode); PatientContentClientDto consentQueryResult = null; try { consentQueryResult = webservice.queryDocuments(patient.getPid(), qArgs); } catch (Exception e1) { if (e1 instanceof EhrException_Exception) { return null; // no consent found } } if (consentQueryResult == null || consentQueryResult.getDocuments() == null || consentQueryResult.getDocuments().size() < 1) return null; result = new PatientConsentObject(); //WILL-NOT-BE-DONE populate from web service result result.setConsentid(consentQueryResult.getDocuments().get(0).getUUID()); result.setPatientId(patient.getPid().get(0).getPatientID()); Calendar cal = Calendar.getInstance(); Date now = cal.getTime(); cal.add(Calendar.MONTH, 1); Date nowPlus1Month = cal.getTime(); result.setCreationDate(now); result.setValidFrom(now); result.setValidTo(nowPlus1Month); result.setDoctorName(usr.getDisplayName()); String address = ""; if (usr.getPostalAddress() != null) { for (String a: usr.getPostalAddress()) { address += a + " "; } } result.setDoctorAddress(address); result.setCountry(getHomeOrganizationCountry(usr)); **/ } return result; }
From source file:com.ext.portlet.epsos.EpsosHelperService.java
public void writeDispensationDocument(SpiritEhrWsClientInterface webservice, byte[] bytes, byte[] bytesDispPdf, EhrPatientClientDto patient, String country, SpiritUserClientDto usr, String language, String fullname) throws EhrException_Exception { EpsosHelperService.getInstance().createLog("Starting the preparation of the eD doc ....", usr); SourceSubmissionClientDto subm = null; DocumentClientDto doc = null;/* w w w . j a va2 s . c o m*/ try { String fc_nr = GetterUtil.getString(GnPropsUtil.get("portalb", "ed.code"), "60593-1"); String fc_cs = GetterUtil.getString(GnPropsUtil.get("portalb", "ed.coding.scheme"), "epSOS formatCodes"); fc_cs = "epSOS formatCodes"; String fc_v = GetterUtil.getString(GnPropsUtil.get("portalb", "ed.epsos.coding.scheme"), "urn:epSOS:ep:dis:2010"); //String fc_v1 = "urn:uuid:a09d5840-386c-46f2-b5ad-9c3699a4309d"; subm = new SourceSubmissionClientDto(); SubmissionSetClientDto subSet = new SubmissionSetClientDto(); subm.setSubmissionSet(subSet); doc = new DocumentClientDto(); doc.setMimeType("text/xml"); doc.setBytes(bytes); doc.setDocStatus("urn:oasis:names:tc:ebxml-regrep:StatusType:Approved"); doc.setCreationTime(dateMetaDataFormat.format(new Date())); doc.setLanguageCode(language); String patid = ""; try { patid = patient.getPid().get(0).getPatientID(); } catch (Exception e) { doc.setPatientId("N/A"); _log.error("ERROR GETTING PATIENT ID"); } doc.setPatientId(patid); doc.setSourceRecordTargetId(patid); IheClassificationClientDto healthcareFacilityCode = new IheClassificationClientDto(); healthcareFacilityCode.setNodeRepresentation("Not Used"); healthcareFacilityCode.setValue("Not Used"); healthcareFacilityCode.getSchema().add("epSOS Healthcare Facility Type Codes-Not Used"); doc.setHealthcareFacilityCode(healthcareFacilityCode); IheClassificationClientDto practiceSettingCode = new IheClassificationClientDto(); practiceSettingCode.setNodeRepresentation("Not Used"); practiceSettingCode.setValue("Not Used"); practiceSettingCode.getSchema().add("epSOS Practice Setting Codes-Not Used"); doc.setPracticeSettingCode(practiceSettingCode); IheClassificationClientDto confidentialityCode = new IheClassificationClientDto(); confidentialityCode.setNodeRepresentation("N"); confidentialityCode.setValue("Normal"); confidentialityCode.getSchema().add("2.16.840.1.113883.5.25"); doc.setConfidentialityCode(confidentialityCode); IheClassificationClientDto classCode = new IheClassificationClientDto(); classCode.setNodeRepresentation("60593-1"); classCode.setValue("eDispensation"); classCode.getSchema().add("2.16.840.1.113883.6.1"); doc.setClassCode(classCode); IheClassificationClientDto formatCode = new IheClassificationClientDto(); formatCode.setNodeRepresentation("urn:epSOS:ep:dis:2010"); formatCode.setValue("eDispensation (epSOS pivot coded)"); formatCode.getSchema().add("epSOS formatCodes"); doc.setFormatCode(formatCode); //doc.setUUID("urn:uuid.........");// will be set from WS endpoint if empty //doc.setUniqueId("OID of the CDA document"); IheClassificationClientDto contentTypeCode = new IheClassificationClientDto(); contentTypeCode.setNodeRepresentation("60593-1"); contentTypeCode.setValue("eDispensation"); contentTypeCode.getSchema().add("2.16.840.1.113883.6.1"); subSet.setContentTypeCode(contentTypeCode); IheClassificationClientDto typeCode = new IheClassificationClientDto(); // typeCode.setNodeRepresentation("Dispensation"); // typeCode.setValue("Dispensation"); // typeCode.getSchema().add("Connect-a-thon classCodes"); typeCode.setNodeRepresentation("60593-1"); typeCode.setValue("eDispensation"); typeCode.getSchema().add("2.16.840.1.113883.6.1"); doc.setTypeCode(typeCode); // Embedded pdf if (bytesDispPdf != null) { DocumentClientDto docPdf = new DocumentClientDto(); docPdf.setMimeType("application/pdf"); docPdf.setBytes(bytesDispPdf); docPdf.setDocStatus("urn:oasis:names:tc:ebxml-regrep:StatusType:Approved"); docPdf.setCreationTime(dateMetaDataFormat.format(new Date())); docPdf.setLanguageCode(language); docPdf.setPatientId(patid); docPdf.setSourceRecordTargetId(patid); docPdf.setParentDocumentRelationShip("urn:ihe:iti:2007:AssociationType:XFRM"); docPdf.setParentDocumentId(doc.getUUID()); IheClassificationClientDto healthcareFacilityCode_pdf = new IheClassificationClientDto(); healthcareFacilityCode_pdf.setNodeRepresentation("Not Used"); healthcareFacilityCode_pdf.setValue("Not Used"); healthcareFacilityCode_pdf.getSchema().add(""); docPdf.setHealthcareFacilityCode(healthcareFacilityCode_pdf); IheClassificationClientDto practiceSettingCode_pdf = new IheClassificationClientDto(); practiceSettingCode_pdf.setNodeRepresentation("Not Used"); practiceSettingCode_pdf.setValue("Not Used"); practiceSettingCode_pdf.getSchema().add("1.1.11.1.11.1.1.11"); docPdf.setPracticeSettingCode(practiceSettingCode_pdf); IheClassificationClientDto confidentialityCode_pdf = new IheClassificationClientDto(); confidentialityCode_pdf.setNodeRepresentation("N"); confidentialityCode_pdf.setValue("Normal"); confidentialityCode_pdf.getSchema().add("2.16.840.1.113883.5.25"); docPdf.setConfidentialityCode(confidentialityCode_pdf); IheClassificationClientDto classCode_pdf = new IheClassificationClientDto(); classCode_pdf.setNodeRepresentation("60593-1"); classCode_pdf.setValue("eDispensation"); classCode_pdf.getSchema().add("2.16.840.1.113883.6.1"); docPdf.setClassCode(classCode_pdf); IheClassificationClientDto formatCode_pdf = new IheClassificationClientDto(); formatCode_pdf.setNodeRepresentation("urn:ihe:iti:xds-sd:pdf:2008"); formatCode_pdf.setValue("PDF/A coded document"); formatCode_pdf.getSchema().add("epSOS formatCodes"); docPdf.setFormatCode(formatCode_pdf); doc.getChildDocuments().add(docPdf); } String currentUserDisplayName = ""; if (Validator.isNull(currentUserDisplayName)) try { currentUserDisplayName = usr.getDisplayName(); //currentUserDisplayName =fullname; } catch (Exception e) { currentUserDisplayName = "EPSOS PORTAL"; } doc.getAuthorPerson().add(currentUserDisplayName); doc.getLegalAuthenticator().add(currentUserDisplayName); doc.setDescription("Dispensation Document"); doc.setName("eDispensation Document"); subSet.getAuthorPerson().add(currentUserDisplayName); subSet.setDescription("eDispensation Document"); } catch (Exception e) { e.printStackTrace(); EpsosHelperService.getInstance().createLog("Error creating disp doc", usr); } String patientName = ""; try { patientName = patient.getGivenName(); } catch (Exception e) { _log.warn("Patient given name is null"); } subm.getDocuments().add(doc); EpsosHelperService.getInstance().createLog("UPLOAD DISP DOC REQUEST:" + patientName, usr); boolean submitDispDocument = GetterUtil.getBoolean(GnPropsUtil.get("portalb", "epsos.submit.disp.document"), true); byte[] docbytes = subm.getDocuments().get(0).getBytes(); String edcda = new String(docbytes); if (submitDispDocument) { webservice.submitDocument(subm, patient); _log.info("The eD doc will be submitted"); } else { _log.info("The eD doc will NOT be submitted"); } EpsosHelperService.getInstance().createLog("UPLOAD DISP DOC RESPONSE OK:" + patient.getGivenName(), usr); }
From source file:com.liferay.asset.publisher.internal.util.AssetPublisherHelperImpl.java
License:Open Source License
@Override public AssetEntryQuery getAssetEntryQuery(PortletPreferences portletPreferences, long groupId, Layout layout, long[] overrideAllAssetCategoryIds, String[] overrideAllAssetTagNames) throws PortalException { long[] groupIds = getGroupIds(portletPreferences, groupId, layout); AssetEntryQuery assetEntryQuery = new AssetEntryQuery(); _setCategoriesAndTags(assetEntryQuery, portletPreferences, groupIds, overrideAllAssetCategoryIds, overrideAllAssetTagNames);/*from w w w . ja va 2 s. co m*/ assetEntryQuery.setGroupIds(groupIds); boolean anyAssetType = GetterUtil.getBoolean(portletPreferences.getValue("anyAssetType", null), true); if (!anyAssetType) { long[] availableClassNameIds = AssetRendererFactoryRegistryUtil.getClassNameIds(layout.getCompanyId()); long[] classNameIds = getClassNameIds(portletPreferences, availableClassNameIds); assetEntryQuery.setClassNameIds(classNameIds); } long[] classTypeIds = GetterUtil.getLongValues(portletPreferences.getValues("classTypeIds", null)); assetEntryQuery.setClassTypeIds(classTypeIds); boolean enablePermissions = GetterUtil.getBoolean(portletPreferences.getValue("enablePermissions", null)); assetEntryQuery.setEnablePermissions(enablePermissions); boolean excludeZeroViewCount = GetterUtil .getBoolean(portletPreferences.getValue("excludeZeroViewCount", null)); assetEntryQuery.setExcludeZeroViewCount(excludeZeroViewCount); boolean showOnlyLayoutAssets = GetterUtil .getBoolean(portletPreferences.getValue("showOnlyLayoutAssets", null)); if (showOnlyLayoutAssets) { assetEntryQuery.setLayout(layout); } String orderByColumn1 = GetterUtil.getString(portletPreferences.getValue("orderByColumn1", "modifiedDate")); assetEntryQuery.setOrderByCol1(orderByColumn1); String orderByColumn2 = GetterUtil.getString(portletPreferences.getValue("orderByColumn2", "title")); assetEntryQuery.setOrderByCol2(orderByColumn2); String orderByType1 = GetterUtil.getString(portletPreferences.getValue("orderByType1", "DESC")); assetEntryQuery.setOrderByType1(orderByType1); String orderByType2 = GetterUtil.getString(portletPreferences.getValue("orderByType2", "ASC")); assetEntryQuery.setOrderByType2(orderByType2); return assetEntryQuery; }
From source file:com.liferay.asset.publisher.web.display.context.AssetPublisherDisplayContext.java
License:Open Source License
public Boolean isAnyAssetType() { if (_anyAssetType != null) { return _anyAssetType; }//from ww w. j a va 2s . c om _anyAssetType = GetterUtil.getBoolean(_portletPreferences.getValue("anyAssetType", null), true); return _anyAssetType; }
From source file:com.liferay.asset.publisher.web.display.context.AssetPublisherDisplayContext.java
License:Open Source License
public boolean isEnableRelatedAssets() { if (_enableRelatedAssets != null) { return _enableRelatedAssets; }/*from w w w . ja va 2s. c o m*/ _enableRelatedAssets = GetterUtil.getBoolean(_portletPreferences.getValue("enableRelatedAssets", null), true); return _enableRelatedAssets; }
From source file:com.liferay.asset.publisher.web.display.context.AssetPublisherDisplayContext.java
License:Open Source License
public boolean isEnableViewCountIncrement() { if (_enableViewCountIncrement != null) { return _enableViewCountIncrement; }/*w w w. j a v a2 s . c om*/ _enableViewCountIncrement = GetterUtil.getBoolean( _portletPreferences.getValue("enableViewCountIncrement", null), PropsValues.ASSET_ENTRY_BUFFERED_INCREMENT_ENABLED); return _enableViewCountIncrement; }
From source file:com.liferay.asset.publisher.web.display.context.AssetPublisherDisplayContext.java
License:Open Source License
public boolean isMergeURLTags() { if (_mergeURLTags != null) { return _mergeURLTags; }/*from w w w . ja v a 2 s . c o m*/ _mergeURLTags = GetterUtil.getBoolean(_portletPreferences.getValue("mergeUrlTags", null), true); return _mergeURLTags; }