Package com.gracevallorani.jpa.factories

Examples of com.gracevallorani.jpa.factories.FeatureFactory


    form.setId(id);
   
    if (id != 0) {
      Feature feature;
     
      IJpaFactory<Feature> strategy = new FeatureFactory(new J2eeConfig());
     
      try {
        feature = strategy.get(id);           
      } finally {
        strategy.close();
      }

      form.setId(id);
      form.setOrder(feature.getOrder());
      form.setSummary(feature.getSummary());
View Full Code Here


    if (result.hasErrors()) {
      return JSP_EDIT;
    }
   
    Feature feature;
    IJpaFactory<Feature> strategy = new FeatureFactory(new J2eeConfig());
    strategy.setTransactional(true);
   
    try {
      if (form.getId() == 0) {
        feature = new Feature();
      } else {
        feature = strategy.get(form.getId());
      }     

      feature.setOrder(form.getOrder());
      feature.setSummary(form.getSummary());
      feature.setTitle(form.getTitle());
      feature.setTrailer(form.getTrailer());
      feature.setTrailerHeight(form.getTrailerHeight());
      feature.setTrailerWidth(form.getTrailerWidth());
      feature.setWebsiteUrl(form.getWebsiteUrl());

      if (form.getId() == 0) {
        strategy.add(feature);             
      } else {
        strategy.refresh(feature);
     
    } finally {
      strategy.close();
    }
       
    return JSP_DISPLAY;   
  }
View Full Code Here

    return JSP_DISPLAY;   
  }

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

public class FeatureController {
  static public final String DATA_KEY = "data";
 
  @RequestMapping(value = "index", method = RequestMethod.GET)
  public String showIndex(Model model) {
    FeatureFactory factory = new FeatureFactory(new J2eeConfig());
   
    try {
      model.addAttribute("list", factory.getAll());
      return "/WEB-INF/website/features/index.jsp";
    } finally {
      factory.close();
    }
  }
View Full Code Here

    }
  }
 
  @RequestMapping(value = "show", method = RequestMethod.GET)
  public String showShow(Model model,  @RequestParam("id") Integer id) {
    FeatureFactory factory = new FeatureFactory(new J2eeConfig());
   
    try {
      model.addAttribute("data", factory.get(id));
      return "/WEB-INF/website/features/show.jsp";
    } finally {
      factory.close();
    }
  } 
View Full Code Here

TOP

Related Classes of com.gracevallorani.jpa.factories.FeatureFactory

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.