From: Vance K. <va...@us...> - 2006-01-18 08:46:11
|
User: vancek Date: 06/01/18 00:46:04 Added: andromda-ejb3/src/main/resources/templates/ejb3 EntityCompositePK.vsl Log: initial revision Revision Changes Path 1.1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityCompositePK.vsl Index: EntityCompositePK.vsl =================================================================== // license-header java merge-point /* Autogenerated by AndroMDA (EntityCompositePK.vsl) - do not edit */ #if ($stringUtils.isNotBlank($entity.packageName)) package $entity.packageName; #end #set ($generatedFile = "${stringUtils.replace($entity.fullyQualifiedEntityCompositePrimaryKeyName,'.','/')}.java") /** * Composite primary key class for ${entity.entityName} entity bean. $entity.getDocumentation(" * ") */ @javax.persistence.Embeddable public class ${entity.entityCompositePrimaryKeyName} implements java.io.Serializable { private static final long serialVersionUID = 1L; #set ($identifiers = $entity.getIdentifiers()) #foreach ($attribute in $identifiers) private $attribute.type.fullyQualifiedName $attribute.name; #end public ${entity.entityCompositePrimaryKeyName}() { // default null constructor } /** * Implementation for the main constructor with all POJO identifier attributes. * #foreach($attribute in $identifiers) * @param $attribute.name Value for the ${attribute.name} property #end */ public ${entity.entityCompositePrimaryKeyName}($entity.getAttributesAsList($identifiers, true, true, true)) { #foreach ($attribute in $identifiers) ${attribute.setterName}(${attribute.name}); #end } #foreach ($attribute in $identifiers) #**##set ($visibility = $attribute.visibility) /** * Get the $attribute.name property. $attribute.getDocumentation(" * ") * @return $attribute.type.fullyQualifiedName The value of ${attribute.name} */ public $attribute.type.fullyQualifiedName ${attribute.getterName}() { return $attribute.name; } /** * Set the $attribute.name property. * @param value the new value */ public void ${attribute.setterName}($attribute.type.fullyQualifiedName value) { this.${attribute.name} = value; } #end public int hashCode() { int result = 0; #foreach($attribute in $identifiers) #**##if ($attribute.type.primitive) #* *##if ($attribute.type.fullyQualifiedName == "java.lang.boolean") result = 37*result + (this.${attribute.name} ? 0 : 1); #* *##else result = 37*result + (int)this.${attribute.name}; #* *##end #**##else result = 37*result + ((this.${attribute.name} != null) ? this.${attribute.name}.hashCode() : 0); #**##end #end return result; } public boolean equals(Object object) { if (object == this) { return true; } if (!(object instanceof ${entity.entityCompositePrimaryKeyName})) { return false; } if (object == null) { return false; } ${entity.entityCompositePrimaryKeyName} pk = (${entity.entityCompositePrimaryKeyName})object; return #set ($totalIdentifiers = $identifiers.size()) #foreach($attribute in $identifiers) #**##if ($attribute.type.fullyQualifiedName == "java.lang.String") #if ($velocityCount > 1)&&#end pk.${attribute.name}.equals(this.${attribute.name})#if ($velocityCount == $totalIdentifiers);#end #**##else #if ($velocityCount > 1)&&#end pk.${attribute.name} == this.${attribute.name}#if ($velocityCount == $totalIdentifiers);#end #**##end #end } } |