@Override
  protected Map<String, List<StagedModel>> addDependentStagedModelsMap(Group group)
      throws Exception {

    Map<String, List<StagedModel>> dependentStagedModelsMap = new LinkedHashMap<>();

    DDMStructure ddmStructure =
        DDMStructureTestUtil.addStructure(group.getGroupId(), DDLRecordSet.class.getName());

    DDMTemplate ddmTemplate1 =
        DDMTemplateTestUtil.addTemplate(
            group.getGroupId(),
            ddmStructure.getStructureId(),
            PortalUtil.getClassNameId(DDLRecordSet.class));

    addDependentStagedModel(dependentStagedModelsMap, DDMTemplate.class, ddmTemplate1);

    DDMTemplate ddmTemplate2 =
        DDMTemplateTestUtil.addTemplate(
            group.getGroupId(),
            ddmStructure.getStructureId(),
            PortalUtil.getClassNameId(DDLRecordSet.class));

    addDependentStagedModel(dependentStagedModelsMap, DDMTemplate.class, ddmTemplate2);

    addDependentStagedModel(dependentStagedModelsMap, DDMStructure.class, ddmStructure);

    return dependentStagedModelsMap;
  }
コード例 #2
0
  @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();
    }
  }
コード例 #3
0
  @Override
  protected BaseModel<?> addBaseModelWithDDMStructure(
      BaseModel<?> parentBaseModel, String keywords, ServiceContext serviceContext)
      throws Exception {

    String content = DDMStructureTestUtil.getSampleStructuredContent(keywords);

    DDMForm ddmForm = DDMStructureTestUtil.getSampleDDMForm("name");

    DDMStructure ddmStructure =
        DDMStructureTestUtil.addStructure(
            serviceContext.getScopeGroupId(), JournalArticle.class.getName(), ddmForm);

    DDMTemplate ddmTemplate =
        DDMTemplateTestUtil.addTemplate(
            serviceContext.getScopeGroupId(),
            ddmStructure.getStructureId(),
            PortalUtil.getClassNameId(JournalArticle.class));

    return addArticleWithXmlContent(
        parentBaseModel, content, ddmStructure, ddmTemplate, serviceContext);
  }