ItEr18S04ArquitecturaServidorItEr17S04: Configuration and creation of PlannerDaoRegistry, OrdersDaoRegistry and WorkReportDaoRegistry.

This commit is contained in:
Susana Montes Pedreira 2009-07-27 09:54:14 +02:00 committed by Javier Moran Rua
parent 664bf0c718
commit 886a15e3d9
4 changed files with 121 additions and 0 deletions

View file

@ -0,0 +1,36 @@
package org.navalplanner.business.orders.daos;
import org.springframework.beans.factory.annotation.Autowired;
/**
* A registry of Orders DAOs. Classes in which dependency injection (DI) is
* not directly supported by Spring (e.g. entities) must use this class to
* access resource DAOs. For the rest of classes (e.g. services, tests, etc.),
* Spring DI is a more convenient option.
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
*/
public class OrdersDaoRegistry {
private static OrdersDaoRegistry instance = new OrdersDaoRegistry();
@Autowired
private IOrderDao order;
private IOrderElementDao orderElement;
private OrdersDaoRegistry() {
}
public static OrdersDaoRegistry getInstance() {
return instance;
}
public static IOrderDao getOrderDao() {
return getInstance().order;
}
public static IOrderElementDao getOrderElementDao() {
return getInstance().orderElement;
}
}

View file

@ -0,0 +1,30 @@
package org.navalplanner.business.planner.daos;
import org.springframework.beans.factory.annotation.Autowired;
/**
* A registry of Planner DAOs. Classes in which dependency injection (DI) is
* not directly supported by Spring (e.g. entities) must use this class to
* access resource DAOs. For the rest of classes (e.g. services, tests, etc.),
* Spring DI is a more convenient option.
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
*/
public class PlannerDaoRegistry {
private static PlannerDaoRegistry instance = new PlannerDaoRegistry();
@Autowired
private ITaskElementDao taskElement;
private PlannerDaoRegistry() {
}
public static PlannerDaoRegistry getInstance() {
return instance;
}
public static ITaskElementDao getTaskElementDao() {
return getInstance().taskElement;
}
}

View file

@ -0,0 +1,44 @@
package org.navalplanner.business.workreports.daos;
import org.springframework.beans.factory.annotation.Autowired;
/**
* A registry of WorkReports DAOs. Classes in which dependency injection (DI) is
* not directly supported by Spring (e.g. entities) must use this class to
* access resource DAOs. For the rest of classes (e.g. services, tests, etc.),
* Spring DI is a more convenient option.
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
*/
public final class WorkReportsDaoRegistry {
private static WorkReportsDaoRegistry instance = new WorkReportsDaoRegistry();
@Autowired
private IWorkReportDAO workReport;
@Autowired
private IWorkReportTypeDAO workReportType;
@Autowired
private IWorkReportLineDAO workReportLine;
private WorkReportsDaoRegistry() {
}
public static WorkReportsDaoRegistry getInstance() {
return instance;
}
public static IWorkReportDAO getWorkReportDao() {
return getInstance().workReport;
}
public static IWorkReportTypeDAO getWorkReportTypeDao() {
return getInstance().workReportType;
}
public static IWorkReportLineDAO getWorkReportLineDao() {
return getInstance().workReportLine;
}
}

View file

@ -65,4 +65,15 @@
class="org.navalplanner.business.resources.daos.ResourcesDaoRegistry"
factory-method="getInstance" />
<bean id="ordersDaoRegistry"
class="org.navalplanner.business.orders.daos.OrdersDaoRegistry"
factory-method="getInstance" />
<bean id="plannerDaoRegistry"
class="org.navalplanner.business.planner.daos.PlannerDaoRegistry"
factory-method="getInstance" />
<bean id="workReportsDaoRegistry"
class="org.navalplanner.business.workreports.daos.WorkReportsDaoRegistry"
factory-method="getInstance" />
</beans>