@Action("List")
 public void list(
     ObjectCache objectCache,
     ValuesProvider provider,
     HttpServletResponse response,
     ModelViewRegister viewFactory)
     throws IOException {
   View view = new MergedTextView("excelexport/show.freemarker");
   String root = provider.getApplicationRoot();
   new TemplateCompositeModelView(false, view.asText(new EmptyContext(), root), getTitle(), "")
       .renderTo(objectCache, provider, response, new EmptyContext(), new QueryKeyViolations());
 }
Exemplo n.º 2
0
 @Action("Update")
 public void update(
     ObjectCache objectCache,
     ValuesProvider provider,
     HttpServletResponse response,
     ModelViewRegister viewFactory)
     throws IOException {
   PersonModel person =
       objectCache.retrieveByIdentity(
           PersonModel.class, provider.getIdentity(), ObjectState.Pending, ObjectState.Active);
   if (person == null) {
     new JsonView(Collections.singletonMap("error", "Person cannot be found"))
         .renderTo(new EmptyContext(), response, provider.getApplicationRoot());
   } else if (provider.getBoolean("activate", Boolean.FALSE).equals(Boolean.TRUE)) {
     person.activate();
     objectCache.save(person);
     new JsonView(Collections.singletonMap("identity", person.getIdentity()))
         .renderTo(new EmptyContext(), response, provider.getApplicationRoot());
   } else {
     new JsonView(Collections.singletonMap("error", "Person not activated"))
         .renderTo(new EmptyContext(), response, provider.getApplicationRoot());
   }
 }