001: package wilos.business.services.misc.concretemilestone;
002:
003: import org.springframework.transaction.annotation.Propagation;
004: import org.springframework.transaction.annotation.Transactional;
005:
006: import wilos.business.services.misc.concreteworkbreakdownelement.ConcreteWorkBreakdownElementService;
007: import wilos.business.services.misc.stateservice.StateService;
008: import wilos.hibernate.misc.concretemilestone.ConcreteMilestoneDao;
009: import wilos.model.misc.concretemilestone.ConcreteMilestone;
010: import wilos.utils.Constantes.State;
011:
012: /**
013: * ConcreteMilestoneService is a transactional class, that manages operations
014: * about concrete milestones, requested by web pages
015: *
016: */
017: @Transactional(readOnly=false,propagation=Propagation.REQUIRED)
018: public class ConcreteMilestoneService {
019:
020: private ConcreteMilestoneDao concreteMilestoneDao;
021:
022: private ConcreteWorkBreakdownElementService concreteWorkBreakdownElementService;
023:
024: private StateService stateService;
025:
026: /**
027: * Allows to save the concreteMilestone
028: * @param _concreteMilestone
029: */
030: public void saveConcreteMilestone(
031: ConcreteMilestone _concreteMilestone) {
032: this .concreteMilestoneDao
033: .saveOrUpdateConcreteMilestone(_concreteMilestone);
034: }
035:
036: /**
037: * Allows to get the concreteMilestone with its id
038: * @param _id
039: * @return the concreteMilestone
040: */
041: public ConcreteMilestone getConcreteMilestone(String _id) {
042: return this .concreteMilestoneDao.getConcreteMilestone(_id);
043: }
044:
045: /**
046: * Allows to get the concreteMilestoneDao
047: * @return the concreteMilestoneDao
048: */
049: public ConcreteMilestoneDao getConcreteMilestoneDao() {
050: return this .concreteMilestoneDao;
051: }
052:
053: /**
054: * Allows to set the concreteMilestoneDao
055: * @param _concreteMilestoneDao
056: *
057: */
058: public void setConcreteMilestoneDao(
059: ConcreteMilestoneDao _concreteMilestoneDao) {
060: this .concreteMilestoneDao = _concreteMilestoneDao;
061: }
062:
063: /**
064: * Allows to cross the concreteMilestone
065: * @param _concreteMilestone
066: */
067: public void crossConcreteMilestone(
068: ConcreteMilestone _concreteMilestone) {
069: this .stateService.updateStateTo(_concreteMilestone,
070: State.STARTED);
071: this .stateService.updateStateTo(_concreteMilestone,
072: State.FINISHED);
073: }
074:
075: /**
076: * Allows to check if a concreteMilestone exists with its id
077: * @param _concreteMilestoneId
078: * @return true if the concreteMilestone exists, false in the other case
079: */
080: public boolean existsConcreteMilestone(String _concreteMilestoneId) {
081: return this .concreteMilestoneDao
082: .existsConcreteMilestone(_concreteMilestoneId);
083: }
084:
085: /**
086: * Allows to get the concreteWorkBreakdownElementService
087: * @return the concreteWorkBreakdownElementService
088: */
089: public ConcreteWorkBreakdownElementService getConcreteWorkBreakdownElementService() {
090: return this .concreteWorkBreakdownElementService;
091: }
092:
093: /**
094: * Allows to set the concreteWorkBreakdownElementService
095: * @param _concreteWorkBreakdownElementService
096: *
097: */
098: public void setConcreteWorkBreakdownElementService(
099: ConcreteWorkBreakdownElementService _concreteWorkBreakdownElementService) {
100: this .concreteWorkBreakdownElementService = _concreteWorkBreakdownElementService;
101: }
102:
103: /**
104: * Allows to get the service's state
105: * @return the stateService
106: */
107: public StateService getStateService() {
108: return this .stateService;
109: }
110:
111: /**
112: * Allows to set the service's state
113: * @param _stateService
114: *
115: */
116: public void setStateService(StateService _stateService) {
117: this.stateService = _stateService;
118: }
119: }
|