Skip to content

Instantly share code, notes, and snippets.

@agoncal
Created March 4, 2015 17:17
Show Gist options
  • Select an option

  • Save agoncal/563a99cd3b2ee7fb196e to your computer and use it in GitHub Desktop.

Select an option

Save agoncal/563a99cd3b2ee7fb196e to your computer and use it in GitHub Desktop.
public class JPANewEmbeddableCommand extends AbstractJPACommand<JavaClassSource>
{
@Inject
private PersistenceOperations persistenceOperations;
@Override
public Metadata getMetadata(UIContext context)
{
return Metadata.from(super.getMetadata(context), getClass())
.name("JPA: New Embeddable")
.description("Create a new JPA Embeddable");
}
@Override
protected String getType()
{
return "JPA Embeddable";
}
@Override
protected Class<JavaClassSource> getSourceType()
{
return JavaClassSource.class;
}
@Override
public JavaClassSource decorateSource(UIExecutionContext context, Project project, JavaClassSource source)
throws Exception
{
JavaResource javaResource = persistenceOperations.newEmbeddableEntity(project, getNamed().getValue(),
getTargetPackage().getValue());
return javaResource.getJavaType();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment