Package org.jboss.seam.render.template

Examples of org.jboss.seam.render.template.CompiledTemplateResource


            ShellMessages.error(out, "Skipping class because @Id type [" + idType + "] is not supported by endpoint generation.");
            continue;
         }
         String idSetterName = resolveIdSetterName(entity);

         CompiledTemplateResource template = compiler.compileResource(getClass().getResourceAsStream(
                 "/org/jboss/forge/rest/Endpoint.jv"));

         Map<Object, Object> map = new HashMap<Object, Object>();
         map.put("entity", entity);
         map.put("idType", idType);
         map.put("setIdStatement", idSetterName);
         map.put("contentType", contentType);
         map.put("entityTable", getEntityTable(entity));

         JavaClass endpoint = JavaParser.parse(JavaClass.class, template.render(map));
         endpoint.addImport(entity.getQualifiedName());
         endpoint.setPackage(java.getBasePackage() + ".rest");
         endpoint.getAnnotation(Path.class).setStringValue("/" + getEntityTable(entity).toLowerCase());

         /*
 
View Full Code Here


            continue;
         }
         String idSetterName = resolveIdSetterName(entity);
         String idGetterName = resolveIdGetterName(entity);

         CompiledTemplateResource template = compiler.compileResource(getClass().getResourceAsStream(
                  "/org/jboss/forge/rest/Endpoint.jv"));

         Map<Object, Object> map = new HashMap<Object, Object>();
         map.put("entity", entity);
         map.put("idType", idType);
         map.put("setIdStatement", idSetterName);
         map.put("getIdStatement", idGetterName);
         map.put("contentType", contentType);
         String entityTable = getEntityTable(entity);
         map.put("entityTable", entityTable);
         map.put("resourcePath", entityTable.toLowerCase() + "s");

         JavaClass resource = JavaParser.parse(JavaClass.class, template.render(map));
         resource.addImport(entity.getQualifiedName());
         resource.setPackage(java.getBasePackage() + ".rest");

         /*
          * Save the sources
View Full Code Here

            continue;
         }
         String idSetterName = resolveIdSetterName(entity);
         String idGetterName = resolveIdGetterName(entity);

         CompiledTemplateResource template = compiler.compileResource(getClass().getResourceAsStream(
                  "/org/jboss/forge/rest/Endpoint.jv"));

         Map<Object, Object> map = new HashMap<Object, Object>();
         map.put("entity", entity);
         map.put("idType", idType);
         map.put("setIdStatement", idSetterName);
         map.put("getIdStatement", idGetterName);
         map.put("contentType", contentType);
         String entityTable = getEntityTable(entity);
         map.put("entityTable", entityTable);
         map.put("resourcePath", entityTable.toLowerCase() + "s");

         JavaClass resource = JavaParser.parse(JavaClass.class, template.render(map));
         resource.addImport(entity.getQualifiedName());
         resource.setPackage(java.getBasePackage() + ".rest");

         /*
          * Save the sources
View Full Code Here

      Map<Object, Object> context = new HashMap<Object, Object>();
      context.put("name", className);
      context.put("alias", pluginAlias);

      CompiledTemplateResource pluginSource = compiler.compileResource(getClass().getResourceAsStream(
               "/org/jboss/forge/dev/PluginTemplate.jv"));
      CompiledTemplateResource testSource = compiler.compileResource(getClass().getResourceAsStream(
               "/org/jboss/forge/dev/PluginTemplateTest.jv"));

      JavaResource pluginResource = java.saveJavaSource(JavaParser.parse(JavaClass.class, pluginSource.render(context))
               .setPackage(packg));
      java.saveTestJavaSource(JavaParser.parse(JavaClass.class, testSource.render(context)).setPackage(packg));

      pickup.fire(new PickupResource(pluginResource));
   }
View Full Code Here

                     + "] is not supported by endpoint generation.");
            continue;
         }
         String idSetterName = resolveIdSetterName(entity);

         CompiledTemplateResource template = compiler.compileResource(getClass().getResourceAsStream(
                  "/org/jboss/forge/rest/Endpoint.jv"));

         Map<Object, Object> map = new HashMap<Object, Object>();
         map.put("entity", entity);
         map.put("idType", idType);
         map.put("setIdStatement", idSetterName);
         map.put("contentType", contentType);
         map.put("entityTable", getEntityTable(entity));

         JavaClass endpoint = JavaParser.parse(JavaClass.class, template.render(map));
         endpoint.addImport(entity.getQualifiedName());
         endpoint.setPackage(java.getBasePackage() + ".rest");
         endpoint.getAnnotation(Path.class).setStringValue("/" + getEntityTable(entity).toLowerCase());

         /*
 
View Full Code Here

   private static final String VIEW_TEMPLATE = "org/jboss/forge/web/empty-view.xhtml";

   @Command("new-view")
   public void newView(final PipeOut out, @Option(name = "target") final Resource<?> target)
   {
      CompiledTemplateResource viewTemplate = compiler.get().compile(VIEW_TEMPLATE);
      if (!target.exists())
      {
         ((FileResource<?>) target).createNewFile();
         ((FileResource<?>) target).setContents(viewTemplate.render());
      }
      else if (prompt.promptBoolean("File exists. Overwrite with blank view?"))
      {
         ((FileResource<?>) target).setContents(viewTemplate.render());
      }
      else
      {
         throw new RuntimeException("Aborted. File exists [" + target.getFullyQualifiedName() + "].");
      }
View Full Code Here

   private static final String VIEW_TEMPLATE = "org/jboss/forge/web/empty-view.xhtml";

   @Command("new-view")
   public void newView(final PipeOut out, @Option(name = "target") final Resource<?> target)
   {
      CompiledTemplateResource viewTemplate = compiler.get().compile(VIEW_TEMPLATE);
      if (!target.exists())
      {
         ((FileResource<?>) target).createNewFile();
         ((FileResource<?>) target).setContents(viewTemplate.render());
      }
      else if (prompt.promptBoolean("File exists. Overwrite with blank view?"))
      {
         ((FileResource<?>) target).setContents(viewTemplate.render());
      }
      else
      {
         throw new RuntimeException("Aborted. File exists [" + target.getFullyQualifiedName() + "].");
      }
View Full Code Here

                     + "] is not supported by endpoint generation.");
            continue;
         }
         String idSetterName = resolveIdSetterName(entity);

         CompiledTemplateResource template = compiler.compileResource(getClass().getResourceAsStream(
                  "/org/jboss/forge/rest/Endpoint.jv"));

         Map<Object, Object> map = new HashMap<Object, Object>();
         map.put("entity", entity);
         map.put("idType", idType);
         map.put("setIdStatement", idSetterName);
         map.put("contentType", contentType);
         map.put("entityTable", getEntityTable(entity));

         JavaClass endpoint = JavaParser.parse(JavaClass.class, template.render(map));
         endpoint.addImport(entity.getQualifiedName());
         endpoint.setPackage(java.getBasePackage() + ".rest");
         endpoint.getAnnotation(Path.class).setStringValue("/" + getEntityTable(entity).toLowerCase());

         /*
 
View Full Code Here

      Map<Object, Object> context = new HashMap<Object, Object>();
      context.put("name", className);
      context.put("alias", pluginName.replaceAll("[^A-Za-z-]", ""));

      CompiledTemplateResource pluginSource = compiler.compileResource(getClass().getResourceAsStream(
               "/org/jboss/forge/dev/PluginTemplate.jv"));
      CompiledTemplateResource testSource = compiler.compileResource(getClass().getResourceAsStream(
               "/org/jboss/forge/dev/PluginTemplateTest.jv"));

      JavaResource pluginResource = java.saveJavaSource(JavaParser.parse(JavaClass.class, pluginSource.render(context))
               .setPackage(packg));
      java.saveTestJavaSource(JavaParser.parse(JavaClass.class, testSource.render(context)).setPackage(packg));

      pickup.fire(new PickupResource(pluginResource));
   }
View Full Code Here

      {
         JavaClass entity = (JavaClass) (jr).getJavaSource();
         if (!entity.hasAnnotation(XmlRootElement.class))
            entity.addAnnotation(XmlRootElement.class);

         CompiledTemplateResource template = compiler.compileResource(getClass().getResourceAsStream(
                  "/org/jboss/forge/rest/Endpoint.jv"));

         Map<Object, Object> map = new HashMap<Object, Object>();
         map.put("entity", entity);
         map.put("entityTable", getEntityTable(entity));

         JavaClass endpoint = JavaParser.parse(JavaClass.class, template.render(map));
         endpoint.addImport(entity.getQualifiedName());
         endpoint.setPackage(java.getBasePackage() + ".rest");
         endpoint.getAnnotation(Path.class).setStringValue("/" + getEntityTable(entity).toLowerCase());

         /*
 
View Full Code Here

TOP

Related Classes of org.jboss.seam.render.template.CompiledTemplateResource

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.