コード例 #1
0
  protected Map<String, List<StagedModel>> addCompanyDependencies() throws Exception {

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

    Company company = CompanyLocalServiceUtil.fetchCompany(stagingGroup.getCompanyId());

    Group companyGroup = company.getGroup();

    DDMStructure ddmStructure =
        DDMStructureTestUtil.addStructure(
            companyGroup.getGroupId(), DLFileEntryType.class.getName());

    addDependentStagedModel(dependentStagedModelsMap, DDMStructure.class, ddmStructure);

    DLFileEntryType dlFileEntryType =
        DLAppTestUtil.addDLFileEntryType(companyGroup.getGroupId(), ddmStructure.getStructureId());

    addDependentStagedModel(dependentStagedModelsMap, DLFileEntryType.class, dlFileEntryType);

    Folder folder =
        DLAppTestUtil.addFolder(
            stagingGroup.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);

    addDependentStagedModel(dependentStagedModelsMap, DLFolder.class, folder);

    return dependentStagedModelsMap;
  }
コード例 #2
0
  protected static FileEntry addFileEntry(
      long userId,
      long repositoryId,
      long folderId,
      String fileName,
      String titleSuffix,
      String contentType,
      long fileEntryTypeId)
      throws Exception {

    ServiceContext serviceContext =
        ServiceContextTestUtil.getServiceContext(_group.getGroupId(), userId);

    DLAppTestUtil.populateServiceContext(serviceContext, fileEntryTypeId);

    return DLAppLocalServiceUtil.addFileEntry(
        userId,
        repositoryId,
        folderId,
        fileName,
        contentType,
        fileName.concat(titleSuffix),
        StringPool.BLANK,
        StringPool.BLANK,
        (byte[]) null,
        serviceContext);
  }
  @Override
  protected long addBaseModel(long containerModelId) throws Exception {
    FileEntry fileEntry =
        DLAppTestUtil.addFileEntryWithWorkflow(
            group.getGroupId(), group.getGroupId(), containerModelId, true);

    return fileEntry.getFileEntryId();
  }
  @Override
  protected StagedModel addStagedModel(
      Group group, Map<String, List<StagedModel>> dependentStagedModelsMap) throws Exception {

    List<StagedModel> dependentStagedModels =
        dependentStagedModelsMap.get(DDMStructure.class.getSimpleName());

    DDMStructure ddmStructure = (DDMStructure) dependentStagedModels.get(0);

    return DLAppTestUtil.addDLFileEntryType(group.getGroupId(), ddmStructure.getStructureId());
  }
コード例 #5
0
  @Override
  protected StagedModel addStagedModel(
      Group group, Map<String, List<StagedModel>> dependentStagedModelsMap) throws Exception {

    List<StagedModel> folderDependentStagedModels =
        dependentStagedModelsMap.get(DLFolder.class.getSimpleName());

    Folder folder = (Folder) folderDependentStagedModels.get(0);

    List<StagedModel> fileEntryTypeDependentStagedModels =
        dependentStagedModelsMap.get(DLFileEntryType.class.getSimpleName());

    DLFileEntryType dlFileEntryType = (DLFileEntryType) fileEntryTypeDependentStagedModels.get(0);

    folder = DLAppTestUtil.addFolder(group.getGroupId(), folder.getFolderId());

    DLAppTestUtil.updateFolderFileEntryType(folder, dlFileEntryType.getFileEntryTypeId());

    return folder;
  }
コード例 #6
0
  @Override
  protected Map<String, List<StagedModel>> addDependentStagedModelsMap(Group group)
      throws Exception {

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

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

    addDependentStagedModel(dependentStagedModelsMap, DDMStructure.class, ddmStructure);

    DLFileEntryType dlFileEntryType =
        DLAppTestUtil.addDLFileEntryType(group.getGroupId(), ddmStructure.getStructureId());

    addDependentStagedModel(dependentStagedModelsMap, DLFileEntryType.class, dlFileEntryType);

    Folder folder =
        DLAppTestUtil.addFolder(group.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);

    addDependentStagedModel(dependentStagedModelsMap, DLFolder.class, folder);

    return dependentStagedModelsMap;
  }
 @Override
 protected void updateBaseModel(long baseModelId) throws Exception {
   DLAppTestUtil.updateFileEntryWithWorkflow(group.getGroupId(), baseModelId, false, true);
 }
  @Override
  protected long addContainerModel(long containerModelId) throws Exception {
    Folder folder = DLAppTestUtil.addFolder(group.getGroupId(), containerModelId);

    return folder.getFolderId();
  }