@Test public void testGetDDMStructure() throws Exception { DDMForm ddmForm = DDMFormTestUtil.createDDMForm("Text1", "Text2", "Text3"); DDMStructure ddmStructure = DDMStructureTestUtil.addStructure( _group.getGroupId(), DDLRecordSet.class.getName(), ddmForm); DDLRecordSet recordSet = _ddlRecordSetTestHelper.addRecordSet(ddmStructure); ddmForm = DDMFormTestUtil.createDDMForm("Text2", "Text3"); DDMTemplate template = DDMTemplateTestUtil.addTemplate( _group.getGroupId(), ddmStructure.getStructureId(), PortalUtil.getClassNameId(DDLRecordSet.class), "json", DDMFormJSONSerializerUtil.serialize(ddmForm), LocaleUtil.US); Set<String> fieldNames = ddmStructure.getFieldNames(); DDMStructure recordSetDDMStructure = recordSet.getDDMStructure(template.getTemplateId()); if (fieldNames.equals(recordSetDDMStructure.getFieldNames())) { Assert.fail(); } recordSetDDMStructure = recordSet.getDDMStructure(); if (!fieldNames.equals(recordSetDDMStructure.getFieldNames())) { Assert.fail(); } }
public String getDDMFormHTML() throws PortalException { DDLRecordSet recordSet = getRecordSet(); if (recordSet == null) { return StringPool.BLANK; } DDMStructure ddmStructure = recordSet.getDDMStructure(); boolean requireCaptcha = isCaptchaRequired(recordSet); DDMForm ddmForm = getDDMForm(ddmStructure, requireCaptcha); DDMFormLayout ddmFormLayout = getDDMFormLayout(ddmStructure, requireCaptcha); DDMFormRenderingContext ddmFormRenderingContext = createDDMFormRenderingContext(ddmForm); boolean showSubmitButton = isShowSubmitButton(); ddmFormRenderingContext.setShowSubmitButton(showSubmitButton); String submitLabel = getSubmitLabel(recordSet); ddmFormRenderingContext.setSubmitLabel(submitLabel); return _ddmFormRenderer.render(ddmForm, ddmFormLayout, ddmFormRenderingContext); }
@AccessControlled(guestAccessEnabled = true) @Override public List<SkinnyDDLRecord> getSkinnyDDLRecords(long ddlRecordSetId) throws Exception { List<SkinnyDDLRecord> skinnyDDLRecords = new ArrayList<>(); PermissionChecker permissionChecker = getPermissionChecker(); DDLRecordSet ddlRecordSet = ddlRecordSetLocalService.getRecordSet(ddlRecordSetId); if (permissionChecker.hasPermission( ddlRecordSet.getGroupId(), DDLRecordSet.class.getName(), ddlRecordSet.getRecordSetId(), ActionKeys.VIEW)) { for (DDLRecord ddlRecord : ddlRecordSet.getRecords()) { SkinnyDDLRecord skinnyDDLRecord = getSkinnyDDLRecord(ddlRecord); skinnyDDLRecords.add(skinnyDDLRecord); } } return skinnyDDLRecords; }
protected boolean isFormPublished() throws PortalException { DDLRecordSet recordSet = getRecordSet(); if (recordSet == null) { return false; } DDLRecordSetSettings recordSetSettings = recordSet.getSettingsModel(); return recordSetSettings.published(); }
public String getRedirectURL() throws PortalException { DDLRecordSet recordSet = getRecordSet(); if (recordSet == null) { return null; } DDLRecordSetSettings recordSetSettings = recordSet.getSettingsModel(); return recordSetSettings.redirectURL(); }
public String getEditFormDDMTemplateTitle() throws PortalException { DDLRecordSet recordSet = getRecordSet(); if (recordSet == null) { return LanguageUtil.get(getLocale(), "add-list"); } DDMDisplay ddmDisplay = getDDMDisplay(); return ddmDisplay.getEditTemplateTitle( recordSet.getDDMStructure(), fetchFormDDMTemplate(), getLocale()); }
public String getEditDisplayDDMTemplateTitle() throws PortalException { DDLRecordSet recordSet = getRecordSet(); if (recordSet == null) { return StringPool.BLANK; } DDMDisplay ddmDisplay = getDDMDisplay(); return ddmDisplay.getEditTemplateTitle( recordSet.getDDMStructure(), fetchDisplayDDMTemplate(), getLocale()); }
public String getAddRecordLabel() throws PortalException { DDLRecordSet recordSet = getRecordSet(); String structureName = StringPool.BLANK; if (recordSet != null) { DDMStructure ddmStructure = recordSet.getDDMStructure(); structureName = ddmStructure.getName(_ddlRequestHelper.getLocale()); } return LanguageUtil.format( _ddlRequestHelper.getRequest(), "add-x", HtmlUtil.escape(structureName), false); }
@Override public List<ClassTypeField> getClassTypeFields() throws PortalException { DDLRecordSet recordSet = DDLRecordSetServiceUtil.getRecordSet(getClassTypeId()); return getClassTypeFields(recordSet.getDDMStructureId()); }
@Override protected void validateImportedStagedModel( StagedModel stagedModel, StagedModel importedStagedModel) throws Exception { super.validateImportedStagedModel(stagedModel, importedStagedModel); DDLRecordSet recordSet = (DDLRecordSet) stagedModel; DDLRecordSet importedRecordSet = (DDLRecordSet) importedStagedModel; Assert.assertEquals(recordSet.getRecordSetKey(), importedRecordSet.getRecordSetKey()); Assert.assertEquals(recordSet.getName(), importedRecordSet.getName()); Assert.assertEquals(recordSet.getDescription(), importedRecordSet.getDescription()); Assert.assertEquals(recordSet.getMinDisplayRows(), importedRecordSet.getMinDisplayRows()); Assert.assertEquals(recordSet.getScope(), importedRecordSet.getScope()); Assert.assertEquals(recordSet.getSettings(), importedRecordSet.getSettings()); }
protected boolean isCaptchaRequired(DDLRecordSet recordSet) throws PortalException { DDLRecordSetSettings recordSetSettings = recordSet.getSettingsModel(); return recordSetSettings.requireCaptcha(); }
protected boolean hasWorkflowEnabled(DDLRecordSet recordSet, ThemeDisplay themeDisplay) { return _workflowDefinitionLinkLocalService.hasWorkflowDefinitionLink( themeDisplay.getCompanyId(), recordSet.getGroupId(), DDLRecordSet.class.getName(), recordSet.getRecordSetId()); }