-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FORGE-2076: Added command to generate DAOs from JPA Entities
- Loading branch information
Salem Elrahal
committed
Oct 15, 2014
1 parent
4ef30a6
commit fb54b2f
Showing
24 changed files
with
877 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
javaee/api/src/main/java/org/jboss/forge/addon/javaee/jpa/dao/DaoGenerationContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package org.jboss.forge.addon.javaee.jpa.dao; | ||
|
||
import org.jboss.forge.addon.projects.Project; | ||
import org.jboss.forge.roaster.model.source.JavaClassSource; | ||
|
||
/** | ||
* Parameters for DAO resource generation. | ||
* | ||
* @author <a href="salem.elrahal@gmail.com">Salem Elrahal</a> | ||
* | ||
*/ | ||
public class DaoGenerationContext | ||
{ | ||
private Project project; | ||
private JavaClassSource entity; | ||
private String targetPackageName; | ||
private String persistenceUnitName; | ||
|
||
public JavaClassSource getEntity() | ||
{ | ||
return entity; | ||
} | ||
|
||
public void setEntity(JavaClassSource entity) | ||
{ | ||
this.entity = entity; | ||
} | ||
|
||
public String getTargetPackageName() | ||
{ | ||
return targetPackageName; | ||
} | ||
|
||
public void setTargetPackageName(String targetPackageName) | ||
{ | ||
this.targetPackageName = targetPackageName; | ||
} | ||
|
||
public String getPersistenceUnitName() | ||
{ | ||
return persistenceUnitName; | ||
} | ||
|
||
public void setPersistenceUnitName(String persistenceUnitName) | ||
{ | ||
this.persistenceUnitName = persistenceUnitName; | ||
} | ||
|
||
public Project getProject() | ||
{ | ||
return project; | ||
} | ||
|
||
public void setProject(Project project) | ||
{ | ||
this.project = project; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
javaee/api/src/main/java/org/jboss/forge/addon/javaee/jpa/dao/DaoResourceGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.jboss.forge.addon.javaee.jpa.dao; | ||
|
||
import java.util.List; | ||
|
||
import org.jboss.forge.roaster.model.source.JavaClassSource; | ||
|
||
/** | ||
* Generates a DAO resource based on a JPA entity. | ||
* | ||
* @author <a href="salem.elrahal@gmail.com">Salem Elrahal</a> | ||
* | ||
*/ | ||
public interface DaoResourceGenerator | ||
{ | ||
/** | ||
* A readable description for this strategy | ||
*/ | ||
String getName(); | ||
|
||
/** | ||
* A human-readable description for this strategy | ||
*/ | ||
String getDescription(); | ||
|
||
/** | ||
* Generate a Dao based on a context | ||
*/ | ||
List<JavaClassSource> generateFrom(DaoGenerationContext context) throws Exception; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.