ItEr20S04ArquitecturaServidorItEr19S04: Erasing AdvanceDAORegistry, methods moved to Registry.
This commit is contained in:
parent
fe5a957f50
commit
efaaccd102
4 changed files with 26 additions and 50 deletions
|
|
@ -2,8 +2,8 @@ package org.navalplanner.business.advance.bootstrap;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.navalplanner.business.advance.daos.AdvanceDAORegistry;
|
||||
import org.navalplanner.business.advance.entities.AdvanceType;
|
||||
import org.navalplanner.business.common.Registry;
|
||||
|
||||
public enum PredefinedAdvancedTypes {
|
||||
PERCENTAGE("percentage", new BigDecimal(100), new BigDecimal(0.01)), UNITS(
|
||||
|
|
@ -33,7 +33,7 @@ public enum PredefinedAdvancedTypes {
|
|||
}
|
||||
|
||||
public AdvanceType getType() {
|
||||
return AdvanceDAORegistry.getAdvanceTypeDao().findByName(name);
|
||||
return Registry.getAdvanceTypeDao().findByName(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
package org.navalplanner.business.advance.daos;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* A registry of Advance 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 AdvanceDAORegistry {
|
||||
|
||||
private static AdvanceDAORegistry instance = new AdvanceDAORegistry();
|
||||
|
||||
@Autowired
|
||||
private IAdvanceAssigmentDAO advanceAssigmentDao;
|
||||
|
||||
@Autowired
|
||||
private IAdvanceTypeDAO advanceTypeDao;
|
||||
|
||||
@Autowired
|
||||
private IAdvanceMeasurementDAO advanceMeasurementDao;
|
||||
|
||||
private AdvanceDAORegistry() {
|
||||
}
|
||||
|
||||
public static AdvanceDAORegistry getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static IAdvanceMeasurementDAO getAdvanceMeasurementDao() {
|
||||
return getInstance().advanceMeasurementDao;
|
||||
}
|
||||
|
||||
public static IAdvanceTypeDAO getAdvanceTypeDao() {
|
||||
return getInstance().advanceTypeDao;
|
||||
}
|
||||
|
||||
public static IAdvanceAssigmentDAO getAdvanceAssigmentDao() {
|
||||
return getInstance().advanceAssigmentDao;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
package org.navalplanner.business.common;
|
||||
|
||||
import org.navalplanner.business.advance.daos.IAdvanceAssigmentDAO;
|
||||
import org.navalplanner.business.advance.daos.IAdvanceMeasurementDAO;
|
||||
import org.navalplanner.business.advance.daos.IAdvanceTypeDAO;
|
||||
import org.navalplanner.business.workreports.daos.IWorkReportDAO;
|
||||
import org.navalplanner.business.workreports.daos.IWorkReportLineDAO;
|
||||
import org.navalplanner.business.workreports.daos.IWorkReportTypeDAO;
|
||||
|
|
@ -25,6 +28,15 @@ public class Registry {
|
|||
@Autowired
|
||||
private IWorkReportLineDAO workReportLine;
|
||||
|
||||
@Autowired
|
||||
private IAdvanceAssigmentDAO advanceAssigmentDao;
|
||||
|
||||
@Autowired
|
||||
private IAdvanceTypeDAO advanceTypeDao;
|
||||
|
||||
@Autowired
|
||||
private IAdvanceMeasurementDAO advanceMeasurementDao;
|
||||
|
||||
private Registry() {
|
||||
|
||||
}
|
||||
|
|
@ -45,4 +57,16 @@ public class Registry {
|
|||
return getInstance().workReportLine;
|
||||
}
|
||||
|
||||
public static IAdvanceMeasurementDAO getAdvanceMeasurementDao() {
|
||||
return getInstance().advanceMeasurementDao;
|
||||
}
|
||||
|
||||
public static IAdvanceTypeDAO getAdvanceTypeDao() {
|
||||
return getInstance().advanceTypeDao;
|
||||
}
|
||||
|
||||
public static IAdvanceAssigmentDAO getAdvanceAssigmentDao() {
|
||||
return getInstance().advanceAssigmentDao;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,6 @@
|
|||
class="org.navalplanner.business.planner.daos.PlannerDAORegistry"
|
||||
factory-method="getInstance" />
|
||||
|
||||
<bean id="advanceDaoRegistry"
|
||||
class="org.navalplanner.business.advance.daos.AdvanceDAORegistry"
|
||||
factory-method="getInstance" />
|
||||
|
||||
<bean id="registry"
|
||||
class="org.navalplanner.business.common.Registry"
|
||||
factory-method="getInstance" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue