template.conf.sit_javaee6.java-input-model.vm Maven / Gradle / Ivy
#parse("/java-class.vm")
package $model.pkg;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import ${model.appRootPkg}.domain.${model.entity.domainPkg}.*;
import ${model.appRootPkg}.web.infra.BaseInputModel;
import ${model.appRootPkg}.web.infra.RequestParam;
@ManagedBean
@ViewScoped
public class $model.pname extends BaseInputModel<${model.entity.domain}Entity, $model.entity.idType, ${model.entity.domain}Service> implements Serializable {
@Inject
${model.entity.domain}Service service;
#foreach ($field in $model.fields)
#field($field "jsf")
#end
#foreach ($field in $model.fields)
#accessor($field)
#end
@Override
protected ${model.entity.domain}Service getService() {
return service;
}
@Override
protected $model.entityId.type getEntityId() {
#if ($model.entity.hasEmbeddedId())
if (id == null) {
id = new ${model.entityId.type}(#getId($model.entity.embeddedId));
}
return id;
#else
return get${model.entityId.pnamePascal}();
#end
}
}
##
#macro(getId $embeddedId)
#foreach ($field in $embeddedId.ids)
#if ($velocityCount > 1), #end get${field.pnamePascal}()
#end
#end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy