Examples of PhotoStrategy


Examples of com.gracevallorani.jpa.factories.PhotoStrategy

    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());
    }
View Full Code Here

Examples of com.gracevallorani.jpa.factories.PhotoStrategy

    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) {
        strategy.add(photo);             
      } else {
        strategy.refresh(photo);
     
    } finally {
      strategy.close();
    }
       
    return JSP_DISPLAY;   
  }
View Full Code Here

Examples of com.gracevallorani.jpa.factories.PhotoStrategy

    return JSP_DISPLAY;   
  }

  @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();
    }
 
    return JSP_DISPLAY;   
  }
View Full Code Here

Examples of com.gracevallorani.jpa.factories.PhotoStrategy

public class PhotoController {
  @RequestMapping(value = "index", method = RequestMethod.GET)
  public String showIndex(
      @RequestParam(value = "color", required = false, defaultValue = "true") String color,     
      Model model) {
    PhotoStrategy strategy = new PhotoStrategy(new J2eeConfig());
   
    try {
      model.addAttribute("list", Utils.createRowList(strategy.getAll(), 3));
      model.addAttribute("color", color.equals("true"));
      return "/WEB-INF/website/photos/index.jsp";
    } finally {
      strategy.close();
    }
  }
View Full Code Here

Examples of com.gracevallorani.jpa.factories.PhotoStrategy

  @RequestMapping(value = "show", method = RequestMethod.GET)
  public String showShow(
      Model model, 
      @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";
      }
     
      model.addAttribute("photoFile", filename);
      return "/WEB-INF/website/photos/show.jsp";
    } finally {
      strategy.close();
    }
  } 
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.