Examples of PersistenceFacet


Examples of org.jboss.forge.spec.javaee.PersistenceFacet

      return result;
   }

   private JavaClass promptForEntity()
   {
      PersistenceFacet scaffold = project.getFacet(PersistenceFacet.class);
      List<JavaClass> entities = scaffold.getAllEntities();
      List<String> entityNames = new ArrayList<String>();
      for (JavaClass javaClass : entities)
      {
         String fullName = javaClass.getPackage();
         if (!fullName.isEmpty())
View Full Code Here

Examples of org.jboss.forge.spec.javaee.PersistenceFacet

   @DefaultCommand
   public void show(final PipeOut out, @Option(name = "all", shortName = "a") final boolean showAll)
   {
      if (project.hasFacet(PersistenceFacet.class))
      {
         PersistenceFacet jpa = project.getFacet(PersistenceFacet.class);
         PersistenceDescriptor config = jpa.getConfig();

         ShellMessages.info(out, "Displaying current JPA configuration:");

         if (!config.listUnits().isEmpty())
            out.println();
View Full Code Here

Examples of org.jboss.forge.spec.javaee.PersistenceFacet

            @Option(name = "jdbcPassword") final String jdbcPassword,
            @Option(name = "named", defaultValue = DEFAULT_UNIT_NAME) final String unitName,
            final PipeOut out)
   {
      installPersistence();
      PersistenceFacet jpa = project.getFacet(PersistenceFacet.class);
      PersistenceDescriptor config = jpa.getConfig();

      PersistenceUnitDef unit = config.persistenceUnit(unitName);

      unit.name(unitName).description(DEFAULT_UNIT_DESC);

      JPADataSource ds = new JPADataSource()
               .setJndiDataSource(jtaDataSource)
               .setDatabaseType(databaseType)
               .setJdbcDriver(jdbcDriver)
               .setDatabaseURL(jdbcURL)
               .setUsername(jdbcUsername)
               .setPassword(jdbcPassword);

      PersistenceContainer container = jpac.getContainer(manager);
      PersistenceProvider provider = jpap.getProvider(manager);

      unit.provider(provider.getProvider());
      container.setupConnection(unit, ds);
      provider.configure(unit, ds);

      jpa.saveConfig(config);

      installAdditionalDependencies(out, container, jpap, provider, providerVersion);
   }
View Full Code Here

Examples of org.jboss.forge.spec.javaee.PersistenceFacet

            @Option(required = false,
                     name = "package",
                     type = PromptType.JAVA_PACKAGE,
                     description = "The package name") final String packageName) throws FileNotFoundException
   {
      final PersistenceFacet jpa = project.getFacet(PersistenceFacet.class);
      final JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);

      String entityPackage;

      if ((packageName != null) && !"".equals(packageName))
      {
         entityPackage = packageName;
      }
      else if (getPackagePortionOfCurrentDirectory() != null)
      {
         entityPackage = getPackagePortionOfCurrentDirectory();
      }
      else
      {
         entityPackage = shell.promptCommon(
                   "In which package you'd like to create this @Entity, or enter for default:",
                   PromptType.JAVA_PACKAGE, jpa.getEntityPackage());
      }

      JavaClass javaClass = JavaParser.create(JavaClass.class)
               .setPackage(entityPackage)
               .setName(entityName)
View Full Code Here

Examples of org.jboss.forge.spec.javaee.PersistenceFacet

   private JavaClass findEntity(final String entity) throws FileNotFoundException
   {
      JavaClass result = null;

      PersistenceFacet scaffold = project.getFacet(PersistenceFacet.class);
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);

      if (entity != null)
      {
         result = getJavaClassFrom(java.getJavaResource(entity));
         if (result == null)
         {
            result = getJavaClassFrom(java.getJavaResource(scaffold.getEntityPackage() + "." + entity));
         }
      }

      if (result == null)
      {
View Full Code Here

Examples of org.jboss.forge.spec.javaee.PersistenceFacet

      return result;
   }

   private JavaClass promptForEntity()
   {
      PersistenceFacet scaffold = project.getFacet(PersistenceFacet.class);
      List<JavaClass> entities = scaffold.getAllEntities();
      List<String> entityNames = new ArrayList<String>();
      for (JavaClass javaClass : entities)
      {
         String fullName = javaClass.getPackage();
         if (!fullName.isEmpty())
View Full Code Here

Examples of org.jboss.forge.spec.javaee.PersistenceFacet

   private JavaClass findEntity(final String entity) throws FileNotFoundException
   {
      JavaClass result = null;

      PersistenceFacet scaffold = project.getFacet(PersistenceFacet.class);
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);

      if (entity != null)
      {
         result = getJavaClassFrom(java.getJavaResource(entity));
         if (result == null)
         {
            result = getJavaClassFrom(java.getJavaResource(scaffold.getEntityPackage() + "." + entity));
         }
      }

      if (result == null)
      {
View Full Code Here

Examples of org.jboss.forge.spec.javaee.PersistenceFacet

      return result;
   }

   private JavaClass promptForEntity()
   {
      PersistenceFacet scaffold = project.getFacet(PersistenceFacet.class);
      List<JavaClass> entities = scaffold.getAllEntities();
      List<String> entityNames = new ArrayList<String>();
      for (JavaClass javaClass : entities)
      {
         String fullName = javaClass.getPackage();
         if (!fullName.isEmpty())
View Full Code Here

Examples of org.jboss.forge.spec.javaee.PersistenceFacet

   private String getPersistenceUnitName()
   {
      // This is currently limited to accessing the persistence units of the current project only, and not of
      // dependencies (like an EJB module with a PU that is accessible on the classpath, but not in WEB-INF/lib).
      PersistenceFacet persistence = project.getFacet(PersistenceFacet.class);
      PersistenceDescriptor persistenceDescriptor = persistence.getConfig();
      List<PersistenceUnitDef> units = persistenceDescriptor.listUnits();
     
      // If there is only one PU, then use it irrespective of whether it excludes unlisted classes or not.
      if (units.size() == 1)
      {
View Full Code Here

Examples of org.jboss.forge.spec.javaee.PersistenceFacet

   @DefaultCommand
   public void show(final PipeOut out, @Option(name = "all", shortName = "a") final boolean showAll)
   {
      if (project.hasFacet(PersistenceFacet.class))
      {
         PersistenceFacet jpa = project.getFacet(PersistenceFacet.class);
         PersistenceDescriptor config = jpa.getConfig();

         ShellMessages.info(out, "Displaying current JPA configuration:");

         if (!config.listUnits().isEmpty())
            out.println();
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.