Exemplo n.º 1
0
  public static DLFolder addDLFolder(
      long groupId, long parentFolderId, boolean deleteExisting, ServiceContext serviceContext)
      throws Exception {

    String name = RandomTestUtil.randomString();

    if (deleteExisting) {
      try {
        DLFolder folder = DLFolderLocalServiceUtil.getFolder(groupId, parentFolderId, name);

        DLFolderLocalServiceUtil.deleteFolder(folder.getFolderId());
      } catch (NoSuchFolderException nsfe) {
      }
    }

    return DLFolderLocalServiceUtil.addFolder(
        TestPropsValues.getUserId(),
        groupId,
        groupId,
        false,
        parentFolderId,
        name,
        StringPool.BLANK,
        false,
        serviceContext);
  }
  @Override
  public DLFolder getFolder() throws PortalException {
    if (getFolderId() <= 0) {
      return new DLFolderImpl();
    }

    return DLFolderLocalServiceUtil.getFolder(getFolderId());
  }