ItEr17S12CUAltaTipoParteDeTraballo: Create entities for WorkReports
This commit is contained in:
parent
7e501dc30f
commit
1d7532d759
20 changed files with 556 additions and 0 deletions
|
|
@ -28,6 +28,8 @@ public abstract class OrderElement {
|
|||
|
||||
private String description;
|
||||
|
||||
private String code;
|
||||
|
||||
private Set<TaskElement> taskElements = new HashSet<TaskElement>();
|
||||
|
||||
public abstract Integer getWorkHours();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package org.navalplanner.business.workreports.daos;
|
||||
|
||||
import org.navalplanner.business.common.daos.IGenericDao;
|
||||
import org.navalplanner.business.workreports.entities.WorkReport;
|
||||
|
||||
/**
|
||||
* Dao for {@link WorkReport}
|
||||
*
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
public interface IWorkReportDAO extends IGenericDao<WorkReport, Long> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package org.navalplanner.business.workreports.daos;
|
||||
|
||||
import org.navalplanner.business.common.daos.IGenericDao;
|
||||
import org.navalplanner.business.workreports.entities.WorkReportLine;
|
||||
|
||||
/**
|
||||
* Dao for {@link WorkReportLine}
|
||||
*
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
public interface IWorkReportLineDAO extends IGenericDao<WorkReportLine, Long> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package org.navalplanner.business.workreports.daos;
|
||||
|
||||
import org.navalplanner.business.common.daos.IGenericDao;
|
||||
import org.navalplanner.business.workreports.entities.WorkReportType;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* Dao for {@link WorkReportType}
|
||||
*
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
@Repository
|
||||
@Scope(BeanDefinition.SCOPE_SINGLETON)
|
||||
public interface IWorkReportTypeDAO extends IGenericDao<WorkReportType, Long> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package org.navalplanner.business.workreports.daos;
|
||||
|
||||
import org.navalplanner.business.common.daos.impl.GenericDaoHibernate;
|
||||
import org.navalplanner.business.workreports.entities.WorkReport;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* Dao for {@link WorkReportDAO}
|
||||
*
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
@Repository
|
||||
@Scope(BeanDefinition.SCOPE_SINGLETON)
|
||||
public class WorkReportDAO extends GenericDaoHibernate<WorkReport, Long>
|
||||
implements IWorkReportDAO {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package org.navalplanner.business.workreports.daos;
|
||||
|
||||
import org.navalplanner.business.common.daos.impl.GenericDaoHibernate;
|
||||
import org.navalplanner.business.workreports.entities.WorkReportLine;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* Dao for {@link WorkReportLineDAO}
|
||||
*
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
@Repository
|
||||
@Scope(BeanDefinition.SCOPE_SINGLETON)
|
||||
public class WorkReportLineDAO extends
|
||||
GenericDaoHibernate<WorkReportLine, Long> implements IWorkReportLineDAO {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package org.navalplanner.business.workreports.daos;
|
||||
|
||||
import org.navalplanner.business.common.daos.impl.GenericDaoHibernate;
|
||||
import org.navalplanner.business.workreports.entities.WorkReportType;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* Dao for {@link WorkReportTypeDAO}
|
||||
*
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
@Repository
|
||||
@Scope(BeanDefinition.SCOPE_SINGLETON)
|
||||
public class WorkReportTypeDAO extends
|
||||
GenericDaoHibernate<WorkReportType, Long> implements IWorkReportTypeDAO {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package org.navalplanner.business.workreports.entities;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
public class WorkReport {
|
||||
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
|
||||
Date date;
|
||||
|
||||
String place;
|
||||
|
||||
WorkReportType workReportType;
|
||||
|
||||
Set<WorkReportLine> workReportLines;
|
||||
|
||||
public WorkReport() {
|
||||
|
||||
}
|
||||
|
||||
public WorkReport(Date date, String place, WorkReportType workReportType,
|
||||
Set<WorkReportLine> workReportLines) {
|
||||
this.date = date;
|
||||
this.place = place;
|
||||
this.workReportType = workReportType;
|
||||
this.workReportLines = workReportLines;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public String getPlace() {
|
||||
return place;
|
||||
}
|
||||
|
||||
public void setPlace(String place) {
|
||||
this.place = place;
|
||||
}
|
||||
|
||||
public WorkReportType getWorkReportType() {
|
||||
return workReportType;
|
||||
}
|
||||
|
||||
public void setWorkReportType(WorkReportType workReporType) {
|
||||
this.workReportType = workReportType;
|
||||
}
|
||||
|
||||
public Set<WorkReportLine> getWorkReportLines() {
|
||||
return workReportLines;
|
||||
}
|
||||
|
||||
public void setWorkReportLines(Set<WorkReportLine> workReportLines) {
|
||||
this.workReportLines = workReportLines;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package org.navalplanner.business.workreports.entities;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
import org.navalplanner.business.resources.entities.Criterion;
|
||||
import org.navalplanner.business.resources.entities.Resource;
|
||||
|
||||
/**
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
public class WorkReportLine {
|
||||
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
|
||||
Integer numHours;
|
||||
|
||||
Set<Resource> resources;
|
||||
|
||||
Set<OrderElement> orderElements;
|
||||
|
||||
Set<Criterion> criterions;
|
||||
|
||||
public WorkReportLine() {
|
||||
|
||||
}
|
||||
|
||||
public WorkReportLine(Integer numHours, Set<Resource> resources,
|
||||
Set<OrderElement> orderElements, Set<Criterion> criterions) {
|
||||
this.numHours = numHours;
|
||||
this.resources = resources;
|
||||
this.orderElements = orderElements;
|
||||
this.criterions = criterions;
|
||||
}
|
||||
|
||||
public Integer getNumHours() {
|
||||
return numHours;
|
||||
}
|
||||
|
||||
public void setNumHours(Integer numHours) {
|
||||
this.numHours = numHours;
|
||||
}
|
||||
|
||||
public Set<Resource> getResources() {
|
||||
return resources;
|
||||
}
|
||||
|
||||
public void setResources(Set<Resource> resources) {
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
public Set<OrderElement> getOrderElements() {
|
||||
return orderElements;
|
||||
}
|
||||
|
||||
public void setOrderElements(Set<OrderElement> orderElements) {
|
||||
this.orderElements = orderElements;
|
||||
}
|
||||
|
||||
public Set<Criterion> getCriterions() {
|
||||
return criterions;
|
||||
}
|
||||
|
||||
public void setCriterions(Set<Criterion> criterions) {
|
||||
this.criterions = criterions;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package org.navalplanner.business.workreports.entities;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.navalplanner.business.resources.entities.CriterionType;
|
||||
|
||||
/**
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
|
||||
public class WorkReportType {
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
|
||||
String name;
|
||||
|
||||
Set<CriterionType> criterionTypes;
|
||||
|
||||
public WorkReportType() {
|
||||
|
||||
}
|
||||
|
||||
public WorkReportType(String name, Set<CriterionType> criterionTypes) {
|
||||
this.name = name;
|
||||
this.criterionTypes = criterionTypes;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Set<CriterionType> getCriterionTypes() {
|
||||
return criterionTypes;
|
||||
}
|
||||
|
||||
public void setCriterionTypes(Set<CriterionType> criterionTypes) {
|
||||
this.criterionTypes = criterionTypes;
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,9 @@
|
|||
<value>
|
||||
org/navalplanner/business/planner/entities/Tasks.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/workreports/entities/WorkReports.hbm.xml
|
||||
</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
<property name="mandatoryInit" access="field" />
|
||||
<property name="mandatoryEnd" access="field" />
|
||||
<property name="description" access="field" />
|
||||
<property name="code" access="field"/>
|
||||
<set name="taskElements" access="field" cascade="delete">
|
||||
<key column="ORDER_ELEMENT_ID"/>
|
||||
<one-to-many class="org.navalplanner.business.planner.entities.TaskElement"></one-to-many>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||
<hibernate-mapping package="org.navalplanner.business.workreports.entities" default-access="field">
|
||||
|
||||
<!-- WorkReportType -->
|
||||
<class name="WorkReportType" table="WORK_REPORT_TYPE">
|
||||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version name="version" type="long"/>
|
||||
|
||||
<property name="name"/>
|
||||
|
||||
<set name="criterionTypes" cascade="all">
|
||||
<key column="WORK_REPORT_TYPE_ID"/>
|
||||
<one-to-many class="org.navalplanner.business.resources.entities.CriterionType"/>
|
||||
</set>
|
||||
</class>
|
||||
|
||||
<!-- WorkReport -->
|
||||
<class name="WorkReport" table="WORK_REPORT">
|
||||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version name="version" type="long"/>
|
||||
|
||||
<property name="date"/>
|
||||
<property name="place"/>
|
||||
|
||||
<many-to-one name="workReportType" class="WorkReportType" column="WORK_REPORT_TYPE_ID" not-null="true"/>
|
||||
|
||||
<set name="workReportLines" cascade="all">
|
||||
<key column="WORK_REPORT_ID"/>
|
||||
<one-to-many class="WorkReportLine"/>
|
||||
</set>
|
||||
</class>
|
||||
|
||||
<!-- WorkReportLine -->
|
||||
<class name="WorkReportLine" table="WORK_REPORT_LINE">
|
||||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version name="version" type="long"/>
|
||||
|
||||
<property name="numHours"/>
|
||||
|
||||
<set name="resources" cascade="all">
|
||||
<key column="WORK_REPORT_LINE_ID"/>
|
||||
<one-to-many class="org.navalplanner.business.resources.entities.Resource"/>
|
||||
</set>
|
||||
|
||||
<set name="orderElements" cascade="all">
|
||||
<key column="WORK_REPORT_LINE_ID"/>
|
||||
<one-to-many class="org.navalplanner.business.orders.entities.OrderElement"/>
|
||||
</set>
|
||||
|
||||
<set name="criterions" table="CRITERION_WORK_REPORT_LINE" inverse="false">
|
||||
<key column="WORK_REPORT_LINE_ID" not-null="false" />
|
||||
<many-to-many class="org.navalplanner.business.resources.entities.Criterion" column="CRITERION_ID"/>
|
||||
</set>
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package org.navalplanner.business.test.workreports.daos;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.navalplanner.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE;
|
||||
import static org.navalplanner.business.test.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_TEST_FILE;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.navalplanner.business.workreports.daos.IWorkReportDAO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { BUSINESS_SPRING_CONFIG_FILE,
|
||||
BUSINESS_SPRING_CONFIG_TEST_FILE })
|
||||
/*
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
@Transactional
|
||||
public class WorkReportDAOTest {
|
||||
|
||||
@Autowired
|
||||
private IWorkReportDAO workReportDAO;
|
||||
|
||||
@Test
|
||||
public void testSaveWorkReport() {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveWorkReport() {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListWorkReport() {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package org.navalplanner.business.test.workreports.daos;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.navalplanner.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE;
|
||||
import static org.navalplanner.business.test.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_TEST_FILE;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.navalplanner.business.workreports.daos.IWorkReportLineDAO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { BUSINESS_SPRING_CONFIG_FILE,
|
||||
BUSINESS_SPRING_CONFIG_TEST_FILE })
|
||||
/*
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
@Transactional
|
||||
public class WorkReportLineDAOTest {
|
||||
|
||||
@Autowired
|
||||
private IWorkReportLineDAO workReportLineDAO;
|
||||
|
||||
@Test
|
||||
public void testSaveWorkReportLine() {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveWorkReportLine() {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListWorkReportLine() {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package org.navalplanner.business.test.workreports.daos;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.navalplanner.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE;
|
||||
import static org.navalplanner.business.test.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_TEST_FILE;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.navalplanner.business.resources.daos.ICriterionTypeDAO;
|
||||
import org.navalplanner.business.resources.entities.CriterionType;
|
||||
import org.navalplanner.business.test.resources.daos.CriterionTypeDAOTest;
|
||||
import org.navalplanner.business.workreports.daos.IWorkReportTypeDAO;
|
||||
import org.navalplanner.business.workreports.entities.WorkReportType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { BUSINESS_SPRING_CONFIG_FILE,
|
||||
BUSINESS_SPRING_CONFIG_TEST_FILE })
|
||||
/*
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
@Transactional
|
||||
public class WorkReportTypeDAOTest {
|
||||
|
||||
@Autowired
|
||||
private IWorkReportTypeDAO workReportTypeDAO;
|
||||
|
||||
@Autowired
|
||||
private ICriterionTypeDAO criterionTypeDAO;
|
||||
|
||||
@Test
|
||||
public void testSaveWorkReportType() {
|
||||
String unique = UUID.randomUUID().toString();
|
||||
CriterionType criterionType = CriterionTypeDAOTest
|
||||
.createValidCriterionType();
|
||||
criterionTypeDAO.save(criterionType);
|
||||
Set<CriterionType> criterionTypes = new HashSet<CriterionType>();
|
||||
criterionTypes.add(criterionType);
|
||||
|
||||
WorkReportType workReportType = new WorkReportType(unique,
|
||||
criterionTypes);
|
||||
workReportTypeDAO.save(workReportType);
|
||||
assertTrue(workReportTypeDAO.exists(workReportType.getId()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveWorkReportType() {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListWorkReportType() {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package org.navalplanner.business.test.workreports.entities;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
public class WorkReportLineTest {
|
||||
|
||||
@Test
|
||||
public void testWorkReportLineTest() {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.navalplanner.business.test.workreports.entities;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
public class WorkReportTest {
|
||||
|
||||
@Test
|
||||
public void testWorkReportTest() {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.navalplanner.business.test.workreports.entities;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
public class WorkReportTypeTest {
|
||||
|
||||
@Test
|
||||
public void testWorkReportTypeTest() {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -39,6 +39,9 @@
|
|||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/planner/entities/Tasks.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/workreports/entities/WorkReports.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
TestEntities.hbm.xml
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue