ItEr41S20CUGravacionModelosUnidadesTraballoItEr40S25: Creating initial template classes and associated mappings.
This commit is contained in:
parent
ae64046c5f
commit
8863cdd369
8 changed files with 216 additions and 0 deletions
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* This file is part of ###PROJECT_NAME###
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.navalplanner.business.templates.entities;
|
||||
|
||||
import org.hibernate.validator.Min;
|
||||
import org.hibernate.validator.Valid;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.orders.entities.InfoComponent;
|
||||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
public abstract class OrderElementTemplate extends BaseEntity {
|
||||
|
||||
private InfoComponent infoComponent;
|
||||
|
||||
private Integer startAsDaysFromBeginning;
|
||||
|
||||
private Integer deadlineAsDaysFromBeginning;
|
||||
|
||||
private OrderLineGroupTemplate parent;
|
||||
|
||||
@Valid
|
||||
private InfoComponent getInfoComponent() {
|
||||
if (infoComponent == null) {
|
||||
infoComponent = new InfoComponent();
|
||||
}
|
||||
return infoComponent;
|
||||
}
|
||||
|
||||
@Min(0)
|
||||
public Integer getDeadlineAsDaysFromBeginning() {
|
||||
return deadlineAsDaysFromBeginning;
|
||||
}
|
||||
|
||||
@Min(0)
|
||||
public Integer getStartAsDaysFromBeginning() {
|
||||
return startAsDaysFromBeginning;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return getInfoComponent().getCode();
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return getInfoComponent().getDescription();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return getInfoComponent().getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* This file is part of ###PROJECT_NAME###
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.navalplanner.business.templates.entities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
public class OrderLineGroupTemplate extends OrderElementTemplate {
|
||||
|
||||
private List<OrderElementTemplate> children = new ArrayList<OrderElementTemplate>();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* This file is part of ###PROJECT_NAME###
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.navalplanner.business.templates.entities;
|
||||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
public class OrderLineTemplate extends OrderElementTemplate {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* This file is part of ###PROJECT_NAME###
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.navalplanner.business.templates.entities;
|
||||
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.navalplanner.business.calendars.entities.BaseCalendar;
|
||||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
public class OrderTemplate extends OrderLineGroupTemplate {
|
||||
|
||||
@NotNull(message = "order calendar not specified")
|
||||
private BaseCalendar calendar;
|
||||
|
||||
}
|
||||
|
|
@ -30,6 +30,9 @@
|
|||
<value>
|
||||
org/navalplanner/business/orders/entities/Orders.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/templates/entities/Templates.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/planner/entities/Tasks.hbm.xml
|
||||
</value>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
<?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.templates.entities" default-access="field">
|
||||
|
||||
<class name="OrderElementTemplate" abstract="true">
|
||||
<id name="id" access="property" type="long">
|
||||
<generator class="hilo" >
|
||||
<param name="max_lo">100</param>
|
||||
</generator>
|
||||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
<component name="infoComponent" class="org.navalplanner.business.orders.entities.InfoComponent">
|
||||
<property name="name" access="field" />
|
||||
<property name="description" access="field" />
|
||||
<property name="code" access="field"/>
|
||||
</component>
|
||||
<property name="startAsDaysFromBeginning" />
|
||||
<property name="deadlineAsDaysFromBeginning" />
|
||||
|
||||
<many-to-one name="parent" access="field" />
|
||||
|
||||
<joined-subclass name="OrderLineGroupTemplate">
|
||||
<key column="GROUP_TEMPLATE_ID"></key>
|
||||
<list name="children" access="field" cascade="all">
|
||||
<key column="parent" not-null="false"></key>
|
||||
<index column="positionInContainer"></index>
|
||||
<one-to-many class="OrderElementTemplate" />
|
||||
</list>
|
||||
|
||||
<joined-subclass name="OrderTemplate">
|
||||
<key column="ORDER_TEMPLATE_ID"></key>
|
||||
<many-to-one name="calendar" column="BASE_CALENDAR_ID" cascade="none"
|
||||
class="org.navalplanner.business.calendars.entities.BaseCalendar"/>
|
||||
</joined-subclass>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="OrderLineTemplate">
|
||||
<key column="ORDER_LINE_TEMPLATE_ID"></key>
|
||||
</joined-subclass>
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
||||
|
|
@ -39,6 +39,9 @@
|
|||
<value>
|
||||
org/navalplanner/business/orders/entities/Orders.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/templates/entities/Templates.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/planner/entities/Tasks.hbm.xml
|
||||
</value>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@
|
|||
<value>
|
||||
org/navalplanner/business/orders/entities/Orders.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/templates/entities/Templates.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/planner/entities/Tasks.hbm.xml
|
||||
</value>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue