@Override protected StagedModel getStagedModel(String uuid, long groupId) { return JournalArticleLocalServiceUtil.fetchJournalArticleByUuidAndGroupId(uuid, groupId); }
protected void exportImportJournalArticle(boolean companyScopeDependencies) throws Exception { JournalArticle article = null; DDMStructure ddmStructure = null; DDMTemplate ddmTemplate = null; long groupId = group.getGroupId(); Company company = CompanyLocalServiceUtil.fetchCompany(group.getCompanyId()); Group companyGroup = company.getGroup(); if (companyScopeDependencies) { groupId = companyGroup.getGroupId(); } ddmStructure = DDMStructureTestUtil.addStructure(groupId, JournalArticle.class.getName()); ddmTemplate = DDMTemplateTestUtil.addTemplate(groupId, ddmStructure.getStructureId()); String content = DDMStructureTestUtil.getSampleStructuredContent(); article = JournalTestUtil.addArticleWithXMLContent( group.getGroupId(), content, ddmStructure.getStructureKey(), ddmTemplate.getTemplateKey()); exportImportPortlet(PortletKeys.JOURNAL); int articlesCount = JournalArticleLocalServiceUtil.getArticlesCount(importedGroup.getGroupId()); Assert.assertEquals(1, articlesCount); JournalArticle groupArticle = JournalArticleLocalServiceUtil.fetchJournalArticleByUuidAndGroupId( article.getUuid(), importedGroup.getGroupId()); Assert.assertNotNull(groupArticle); groupId = importedGroup.getGroupId(); if (companyScopeDependencies) { DDMStructure importedDDMStructure = DDMStructureLocalServiceUtil.fetchDDMStructureByUuidAndGroupId( ddmStructure.getUuid(), groupId); Assert.assertNull(importedDDMStructure); DDMTemplate importedDDMTemplate = DDMTemplateLocalServiceUtil.fetchDDMTemplateByUuidAndGroupId( ddmTemplate.getUuid(), groupId); Assert.assertNull(importedDDMTemplate); groupId = companyGroup.getGroupId(); } DDMStructure dependentDDMStructure = DDMStructureLocalServiceUtil.fetchDDMStructureByUuidAndGroupId( ddmStructure.getUuid(), groupId); Assert.assertNotNull(dependentDDMStructure); DDMTemplate dependentDDMTemplate = DDMTemplateLocalServiceUtil.fetchDDMTemplateByUuidAndGroupId( ddmTemplate.getUuid(), groupId); Assert.assertNotNull(dependentDDMTemplate); Assert.assertEquals(article.getDDMStructureKey(), dependentDDMStructure.getStructureKey()); Assert.assertEquals(article.getDDMTemplateKey(), dependentDDMTemplate.getTemplateKey()); Assert.assertEquals(dependentDDMTemplate.getClassPK(), dependentDDMStructure.getStructureId()); }