Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-2321

Refactor common code into the xxxOperations classes

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 2.16.1.Final
    • 2.16.0.Final
    • UI - API
    • None

      At the moment the class JPANewFieldWizard defines code as follow :

         private List<JavaResource> getProjectEntities(Project project)
         {
            final List<JavaResource> entities = new ArrayList<>();
            if (project != null)
            {
               project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaResourceVisitor()
               {
                  @Override
                  public void visit(VisitContext context, JavaResource resource)
                  {
                     try
                     {
                        JavaSource<?> javaSource = resource.getJavaType();
                        if (javaSource.hasAnnotation(Entity.class) || javaSource.hasAnnotation(Embeddable.class)
                                 || javaSource.hasAnnotation(MappedSuperclass.class))
                        {
                           entities.add(resource);
                        }
                     }
                     catch (ResourceException | FileNotFoundException e)
                     {
                        // ignore
                     }
                  }
               });
            }
            return entities;
         }
      

      This code should go into the PersistenceOperations class. There are other places like that.

              agoncal Antonio Goncalves (Inactive)
              agoncal Antonio Goncalves (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: