diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/CalendarDataDAO.java b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/CalendarDataDAO.java
new file mode 100644
index 000000000..fb2670393
--- /dev/null
+++ b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/CalendarDataDAO.java
@@ -0,0 +1,40 @@
+/*
+ * This file is part of NavalPlan
+ *
+ * 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 .
+ */
+
+package org.navalplanner.business.calendars.daos;
+
+import org.navalplanner.business.calendars.entities.CalendarData;
+import org.navalplanner.business.common.daos.IntegrationEntityDAO;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Repository;
+
+/**
+ * DAO for {@link CalendarData}
+ *
+ * @author Manuel Rego Casasnovas
+ */
+@Repository
+@Scope(BeanDefinition.SCOPE_SINGLETON)
+public class CalendarDataDAO extends
+ IntegrationEntityDAO
+ implements ICalendarDataDAO {
+
+}
diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/CalendarExceptionDAO.java b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/CalendarExceptionDAO.java
new file mode 100644
index 000000000..1863c6b22
--- /dev/null
+++ b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/CalendarExceptionDAO.java
@@ -0,0 +1,40 @@
+/*
+ * This file is part of NavalPlan
+ *
+ * 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 .
+ */
+
+package org.navalplanner.business.calendars.daos;
+
+import org.navalplanner.business.calendars.entities.CalendarException;
+import org.navalplanner.business.common.daos.IntegrationEntityDAO;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Repository;
+
+/**
+ * DAO for {@link CalendarException}
+ *
+ * @author Manuel Rego Casasnovas
+ */
+@Repository
+@Scope(BeanDefinition.SCOPE_SINGLETON)
+public class CalendarExceptionDAO extends
+ IntegrationEntityDAO implements
+ ICalendarExceptionDAO {
+
+}
diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/ICalendarDataDAO.java b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/ICalendarDataDAO.java
new file mode 100644
index 000000000..e1dbf7fed
--- /dev/null
+++ b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/ICalendarDataDAO.java
@@ -0,0 +1,34 @@
+/*
+ * This file is part of NavalPlan
+ *
+ * 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 .
+ */
+
+package org.navalplanner.business.calendars.daos;
+
+import org.navalplanner.business.calendars.entities.CalendarData;
+import org.navalplanner.business.common.daos.IIntegrationEntityDAO;
+
+/**
+ * Contract for {@link CalendarDataDAO}
+ *
+ * @author Manuel Rego Casasnovas
+ */
+public interface ICalendarDataDAO extends
+ IIntegrationEntityDAO {
+
+}
diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/ICalendarExceptionDAO.java b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/ICalendarExceptionDAO.java
new file mode 100644
index 000000000..3db41b8a6
--- /dev/null
+++ b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/ICalendarExceptionDAO.java
@@ -0,0 +1,34 @@
+/*
+ * This file is part of NavalPlan
+ *
+ * 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 .
+ */
+
+package org.navalplanner.business.calendars.daos;
+
+import org.navalplanner.business.calendars.entities.CalendarException;
+import org.navalplanner.business.common.daos.IIntegrationEntityDAO;
+
+/**
+ * Contract for {@link CalendarExceptionDAO}.
+ *
+ * @author Manuel Rego Casasnovas
+ */
+public interface ICalendarExceptionDAO extends
+ IIntegrationEntityDAO {
+
+}
diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarData.java b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarData.java
index f9b474978..27a089c53 100644
--- a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarData.java
+++ b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarData.java
@@ -25,19 +25,19 @@ import java.util.HashMap;
import java.util.Map;
import org.joda.time.LocalDate;
-import org.navalplanner.business.common.BaseEntity;
+import org.navalplanner.business.calendars.daos.ICalendarDataDAO;
+import org.navalplanner.business.common.IntegrationEntity;
+import org.navalplanner.business.common.Registry;
/**
* Represents the information about the calendar that can change through time.
*
* @author Manuel Rego Casasnovas
*/
-public class CalendarData extends BaseEntity {
+public class CalendarData extends IntegrationEntity {
public static CalendarData create() {
- CalendarData calendarData = new CalendarData();
- calendarData.setNewObject(true);
- return calendarData;
+ return create(new CalendarData());
}
private Map hoursPerDay;
@@ -159,4 +159,9 @@ public class CalendarData extends BaseEntity {
return true;
}
+ @Override
+ protected ICalendarDataDAO getIntegrationEntityDAO() {
+ return Registry.getCalendarDataDAO();
+ }
+
}
diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarException.java b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarException.java
index 1abff1058..37c09c721 100644
--- a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarException.java
+++ b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarException.java
@@ -24,7 +24,9 @@ import java.util.Date;
import org.hibernate.validator.NotNull;
import org.joda.time.LocalDate;
-import org.navalplanner.business.common.BaseEntity;
+import org.navalplanner.business.calendars.daos.ICalendarExceptionDAO;
+import org.navalplanner.business.common.IntegrationEntity;
+import org.navalplanner.business.common.Registry;
/**
* Represents an exceptional day that has a different number of hours. For
@@ -34,22 +36,16 @@ import org.navalplanner.business.common.BaseEntity;
*
* @author Manuel Rego Casasnovas
*/
-public class CalendarException extends BaseEntity {
+public class CalendarException extends IntegrationEntity {
public static CalendarException create(Date date, Integer hours,
CalendarExceptionType type) {
- CalendarException exceptionDay = new CalendarException(new LocalDate(
- date), hours, type);
- exceptionDay.setNewObject(true);
- return exceptionDay;
+ return create(new CalendarException(new LocalDate(date), hours, type));
}
public static CalendarException create(LocalDate date, Integer hours,
CalendarExceptionType type) {
- CalendarException exceptionDay = new CalendarException(date, hours,
- type);
- exceptionDay.setNewObject(true);
- return exceptionDay;
+ return create(new CalendarException(date, hours, type));
}
private LocalDate date;
@@ -85,4 +81,9 @@ public class CalendarException extends BaseEntity {
return type;
}
+ @Override
+ protected ICalendarExceptionDAO getIntegrationEntityDAO() {
+ return Registry.getCalendarExceptionDAO();
+ }
+
}
diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/common/Registry.java b/navalplanner-business/src/main/java/org/navalplanner/business/common/Registry.java
index 2ed0c7357..f8ca7feaa 100644
--- a/navalplanner-business/src/main/java/org/navalplanner/business/common/Registry.java
+++ b/navalplanner-business/src/main/java/org/navalplanner/business/common/Registry.java
@@ -22,6 +22,8 @@ package org.navalplanner.business.common;
import org.navalplanner.business.advance.daos.IAdvanceTypeDAO;
import org.navalplanner.business.calendars.daos.IBaseCalendarDAO;
+import org.navalplanner.business.calendars.daos.ICalendarDataDAO;
+import org.navalplanner.business.calendars.daos.ICalendarExceptionDAO;
import org.navalplanner.business.calendars.daos.ICalendarExceptionTypeDAO;
import org.navalplanner.business.common.daos.IConfigurationDAO;
import org.navalplanner.business.costcategories.daos.ICostCategoryDAO;
@@ -154,6 +156,12 @@ public class Registry {
@Autowired
private IHourCostDAO hourCostDAO;
+ @Autowired
+ private ICalendarExceptionDAO calendarExceptionDAO;
+
+ @Autowired
+ private ICalendarDataDAO calendarDataDAO;
+
@Autowired
private ICalendarExceptionTypeDAO calendarExceptionTypeDAO;
@@ -282,4 +290,12 @@ public class Registry {
return getInstance().calendarExceptionTypeDAO;
}
+ public static ICalendarExceptionDAO getCalendarExceptionDAO() {
+ return getInstance().calendarExceptionDAO;
+ }
+
+ public static ICalendarDataDAO getCalendarDataDAO() {
+ return getInstance().calendarDataDAO;
+ }
+
}
\ No newline at end of file
diff --git a/navalplanner-business/src/main/resources/org/navalplanner/business/calendars/entities/Calendars.hbm.xml b/navalplanner-business/src/main/resources/org/navalplanner/business/calendars/entities/Calendars.hbm.xml
index 25e6d97b2..1e9d2b822 100644
--- a/navalplanner-business/src/main/resources/org/navalplanner/business/calendars/entities/Calendars.hbm.xml
+++ b/navalplanner-business/src/main/resources/org/navalplanner/business/calendars/entities/Calendars.hbm.xml
@@ -51,6 +51,8 @@
+
+
@@ -85,6 +87,8 @@
+
+