]
George Gastaldi closed FORGE-2321.
----------------------------------
Fix Version/s: 2.16.1.Final
(was: 2.x Future)
Resolution: Done
Refactor common code into the xxxOperations classes
---------------------------------------------------
Key: FORGE-2321
URL:
https://issues.jboss.org/browse/FORGE-2321
Project: Forge
Issue Type: Enhancement
Components: UI - API
Affects Versions: 2.16.0.Final
Reporter: Antonio Goncalves
Assignee: Antonio Goncalves
Fix For: 2.16.1.Final
At the moment the class {{JPANewFieldWizard}} defines code as follow :
{code}
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;
}
{code}
This code should go into the {{PersistenceOperations}} class. There are other places like
that.