public static FileEntry addTempFileEntry( long groupId, long userId, String folderName, String fileName, File file, String mimeType) throws PortalException { try (InputStream inputStream = new FileInputStream(file)) { return addTempFileEntry( groupId, userId, folderName, fileName, inputStream, mimeType); } catch (IOException ioe) { throw new PortalException(ioe); } }
@Override public String getURLEditWorkflowTask( long workflowTaskId, ServiceContext serviceContext) throws PortalException { try { PortletURL portletURL = PortalUtil.getControlPanelPortletURL( serviceContext.getRequest(), PortletKeys.MY_WORKFLOW_TASK, PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcPath", "/edit_workflow_task.jsp"); portletURL.setParameter( "workflowTaskId", String.valueOf(workflowTaskId)); portletURL.setWindowState(WindowState.MAXIMIZED); return portletURL.toString(); } catch (WindowStateException wse) { throw new PortalException(wse); } }
protected String getUniqueFileName( ThemeDisplay themeDisplay, String fileName, long folderId) throws PortalException { FileEntry fileEntry = fetchFileEntry( themeDisplay.getUserId(), themeDisplay.getScopeGroupId(), folderId, fileName); if (fileEntry == null) { return fileName; } int suffix = 1; for (int i = 0; i < _UNIQUE_FILE_NAME_TRIES; i++) { String curFileName = FileUtil.appendParentheticalSuffix( fileName, String.valueOf(suffix)); fileEntry = fetchFileEntry( themeDisplay.getUserId(), themeDisplay.getScopeGroupId(), folderId, curFileName); if (fileEntry == null) { return curFileName; } suffix++; } throw new PortalException( "Unable to get a unique file name for " + fileName); }
public ServiceWrapper<DDMTemplatePermissionSupport> getDDMTemplatePermissionSupportServiceWrapper( String resourceClassName) throws PortalException { ServiceWrapper<DDMTemplatePermissionSupport> ddmTemplatePermissionSupportServiceWrapper = _ddmTemplatePermissionSupportServiceTrackerMap.getService( resourceClassName); if (ddmTemplatePermissionSupportServiceWrapper == null) { throw new PortalException( "The model does not support DDMTemplate permission checking " + resourceClassName); } return ddmTemplatePermissionSupportServiceWrapper; }
public ServiceWrapper<DDMStructurePermissionSupport> getDDMStructurePermissionSupportServiceWrapper(String className) throws PortalException { ServiceWrapper<DDMStructurePermissionSupport> ddmStructurePermissionSupportServiceWrapper = _ddmStructurePermissionSupportServiceTrackerMap.getService( className); if (ddmStructurePermissionSupportServiceWrapper == null) { throw new PortalException( "The model does not support DDMStructure permission checking " + className); } return ddmStructurePermissionSupportServiceWrapper; }
protected String[] getDDMFieldsDisplayValues( Map<String, DDMFormField> ddmFormFieldsMap, Field ddmFieldsDisplayField) throws PortalException { try { List<String> fieldsDisplayValues = new ArrayList<>(); String[] values = splitFieldsDisplayValue(ddmFieldsDisplayField); for (String value : values) { String fieldName = StringUtil.extractFirst( value, DDMImpl.INSTANCE_SEPARATOR); if (ddmFormFieldsMap.containsKey(fieldName)) { fieldsDisplayValues.add(fieldName); } } return fieldsDisplayValues.toArray( new String[fieldsDisplayValues.size()]); } catch (Exception e) { throw new PortalException(e); } }
@Override public Fields getDDMFields(DDMStructure ddmStructure, String content) throws PortalException { try { return getDDMFields(ddmStructure, SAXReaderUtil.read(content)); } catch (DocumentException de) { throw new PortalException(de); } }
throw new PortalException(cause);
protected String[] getDDMFieldsDisplayValues(Field ddmFieldsDisplayField) throws PortalException { try { DDMStructure ddmStructure = ddmFieldsDisplayField.getDDMStructure(); List<String> fieldsDisplayValues = new ArrayList<>(); String[] values = splitFieldsDisplayValue(ddmFieldsDisplayField); for (String value : values) { String fieldName = StringUtil.extractFirst( value, DDM.INSTANCE_SEPARATOR); if (ddmStructure.hasField(fieldName)) { fieldsDisplayValues.add(fieldName); } } return fieldsDisplayValues.toArray( new String[fieldsDisplayValues.size()]); } catch (Exception e) { throw new PortalException(e); } }
private static String _getUniqueFileName( long groupId, String fileName, long folderId) throws PortalException { fileName = FileUtil.stripParentheticalSuffix(fileName); FileEntry fileEntry = _fetchPortletFileEntry( groupId, fileName, folderId); if (fileEntry == null) { return fileName; } int suffix = 1; for (int i = 0; i < _UNIQUE_FILE_NAME_TRIES; i++) { String curFileName = FileUtil.appendParentheticalSuffix( fileName, String.valueOf(suffix)); fileEntry = _fetchPortletFileEntry(groupId, curFileName, folderId); if (fileEntry == null) { return curFileName; } suffix++; } throw new PortalException( StringBundler.concat( "Unable to get a unique file name for ", fileName, " in folder ", folderId)); }
private String _getDisplayPageURL( AssetEntry assetEntry, String mainPath, Map<String, Object> requestContext) throws PortalException { AssetDisplayContributor assetDisplayContributor = _assetDisplayContributorTracker.getAssetDisplayContributor( assetEntry.getClassName()); if (assetDisplayContributor == null) { throw new PortalException(); } HttpServletRequest request = (HttpServletRequest)requestContext.get( "request"); request.setAttribute( AssetDisplayWebKeys.ASSET_DISPLAY_CONTRIBUTOR, assetDisplayContributor); request.setAttribute(AssetDisplayWebKeys.ASSET_ENTRY, assetEntry); Locale locale = _portal.getLocale(request); _portal.addPageSubtitle(assetEntry.getTitle(locale), request); _portal.addPageDescription(assetEntry.getDescription(locale), request); Layout layout = _getAssetDisplayPageEntryLayout(assetEntry); return _portal.getLayoutActualURL(layout, mainPath); }
protected SearchResult createSearchResultWithClass(Document document) throws PortalException { long classNameId = GetterUtil.getLong( document.get(Field.CLASS_NAME_ID)); ClassName className = _classNameLocalService.getClassName(classNameId); if (className == null) { throw new PortalException( "Unable to get class name from class name ID " + classNameId); } long classPK = GetterUtil.getLong(document.get(Field.CLASS_PK)); return new SearchResult(className.getClassName(), classPK); }
throw new PortalException(murle);
TYPE_PUBLISH_PORTLET_REMOTE)) { throw new PortalException( "Invalid export import configuration type: " + exportImportConfiguration.getType());
throw new PortalException(cause);
@Override public String render( DDMFormField ddmFormField, DDMFormFieldRenderingContext ddmFormFieldRenderingContext) throws PortalException { try { HttpServletRequest request = ddmFormFieldRenderingContext.getHttpServletRequest(); HttpServletResponse response = ddmFormFieldRenderingContext.getHttpServletResponse(); Fields fields = ddmFormFieldRenderingContext.getFields(); String portletNamespace = ddmFormFieldRenderingContext.getPortletNamespace(); String namespace = ddmFormFieldRenderingContext.getNamespace(); String mode = ddmFormFieldRenderingContext.getMode(); boolean readOnly = ddmFormFieldRenderingContext.isReadOnly(); boolean showEmptyFieldLabel = ddmFormFieldRenderingContext.isShowEmptyFieldLabel(); Locale locale = ddmFormFieldRenderingContext.getLocale(); return getFieldHTML( request, response, ddmFormField, fields, null, portletNamespace, namespace, mode, readOnly, showEmptyFieldLabel, locale); } catch (Exception e) { throw new PortalException(e); } }
@Override public DDMForm deserialize(String serializedDDMForm) throws PortalException { DDMForm ddmForm = new DDMForm(); try { Document document = _saxReader.read(serializedDDMForm); setDDMFormAvailableLocales(document.getRootElement(), ddmForm); setDDMFormDefaultLocale(document.getRootElement(), ddmForm); setDDMFormFields(document.getRootElement(), ddmForm); setDDMFormLocalizedValuesDefaultLocale(ddmForm); } catch (DocumentException de) { throw new PortalException(de); } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn(e, e); } } return ddmForm; }
@Override public DDMForm deserialize(String serializedDDMForm) throws PortalException { try { JSONObject jsonObject = _jsonFactory.createJSONObject( serializedDDMForm); DDMForm ddmForm = new DDMForm(); setDDMFormAvailableLocales( jsonObject.getJSONArray("availableLanguageIds"), ddmForm); setDDMFormDefaultLocale( jsonObject.getString("defaultLanguageId"), ddmForm); setDDMFormFields(jsonObject.getJSONArray("fields"), ddmForm); setDDMFormRules(jsonObject.getJSONArray("rules"), ddmForm); setDDMFormLocalizedValuesDefaultLocale(ddmForm); setDDMFormSuccessPageSettings( jsonObject.getJSONObject("successPage"), ddmForm); return ddmForm; } catch (JSONException jsone) { throw new PortalException(jsone); } }