1 /*****************************************************************************
5 * Creation date 22.10.2012
8 * @copyright OPEN CASCADE 2012
9 *****************************************************************************/
11 package org.splat.service;
13 import org.splat.dal.bo.som.ProgressState;
14 import org.splat.dal.bo.som.SimulationContextType;
15 import org.splat.dal.dao.som.SimulationContextTypeDAO;
16 import org.splat.kernel.InvalidPropertyException;
17 import org.splat.service.technical.ProjectSettingsService;
18 import org.springframework.transaction.annotation.Transactional;
21 * Simulation context type service implementation.
23 * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
25 public class SimulationContextTypeServiceImpl implements
26 SimulationContextTypeService {
29 * Injected simulation context type DAO.
31 private SimulationContextTypeDAO _simulationContextTypeDAO;
36 * @see org.splat.service.SimulationContextService#createType(java.lang.String, org.splat.service.technical.ProjectSettingsService.Step)
39 public SimulationContextType createType(String name,
40 ProjectSettingsService.Step step) throws InvalidPropertyException {
41 // TODO: Check for duplicate definition
42 SimulationContextType type = new SimulationContextType(name, step);
43 getSimulationContextTypeDAO().create(type);
49 * Approve the simulation context type.
53 * @return true if approval succeeded
55 public boolean approve(SimulationContextType simCtxType) {
56 if (simCtxType.getState() != ProgressState.inCHECK)
58 simCtxType.setState(ProgressState.APPROVED); // The type name is supposed being localized
59 getSimulationContextTypeDAO().update(simCtxType);
64 * Get the simulationContextTypeDAO.
66 * @return the simulationContextTypeDAO
68 public SimulationContextTypeDAO getSimulationContextTypeDAO() {
69 return _simulationContextTypeDAO;
73 * Set the simulationContextTypeDAO.
75 * @param simulationContextTypeDAO
76 * the simulationContextTypeDAO to set
78 public void setSimulationContextTypeDAO(
79 SimulationContextTypeDAO simulationContextTypeDAO) {
80 _simulationContextTypeDAO = simulationContextTypeDAO;