コード例 #1
0
  public int deleteResource(WebDAVRequest webDavRequest) throws WebDAVException {

    try {
      Resource resource = getResource(webDavRequest);

      if (resource == null) {
        return HttpServletResponse.SC_NOT_FOUND;
      }

      Object model = resource.getModel();

      if (model instanceof IGFolder) {
        IGFolder folder = (IGFolder) model;

        IGFolderServiceUtil.deleteFolder(folder.getFolderId());
      } else {
        IGImage image = (IGImage) model;

        IGImageServiceUtil.deleteImage(image.getImageId());
      }

      return HttpServletResponse.SC_NO_CONTENT;
    } catch (PrincipalException pe) {
      return HttpServletResponse.SC_FORBIDDEN;
    } catch (Exception e) {
      throw new WebDAVException(e);
    }
  }
コード例 #2
0
  protected boolean deleteResource(long groupId, long parentFolderId, String name)
      throws PortalException, SystemException {

    try {
      IGFolder folder = IGFolderServiceUtil.getFolder(groupId, parentFolderId, name);

      IGFolderServiceUtil.deleteFolder(folder.getFolderId());

      return true;
    } catch (NoSuchFolderException nsfe) {
      if (name.indexOf(StringPool.PERIOD) == -1) {
        return false;
      }

      try {
        IGImageServiceUtil.deleteImageByFolderIdAndNameWithExtension(groupId, parentFolderId, name);

        return true;
      } catch (NoSuchImageException nsie) {
      }
    }

    return false;
  }