Package com.skyline.base.exception

Examples of com.skyline.base.exception.NoOperatePermissionException


    Album album = albumDao.queryAlbumDetailById(albumId);
    if(album == null) {
      throw new NoResourceException("Id为" + albumId + "的相册不存在!");
    }
    if (album.getOwnerId() != userId) {
      throw new NoOperatePermissionException("ID为" + userId + "的用户无法操作ID为" + albumId + "的相册");
    }
    Activity act = album.getActivity();
    if (act == Activity.DELETED || act == Activity.FREEZED) {
      throw new NoOperatePermissionException("Id为" + albumId + "的相册已删除或者已被屏蔽");
    }
    if (act == Activity.UNDELETABLE) {
      throw new NoOperatePermissionException("Id为" + albumId + "的相册为头像相册,不能修改");
    }
    return album;
  }
View Full Code Here


      Activity oldActivity = album.getActivity();
      if (oldActivity == Activity.NORMAL) {// 只能删除普通相册
        albumDao.updateAlbumActivity(album.getOwnerId(), albumId, Activity.DELETED);
        photoDao.updatePhotosActivityByAlbumId(albumId, Activity.DELETED);
      } else {
        throw new NoOperatePermissionException("ID为" + albumId + "的相册状态为" + oldActivity
            + ",不能删除");
      }
    } else {
      throw new NoOperatePermissionException("ID为" + userId + "的用户没有删除ID为" + albumId
          + "相册的权限");
    }
  }
View Full Code Here

      if (oldActivity == Activity.NORMAL) {// 只能删除普通相册
        Long albumId = photo.getAlbumId();
        String file = photo.getSmallFile();
        Album album = albumDao.queryAlbumById(albumId);
        if (album.getOwnerId() != userId) {
          throw new NoOperatePermissionException("ID为" + userId + "的用户没有修改ID为" + albumId
              + "相册的权限");
        }
        String cover = album.getCover();
        if (cover.equals(file)) {
          albumDao.updateRandomCoverAndPhotoCount(userId, albumId, photoId, this.cover,
              this.ext, -1);
        } else {
          albumDao.updatePhotoCount(userId, albumId, -1);
        }
        photoDao.updatePhotoActivity(album.getId(), photoId, Activity.DELETED);
        return album.getId();
      } else {
        throw new NoOperatePermissionException("Id为" + photoId + "的相册状态为" + oldActivity
            + ",不能删除");
      }
    } else {
      throw new NoOperatePermissionException("Id为" + userId + "的用户没有删除Id为" + photoId
          + "图片的权限");
    }
  }
View Full Code Here

    Photo photo = photoDao.queryPhotoDetailById(photoId);
    if(photo == null) {
      throw new NoResourceException("Id为" + photoId + "的图片不存在!");
    }
    if (photo.getOwnerId() != userId) {
      throw new NoOperatePermissionException("Id为" + userId + "的用户没有修改Id为" + photoId
          + "图片的权限");
    }
    return photo;
  }
View Full Code Here

TOP

Related Classes of com.skyline.base.exception.NoOperatePermissionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.