Package com.gracevallorani.jpa.entities

Examples of com.gracevallorani.jpa.entities.Photo


      try {
        int photoOrder = 0;
       
        for (Storage o: storages) {
          PhotoInternalStorage storage = (PhotoInternalStorage)o;
          Photo photo = new Photo();
          photo.setFullSizeBW(storage.getFullSizeBW());
          photo.setFullSizeColor(storage.getFullSizeColor());
          photo.setThumbnailBW(storage.getThumbnailBW());
          photo.setThumbnailColor(storage.getThumbnailColor());
          photo.setOrder(photoOrder++);
         
          entity.persist(photo);
        }       
      } finally {
        trans.commit();
View Full Code Here


      Model model,
      @RequestParam(value = "id", required = false, defaultValue = "0") int id) {
    form.setId(id);
   
    if (id != 0) {
      Photo photo;
     
      IJpaFactory<Photo> strategy = new PhotoStrategy(new J2eeConfig());
     
      try {
        photo = strategy.get(id);           
      } finally {
        strategy.close();
      }

      form.setId(id);
      form.setOrder(photo.getOrder());
    }
   
    return JSP_EDIT;
  }
View Full Code Here

  public String postEdit(@Valid PhotoForm form, BindingResult result, Model model) throws Exception {
    if (result.hasErrors()) {
      return JSP_EDIT;
    }
   
    Photo photo;
    IJpaFactory<Photo> strategy = new PhotoStrategy(new J2eeConfig());
    strategy.setTransactional(true);
   
    try {
      if (form.getId() == 0) {
        photo = new Photo();
      } else {
        photo = strategy.get(form.getId());
      }     

      photo.setOrder(form.getOrder());
           
      setPhotoWithThumb(form, photo, true);
      setPhotoWithThumb(form, photo, false);

      if (form.getId() == 0) {
View Full Code Here

  @RequestMapping(value = "delete", method = RequestMethod.GET)
  public String getDelete(@RequestParam(value = "id", required = true, defaultValue = "0") int id) throws Exception {   
    IJpaFactory<Photo> strategy = new PhotoStrategy(new J2eeConfig());
       
    try {
      Photo photo = strategy.get(id);
      strategy.setTransactional(true);
      strategy.delete(photo);
    } finally {
      strategy.close();
    }
View Full Code Here

      @RequestParam(value = "id", required = true) int id,
      @RequestParam(value = "color", required = false, defaultValue = "true") String color)  {
    PhotoStrategy strategy = new PhotoStrategy(new J2eeConfig());
   
    try {
      Photo photo = strategy.get(id);
     
      if (photo == null) {
        return "/photos/index.gve";
      }
     
      String filename = (color.endsWith("true") ? photo.getFullSizeColor() : photo.getFullSizeBW());
     
      if (filename == null) {
        return "/photos/index.gve";
      }
     
View Full Code Here

TOP

Related Classes of com.gracevallorani.jpa.entities.Photo

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.