Skip to main content
summaryrefslogtreecommitdiffstats
blob: 47d8e979ef227ee3cd4dca4874a4aced112c65f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<%@ jet package="org.eclipse.jpt.ui" 
	imports="org.eclipse.jpt.ui.internal.wizards.entity.data.model.* java.util.* " 
	class="AnnotatedEntityTemplate" 
%>
<% CreateEntityTemplateModel model = (CreateEntityTemplateModel) argument; 
if (model.getJavaPackageName()!=null && model.getJavaPackageName()!="") { %>package <%=model.getJavaPackageName()%>;<%}%>

<% Collection<String> imports = model.getImports(false);
for (String anImport : imports) { %>
import <%=anImport%>;
<% } %>

/**
 * Entity implementation class for Entity: <%=model.getEntityName()%>
 *
 */
<%=model.getArtifactType()%><%String ENTITY_NAME = model.getEntityName();
if (model.isEntityNameSet()) {%>(name="<%=ENTITY_NAME%>")<%}%>
<%if (model.isTableNameSet()) {%>
@Table(name="<%=model.getTableName()%>")<%}%>
<%=model.getInheritanceStrategy()%>
<%if (model.isCompositePK()) {%>
@IdClass(<%=model.getIdClassName()%>.class)<%}%>
public class <%=model.getClassName()%><%String superClass = model.getSuperclassName();
	if (! "".equals(superClass)) {%> extends <%=superClass%><%}%><%
	List interfaces = model.getInterfaces(); 
	if (interfaces.size()>0) {%> implements <% }
	for (int i=0; i<interfaces.size(); i++) {
 		String INTERFACE = (String) interfaces.get(i);
		if (i>0) { %>, <%}%><%=INTERFACE%><%}%> {

	<% List<EntityRow> fields = model.getEntityFields();
	List<String> pkFields = model.getPKFields(); 
 	for (EntityRow entity : fields) {
		String NAME = entity.getName();
		if (pkFields.contains(NAME) && model.isFieldAccess()) {
    %>   
	@Id<%}%>
	private <%=entity.getType()%> <%=entity.getName()%>;<%}%>
	private static final long serialVersionUID = 1L;

	public <%=model.getClassName()%>() {
		super();
	}
   <%
	fields = model.getEntityFields();
	if (fields != null) for (int i=0; i<fields.size(); i++) {
		EntityRow field = (EntityRow) fields.get(i);
		String TYPE = field.getType();
		String NAME = field.getName();
		String METHOD = NAME.substring(0,1).toUpperCase() + NAME.substring(1);
	if (pkFields.contains(NAME) && !model.isFieldAccess()) {
    %>   
	@Id <%}%>   
	public <%=TYPE%> get<%=METHOD%>() {
		return this.<%=NAME%>;
	}

	public void set<%=METHOD%>(<%=TYPE%> <%=NAME%>) {
		this.<%=NAME%> = <%=NAME%>;
	}
   <%}%>
   
}

Back to the top