public static com.liferay.portlet.documentlibrary.model.DLFolderSoap updateFolder(
      long folderId,
      java.lang.String name,
      java.lang.String description,
      long defaultFileEntryTypeId,
      Long[] fileEntryTypeIds,
      boolean overrideFileEntryTypes,
      com.liferay.portal.service.ServiceContext serviceContext)
      throws RemoteException {
    try {
      com.liferay.portlet.documentlibrary.model.DLFolder returnValue =
          DLFolderServiceUtil.updateFolder(
              folderId,
              name,
              description,
              defaultFileEntryTypeId,
              ListUtil.toList(fileEntryTypeIds),
              overrideFileEntryTypes,
              serviceContext);

      return com.liferay.portlet.documentlibrary.model.DLFolderSoap.toSoapModel(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
    public void processAction(ActionEvent actionEvent) throws AbortProcessingException {

      try {
        FolderUserObject folderUserObject = docLibModelBean.getSelectedFolderUserObject();
        DLFolder dlFolder = folderUserObject.getDlFolder();
        long groupId = dlFolder.getGroupId();
        long repositoryId = dlFolder.getRepositoryId();
        boolean mountPoint = dlFolder.getMountPoint();
        long parentFolderId = dlFolder.getFolderId();
        ServiceContext serviceContext = new ServiceContext();

        // Temporary: Make the default setting be that community members can view the file. Need to
        // develop a
        // "Viewable By" permissions Facelet composite component UI similar to
        // portal-web/docroot/html/taglib/ui/input_permissions/page.jsp
        serviceContext.setAddGroupPermissions(true);
        DLFolderServiceUtil.addFolder(
            groupId,
            repositoryId,
            mountPoint,
            parentFolderId,
            folderName,
            folderDescription,
            serviceContext);
        docLibModelBean.forceTreeRequery();
        logger.debug("Added folderName=[{0}] description=[{1}]", folderName, folderDescription);
      } catch (Exception e) {
        logger.error(e.getMessage(), e);
        liferayFacesContext.addGlobalUnexpectedErrorMessage();
      }

      docLibViewBean.setPopupRendered(false);
    }
Пример #3
0
  @Override
  public void postProcessContextQuery(BooleanQuery contextQuery, SearchContext searchContext)
      throws Exception {

    int status =
        GetterUtil.getInteger(
            searchContext.getAttribute(Field.STATUS), WorkflowConstants.STATUS_APPROVED);

    if (status != WorkflowConstants.STATUS_ANY) {
      contextQuery.addRequiredTerm(Field.STATUS, status);
    }

    long[] folderIds = searchContext.getFolderIds();

    if ((folderIds != null) && (folderIds.length > 0)) {
      if (folderIds[0] == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
        return;
      }

      BooleanQuery folderIdsQuery = BooleanQueryFactoryUtil.create(searchContext);

      for (long folderId : folderIds) {
        try {
          DLFolderServiceUtil.getFolder(folderId);
        } catch (Exception e) {
          continue;
        }

        folderIdsQuery.addTerm(Field.FOLDER_ID, folderId);
      }

      contextQuery.add(folderIdsQuery, BooleanClauseOccur.MUST);
    }
  }
Пример #4
0
  public boolean isLocked() {
    try {
      return DLFolderServiceUtil.isFolderLocked(getFolderId());
    } catch (Exception e) {
    }

    return false;
  }
Пример #5
0
  public boolean hasInheritableLock() {
    try {
      return DLFolderServiceUtil.hasInheritableLock(getFolderId());
    } catch (Exception e) {
    }

    return false;
  }
  public static void deleteFolder(long folderId) throws RemoteException {
    try {
      DLFolderServiceUtil.deleteFolder(folderId);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  @Override
  public boolean hasLock() {
    try {
      return DLFolderServiceUtil.hasFolderLock(getFolderId());
    } catch (Exception e) {
    }

    return false;
  }
  public static void unlockFolder(long groupId, long folderId, java.lang.String lockUuid)
      throws RemoteException {
    try {
      DLFolderServiceUtil.unlockFolder(groupId, folderId, lockUuid);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static void deleteFolder(long groupId, long parentFolderId, java.lang.String name)
      throws RemoteException {
    try {
      DLFolderServiceUtil.deleteFolder(groupId, parentFolderId, name);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static long[] getFolderIds(long groupId, long folderId) throws RemoteException {
    try {
      long[] returnValue = DLFolderServiceUtil.getFolderIds(groupId, folderId);

      return returnValue;
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static int getMountFoldersCount(long groupId, long parentFolderId) throws RemoteException {
    try {
      int returnValue = DLFolderServiceUtil.getMountFoldersCount(groupId, parentFolderId);

      return returnValue;
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static boolean isFolderLocked(long folderId) throws RemoteException {
    try {
      boolean returnValue = DLFolderServiceUtil.isFolderLocked(folderId);

      return returnValue;
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static boolean verifyInheritableLock(long folderId, java.lang.String lockUuid)
      throws RemoteException {
    try {
      boolean returnValue = DLFolderServiceUtil.verifyInheritableLock(folderId, lockUuid);

      return returnValue;
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static int getFileEntriesAndFileShortcutsCount(long groupId, long folderId, int status)
      throws RemoteException {
    try {
      int returnValue =
          DLFolderServiceUtil.getFileEntriesAndFileShortcutsCount(groupId, folderId, status);

      return returnValue;
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static com.liferay.portlet.documentlibrary.model.DLFolderSoap getFolder(long folderId)
      throws RemoteException {
    try {
      com.liferay.portlet.documentlibrary.model.DLFolder returnValue =
          DLFolderServiceUtil.getFolder(folderId);

      return com.liferay.portlet.documentlibrary.model.DLFolderSoap.toSoapModel(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static com.liferay.portlet.documentlibrary.model.DLFolderSoap getFolder(
      long groupId, long parentFolderId, java.lang.String name) throws RemoteException {
    try {
      com.liferay.portlet.documentlibrary.model.DLFolder returnValue =
          DLFolderServiceUtil.getFolder(groupId, parentFolderId, name);

      return com.liferay.portlet.documentlibrary.model.DLFolderSoap.toSoapModel(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static java.lang.Long[] getSubfolderIds(long groupId, long folderId, boolean recurse)
      throws RemoteException {
    try {
      java.util.List<java.lang.Long> returnValue =
          DLFolderServiceUtil.getSubfolderIds(groupId, folderId, recurse);

      return returnValue.toArray(new java.lang.Long[returnValue.size()]);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static com.liferay.portlet.documentlibrary.model.DLFolderSoap moveFolder(
      long folderId, long parentFolderId, com.liferay.portal.service.ServiceContext serviceContext)
      throws RemoteException {
    try {
      com.liferay.portlet.documentlibrary.model.DLFolder returnValue =
          DLFolderServiceUtil.moveFolder(folderId, parentFolderId, serviceContext);

      return com.liferay.portlet.documentlibrary.model.DLFolderSoap.toSoapModel(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static com.liferay.portlet.documentlibrary.model.DLFolderSoap[] getMountFolders(
      long groupId,
      long parentFolderId,
      int start,
      int end,
      com.liferay.portal.kernel.util.OrderByComparator obc)
      throws RemoteException {
    try {
      java.util.List<com.liferay.portlet.documentlibrary.model.DLFolder> returnValue =
          DLFolderServiceUtil.getMountFolders(groupId, parentFolderId, start, end, obc);

      return com.liferay.portlet.documentlibrary.model.DLFolderSoap.toSoapModels(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static com.liferay.portlet.documentlibrary.model.DLFolderSoap addFolder(
      long groupId,
      long repositoryId,
      boolean mountPoint,
      long parentFolderId,
      java.lang.String name,
      java.lang.String description,
      com.liferay.portal.service.ServiceContext serviceContext)
      throws RemoteException {
    try {
      com.liferay.portlet.documentlibrary.model.DLFolder returnValue =
          DLFolderServiceUtil.addFolder(
              groupId, repositoryId, mountPoint, parentFolderId, name, description, serviceContext);

      return com.liferay.portlet.documentlibrary.model.DLFolderSoap.toSoapModel(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  @Override
  public void postProcessContextQuery(BooleanQuery contextQuery, SearchContext searchContext)
      throws Exception {

    addStatus(contextQuery, searchContext);

    if (searchContext.isIncludeAttachments()) {
      addRelatedClassNames(contextQuery, searchContext);
    }

    contextQuery.addRequiredTerm(Field.HIDDEN, searchContext.isIncludeAttachments());

    addSearchClassTypeIds(contextQuery, searchContext);

    String ddmStructureFieldName = (String) searchContext.getAttribute("ddmStructureFieldName");
    Serializable ddmStructureFieldValue = searchContext.getAttribute("ddmStructureFieldValue");

    if (Validator.isNotNull(ddmStructureFieldName) && Validator.isNotNull(ddmStructureFieldValue)) {

      String[] ddmStructureFieldNameParts =
          StringUtil.split(ddmStructureFieldName, StringPool.SLASH);

      DDMStructure structure =
          DDMStructureLocalServiceUtil.getStructure(
              GetterUtil.getLong(ddmStructureFieldNameParts[1]));

      String fieldName =
          StringUtil.replaceLast(
              ddmStructureFieldNameParts[2],
              StringPool.UNDERLINE.concat(LocaleUtil.toLanguageId(searchContext.getLocale())),
              StringPool.BLANK);

      try {
        ddmStructureFieldValue =
            DDMUtil.getIndexedFieldValue(ddmStructureFieldValue, structure.getFieldType(fieldName));
      } catch (StructureFieldException sfe) {
      }

      contextQuery.addRequiredTerm(
          ddmStructureFieldName, StringPool.QUOTE + ddmStructureFieldValue + StringPool.QUOTE);
    }

    long[] folderIds = searchContext.getFolderIds();

    if ((folderIds != null)
        && (folderIds.length > 0)
        && (folderIds[0] != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID)) {

      BooleanQuery folderIdsQuery = BooleanQueryFactoryUtil.create(searchContext);

      for (long folderId : folderIds) {
        try {
          DLFolderServiceUtil.getFolder(folderId);
        } catch (Exception e) {
          continue;
        }

        folderIdsQuery.addTerm(Field.FOLDER_ID, folderId);
      }

      contextQuery.add(folderIdsQuery, BooleanClauseOccur.MUST);
    }

    String[] mimeTypes = (String[]) searchContext.getAttribute("mimeTypes");

    if ((mimeTypes != null) && (mimeTypes.length > 0)) {
      BooleanQuery mimeTypesQuery = BooleanQueryFactoryUtil.create(searchContext);

      for (String mimeType : mimeTypes) {
        mimeTypesQuery.addTerm(
            "mimeType", StringUtil.replace(mimeType, CharPool.FORWARD_SLASH, CharPool.UNDERLINE));
      }

      contextQuery.add(mimeTypesQuery, BooleanClauseOccur.MUST);
    }
  }