Examples of Photo


Examples of org.damour.base.client.objects.Photo

    try {
      for (final FileItem item : fileItems) {

        File fileObject = null;
        if (item.getContentType().contains("image")) {
          fileObject = new Photo();
        } else {
          fileObject = new File();
        }
        fileObject.setOwner(owner);

        String parentFolderId = request.getParameter("parentFolder");
        Folder parentFolder = null;
        if (parentFolderId != null && !"".equals(parentFolderId)) {
          parentFolder = (Folder) session.load(Folder.class, new Long(parentFolderId));
          if (!SecurityHelper.doesUserHavePermission(session, owner, parentFolder, PERM.WRITE)) {
            Cookie cookie = new Cookie(item.getFieldName(), "");
            cookie.setMaxAge(0);
            cookie.setPath("/");
            response.addCookie(cookie);
            response.sendError(HttpServletResponse.SC_FORBIDDEN);
            response.setStatus(HttpServletResponse.SC_FORBIDDEN);
            response.flushBuffer();
            Logger.log("Unauthorized upload requested: " + request.getRemoteAddr());
            return;
          }
        }
        fileObject.setParent(parentFolder);

        fileObject.setContentType(item.getContentType());
        String name = item.getName();
        if (name.lastIndexOf("/") >= 0) {
          name = name.substring(name.lastIndexOf("/") + 1);
        }
        if (name.lastIndexOf("\\") >= 0) {
          name = name.substring(name.lastIndexOf("\\") + 1);
        }

        fileObject.setName(name);
        fileObject.setDescription(name);
        session.save(fileObject);

        status.setStatus(FileUploadStatus.WRITING_FILE);
        java.io.File outputPath = new java.io.File(java.io.File.separatorChar + "tmp" + java.io.File.separatorChar + BaseSystem.getDomainName(request));
        java.io.File outputFile = new java.io.File(outputPath, fileObject.getId() + "_" + fileObject.getName());
        outputPath.mkdirs();
        item.write(outputFile);
        tx = session.beginTransaction();
        fileObject.setNameOnDisk(fileObject.getId() + "_" + fileObject.getName());
        fileObject.setSize(outputFile.length());
        session.save(fileObject);
        tx.commit();
        Logger.log("Wrote to file: " + outputFile.getCanonicalPath());

        status.setStatus(FileUploadStatus.WRITING_DATABASE);
        saveFileFromStream(fileObject, new FileInputStream(outputFile));

        try {

          // if we are uploading a photo, create slideshow (sane size) image and thumbnail
          if (fileObject instanceof Photo) {
            // convert file to png for faster inclusion in thumbnails
            BufferedImage bi = javax.imageio.ImageIO.read(outputFile);
            ByteArrayOutputStream pngOut = new ByteArrayOutputStream();
            ImageIO.write(bi, "png", pngOut);

            tx = session.beginTransaction();
            Photo photo = (Photo) fileObject;
            photo.setWidth(bi.getWidth());
            photo.setHeight(bi.getHeight());

            PhotoThumbnail thumbFile = new PhotoThumbnail();
            thumbFile.setHidden(true);
            thumbFile.setOwner(owner);
            thumbFile.setParent(parentFolder);
            thumbFile.setName(createFileName("", name, "_thumb"));
            thumbFile.setDescription("Thumbnail for " + name);
            session.save(thumbFile);

            PhotoThumbnail previewFile = new PhotoThumbnail();
            previewFile.setHidden(true);
            previewFile.setOwner(owner);
            previewFile.setParent(parentFolder);
            previewFile.setName(createFileName("", name, "_preview"));
            previewFile.setDescription("Preview image for " + name);
            session.save(previewFile);
           
            PhotoThumbnail slideFile = new PhotoThumbnail();
            slideFile.setHidden(true);
            slideFile.setOwner(owner);
            slideFile.setParent(parentFolder);
            slideFile.setName(createFileName("", name, "_slideshow"));
            slideFile.setDescription("Slideshow image for " + name);
            session.save(slideFile);

           
            photo.setThumbnailImage(thumbFile);
            photo.setSlideshowImage(slideFile);
            photo.setPreviewImage(previewFile);

           
            ByteArrayInputStream pngIn = new ByteArrayInputStream(pngOut.toByteArray());

            ByteArrayOutputStream thumbOutStream = new ByteArrayOutputStream();
View Full Code Here

Examples of org.focusns.model.photo.Photo

    @RequestMapping("photo-edit")
    public String doEdit(@RequestParam(required = false) Long albumId, @WidgetAttribute Project project,
                         @WidgetAttribute ProjectUser projectUser, Model model) {
        //
        Photo photo = new Photo();
        photo.setAlbumId(albumId==null?0:albumId);
        photo.setProjectId(project.getId());
        photo.setCreatedById(projectUser.getId());
        model.addAttribute("photo", photo);
        //
        List<Album> albums = albumService.listAlbums(project.getId());
        model.addAttribute("albums", albums);
        //
View Full Code Here

Examples of org.osforce.connect.entity.gallery.Photo

      model.put("event", event);
    } else if(StringUtils.equals(Album.NAME, activity.getEntity())) {
      Album album = albumService.getAlbum(activity.getLinkedId());
      model.put("album", album);
    } else if(StringUtils.equals(Photo.NAME, activity.getEntity())) {
      Photo photo = photoService.getPhoto(activity.getLinkedId());
      model.put("photo", photo);
    } else if(StringUtils.equals(Question.NAME, activity.getEntity())) {
      Question question = questionService.getQuestion(activity.getLinkedId());
      model.put("question", question);
    } else if(StringUtils.equals(Answer.NAME, activity.getEntity())) {
View Full Code Here

Examples of org.osforce.connect.entity.gallery.Photo

 
  @RequestMapping("/detail-view")
  @Permission({"photo-view"})
  public String doDetailView(@RequestParam(required=false) Long albumId,
      @RequestParam(required=false) Long photoId, Model model) {
    Photo photo = null;
    if(albumId!=null) {
      List<Photo> photos = photoService.getPhotoList(albumId);
      photo = photos.get(0);
    }
    if(photoId!=null) {
View Full Code Here

Examples of org.osforce.connect.entity.gallery.Photo

  }
 
  @RequestMapping(value="/delete-action", method=RequestMethod.GET)
  @Permission(value={"photo-edit"}, userRequired=true)
  public String doDeleteAction(@RequestParam Long photoId, WebRequest request) {
    Photo photo = photoService.getPhoto(photoId);
    String uniqueId = photo.getAlbum().getProject().getUniqueId();
    Long albumId = photo.getAlbumId();
    // delete from session
    syncSessionPhotoList(photo, request, true);
    // delete from database
    AttachmentUtil.delete(photo.getRealFile());
    attachmentService.deleteAttachment(photo.getRealFileId());
    photoService.deletePhoto(photoId);
    return String.format("redirect:/%s/gallery/photo/form?albumId=%s", uniqueId, albumId);
  }
View Full Code Here

Examples of org.osforce.connect.entity.gallery.Photo

  }

  @Override
  protected void doTask(Map<Object, Object> context) throws Exception {
    Long photoId = (Long) context.get("photoId");
    Photo photo = photoService.getPhoto(photoId);
    String template = (String) context.get("template");
    Activity activity = new Activity();
    activity.setLinkedId(photoId);
    activity.setEntity(Photo.NAME);
    activity.setType(Photo.NAME);
    activity.setDescription(template);
    activity.setFormat(Activity.FORMAT_FTL);
    activity.setProjectId(photo.getAlbum().getProjectId());
    activity.setEnteredId(photo.getModifiedId());
    activityService.createActivity(activity);
  }
View Full Code Here

Examples of org.osforce.connect.entity.gallery.Photo

  }

  @AfterReturning("execution(* org.osforce.connect.service.gallery.PhotoService.createPhoto(..)) ||" +
  "execution(* org.osforce.connect.service.gallery.PhotoService.updatePhoto(..))")
  public void updatePhoto(JoinPoint jp) {
    Photo photo = (Photo) jp.getArgs()[0];
    Map<Object, Object> context = CollectionUtil.newHashMap();
    context.put("photoId", photo.getId());
    context.put("template", TEMPLATE_PHOTO_UPDATE);
    photoActivityStreamTask.doAsyncTask(context);
  }
View Full Code Here

Examples of org.springframework.social.foursquare.api.Photo

  public void get() {
    mockServer.expect(requestTo("https://api.foursquare.com/v2/photos/PHOTO_ID?oauth_token=ACCESS_TOKEN&v=20110609"))
      .andExpect(method(GET))
      .andRespond(withResponse(new ClassPathResource("testdata/photo.json", getClass()), responseHeaders));
   
    Photo photo = foursquare.photoOperations().get("PHOTO_ID");
    assertEquals("4d0fb8162d39a340637dc42b", photo.getId());
    mockServer.verify();
  }
View Full Code Here

Examples of org.teleal.cling.support.model.item.Photo

       
        upnpItem = getUpnpMusicTrackFromSmdTrackEntity((ResultItem<TrackEntity>)browsedItem, objectID, filters);
       
      } else if (browsedItem.getType().equals("LastFMImage") ) {
        ResultItemImage smdImage = browsedItem.getImage();    
        Photo upnpPhoto = new Photo();
          upnpItem = upnpPhoto;
         
        // Mandatory elements:
          upnpPhoto.setTitle("unknown");
          upnpPhoto.setAlbum("unknown");
          upnpPhoto.setWriteStatus(WriteStatus.NOT_WRITABLE);
          upnpPhoto.setCreator("LastFM");
          upnpPhoto.setId(objectID+"/"+browsedItem.getId());
          upnpPhoto.setClazz(new org.teleal.cling.support.model.DIDLObject.Class("object.item.imageItem.photo"));
          Res url = new Res();
          upnpPhoto.addResource(url);
          url.setValue(smdImage.getUrl());
          if(url.getValue().endsWith(".png")) {
            url.setProtocolInfo(new ProtocolInfo("http-get:*:image/png:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS="));
          } else if(url.getValue().endsWith(".jpg")) {
            url.setProtocolInfo(new ProtocolInfo("http-get:*:image/jpeg:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS="));
 
View Full Code Here

Examples of org.w3._2005.atom.Photo

    public Photo getPhotoById(
        @WebParam(name = "albumId", partName = "albumId")
        int albumId,
        @WebParam(name = "photoId", partName = "photoId")
        int photoId){
      Photo photo = new Photo();
      photo.setHeight(photoId);
      photo.setWidth(albumId);
      return photo;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.