Professional Documents
Culture Documents
Clase dominio
package pe.com.sbfi.domain;
import java.io.Serializable;
import javax.persistence.*;
import pe.com.sbfi.domain.pk.ComponenteProyectoPK;
import java.util.List;
/**
* The persistent class for the COMPONENTE_PROYECTO database table.
*
*/
@Entity
@Table(name="COMPONENTE_PROYECTO")
@NamedQuery(name="ComponenteProyecto.findAll", query="SELECT c
FROM ComponenteProyecto c")
public class ComponenteProyecto implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private ComponenteProyectoPK id;
@Column(name="COSTO_TOTAL")
private String costoTotal;
@Column(name="FECHA_FINALIZACION")
private String fechaFinalizacion;
@Column(name="FECHA_FINALIZACION_ESTIMADO")
private String fechaFinalizacionEstimado;
@Column(name="FECHA_INICIO_EFECTIVO")
private String fechaInicioEfectivo;
@Column(name="FECHA_INICIO_PROGRMADO")
private String fechaInicioProgrmado;
private String meta;
@Column(name="NOMBRE_COMPONENTE")
private String nombreComponente;
@Column(name="TIEMPO_EJECUCION")
private String tiempoEjecucion;
@Column(name="UNIDAD_MEDIDA")
private String unidadMedida;
//bi-directional many-to-one association to ActividadProyecto
@ManyToOne
@JoinColumns({
@JoinColumn(name="ID_ACTVIDAD_PROYECTO",
referencedColumnName="ID_ACTVIDAD_PROYECTO"),
@JoinColumn(name="ID_EQUIPO",
referencedColumnName="ID_EQUIPO"),
@JoinColumn(name="ID_MATERIAL",
referencedColumnName="ID_MATERIAL"),
@JoinColumn(name="ID_PARTIDA_PROYECTO",
referencedColumnName="ID_PARTIDA_PROYECTO"),
@JoinColumn(name="ID_RECURSO_HUMANO",
referencedColumnName="ID_RECURSO_HUMANO"),
@JoinColumn(name="ID_SERVICIO",
referencedColumnName="ID_SERVICIO")
})
private ActividadProyecto actividadProyecto;
//bi-directional many-to-one association to EjecucionProyecto
@OneToMany(mappedBy="componenteProyecto")
private List<EjecucionProyecto> ejecucionProyectos;
public ComponenteProyecto() {
}
public ComponenteProyectoPK getId() {
return this.id;
}
public void setId(ComponenteProyectoPK id) {
this.id = id;
}
public String getCostoTotal() {
return this.costoTotal;
}
public void setCostoTotal(String costoTotal) {
this.costoTotal = costoTotal;
}
this.nombreComponente = nombreComponente;
}
public String getTiempoEjecucion() {
return this.tiempoEjecucion;
}
public void setTiempoEjecucion(String tiempoEjecucion) {
this.tiempoEjecucion = tiempoEjecucion;
}
public String getUnidadMedida() {
return this.unidadMedida;
}
public void setUnidadMedida(String unidadMedida) {
this.unidadMedida = unidadMedida;
}
public ActividadProyecto getActividadProyecto() {
return this.actividadProyecto;
}
public void setActividadProyecto(ActividadProyecto
actividadProyecto) {
this.actividadProyecto = actividadProyecto;
}
public List<EjecucionProyecto> getEjecucionProyectos() {
return this.ejecucionProyectos;
}
public void setEjecucionProyectos(List<EjecucionProyecto>
ejecucionProyectos) {
this.ejecucionProyectos = ejecucionProyectos;
}
public EjecucionProyecto addEjecucionProyecto(EjecucionProyecto
ejecucionProyecto) {
getEjecucionProyectos().add(ejecucionProyecto);
ejecucionProyecto.setComponenteProyecto(this);
return ejecucionProyecto;
}
public EjecucionProyecto
removeEjecucionProyecto(EjecucionProyecto ejecucionProyecto) {
getEjecucionProyectos().remove(ejecucionProyecto);
ejecucionProyecto.setComponenteProyecto(null);
return ejecucionProyecto;
}
}
Clase Modelo
package pe.com.sbfi.model;
import java.util.List;
import pe.com.sbfi.domain.PartidaProyecto;
public interface ComponenteProyectoModel {
public List<Object[]>
listComponenteProyecto(ComponenteProyectoModel
componenteProyectoModel);
public Integer countComponenteProyecto(ComponenteProyectoModel
componenteProyectoModel);
public void insertComponenteProyecto(ComponenteProyectoModel
componenteProyectoModel);
}
Clase modelo implementacin
package pe.com.sbfi.model.impl;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import pe.com.sbfi.model.ComponenteProyectoModel;
@Repository
@Transactional("sbfiTM")
public class ComponenteProyectoModelImpl implements
ComponenteProyectoModel {
Logger logger = Logger.getLogger(PartidaProyectoModelImpl.class);
@PersistenceContext(unitName = "sbfiJpa")
private EntityManager em;
@Override
public List<Object[]> listComponenteProyecto(
ComponenteProyectoModel componenteProyectoModel)
{
// TODO Auto-generated method stub
return null;
}
@Override
public Integer countComponenteProyecto(
ComponenteProyectoModel componenteProyectoModel)
{
// TODO Auto-generated method stub
return null;
}
@Override
public void insertComponenteProyecto(
ComponenteProyectoModel componenteProyectoModel)
{
// TODO Auto-generated method stub
}
}
Ejecucin proyecto
Clase dominio
package pe.com.sbfi.domain;
import java.io.Serializable;
import javax.persistence.*;
import pe.com.sbfi.domain.pk.EjecucionProyectoPK;
/**
* The persistent class for the EJECUCION_PROYECTO database table.
*
*/
@Entity
@Table(name="EJECUCION_PROYECTO")
@NamedQuery(name="EjecucionProyecto.findAll", query="SELECT e FROM
EjecucionProyecto e")
return this.id;
}
public void setId(EjecucionProyectoPK id) {
this.id = id;
}
public String getCostoDirecto() {
return this.costoDirecto;
}
public void setCostoDirecto(String costoDirecto) {
this.costoDirecto = costoDirecto;
}
public String getCostoTotalProyecto() {
return this.costoTotalProyecto;
}
public void setCostoTotalProyecto(String costoTotalProyecto) {
this.costoTotalProyecto = costoTotalProyecto;
}
public String getGastoSupervision() {
return this.gastoSupervision;
}
public void setGastoSupervision(String gastoSupervision) {
this.gastoSupervision = gastoSupervision;
}
public String getGastosGenerales() {
return this.gastosGenerales;
}
public void setGastosGenerales(String gastosGenerales) {
this.gastosGenerales = gastosGenerales;
}
public ComponenteProyecto getComponenteProyecto() {
return this.componenteProyecto;
}
public void setComponenteProyecto(ComponenteProyecto
componenteProyecto) {
this.componenteProyecto = componenteProyecto;
}
EjecucionProyectoModel {
Logger logger = Logger.getLogger(PartidaProyectoModelImpl.class);
@PersistenceContext(unitName = "sbfiJpa")
private EntityManager em;
@Override
public List<Object[]> listEjecucionProyecto(
EjecucionProyecto componenteProyectoModel) {
// TODO Auto-generated method stub
return null;
}
@Override
public Integer countEjecucionProyecto(
EjecucionProyecto componenteProyectoModel) {
// TODO Auto-generated method stub
return null;
}
@Override
public void insertEjecucionProyecto(
EjecucionProyecto componenteProyectoModel) {
// TODO Auto-generated method stub
}
}
Expediente tcnico
Clase dominio
package pe.com.sbfi.domain;
import
import
import
import
java.io.Serializable;
javax.persistence.*;
java.net.URL;
java.util.Date;
/**
* The persistent class for the EXPEDIENTE_TECNICO database table.
*
*/
@Entity
@Table(name="EXPEDIENTE_TECNICO")
@PersistenceContext(unitName = "sbfiJpa")
private EntityManager em;
@Override
public List<Object[]> listExpedienteTecnico(
ExpedienteTecnico expedienteTecnico) {
// TODO Auto-generated method stub
return null;
}
@Override
public Integer countExpedienteTecnico(ExpedienteTecnico
expedienteTecnico) {
// TODO Auto-generated method stub
return null;
}
@Override
public void insertExpedienteTecnico(ExpedienteTecnico
expedienteTecnico) {
// TODO Auto-generated method stub
}
}
Objetivo proyecto
Clase dominio
package pe.com.sbfi.domain;
import java.io.Serializable;
import javax.persistence.*;
import pe.com.sbfi.domain.pk.ObjetivoProyectoPK;
/**
* The persistent class for the OBJETIVO_PROYECTO database table.
*
*/
@Entity
@Table(name="OBJETIVO_PROYECTO")
@NamedQuery(name="ObjetivoProyecto.findAll", query="SELECT o FROM
ObjetivoProyecto o")
public class ObjetivoProyecto implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private ObjetivoProyectoPK id;
@Column(name="NOMBRE_OBJETIVO")
private String nombreObjetivo;
//bi-directional many-to-one association to ObjetivoEspecifico
@ManyToOne
@JoinColumn(name="ID_OBJ_ESPECIFICO")
private ObjetivoEspecifico objetivoEspecifico;
public ObjetivoProyecto() {
}
public ObjetivoProyectoPK getId() {
return this.id;
}
public void setId(ObjetivoProyectoPK id) {
this.id = id;
}
import org.springframework.transaction.annotation.Transactional;
import pe.com.sbfi.model.ObjetivoProyectoModel;
@Repository
@Transactional("sbfiTM")
public class ObjetivoProyectoModelImpl implements
ObjetivoProyectoModel{
Logger logger = Logger.getLogger(ObjetivoProyectoModelImpl.class);
@PersistenceContext(unitName = "sbfiJpa")
private EntityManager em;
@Override
public List<Object[]> listObjetivoProyectoModel(
ObjetivoProyectoModel objetivoProyectoModel) {
// TODO Auto-generated method stub
return null;
}
@Override
public Integer countObjetivoProyectoModel(
ObjetivoProyectoModel objetivoProyectoModel) {
// TODO Auto-generated method stub
return null;
}
@Override
public void insertObjetivoProyectoModel(
ObjetivoProyectoModel objetivoProyectoModel) {
// TODO Auto-generated method stub
}
}
Partida Proyecto
Clase dominio
package pe.com.sbfi.domain;
import java.io.Serializable;
import javax.persistence.*;
import pe.com.sbfi.domain.pk.PartidaProyectoPK;
import java.util.List;
/**
* The persistent class for the PARTIDA_PROYECTO database table.
*
*/
@Entity
@Table(name="PARTIDA_PROYECTO")
@NamedQuery(name="PartidaProyecto.findAll", query="SELECT p FROM
PartidaProyecto p")
public class PartidaProyecto implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private PartidaProyectoPK id;
@Column(name="NOMBRE_PARTIDA")
private String nombrePartida;
//bi-directional many-to-one association to ActividadProyecto
@OneToMany(mappedBy="partidaProyecto")
private List<ActividadProyecto> actividadProyectos;
//bi-directional many-to-one association to Equipo
@ManyToOne
@JoinColumn(name="ID_EQUIPO")
private Equipo equipo;
//bi-directional many-to-one association to Materiale
@ManyToOne
@JoinColumn(name="ID_MATERIAL")
private Materiale materiale;
//bi-directional many-to-one association to RecursoHumano
@ManyToOne
@JoinColumn(name="ID_RECURSO_HUMANO")
private RecursoHumano recursoHumano;
//bi-directional many-to-one association to Servicio
@ManyToOne
@JoinColumn(name="ID_SERVICIO")
private Servicio servicio;
public PartidaProyecto() {
}
public PartidaProyectoPK getId() {
return this.id;
}
public void setId(PartidaProyectoPK id) {
this.id = id;
}
public String getNombrePartida() {
return this.nombrePartida;
}
public void setNombrePartida(String nombrePartida) {
this.nombrePartida = nombrePartida;
}
public List<ActividadProyecto> getActividadProyectos() {
return this.actividadProyectos;
}
public void setActividadProyectos(List<ActividadProyecto>
actividadProyectos) {
this.actividadProyectos = actividadProyectos;
}
public ActividadProyecto addActividadProyecto(ActividadProyecto
actividadProyecto) {
getActividadProyectos().add(actividadProyecto);
actividadProyecto.setPartidaProyecto(this);
return actividadProyecto;
}
public ActividadProyecto removeActividadProyecto(ActividadProyecto
actividadProyecto) {
getActividadProyectos().remove(actividadProyecto);
actividadProyecto.setPartidaProyecto(null);
return actividadProyecto;
}
public Equipo getEquipo() {
return this.equipo;
}
public void setEquipo(Equipo equipo) {
this.equipo = equipo;
}
public Materiale getMateriale() {
return this.materiale;
}
public void setMateriale(Materiale materiale) {
this.materiale = materiale;
}
public RecursoHumano getRecursoHumano() {
return this.recursoHumano;
}
public void setRecursoHumano(RecursoHumano recursoHumano) {
this.recursoHumano = recursoHumano;
}
public Servicio getServicio() {
return this.servicio;
}
public void setServicio(Servicio servicio) {
this.servicio = servicio;
}
}
Clase modelo
package pe.com.sbfi.model;
import java.util.List;
import pe.com.sbfi.domain.PartidaProyecto;
public interface PartidaProyectoModel {
@Repository
@Transactional("sbfiTM")
public class PartidaProyectoModelImpl implements PartidaProyectoModel{
Logger logger = Logger.getLogger(PartidaProyectoModelImpl.class);
@PersistenceContext(unitName = "sbfiJpa")
private EntityManager em;
@Override
public List<Object[]> listPartidaProyectoModel(
PartidaProyecto partidaProyecto) {
// TODO Auto-generated method stub
return null;
}
@Override
public Integer countPartidaProyectoModel(PartidaProyecto
partidaProyecto) {
// TODO Auto-generated method stub
return null;
}
@Override
}
Recurso humano
Clase dominio
package pe.com.sbfi.domain;
import
import
import
import
java.io.Serializable;
javax.persistence.*;
java.math.BigDecimal;
java.util.List;
/**
* The persistent class for the RECURSO_HUMANO database table.
*
*/
@Entity
@Table(name="RECURSO_HUMANO")
@NamedQuery(name="RecursoHumano.findAll", query="SELECT r FROM
RecursoHumano r")
public class RecursoHumano implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="ID_RECURSO_HUMANO")
private String idRecursoHumano;
@Column(name="CANTIDAD_RRHH")
private BigDecimal cantidadRrhh;
private double costo;
@Column(name="NOMBRE_RRHH")
private String nombreRrhh;
@Column(name="UNIDAD_RRHH")
private String unidadRrhh;
package pe.com.sbfi.model.impl;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import pe.com.sbfi.domain.RecursoHumano;
import pe.com.sbfi.model.RecursoHumanoModel;
@Repository
@Transactional("sbfiTM")
public class RecursoHumanoModelImpl implements RecursoHumanoModel {
Logger logger = Logger.getLogger(PartidaProyectoModelImpl.class);
@PersistenceContext(unitName = "sbfiJpa")
private EntityManager em;
@Override
public List<Object[]> listRecursoHumano(RecursoHumano
recursoHumano) {
// TODO Auto-generated method stub
return null;
}
@Override
public Integer countRecursoHumano(RecursoHumano
recursoHumano) {
// TODO Auto-generated method stub
return null;
}
@Override
public void insertRecursoHumano(RecursoHumano recursoHumano) {
// TODO Auto-generated method stub
}
}
Conexin a base de datos
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/lang
http://www.springframework.org/schema/lang/spring-lang-3.2.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.2.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd
">
<context:component-scan base-package="pe.com.sbfi" />
<context:annotation-config/>
<task:annotation-driven/>
<context:property-placeholder
location="classpath:pe/com/sbfi/resource/sbfi-jdbc.properties,
classpath:pe/com/sbfi/resource/sbfi-email.properties" />
<!-- Inicio config cache -->
<cache:annotation-driven cache-manager="sbfiCacheManager" />
<bean id="sbfiCacheManager"
class="org.springframework.cache.ehcache.EhCacheCacheManager">
<property name="cacheManager" ref="sbfiEhcache"/>
</bean>
<bean id="sbfiEhcache"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation"
value="classpath:pe/com/sbfi/resource/sbfi-ehcache.xml"/>
</bean>
<!-- Fin config cache -->
<!-Setup local data source -->
<bean id="sbfiDS"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="$
{database.driver}"></property>
<property name="url" value="${database.url}"></property>
<property name="username" value="$
{database.username}"></property>
<property name="password" value="$
{database.password}"></property>
</bean>
<import resource="classpath:pe/com/sbfi/resource/sbfi-jpa-entitymanager.xml" />
<!-- -->
<import resource="classpath:pe/com/sbfi/resource/sbfi-transactionaop.xml" />
<import resource="classpath:pe/com/sbfi/resource/sbfi-email.xml" />
</beans>
<ehcache>
<defaultCache eternal="false" maxElementsInMemory="100"
overflowToDisk="false" />
<cache name="sbfiCache"
maxElementsInMemory="10000"
maxElementsOnDisk="10000000"
eternal="false"
overflowToDisk="true"
timeToIdleSeconds="600"
timeToLiveSeconds="1800"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>
#
#
#
#
#
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="sbfiDS" />
<property name="persistenceXmlLocation" value="classpath:METAINF/sbfi-persistence.xml"/>
<property name="persistenceUnitName"
value="sbfiJpa"></property>
<property name="jpaProperties">
<props>
<prop key="hibernate.validator.apply_to_ddl">false</prop>
<prop
key="hibernate.validator.autoregister_listeners">false</prop>
</props>
</property>
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="$
{jpa.showSql}"></property>
<property name="generateDdl" value="$
{jpa.generateDdl}"></property>
<property name="databasePlatform" value="$
{hibernate.dialect}"></property>
</bean>
</property>
</bean>
<!-- Spring acting as JPA container for creation of Entity Manager -->
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProce
ssor" />
<!-<bean id="fonafeJpaTemplate"
class="org.springframework.orm.jpa.JpaTemplate">
<property name="entityManagerFactory"
ref="fonafeEntityManagerFactory" />
</bean>
-->
</beans>