protected void doExportStagedModel( PortletDataContext portletDataContext, CalendarResource calendarResource) throws Exception { Element calendarResourceElement = portletDataContext.getExportDataElement(calendarResource); for (Calendar calendar : calendarResource.getCalendars()) { StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, calendarResource, calendar, PortletDataContext.REFERENCE_TYPE_STRONG); } if (calendarResource.getClassNameId() == PortalUtil.getClassNameId(User.class)) { User user = UserLocalServiceUtil.getUser(calendarResource.getClassPK()); portletDataContext.addReferenceElement( calendarResource, calendarResourceElement, user, User.class, PortletDataContext.REFERENCE_TYPE_DEPENDENCY_DISPOSABLE, true); } portletDataContext.addClassedModel( calendarResourceElement, ExportImportPathUtil.getModelPath(calendarResource), calendarResource); }
@Override protected void doExportStagedModel(PortletDataContext portletDataContext, DDLRecordSet recordSet) throws Exception { DDMStructure ddmStructure = recordSet.getDDMStructure(); StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, ddmStructure); List<DDMTemplate> ddmTemplates = ddmStructure.getTemplates(); Element recordSetElement = portletDataContext.getExportDataElement(recordSet); for (DDMTemplate ddmTemplate : ddmTemplates) { StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, ddmTemplate); portletDataContext.addReferenceElement( recordSet, recordSetElement, ddmTemplate, PortletDataContext.REFERENCE_TYPE_STRONG, false); } portletDataContext.addClassedModel( recordSetElement, ExportImportPathUtil.getModelPath(recordSet), recordSet, DDLPortletDataHandler.NAMESPACE); }
@Override protected PortletPreferences doImportData( PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences, String data) throws Exception { if (portletDataContext.getBooleanParameter(NAMESPACE, "categories")) { Element categoriesElement = portletDataContext.getImportDataGroupElement(AssetCategory.class); List<Element> categoryElements = categoriesElement.elements(); for (Element categoryElement : categoryElements) { StagedModelDataHandlerUtil.importStagedModel(portletDataContext, categoryElement); } } if (portletDataContext.getBooleanParameter(NAMESPACE, "vocabularies")) { Element vocabulariesElement = portletDataContext.getImportDataGroupElement(AssetVocabulary.class); List<Element> vocabularyElements = vocabulariesElement.elements(); for (Element vocabularyElement : vocabularyElements) { StagedModelDataHandlerUtil.importStagedModel(portletDataContext, vocabularyElement); } } return null; }
@Override protected PortletPreferences doProcessImportPortletPreferences( PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) throws Exception { portletDataContext.importPortletPermissions(WikiPermission.RESOURCE_NAME); StagedModelDataHandlerUtil.importReferenceStagedModels(portletDataContext, WikiNode.class); StagedModelDataHandlerUtil.importReferenceStagedModels(portletDataContext, WikiPage.class); long nodeId = GetterUtil.getLong(portletPreferences.getValue("nodeId", StringPool.BLANK)); if (nodeId > 0) { Map<Long, Long> nodeIds = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(WikiNode.class); nodeId = MapUtil.getLong(nodeIds, nodeId, nodeId); portletPreferences.setValue("nodeId", String.valueOf(nodeId)); } return portletPreferences; }
@Test public void testTypeArticle() throws Exception { initExport(); Map<String, List<StagedModel>> dependentStagedModelsMap = new HashMap<>(); JournalArticle journalArticle = JournalTestUtil.addArticle( stagingGroup.getGroupId(), JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID, RandomTestUtil.randomString(), RandomTestUtil.randomString()); addDependentStagedModel(dependentStagedModelsMap, JournalArticle.class, journalArticle); Layout layout = LayoutTestUtil.addTypeArticleLayout( stagingGroup.getGroupId(), journalArticle.getArticleId()); addDependentLayoutFriendlyURLs(dependentStagedModelsMap, layout); StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, layout); validateExport(portletDataContext, layout, dependentStagedModelsMap); initImport(); Layout exportedLayout = (Layout) readExportedStagedModel(layout); StagedModelDataHandlerUtil.importStagedModel(portletDataContext, exportedLayout); }
@Override protected PortletPreferences doImportData( PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences, String data) throws Exception { portletDataContext.importPermissions( "com.liferay.portlet.dynamicdatamapping", portletDataContext.getSourceGroupId(), portletDataContext.getScopeGroupId()); Element structuresElement = portletDataContext.getImportDataGroupElement(DDMStructure.class); List<Element> structureElements = structuresElement.elements(); for (Element structureElement : structureElements) { StagedModelDataHandlerUtil.importStagedModel(portletDataContext, structureElement); } if (portletDataContext.getBooleanParameter(NAMESPACE, "templates")) { Element templatesElement = portletDataContext.getImportDataGroupElement(DDMTemplate.class); List<Element> templateElements = templatesElement.elements(); for (Element templateElement : templateElements) { StagedModelDataHandlerUtil.importStagedModel(portletDataContext, templateElement); } } return portletPreferences; }
@Test public void testTypeLinkToLayout() throws Exception { initExport(); Map<String, List<StagedModel>> dependentStagedModelsMap = new HashMap<>(); Layout linkedLayout = LayoutTestUtil.addLayout(stagingGroup); List<LayoutFriendlyURL> linkedLayoutFriendlyURLs = LayoutFriendlyURLLocalServiceUtil.getLayoutFriendlyURLs(linkedLayout.getPlid()); addDependentStagedModel(dependentStagedModelsMap, Layout.class, linkedLayout); addDependentLayoutFriendlyURLs(dependentStagedModelsMap, linkedLayout); Layout layout = LayoutTestUtil.addTypeLinkToLayoutLayout( stagingGroup.getGroupId(), linkedLayout.getLayoutId()); List<LayoutFriendlyURL> layoutFriendlyURLs = LayoutFriendlyURLLocalServiceUtil.getLayoutFriendlyURLs(layout.getPlid()); addDependentLayoutFriendlyURLs(dependentStagedModelsMap, layout); StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, layout); validateExport(portletDataContext, layout, dependentStagedModelsMap); initImport(); Layout exportedLayout = (Layout) readExportedStagedModel(layout); StagedModelDataHandlerUtil.importStagedModel(portletDataContext, exportedLayout); LayoutLocalServiceUtil.getLayoutByUuidAndGroupId( linkedLayout.getUuid(), liveGroup.getGroupId(), false); LayoutFriendlyURL linkedLayoutFriendlyURL = linkedLayoutFriendlyURLs.get(0); LayoutFriendlyURLLocalServiceUtil.getLayoutFriendlyURLByUuidAndGroupId( linkedLayoutFriendlyURL.getUuid(), liveGroup.getGroupId()); LayoutLocalServiceUtil.getLayoutByUuidAndGroupId( layout.getUuid(), liveGroup.getGroupId(), false); LayoutFriendlyURL layoutFriendlyURL = layoutFriendlyURLs.get(0); LayoutFriendlyURLLocalServiceUtil.getLayoutFriendlyURLByUuidAndGroupId( layoutFriendlyURL.getUuid(), liveGroup.getGroupId()); }
@Override protected void doExportStagedModel(PortletDataContext portletDataContext, DDLRecord record) throws Exception { StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, record, record.getRecordSet(), PortletDataContext.REFERENCE_TYPE_STRONG); DDLRecordVersion recordVersion = record.getRecordVersion(); Fields fields = StorageEngineUtil.getFields(recordVersion.getDDMStorageId()); String fieldsPath = ExportImportPathUtil.getModelPath(record, "fields.xml"); portletDataContext.addZipEntry(fieldsPath, fields); Element recordElement = portletDataContext.getExportDataElement(record); recordElement.addAttribute("fields-path", fieldsPath); portletDataContext.addClassedModel( recordElement, ExportImportPathUtil.getModelPath(record), record); }
@Override @SuppressWarnings("unused") protected void performAction(Object object) throws PortalException, SystemException { AssetVocabulary stagedModel = (AssetVocabulary) object; StagedModelDataHandlerUtil.exportStagedModel(_portletDataContext, stagedModel); }
protected void importLayouts( PortletDataContext portletDataContext, LayoutPrototype layoutPrototype, long importedGroupId) throws PortalException { long groupId = portletDataContext.getGroupId(); boolean privateLayout = portletDataContext.isPrivateLayout(); long scopeGroupId = portletDataContext.getScopeGroupId(); try { portletDataContext.setGroupId(importedGroupId); portletDataContext.setPrivateLayout(true); portletDataContext.setScopeGroupId(importedGroupId); List<Element> layoutElements = portletDataContext.getReferenceDataElements(layoutPrototype, Layout.class); for (Element layoutElement : layoutElements) { StagedModelDataHandlerUtil.importStagedModel(portletDataContext, layoutElement); } } finally { portletDataContext.setGroupId(groupId); portletDataContext.setPrivateLayout(privateLayout); portletDataContext.setScopeGroupId(scopeGroupId); } }
@Override protected void doExportStagedModel( PortletDataContext portletDataContext, Element[] elements, MDRRuleGroupInstance ruleGroupInstance) throws Exception { Element ruleGroupsElement = elements[0]; MDRRuleGroup ruleGroup = MDRRuleGroupLocalServiceUtil.getRuleGroup(ruleGroupInstance.getRuleGroupId()); StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, ruleGroupsElement, ruleGroup); Element ruleGroupInstancesElement = elements[1]; Element ruleGroupInstanceElement = ruleGroupInstancesElement.addElement("rule-group-instance"); String className = ruleGroupInstance.getClassName(); if (className.equals(Layout.class.getName())) { Layout layout = LayoutLocalServiceUtil.getLayout(ruleGroupInstance.getClassPK()); ruleGroupInstanceElement.addAttribute("layout-uuid", layout.getUuid()); } portletDataContext.addClassedModel( ruleGroupInstanceElement, StagedModelPathUtil.getPath(ruleGroupInstance), ruleGroupInstance, MDRPortletDataHandler.NAMESPACE); }
@Override protected void doExportStagedModel(PortletDataContext portletDataContext, Repository repository) throws Exception { Element repositoryElement = portletDataContext.getExportDataElement(repository); Folder folder = DLAppLocalServiceUtil.getFolder(repository.getDlFolderId()); if (folder.getModel() instanceof DLFolder) { DLFolder dlFolder = (DLFolder) folder.getModel(); repositoryElement.addAttribute("hidden", String.valueOf(dlFolder.isHidden())); } portletDataContext.addClassedModel( repositoryElement, ExportImportPathUtil.getModelPath(repository), repository); List<RepositoryEntry> repositoryEntries = RepositoryEntryLocalServiceUtil.getRepositoryEntries(repository.getRepositoryId()); for (RepositoryEntry repositoryEntry : repositoryEntries) { StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, repository, repositoryEntry, PortletDataContext.REFERENCE_TYPE_CHILD); } }
@Override protected PortletPreferences doProcessExportPortletPreferences( PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) throws Exception { portletDataContext.addPortletPermissions(DDLPermission.RESOURCE_NAME); long recordSetId = GetterUtil.getLong(portletPreferences.getValue("recordSetId", null), 0); if (recordSetId == 0) { if (_log.isDebugEnabled()) { _log.debug("Unable to get record set with ID " + portletId); } return portletPreferences; } DDLRecordSet recordSet = DDLRecordSetLocalServiceUtil.fetchRecordSet(recordSetId); if (recordSet == null) { return portletPreferences; } StagedModelDataHandlerUtil.exportReferenceStagedModel(portletDataContext, portletId, recordSet); return portletPreferences; }
@Override @SuppressWarnings("unused") protected void performAction(Object object) throws PortalException, SystemException { LayoutSetPrototype stagedModel = (LayoutSetPrototype) object; StagedModelDataHandlerUtil.exportStagedModel(_portletDataContext, stagedModel); }
@Override protected void doExportStagedModel( PortletDataContext portletDataContext, DLFileEntryType fileEntryType) throws Exception { Element fileEntryTypeElement = portletDataContext.getExportDataElement(fileEntryType); List<DDMStructure> ddmStructures = fileEntryType.getDDMStructures(); for (DDMStructure ddmStructure : ddmStructures) { StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, ddmStructure); Element referenceElement = portletDataContext.addReferenceElement( fileEntryType, fileEntryTypeElement, ddmStructure, PortletDataContext.REFERENCE_TYPE_STRONG, false); referenceElement.addAttribute( "structure-id", StringUtil.valueOf(ddmStructure.getStructureId())); } portletDataContext.addClassedModel( fileEntryTypeElement, ExportImportPathUtil.getModelPath(fileEntryType), fileEntryType, DLPortletDataHandler.NAMESPACE); }
@Override protected PortletPreferences doImportData( PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences, String data) throws Exception { portletDataContext.importPermissions( "com.liferay.portlet.blogs", portletDataContext.getSourceGroupId(), portletDataContext.getScopeGroupId()); Element entriesElement = portletDataContext.getImportDataGroupElement(BlogsEntry.class); JournalPortletDataHandler.importReferenceData(portletDataContext, entriesElement); List<Element> entryElements = entriesElement.elements(); for (Element entryElement : entryElements) { StagedModelDataHandlerUtil.importStagedModel(portletDataContext, entryElement); } return null; }
@Override @SuppressWarnings("unused") protected void performAction(Object object) throws PortalException, SystemException { CalendarResource stagedModel = (CalendarResource) object; StagedModelDataHandlerUtil.exportStagedModel(_portletDataContext, stagedModel); }
@Override protected void doExportStagedModel(PortletDataContext portletDataContext, MBThreadFlag threadFlag) throws Exception { MBThread thread = MBThreadLocalServiceUtil.getThread(threadFlag.getThreadId()); MBMessage rootMessage = MBMessageLocalServiceUtil.getMessage(thread.getRootMessageId()); if ((rootMessage.getStatus() != WorkflowConstants.STATUS_APPROVED) || (rootMessage.getCategoryId() == MBCategoryConstants.DISCUSSION_CATEGORY_ID)) { return; } StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, rootMessage); Element threadFlagElement = portletDataContext.getExportDataElement(threadFlag); threadFlagElement.addAttribute("root-message-id", String.valueOf(rootMessage.getMessageId())); portletDataContext.addClassedModel( threadFlagElement, ExportImportPathUtil.getModelPath(threadFlag), threadFlag, MBPortletDataHandler.NAMESPACE); }
@Override protected void doExportStagedModel( PortletDataContext portletDataContext, DLFileEntryType fileEntryType) throws Exception { Element fileEntryTypeElement = portletDataContext.getExportDataElement(fileEntryType); List<DDMStructure> ddmStructures = fileEntryType.getDDMStructures(); for (DDMStructure ddmStructure : ddmStructures) { Element referenceElement = StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, fileEntryType, ddmStructure, PortletDataContext.REFERENCE_TYPE_STRONG); referenceElement.addAttribute( "structure-id", StringUtil.valueOf(ddmStructure.getStructureId())); } long defaultUserId = UserLocalServiceUtil.getDefaultUserId(fileEntryType.getCompanyId()); if (defaultUserId == fileEntryType.getUserId()) { fileEntryTypeElement.addAttribute("preloaded", "true"); } portletDataContext.addClassedModel( fileEntryTypeElement, ExportImportPathUtil.getModelPath(fileEntryType), fileEntryType); }
@Override protected void doImportStagedModel( PortletDataContext portletDataContext, WSRPConsumerPortlet wsrpConsumerPortlet) throws Exception { StagedModelDataHandlerUtil.importReferenceStagedModel( portletDataContext, wsrpConsumerPortlet, WSRPConsumer.class, wsrpConsumerPortlet.getWsrpConsumerId()); Map<Long, Long> wsrpConsumerIds = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(WSRPConsumer.class); long wsrpConsumerId = MapUtil.getLong( wsrpConsumerIds, wsrpConsumerPortlet.getWsrpConsumerId(), wsrpConsumerPortlet.getWsrpConsumerId()); ServiceContext serviceContext = portletDataContext.createServiceContext(wsrpConsumerPortlet); WSRPConsumerPortlet importedWSRPConsumerPortlet = null; if (portletDataContext.isDataStrategyMirror()) { WSRPConsumerPortlet existingWSRPConsumerPortlet = WSRPConsumerPortletLocalServiceUtil.fetchWSRPConsumerPortletByUuidAndCompanyId( wsrpConsumerPortlet.getUuid(), portletDataContext.getCompanyId()); if (existingWSRPConsumerPortlet == null) { serviceContext.setUuid(wsrpConsumerPortlet.getUuid()); importedWSRPConsumerPortlet = WSRPConsumerPortletLocalServiceUtil.addWSRPConsumerPortlet( wsrpConsumerId, wsrpConsumerPortlet.getName(), wsrpConsumerPortlet.getPortletHandle(), serviceContext); } else { existingWSRPConsumerPortlet.setWsrpConsumerId(wsrpConsumerId); existingWSRPConsumerPortlet.setName(wsrpConsumerPortlet.getName()); existingWSRPConsumerPortlet.setPortletHandle(wsrpConsumerPortlet.getPortletHandle()); importedWSRPConsumerPortlet = WSRPConsumerPortletLocalServiceUtil.updateWSRPConsumerPortlet( existingWSRPConsumerPortlet); } } else { importedWSRPConsumerPortlet = WSRPConsumerPortletLocalServiceUtil.addWSRPConsumerPortlet( wsrpConsumerId, wsrpConsumerPortlet.getName(), wsrpConsumerPortlet.getPortletHandle(), serviceContext); } portletDataContext.importClassedModel(wsrpConsumerPortlet, importedWSRPConsumerPortlet); }
@Override protected void doExportStagedModel(PortletDataContext portletDataContext, AssetCategory category) throws Exception { if (category.getParentCategoryId() != AssetCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) { AssetCategory parentCategory = AssetCategoryLocalServiceUtil.fetchAssetCategory(category.getParentCategoryId()); StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, category, parentCategory, PortletDataContext.REFERENCE_TYPE_PARENT); } else { AssetVocabulary vocabulary = AssetVocabularyLocalServiceUtil.fetchAssetVocabulary(category.getVocabularyId()); StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, category, vocabulary, PortletDataContext.REFERENCE_TYPE_PARENT); } Element categoryElement = portletDataContext.getExportDataElement(category); category.setUserUuid(category.getUserUuid()); List<AssetCategoryProperty> categoryProperties = AssetCategoryPropertyLocalServiceUtil.getCategoryProperties(category.getCategoryId()); for (AssetCategoryProperty categoryProperty : categoryProperties) { Element propertyElement = categoryElement.addElement("property"); propertyElement.addAttribute("userUuid", categoryProperty.getUserUuid()); propertyElement.addAttribute("key", categoryProperty.getKey()); propertyElement.addAttribute("value", categoryProperty.getValue()); } String categoryPath = ExportImportPathUtil.getModelPath(category); categoryElement.addAttribute("path", categoryPath); portletDataContext.addPermissions(AssetCategory.class, category.getCategoryId()); portletDataContext.addZipEntry(categoryPath, category); }
@Test public void testCompanyScopeDependencies() throws Exception { initExport(); Map<String, List<StagedModel>> dependentStagedModelsMap = addCompanyDependencies(); StagedModel stagedModel = addStagedModel(stagingGroup, dependentStagedModelsMap); StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, stagedModel); initImport(); StagedModel exportedStagedModel = readExportedStagedModel(stagedModel); Assert.assertNotNull(exportedStagedModel); StagedModelDataHandlerUtil.importStagedModel(portletDataContext, exportedStagedModel); validateCompanyDependenciesImport(dependentStagedModelsMap, liveGroup); }
@Override protected void doExportStagedModel(PortletDataContext portletDataContext, PollsVote vote) throws Exception { StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, vote, vote.getChoice(), PortletDataContext.REFERENCE_TYPE_STRONG); Element voteElement = portletDataContext.getExportDataElement(vote); portletDataContext.addClassedModel(voteElement, ExportImportPathUtil.getModelPath(vote), vote); }
@Override protected void doExportStagedModel(PortletDataContext portletDataContext, MBMessage message) throws Exception { if ((message.getStatus() != WorkflowConstants.STATUS_APPROVED) || (message.getCategoryId() == MBCategoryConstants.DISCUSSION_CATEGORY_ID)) { return; } StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, message.getCategory()); Element messageElement = portletDataContext.getExportDataStagedModelElement(message); message.setPriority(message.getPriority()); MBThread thread = message.getThread(); messageElement.addAttribute("question", String.valueOf(thread.isQuestion())); boolean hasAttachmentsFileEntries = message.getAttachmentsFileEntriesCount() > 0; messageElement.addAttribute( "hasAttachmentsFileEntries", String.valueOf(hasAttachmentsFileEntries)); if (portletDataContext.getBooleanParameter(MBPortletDataHandler.NAMESPACE, "attachments") && hasAttachmentsFileEntries) { for (FileEntry fileEntry : message.getAttachmentsFileEntries()) { String name = fileEntry.getTitle(); String binPath = ExportImportPathUtil.getModelPath(message, name); Element attachmentElement = messageElement.addElement("attachment"); attachmentElement.addAttribute("name", name); attachmentElement.addAttribute("bin-path", binPath); portletDataContext.addZipEntry(binPath, fileEntry.getContentStream()); } long folderId = message.getAttachmentsFolderId(); if (folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { message.setAttachmentsFolderId(folderId); } } portletDataContext.addClassedModel( messageElement, ExportImportPathUtil.getModelPath(message), message, MBPortletDataHandler.NAMESPACE); }
@Override protected PortletPreferences doProcessExportPortletPreferences( PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) throws Exception { long nodeId = GetterUtil.getLong(portletPreferences.getValue("nodeId", StringPool.BLANK)); if (nodeId <= 0) { if (_log.isWarnEnabled()) { _log.warn("No node id found in preferences of portlet " + portletId); } return portletPreferences; } String title = portletPreferences.getValue("title", null); if (title == null) { if (_log.isWarnEnabled()) { _log.warn("No title found in preferences of portlet " + portletId); } return portletPreferences; } WikiNode node = WikiNodeUtil.fetchByPrimaryKey(nodeId); if (node == null) { if (_log.isWarnEnabled()) { _log.warn("Unable to find wiki node"); } return portletPreferences; } portletDataContext.addPortletPermissions(WikiPermission.RESOURCE_NAME); StagedModelDataHandlerUtil.exportReferenceStagedModel(portletDataContext, portletId, node); ActionableDynamicQuery actionableDynamicQuery = getPageActionableDynamicQuery(portletDataContext, node.getNodeId(), portletId); actionableDynamicQuery.performActions(); return portletPreferences; }
@Override protected void doExportStagedModel( PortletDataContext portletDataContext, Element[] elements, MDRRule rule) throws Exception { Element ruleGroupsElement = elements[0]; MDRRuleGroup ruleGroup = MDRRuleGroupLocalServiceUtil.getRuleGroup(rule.getRuleGroupId()); StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, ruleGroupsElement, ruleGroup); Element rulesElement = elements[1]; Element ruleElement = rulesElement.addElement("rule"); portletDataContext.addClassedModel( ruleElement, StagedModelPathUtil.getPath(rule), rule, MDRPortletDataHandler.NAMESPACE); }
@Override protected void doExportStagedModel(PortletDataContext portletDataContext, JournalFolder folder) throws Exception { if (folder.getParentFolderId() != JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID) { StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, folder, folder.getParentFolder(), PortletDataContext.REFERENCE_TYPE_PARENT); } Element folderElement = portletDataContext.getExportDataElement(folder); portletDataContext.addClassedModel( folderElement, ExportImportPathUtil.getModelPath(folder), folder); }
@Override protected PortletPreferences doImportData( PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences, String data) throws Exception { portletDataContext.importPortalPermissions(); Element rolesElement = portletDataContext.getImportDataGroupElement(Role.class); List<Element> roleElements = rolesElement.elements(); for (Element roleElement : roleElements) { StagedModelDataHandlerUtil.importStagedModel(portletDataContext, roleElement); } return null; }
protected void exportLayouts( PortletDataContext portletDataContext, LayoutPrototype layoutPrototype, Element layoutPrototypeElement) throws Exception { List<Layout> layouts = LayoutLocalServiceUtil.getLayouts( layoutPrototype.getGroupId(), true, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID); for (Layout layout : layouts) { StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, layout); portletDataContext.addReferenceElement( layoutPrototype, layoutPrototypeElement, layout, PortletDataContext.REFERENCE_TYPE_EMBEDDED, false); } }
@Override protected void doExportStagedModel( PortletDataContext portletDataContext, WSRPConsumerPortlet wsrpConsumerPortlet) throws Exception { WSRPConsumer wsrpConsumer = WSRPConsumerLocalServiceUtil.getWSRPConsumer(wsrpConsumerPortlet.getWsrpConsumerId()); StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, wsrpConsumerPortlet, wsrpConsumer, PortletDataContext.REFERENCE_TYPE_STRONG); Element wsrpConsumerPortletElement = portletDataContext.getExportDataElement(wsrpConsumerPortlet); portletDataContext.addClassedModel( wsrpConsumerPortletElement, ExportImportPathUtil.getModelPath(wsrpConsumerPortlet), wsrpConsumerPortlet); }