INTSAMPLES-28 Pushed .aj deletes

This commit is contained in:
Gary Russell
2011-08-19 13:37:23 -04:00
committed by Mark Fisher
parent 2db4473aa0
commit d87f141e83
6 changed files with 0 additions and 334 deletions

View File

@@ -1,12 +0,0 @@
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).
package org.springframework.integration.samples.loanbroker.loanshark.domain;
import org.springframework.beans.factory.annotation.Configurable;
privileged aspect LoanShark_Roo_Configurable {
declare @type: LoanShark: @Configurable;
}

View File

@@ -1,106 +0,0 @@
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).
package org.springframework.integration.samples.loanbroker.loanshark.domain;
import java.lang.Integer;
import java.lang.Long;
import java.lang.SuppressWarnings;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.EntityManager;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PersistenceContext;
import javax.persistence.Version;
import org.springframework.integration.samples.loanbroker.loanshark.domain.LoanShark;
import org.springframework.transaction.annotation.Transactional;
privileged aspect LoanShark_Roo_Entity {
@PersistenceContext
transient EntityManager LoanShark.entityManager;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long LoanShark.id;
@Version
@Column(name = "version")
private Integer LoanShark.version;
public Long LoanShark.getId() {
return this.id;
}
public void LoanShark.setId(Long id) {
this.id = id;
}
public Integer LoanShark.getVersion() {
return this.version;
}
public void LoanShark.setVersion(Integer version) {
this.version = version;
}
@Transactional
public void LoanShark.persist() {
if (this.entityManager == null) this.entityManager = entityManager();
this.entityManager.persist(this);
}
@Transactional
public void LoanShark.remove() {
if (this.entityManager == null) this.entityManager = entityManager();
if (this.entityManager.contains(this)) {
this.entityManager.remove(this);
} else {
LoanShark attached = this.entityManager.find(this.getClass(), this.id);
this.entityManager.remove(attached);
}
}
@Transactional
public void LoanShark.flush() {
if (this.entityManager == null) this.entityManager = entityManager();
this.entityManager.flush();
}
@Transactional
public LoanShark LoanShark.merge() {
if (this.entityManager == null) this.entityManager = entityManager();
LoanShark merged = this.entityManager.merge(this);
this.entityManager.flush();
return merged;
}
public static final EntityManager LoanShark.entityManager() {
EntityManager em = new LoanShark().entityManager;
if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
return em;
}
public static long LoanShark.countLoanSharks() {
return ((Number) entityManager().createQuery("select count(o) from LoanShark o").getSingleResult()).longValue();
}
@SuppressWarnings("unchecked")
public static List<LoanShark> LoanShark.findAllLoanSharks() {
return entityManager().createQuery("select o from LoanShark o").getResultList();
}
public static LoanShark LoanShark.findLoanShark(Long id) {
if (id == null) return null;
return entityManager().find(LoanShark.class, id);
}
@SuppressWarnings("unchecked")
public static List<LoanShark> LoanShark.findLoanSharkEntries(int firstResult, int maxResults) {
return entityManager().createQuery("select o from LoanShark o").setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
}
}

View File

@@ -1,20 +0,0 @@
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).
package org.springframework.integration.samples.loanbroker.loanshark.domain;
import java.lang.String;
import javax.persistence.EntityManager;
import javax.persistence.Query;
privileged aspect LoanShark_Roo_Finder {
public static Query LoanShark.findLoanSharksByName(String name) {
if (name == null || name.length() == 0) throw new IllegalArgumentException("The name argument is required");
EntityManager em = LoanShark.entityManager();
Query q = em.createQuery("SELECT LoanShark FROM LoanShark AS loanshark WHERE loanshark.name = :name");
q.setParameter("name", name);
return q;
}
}

View File

@@ -1,36 +0,0 @@
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).
package org.springframework.integration.samples.loanbroker.loanshark.domain;
import java.lang.Double;
import java.lang.Long;
import java.lang.String;
privileged aspect LoanShark_Roo_JavaBean {
public String LoanShark.getName() {
return this.name;
}
public void LoanShark.setName(String name) {
this.name = name;
}
public Long LoanShark.getCounter() {
return this.counter;
}
public void LoanShark.setCounter(Long counter) {
this.counter = counter;
}
public Double LoanShark.getAverageRate() {
return this.averageRate;
}
public void LoanShark.setAverageRate(Double averageRate) {
this.averageRate = averageRate;
}
}

View File

@@ -1,20 +0,0 @@
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).
package org.springframework.integration.samples.loanbroker.loanshark.domain;
import java.lang.String;
privileged aspect LoanShark_Roo_ToString {
public String LoanShark.toString() {
StringBuilder sb = new StringBuilder();
sb.append("Id: ").append(getId()).append(", ");
sb.append("Version: ").append(getVersion()).append(", ");
sb.append("Name: ").append(getName()).append(", ");
sb.append("Counter: ").append(getCounter()).append(", ");
sb.append("AverageRate: ").append(getAverageRate());
return sb.toString();
}
}

View File

@@ -1,140 +0,0 @@
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).
package org.springframework.integration.samples.loanbroker.loanshark.web;
import java.lang.Long;
import java.lang.String;
import javax.validation.Valid;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.integration.samples.loanbroker.loanshark.domain.LoanShark;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
privileged aspect SharkController_Roo_Controller {
@RequestMapping(method = RequestMethod.POST)
public String SharkController.create(@Valid LoanShark loanShark, BindingResult result, Model model) {
if (result.hasErrors()) {
model.addAttribute("loanShark", loanShark);
return "loansharks/create";
}
loanShark.persist();
return "redirect:/loansharks/" + loanShark.getId();
}
@RequestMapping(params = "form", method = RequestMethod.GET)
public String SharkController.createForm(Model model) {
model.addAttribute("loanShark", new LoanShark());
return "loansharks/create";
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String SharkController.show(@PathVariable("id") Long id, Model model) {
model.addAttribute("loanshark", LoanShark.findLoanShark(id));
model.addAttribute("itemId", id);
return "loansharks/show";
}
@RequestMapping(method = RequestMethod.GET)
public String SharkController.list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model model) {
if (page != null || size != null) {
int sizeNo = size == null ? 10 : size.intValue();
model.addAttribute("loansharks", LoanShark.findLoanSharkEntries(page == null ? 0 : (page.intValue() - 1) * sizeNo, sizeNo));
float nrOfPages = (float) LoanShark.countLoanSharks() / sizeNo;
model.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
} else {
model.addAttribute("loansharks", LoanShark.findAllLoanSharks());
}
return "loansharks/list";
}
@RequestMapping(method = RequestMethod.PUT)
public String SharkController.update(@Valid LoanShark loanShark, BindingResult result, Model model) {
if (result.hasErrors()) {
model.addAttribute("loanShark", loanShark);
return "loansharks/update";
}
loanShark.merge();
return "redirect:/loansharks/" + loanShark.getId();
}
@RequestMapping(value = "/{id}", params = "form", method = RequestMethod.GET)
public String SharkController.updateForm(@PathVariable("id") Long id, Model model) {
model.addAttribute("loanShark", LoanShark.findLoanShark(id));
return "loansharks/update";
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public String SharkController.delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model model) {
LoanShark.findLoanShark(id).remove();
model.addAttribute("page", (page == null) ? "1" : page.toString());
model.addAttribute("size", (size == null) ? "10" : size.toString());
return "redirect:/loansharks?page=" + ((page == null) ? "1" : page.toString()) + "&size=" + ((size == null) ? "10" : size.toString());
}
@RequestMapping(params = { "find=ByName", "form" }, method = RequestMethod.GET)
public String SharkController.findLoanSharksByNameForm(Model model) {
return "loansharks/findLoanSharksByName";
}
@RequestMapping(params = "find=ByName", method = RequestMethod.GET)
public String SharkController.findLoanSharksByName(@RequestParam("name") String name, Model model) {
model.addAttribute("loansharks", LoanShark.findLoanSharksByName(name).getResultList());
return "loansharks/list";
}
Converter<LoanShark, String> SharkController.getLoanSharkConverter() {
return new Converter<LoanShark, String>() {
public String convert(LoanShark loanShark) {
return new StringBuilder().append(loanShark.getName()).append(" ").append(loanShark.getCounter()).append(" ").append(loanShark.getAverageRate()).toString();
}
};
}
@InitBinder
void SharkController.registerConverters(WebDataBinder binder) {
if (binder.getConversionService() instanceof GenericConversionService) {
GenericConversionService conversionService = (GenericConversionService) binder.getConversionService();
conversionService.addConverter(getLoanSharkConverter());
}
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET, headers = "Accept=application/json")
@ResponseBody
public String SharkController.showJson(@PathVariable("id") Long id) {
return LoanShark.findLoanShark(id).toJson();
}
@RequestMapping(method = RequestMethod.POST, headers = "Accept=application/json")
public ResponseEntity<String> SharkController.createFromJson(@RequestBody String json) {
LoanShark.fromJsonToLoanShark(json).persist();
return new ResponseEntity<String>("LoanShark created", HttpStatus.CREATED);
}
@RequestMapping(headers = "Accept=application/json")
@ResponseBody
public String SharkController.listJson() {
return LoanShark.toJsonArray(LoanShark.findAllLoanSharks());
}
@RequestMapping(value = "/jsonArray", method = RequestMethod.POST, headers = "Accept=application/json")
public ResponseEntity<String> SharkController.createFromJsonArray(@RequestBody String json) {
for (LoanShark loanshark: LoanShark.fromJsonArrayToLoanSharks(json)) {
loanshark.persist();
}
return new ResponseEntity<String>("LoanShark created", HttpStatus.CREATED);
}
}