Package com.skyline.base.exception

Examples of com.skyline.base.exception.OperateFailedException


    }

    long ownerId = user.getId();
    Photo portrait = albumService.getUserCurrentPortraitPhoto(ownerId);
    if (portrait == null) {
      throw new OperateFailedException("不存在当前图片,无法剪切");
    }
    long albumId = portrait.getAlbumId();

    String smallFile = portrait.getSmallFile();
    String ext = portrait.getExt();
    String remoteFileKey = smallFile + '.' + ext;

    SkylineImageCropTask cropTask = new SkylineImageCropTask(remoteFileKey, portraitSize);
    cropTask.setAlbumId(albumId);
    cropTask.setUserId(ownerId);
    cropTask.setOffsetX(x);
    cropTask.setOffsetY(y);
    cropTask.setCropSize(size);
    ImageCropResult cropResult;
    try {
      cropResult = crop.processImage(basePath, cropTask);
    } catch (IOException e) {
      throw new OperateFailedException("无法剪切图片");
    }
    if (cropResult == null || cropResult.getResultState() != ResultState.SUCCESS) {
      throw new OperateFailedException("无法剪切图片,原因:"
          + (cropResult == null ? null : cropResult.getResultState()));
    }
    String portraitFile = cropResult.getFileKey();

    personalInfoService.changeUserPortrait(ownerId, portraitFile);
View Full Code Here


    if (errMsg != null) {
      return processValidationErrors("errMsg", errMsg, photoUploadRequest());
    }
    Photo portrait = albumService.getUserCurrentPortraitPhoto(spotId);
    if (portrait == null) {
      throw new OperateFailedException("不存在当前图片,无法剪切");
    }
    long albumId = portrait.getAlbumId();

    String smallFile = portrait.getSmallFile();
    String ext = portrait.getExt();
    String remoteFileKey = smallFile + '.' + ext;

    SkylineImageCropTask cropTask = new SkylineImageCropTask(remoteFileKey, portraitSize);
    cropTask.setAlbumId(albumId);
    cropTask.setUserId(spotId);
    cropTask.setOffsetX(x);
    cropTask.setOffsetY(y);
    cropTask.setCropSize(size);
    ImageCropResult cropResult;
    try {
      cropResult = crop.processImage(basePath, cropTask);
    } catch (IOException e) {
      throw new OperateFailedException("无法剪切图片");
    }
    if (cropResult == null || cropResult.getResultState() != ResultState.SUCCESS) {
      throw new OperateFailedException("无法剪切图片,原因:"
          + (cropResult == null ? null : cropResult.getResultState()));
    }
    String portraitFile = cropResult.getFileKey();

    spotService.updateSpotPortrait(spotId, portraitFile);
View Full Code Here

      album.setActivity(Activity.NORMAL);
      album.setCover(cover);
      album.setCoverExt(ext);
      return album;
    } else {
      throw new OperateFailedException("ID为:" + ownerId + "的用户创建相册失败");
    }
  }
View Full Code Here

 
  public Photo createPortraitPhoto(User owner, Album portraitAlbum, ImageResizeResult result) {
    long ownerId = owner.getId();
    List<Photo> photos = createPhotos(owner, portraitAlbum, Arrays.asList(result));
    if(photos.isEmpty()) {
      throw new OperateFailedException("插入头像相册失败");
    }
    Photo portrait = photos.get(0);
    String smallFile = portrait.getSmallFile();
    String fileExt = portrait.getExt();
    //修改头像相册封面
View Full Code Here

    }

    Album resultAlbum = albumService.createAlbum(user, album);
    if (resultAlbum == null) {
      LOGGER.warn("数据异常,如果结果为空,应该早已抛出异常!");
      throw new OperateFailedException("创建相册失败");
    }
    String url = buildRecirectPath(URL_PREFIX + "/bupload/" + resultAlbum.getId());
    ModelAndView mav = new ModelAndView(new RedirectView(url));
    return mav;
  }
View Full Code Here

TOP

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

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.