Package com.skyline.wo.model

Examples of com.skyline.wo.model.Album


      v.setViewName(ViewPaths.USER_LOGIN);
      return v;
    }
    Spot spot = spotService.getSpot(spotId);
    if (spot.getAdministratorId().equals(user.getId())) {
      Album portraitAlbum = albumService.getUserPortraitAlbum(spotId);
      Photo portraitPhoto = albumService.getCurrentPortraitPhotoFromAlbum(portraitAlbum);
      v.addObject("portraitAlbumId", portraitAlbum.getId());
      v.addObject("portrait", portraitPhoto);
      v.addObject("spotInfo", spot);
      v.setViewName(ViewPaths.SPOT_EDITPORTRAIT);
    }
    // 没权限
View Full Code Here


    if (user == null) {
      throw new NotLoginException("上传头像必须登录");
    }

    long ownerId = user.getId();
    Album portraitAlbum = albumService.getUserPortraitAlbum(ownerId);
    Photo portraitPhoto = albumService.getCurrentPortraitPhotoFromAlbum(portraitAlbum);

    ModelAndView view = new ModelAndView();
    view.addObject("portraitAlbum", portraitAlbum);
    view.addObject("portrait", portraitPhoto);
View Full Code Here

        spotId, page, Activity.NORMAL);

    /**
     * spot 的默认相册即才有头像相册的形式
     */
    Album defaultAlbum = albumService.getUserPortraitAlbum(spotId);
    List<SpotRefrence> refList = spotRefrenceService.getRefrencesBySpotIdAndType(spotId,
        SpotRefrenceType.ALBUM, page);

    List<Fan> fanList = attentionService.queryFans(spotId, page);
    int fanCounts = attentionService.countFans(spotId);
View Full Code Here

      @PathVariable("albumId") Long albumId) {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null) {
      throw new NotLoginException("上传照片必须登录");
    }
    Album album = albumService.getAlbumForChange(albumId, spotId);
    ModelAndView mav = new ModelAndView(ViewPaths.SPOT_UPLOADPHOTO);
    mav.addObject("album", album);
    // WebHelper.saveToken(request);
    return mav;
  }
View Full Code Here

    return albumDao.queryAlbumsByUserIdWithoutPortrait(ownerId, authority, page);
  }

  @Override
  public Album getAlbumById(long albumId) {
    Album album = albumDao.queryAlbumById(albumId);
    if (album == null) {
      throw new NoResourceException("Id为" + albumId + "的相册不存在");
    }
    Activity act = album.getActivity();
    if (act == Activity.DELETED || act == Activity.FREEZED) {
      throw new NoResourceException("Id为" + albumId + "的相册已删除或者已被屏蔽");
    }
    return album;
  }
View Full Code Here

    String newAlbumName = newAlbum.getAlbumName();
    String newPlace = newAlbum.getPlace();
    String newDescription = newAlbum.getDescription();
    Integer newAuthority = newAlbum.getAuthority();

    Album oldAlbum = getAlbumForChange(albumId, ownerId);
    boolean isModified = false;
    boolean shouldModifyPhotos = false;
    if (!StringUtils.equals(newAlbumName, oldAlbum.getAlbumName())) {
      isModified = true;
      shouldModifyPhotos = true;
    }
    if (!StringUtils.equals(newPlace, oldAlbum.getPlace())) {
      isModified = true;
    }
    if (!StringUtils.equals(newDescription, oldAlbum.getDescription())) {
      isModified = true;
    }
    if (!oldAlbum.getAuthority().equals(newAuthority)) {
      isModified = true;
      shouldModifyPhotos = true;
    }

    if (isModified) {
View Full Code Here

    }
  }

  @Override
  public Album getAlbumForChange(long albumId, long userId) {
    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 + "的相册为头像相册,不能修改");
View Full Code Here

    }
  }

  @Override
  public void deleteAlbum(long albumId, long userId) {
    Album album = albumDao.queryAlbumById(albumId);
    if (album.getOwnerId() == userId) {
      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
            + ",不能删除");
      }
View Full Code Here

    if (photo.getOwnerId() == userId) {
      Activity oldActivity = photo.getActivity();
      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 {
View Full Code Here

    changeAlbumCover(ownerId, portraitAlbum.getId(), smallFile, fileExt);
    return portrait;
  }
 
  public Photo getUserCurrentPortraitPhoto(long userId) {
    Album portraitAlbum = getUserPortraitAlbum(userId);
    return getCurrentPortraitPhotoFromAlbum(portraitAlbum);
  }
View Full Code Here

TOP

Related Classes of com.skyline.wo.model.Album

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.