<hibernate-mapping>
-<!-- Uses relation
+<!-- Uses relation: Document to Document
-->
<union-subclass name="org.splat.dal.bo.som.UsesRelation" extends="org.splat.dal.bo.kernel.Relation" table="uses_rel">
<many-to-one cascade="merge" name="refer" column="refer" access="field" not-null="true" />
</union-subclass>
-<!-- UsedBy relation
+<!-- UsedBy relation: Document to Document
-->
<union-subclass name="org.splat.dal.bo.som.UsedByRelation" extends="org.splat.dal.bo.kernel.Relation" table="usedby_rel">
<many-to-one cascade="merge" name="refer" column="refer" access="field" not-null="true" />
</union-subclass>
-<!-- Versions relation
+<!-- Versions relation: Document to Document
-->
<union-subclass name="org.splat.dal.bo.som.VersionsRelation" extends="org.splat.dal.bo.kernel.Relation" table="versions_rel">
<many-to-one cascade="merge" name="refer" column="refer" access="field" not-null="true" />
</union-subclass>
-<!-- Converts relation
+<!-- Converts relation: Document to File
-->
<union-subclass name="org.splat.dal.bo.som.ConvertsRelation" extends="org.splat.dal.bo.kernel.Relation" table="converts_rel">
- <many-to-one cascade="merge" name="refer" column="refer" access="field" not-null="true" />
+ <many-to-one cascade="all-delete-orphan" name="refer" unique="true" column="refer" access="field" not-null="true" />
</union-subclass>
-<!-- Contributor actor relation
+<!-- Contributor actor relation: Study to User
-->
<union-subclass name="org.splat.dal.bo.som.ContributorRelation" extends="org.splat.dal.bo.kernel.Relation" table="contributor_rel">
<many-to-one cascade="merge" name="refer" column="refer" access="field" not-null="true" />
</union-subclass>
-<!-- ValidationCycle relation
+<!-- ValidationCycle relation: Study to ValidationCycle
-->
<union-subclass name="org.splat.dal.bo.som.ValidationCycleRelation" extends="org.splat.dal.bo.kernel.Relation" table="cycle_rel">
-<!-- <many-to-one name="refer" column="refer" unique="true" cascade="all-delete-orphan" access="field" not-null="true" />-->
- <many-to-one cascade="merge" name="refer" column="refer" unique="true" access="field" not-null="true" />
+ <many-to-one name="refer" column="refer" unique="true" cascade="all-delete-orphan" access="field" not-null="true" />
+ <!-- <many-to-one cascade="merge" name="refer" column="refer" unique="true" access="field" not-null="true" />-->
</union-subclass>
-<!-- Stamp relation
+<!-- Stamp relation: Document to Timestamp
-->
<union-subclass name="org.splat.dal.bo.som.StampRelation" extends="org.splat.dal.bo.kernel.Relation" table="stamp_rel">
-<!-- <many-to-one name="refer" column="refer" unique="true" cascade="all-delete-orphan" access="field" not-null="true" />-->
- <many-to-one cascade="merge" name="refer" column="refer" unique="true" access="field" not-null="true" />
+ <many-to-one name="refer" column="refer" unique="true" cascade="all-delete-orphan" access="field" not-null="true" />
+ <!-- <many-to-one cascade="merge" name="refer" column="refer" unique="true" access="field" not-null="true" />-->
</union-subclass>
</hibernate-mapping>
\ No newline at end of file
import org.splat.dal.bo.som.Publication;
import org.splat.dal.dao.som.ProjectElementDAO;
import org.splat.service.technical.ProjectSettingsService;
+import org.splat.service.technical.StepsConfigService;
import org.splat.som.Step;
import org.springframework.transaction.annotation.Transactional;
/**
* Injected project settings service.
*/
- private ProjectSettingsService _projectSettings;
+ private StepsConfigService _stepsConfigService;
/**
* Injected project element DAO.
*/
*/
public Step[] getSteps(final ProjectElement elem) {
if (elem.getFolders() == null) {
- List<ProjectSettingsService.Step> steps = getProjectSettings()
+ List<ProjectSettingsService.Step> steps = getStepsConfigService()
.getStepsOf(elem.getClass());
Iterator<ProjectSettingsService.Step> nstep = steps.iterator();
}
/**
- * Get project settings.
+ * Get steps config.
*
- * @return Project settings service
+ * @return steps config service
*/
- private ProjectSettingsService getProjectSettings() {
- return _projectSettings;
+ private StepsConfigService getStepsConfigService() {
+ return _stepsConfigService;
}
/**
- * Set project settings service.
+ * Set steps config service.
*
- * @param projectSettingsService
- * project settings service
+ * @param stepsConfigService
+ * steps config service
*/
- public void setProjectSettings(final ProjectSettingsService projectSettingsService) {
- _projectSettings = projectSettingsService;
+ public void setStepsConfigService(final StepsConfigService stepsConfigService) {
+ _stepsConfigService = stepsConfigService;
}
/**
*/
void configure(String filename) throws IOException, SQLException;
- /**
- * Get steps of the given project element (study or scenario).
- *
- * @param level
- * the project element (study or scenario)
- * @return the list of steps
- */
- List<ProjectSettingsService.Step> getStepsOf(
- Class<? extends ProjectElement> level);
-
/**
* Check if a file of the given format should be imported during check-in of a document of the given type.
*
import org.splat.service.DocumentTypeService;
import org.splat.service.KnowledgeElementTypeService;
import org.splat.service.SimulationContextTypeService;
+import org.springframework.context.ResourceLoaderAware;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.ResourceLoader;
import org.springframework.transaction.annotation.Transactional;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
/**
* SIMAN workflow configuration data service.
*/
-public class ProjectSettingsServiceImpl implements ProjectSettingsService {
+public class ProjectSettingsServiceImpl implements ProjectSettingsService,
+ ResourceLoaderAware {
/**
* The logger for the service.
*/
private final static String TYPE_ATTR = "type";
+ /**
+ * Steps configuration storage.
+ */
+ private StepsConfigService _stepsConfigService;
+ /**
+ * Resource loader injected by Spring.
+ */
+ private ResourceLoader _resourceLoader;
+
+ /**
+ * Configuration resource injected by Spring.
+ */
+ private Resource _config;
+
// Non persistent configuration information
/**
* Repository settings.
* Pattern of the presentation of version numbers.
*/
private transient String _versioning;
- /**
- * Ordered list of (transient) study steps.
- */
- private transient final List<ProjectSettingsService.Step> _steps = new ArrayList<ProjectSettingsService.Step>();
/**
* Configuration document validation cycles.
*/
// ==============================================================================================================================
/**
- * Load workflow configuration from the given file. <br/> Create necessary default staff in the database if it is not initialized yet.
+ * Load workflow configuration from the file defined by config property. <BR>
+ * Create necessary default staff in the database if it is not initialized yet.
+ *
+ * @throws IOException
+ * if there is a file reading or index creation problem
+ * @throws SQLException
+ * if there is a database population problem
+ */
+ @Transactional
+ public void configure() throws IOException, SQLException {
+ if (getConfig() != null) {
+ configure("file:" + getConfig().getFile().getAbsolutePath());
+ }
+ }
+
+ /**
+ * Load workflow configuration from the given file. <BR>
+ * Create necessary default staff in the database if it is not initialized yet.
*
* @param filename
* the workflow configuration file
@Transactional
public void configure(final String filename) throws IOException,
SQLException {
- if (!_steps.isEmpty()) {
+ if (!getStepsConfigService().getSteps().isEmpty()) {
return; // Project already configured
}
Database base = getDatabase().getCheckedDB();
- File config = new File(filename);
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Loading configuration from: "
+ + getResource(filename).getFile().getAbsolutePath());
+ LOG.info("Root: " + getResource("/").getURI());
+ }
+ File config = getResource(filename).getFile();
if (config.exists()) {
loadCustomization(config);
} else {
* @return the list of steps from project settings
*/
public List<ProjectSettingsService.Step> getAllSteps() {
- return _steps;
+ return getStepsConfigService().getSteps();
}
/**
*/
public ProjectSettingsService.Step getStep(final int number) {
ProjectSettingsService.Step res = null;
- for (int i = 0; i < _steps.size(); i++) {
- ProjectSettingsService.Step step = _steps.get(i);
+ for (int i = 0; i < getStepsConfigService().getSteps().size(); i++) {
+ ProjectSettingsService.Step step = getStepsConfigService()
+ .getSteps().get(i);
if (step.getNumber() == number) {
res = step;
break;
return res;
}
- /**
- * Get steps of the given project element (study or scenario).
- *
- * @param level
- * the project element (study or scenario)
- * @return the list of steps
- */
- public List<ProjectSettingsService.Step> getStepsOf(
- final Class<? extends ProjectElement> level) {
- List<ProjectSettingsService.Step> result = new ArrayList<ProjectSettingsService.Step>();
-
- for (int i = 0; i < _steps.size(); i++) {
- ProjectSettingsService.Step step = _steps.get(i);
- if (step.appliesTo(level)) {
- result.add(step);
- }
- }
- return result;
- }
-
/**
* Check if a file of the given format should be imported during check-out of a document of the given type.
*
step.setModule(module.getAttribute("name"));
}
- _steps.add(step);
+ getStepsConfigService().getSteps().add(step);
res += 1;
}
return res;
String uses = null;
for (Iterator<NamedNodeMap> i = _flows.iterator(); i.hasNext(); snum++) {
NamedNodeMap flow = i.next();
- ProjectSettingsService.Step step = _steps.get(snum);
+ ProjectSettingsService.Step step = getStepsConfigService()
+ .getSteps().get(snum);
String[] contents = flow.getNamedItem("contents").getNodeValue()
.split(",");
for (int j = 0; j < contents.length; j++) {
// Parse uses attribute
String[] usesArr = uses.split(",");
List<DocumentType> usesTypesList = new ArrayList<DocumentType>();
- for (String usesType: usesArr) {
+ for (String usesType : usesArr) {
tdoc = maptype.get(usesType.trim());
if (tdoc == null) {
LOG.warn("Undefined \"" + usesType.trim()
}
}
}
- tprop.setUses(usesTypesList.toArray(new DocumentType[]{}));
+ tprop.setUses(usesTypesList
+ .toArray(new DocumentType[] {}));
}
if (step != null) {
tprop.setResult(step);
String[] clist = clatr.getNamedItem("context").getNodeValue()
.split(",");
for (int j = 0; j < clist.length; j++) {
- mapstep.put(clist[j], _steps.get(snum));
+ mapstep.put(clist[j], getStepsConfigService().getSteps()
+ .get(snum));
}
}
}
final DocumentTypeService documentTypeService) {
_documentTypeService = documentTypeService;
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.springframework.context.ResourceLoaderAware#setResourceLoader(org.springframework.core.io.ResourceLoader)
+ */
+ @Override
+ public void setResourceLoader(final ResourceLoader resourceLoader) {
+ this._resourceLoader = resourceLoader;
+ }
+
+ /**
+ * Get resource by means of Spring resource loader.
+ *
+ * @param location
+ * the resource location
+ * @return the resource
+ */
+ public Resource getResource(final String location) {
+ return _resourceLoader.getResource(location);
+ }
+
+ /**
+ * Get the config.
+ *
+ * @return the config
+ */
+ public Resource getConfig() {
+ return _config;
+ }
+
+ /**
+ * Set the config.
+ *
+ * @param config
+ * the config to set
+ */
+ public void setConfig(final Resource config) {
+ _config = config;
+ }
+
+ /**
+ * Get the stepsConfigService.
+ *
+ * @return the stepsConfigService
+ */
+ public StepsConfigService getStepsConfigService() {
+ return _stepsConfigService;
+ }
+
+ /**
+ * Set the stepsConfigService.
+ *
+ * @param stepsConfigService
+ * the stepsConfigService to set
+ */
+ public void setStepsConfigService(
+ final StepsConfigService stepsConfigService) {
+ _stepsConfigService = stepsConfigService;
+ }
}
\ No newline at end of file
--- /dev/null
+/*****************************************************************************
+ * Company OPEN CASCADE
+ * Application SIMAN
+ * File $Id$
+ * Creation date 12.03.2013
+ * @author $Author$
+ * @version $Revision$
+ * @copyright OPEN CASCADE 2012
+ *****************************************************************************/
+
+package org.splat.service.technical;
+
+import java.util.List;
+
+import org.splat.dal.bo.som.ProjectElement;
+
+/**
+ * Study steps configuration service.
+ *
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ */
+public interface StepsConfigService {
+
+ /**
+ * Get steps of the given project element (study or scenario).
+ *
+ * @param level
+ * the project element (study or scenario)
+ * @return the list of steps
+ */
+ List<ProjectSettingsService.Step> getStepsOf(
+ Class<? extends ProjectElement> level);
+
+ /**
+ * Get the steps.
+ *
+ * @return the steps
+ */
+ public List<ProjectSettingsService.Step> getSteps();
+
+}
--- /dev/null
+/*****************************************************************************
+ * Company OPEN CASCADE
+ * Application SIMAN
+ * File $Id$
+ * Creation date 12.03.2013
+ * @author $Author$
+ * @version $Revision$
+ * @copyright OPEN CASCADE 2012
+ *****************************************************************************/
+
+package org.splat.service.technical;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.splat.dal.bo.som.ProjectElement;
+
+/**
+ * Study steps configuration service.
+ *
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ */
+public class StepsConfigServiceImpl implements StepsConfigService {
+
+ /**
+ * Ordered list of (transient) study steps.
+ */
+ private transient final List<ProjectSettingsService.Step> _steps = new ArrayList<ProjectSettingsService.Step>();
+
+ /**
+ * Get steps of the given project element (study or scenario).
+ *
+ * @param level
+ * the project element (study or scenario)
+ * @return the list of steps
+ */
+ public List<ProjectSettingsService.Step> getStepsOf(
+ final Class<? extends ProjectElement> level) {
+ List<ProjectSettingsService.Step> result = new ArrayList<ProjectSettingsService.Step>();
+
+ for (int i = 0; i < _steps.size(); i++) {
+ ProjectSettingsService.Step step = _steps.get(i);
+ if (step.appliesTo(level)) {
+ result.add(step);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get the steps.
+ *
+ * @return the steps
+ */
+ public List<ProjectSettingsService.Step> getSteps() {
+ return _steps;
+ }
+
+}
</bean>
<bean id="projectElementService"
class="org.splat.service.ProjectElementServiceImpl">
- <property name="projectSettings" ref="projectSettings" />
+ <property name="stepsConfigService" ref="stepsConfigService" />
<property name="projectElementDAO" ref="projectElementDAO" />
</bean>
<bean id="repositoryService"
class="org.splat.service.technical.RepositoryServiceImpl" />
+ <bean id="stepsConfigService"
+ class="org.splat.service.technical.StepsConfigServiceImpl"/>
+
<bean id="projectSettings"
- class="org.splat.service.technical.ProjectSettingsServiceImpl">
+ class="org.splat.service.technical.ProjectSettingsServiceImpl"
+ init-method="configure">
+ <property name="config" value="${wapp.configuration}" />
+ <property name="stepsConfigService" ref="stepsConfigService" />
<property name="database" ref="database" />
<property name="simulationContextTypeService"
ref="simulationContextTypeService" />
wapp.version = D-0.5
wapp.login = conf/login.conf
-wapp.configuration = som.xml
+wapp.configuration = classpath:test/som.xml
wapp.customization = conf/my.xml
wapp.website = http://www.salome-platform.org
wapp.onlinehelp = http://docs.salome-platform.org/salome_6_3_1/gui/GUI_index.html
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
// Load workflow customization
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find som.xml: ", e);
}
import org.splat.service.KnowledgeElementTypeService;
import org.splat.service.SimulationContextService;
import org.splat.service.technical.ProjectSettingsService;
+import org.splat.service.technical.StepsConfigService;
import org.splat.service.technical.ProjectSettingsService.Step;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@Qualifier("projectSettings")
private transient ProjectSettingsService _projectSettings;
+ /**
+ * The StepsConfigService. Later injected by Spring.
+ */
+ @Autowired
+ @Qualifier("stepsConfigService")
+ private transient StepsConfigService _stepsConfigService;
+
/**
* The DocumentTypeService. Later injected by Spring.
*/
*/
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find configuration file: ", e);
}
- List<Step> steps = _projectSettings.getStepsOf(Scenario.class);
+ List<Step> steps = _stepsConfigService.getStepsOf(Scenario.class);
Assert.assertTrue(steps.size() > 0, "No steps are created.");
Assert.assertTrue(_projectSettings.doImport("geometry", "brep"));
Assert.assertTrue(_projectSettings.doImport("model", "med"));
// ////// Load workflow customization with empty mappings
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som-without-mappings.xml").getPath());
+ _projectSettings.configure("classpath:test/som-without-mappings.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find configuration file: ", e);
}
- steps = _projectSettings.getStepsOf(Scenario.class);
+ steps = _stepsConfigService.getStepsOf(Scenario.class);
Assert.assertTrue(steps.size() > 0, "No steps are created.");
Assert.assertFalse(_projectSettings.doImport("geometry", "brep"));
Assert.assertFalse(_projectSettings.doImport("model", "med"));
// ////// Load workflow customization from not existing file
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
try {
- _projectSettings.configure(ClassLoader.getSystemResource("/")
- .getPath()
- + "test/xxx.xml");
+ _projectSettings.configure("classpath:test/xxx.xml");
Assert
.fail("Customization loading must fail for not existing configuration file.");
} catch (FileNotFoundException e) {
Database.getInstance().reset();
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find configuration file: ", e);
}
Assert.assertTrue(_documentTypeService.selectAllTypes().size() > 0,
"No document types are created.");
- List<Step> steps = _projectSettings.getStepsOf(Scenario.class);
+ List<Step> steps = _stepsConfigService.getStepsOf(Scenario.class);
Assert.assertTrue(steps.size() > 0, "No steps are created.");
for (Step step : steps) {
// ////// Load workflow customization with empty mappings
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som-without-mappings.xml").getPath());
+ _projectSettings.configure("classpath:test/som-without-mappings.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find configuration file: ", e);
}
- steps = _projectSettings.getStepsOf(Scenario.class);
+ steps = _stepsConfigService.getStepsOf(Scenario.class);
Assert.assertTrue(steps.size() > 0, "No steps are created.");
for (Step step : steps) {
List<String> defTypes = _projectSettings.getDefaultFormats(step);
// ////// Load workflow customization from not existing file
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
try {
- _projectSettings.configure(ClassLoader.getSystemResource("/")
- .getPath()
- + "test/xxx.xml");
+ _projectSettings.configure("classpath:test/xxx.xml");
Assert
.fail("Customization loading must fail for not existing configuration file.");
} catch (FileNotFoundException e) {
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
Database.getInstance().reset();
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find configuration file: ", e);
}
getHibernateTemplate().flush();
- List<Step> steps = _projectSettings.getStepsOf(Scenario.class);
+ List<Step> steps = _stepsConfigService.getStepsOf(Scenario.class);
Assert.assertTrue(steps.size() > 0, "No steps are created.");
KnowledgeElementType ucase = _knowledgeElementTypeService.selectType("usecase");
Assert.assertNotNull(ucase, "Knowledge type 'usecase' must be created in the database.");
Database.getInstance().reset();
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find configuration file: ", e);
}
- steps = _projectSettings.getStepsOf(Scenario.class);
+ steps = _stepsConfigService.getStepsOf(Scenario.class);
Assert.assertTrue(steps.size() > 0, "No steps are created.");
ucase = _knowledgeElementTypeService.selectType("usecase");
Assert.assertNotNull(ucase, "Knowledge type 'usecase' must be created in the database.");
startNestedTransaction();
// ///////////////////////////////////////////////////
// ////// Load good workflow customization
+ getHibernateTemplate().bulkUpdate("delete from User");
getHibernateTemplate().bulkUpdate("delete from Role");
getHibernateTemplate().flush();
Database.getInstance().reset();
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find configuration file: ", e);
}
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
// Load workflow customization
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find som.xml: ", e);
}
import org.splat.service.dto.StepDTO;
import org.splat.service.technical.ProjectSettingsService;
import org.splat.service.technical.RepositoryService;
+import org.splat.service.technical.StepsConfigService;
import org.splat.service.technical.ProjectSettingsService.Step;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@Qualifier("projectSettings")
private transient ProjectSettingsService _projectSettings;
+ /**
+ * The StepsConfigService. Later injected by Spring.
+ */
+ @Autowired
+ @Qualifier("stepsConfigService")
+ private transient StepsConfigService _stepsConfigService;
+
/**
* The DocumentTypeService. Later injected by Spring.
*/
Assert.assertNotNull(steps, "List of steps must not be null.");
Assert.assertTrue(steps.size() > 0, "No steps are read.");
- List<Step> projSteps = _projectSettings.getStepsOf(Scenario.class);
+ List<Step> projSteps = _stepsConfigService.getStepsOf(Scenario.class);
Assert.assertEquals(steps.size(), projSteps.size(),
"Not all steps are listed.");
int docIndex = 0;
startNestedTransaction();
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
- _projectSettings.configure(ClassLoader
- .getSystemResource("test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
getHibernateTemplate().flush();
long scenarioId = createScenario();
Scenario aScen = _scenarioDAO.get(scenarioId);
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
// Load workflow customization
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find som.xml: ", e);
}
- List<Step> steps = _projectSettings.getStepsOf(Scenario.class);
+ List<Step> steps = _stepsConfigService.getStepsOf(Scenario.class);
Assert.assertTrue(steps.size() > 0, "No steps are created.");
// Create a test user
Database.getInstance().reset();
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
- _projectSettings.configure(ClassLoader
- .getSystemResource("test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
// Create a test user
User.Properties uprop = new User.Properties();
Database.getInstance().reset();
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
- _projectSettings.configure(ClassLoader
- .getSystemResource("test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
// Create a test user
User goodUser = TestEntitiesGenerator.getTestUser("goodUser");
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
// Load workflow customization
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (Exception e) {
Assert.fail("Can't load som.xml: ", e);
}
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
// Load workflow customization
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (Exception e) {
Assert.fail("Can't load som.xml: ", e);
}
startNestedTransaction();
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
- _projectSettings.configure(ClassLoader
- .getSystemResource("test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
HibernateTemplate ht = getHibernateTemplate();
ht.flush();
long scenarioId = createScenario();
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
// Load workflow customization
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find som.xml: ", e);
}
* @param title the title
* @throws InvalidParameterException if there is something wrong likely unrelated to the tested method
*/
- private void testEdit(StepCommentAttribute comment, String value, String title)
+ private void testEdit(final StepCommentAttribute comment, final String value, final String title)
throws InvalidParameterException {
String oldValue = comment.getValue();
String oldTitle = comment.getTitle();
import org.splat.dal.bo.kernel.User;
import org.splat.dal.bo.som.DescriptionAttribute;
import org.splat.dal.bo.som.Document;
-import org.splat.dal.bo.som.Document.Properties;
import org.splat.dal.bo.som.DocumentType;
import org.splat.dal.bo.som.ProjectElement;
import org.splat.dal.bo.som.Publication;
import org.splat.dal.bo.som.Scenario;
import org.splat.dal.bo.som.Study;
+import org.splat.dal.bo.som.Document.Properties;
import org.splat.dal.dao.kernel.UserDAO;
import org.splat.dal.dao.som.Database;
import org.splat.dal.dao.som.StudyDAO;
_projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
// Load workflow customization
try {
- _projectSettings.configure(ClassLoader.getSystemResource(
- "test/som.xml").getPath());
+ _projectSettings.configure("classpath:test/som.xml");
} catch (FileNotFoundException e) {
Assert.fail("Can't find som.xml: ", e);
}
import org.splat.service.SearchService;
import org.splat.service.dto.StudySearchFilterDTO;
import org.splat.service.technical.ProjectSettingsService;
+import org.splat.service.technical.StepsConfigService;
import org.splat.wapp.Constants;
/**
/**
* Injected project settings service.
*/
- private ProjectSettingsService _projectSettings;
+ private StepsConfigService _stepsConfigService;
/**
* Injected search service.
*/
*/
@Override
protected List<SimulationContextType> getInvolvedContexts() {
- List<ProjectSettingsService.Step> steps = getProjectSettings()
+ List<ProjectSettingsService.Step> steps = getStepsConfigService()
.getStepsOf(Study.class);
ProjectSettingsService.Step[] number = steps
.toArray(new ProjectSettingsService.Step[steps.size()]);
}
/**
- * Get project settings.
+ * Get StepsConfigService.
*
- * @return Project settings service
+ * @return StepsConfigService
*/
- private ProjectSettingsService getProjectSettings() {
- return _projectSettings;
+ private StepsConfigService getStepsConfigService() {
+ return _stepsConfigService;
}
/**
- * Set project settings service.
+ * Set StepsConfigService.
*
- * @param projectSettingsService
- * project settings service
+ * @param stepsConfigService
+ * StepsConfigService
*/
- public void setProjectSettings(
- final ProjectSettingsService projectSettingsService) {
- _projectSettings = projectSettingsService;
+ public void setStepsConfigService(
+ final StepsConfigService stepsConfigService) {
+ _stepsConfigService = stepsConfigService;
}
/**
import java.util.Map;
-import org.splat.service.technical.ProjectSettingsService;
import org.splat.som.ApplicationRights;
import org.splat.wapp.Constants;
/**
- * Start application action.
+ * Start application action. Initializes application settings.
*/
public class StartAction extends Action {
/**
*/
private static final long serialVersionUID = 5875058140682652964L;
- /**
- * Injected project settings service.
- */
- private ProjectSettingsService _projectSettings;
-
// ==============================================================================================================================
// Action execution
// ==============================================================================================================================
LOG.info(new StringBuffer("Initializing ").append(wappurl)
.append("...").toString());
try {
- ProjectSettingsService project = getProjectSettings();
ApplicationSettings wapp = getApplicationSettings();
wapp.setLocale(this.getLocale());
String root = ApplicationSettings.getApplicationRootPath();
LOG.debug("Application root: " + root);
- // Database configuration
- project.configure(root
- + ApplicationSettings
- .getApplicationProperty("wapp.configuration"));
-
// Configure menus for the current user
wapp.configure();
}
return res;
}
-
- // ==============================================================================================================================
- // Setter
- // ==============================================================================================================================
-
- /**
- * Get project settings.
- *
- * @return Project settings service
- */
- private ProjectSettingsService getProjectSettings() {
- return _projectSettings;
- }
-
- /**
- * Set project settings service.
- *
- * @param projectSettingsService
- * project settings service
- */
- public void setProjectSettings(
- final ProjectSettingsService projectSettingsService) {
- _projectSettings = projectSettingsService;
- }
}
\ No newline at end of file
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
- <value>conf/log-messages</value>
- <value>som</value>
+ <value>conf/log-messages</value>
+ <value>som</value>
</list>
</property>
</bean>
</bean>
<bean id="menuBarSettings" class="org.splat.simer.MenuBarSettings"
- scope="session">
- </bean>
+ scope="session" />
<bean id="titleBarSettings" class="org.splat.simer.TitleBarSettings"
- scope="session">
- </bean>
+ scope="session" />
<bean id="toolBarSettings" class="org.splat.simer.ToolBarSettings"
- scope="session">
- </bean>
+ scope="session" />
<bean id="leftMenuSettings" class="org.splat.simer.LeftMenuSettings"
- scope="session">
- </bean>
+ scope="session" />
<bean id="slidMenu" scope="session" abstract="true">
<property name="projectElementService"
<property name="projectSettings" ref="projectSettings" />
<property name="knowledgeElementTypeService"
ref="knowledgeElementTypeService" />
- <property name="publicationService" ref="publicationService" />
+ <property name="publicationService" ref="publicationService" />
</bean>
<bean id="openStudy" class="org.splat.simer.OpenStudy"
</bean>
<bean id="openKnowledge" class="org.splat.simer.OpenKnowledge"
- parent="openObject" scope="session">
- </bean>
+ parent="openObject" scope="session" />
+
+ <bean id="invalidateAction"
+ class="org.splat.simer.InvalidateAction" />
- <bean id="invalidateAction" class="org.splat.simer.InvalidateAction"/>
-
- <bean id="baseAction" class="org.splat.simer.Action"
+ <bean id="baseAction" class="org.splat.simer.Action"
scope="prototype" abstract="true">
<property name="applicationSettings" ref="applicationSettings" />
<property name="openStudy" ref="openStudy" />
<bean id="importDocumentAction"
class="org.splat.simer.ImportDocumentAction" scope="prototype"
parent="baseAction">
- <property name="studyService" ref="studyService" />
+ <property name="studyService" ref="studyService" />
<property name="stepService" ref="stepService" />
<property name="projectSettings" ref="projectSettings" />
<property name="publicationService" ref="publicationService" />
<property name="studyService" ref="studyService" />
</bean>
- <bean id="removeStudyAction" class="org.splat.simer.RemoveStudyAction"
- scope="prototype" parent="baseAction">
- <property name="studyService" ref="studyService" />
- </bean>
+ <bean id="removeStudyAction"
+ class="org.splat.simer.RemoveStudyAction" scope="prototype"
+ parent="baseAction">
+ <property name="studyService" ref="studyService" />
+ </bean>
<!--========= Inherited from displayStudyStepAction ========= -->
<property name="userService" ref="userService" />
</bean>
- <bean id="editStudyAction" class="org.splat.simer.EditStudyAction"
- scope="prototype" parent="displayStudyStepAction">
- </bean>
-
+ <bean id="editStudyAction" class="org.splat.simer.EditStudyAction"
+ scope="prototype" parent="displayStudyStepAction" />
+
<bean id="editScenarioPropertiesAction"
class="org.splat.simer.EditScenarioPropertiesAction" scope="prototype"
parent="displayStudyStepAction">
ref="knowledgeElementTypeService" />
<property name="scenarioService" ref="scenarioService" />
</bean>
-
+
<bean id="editStepCommentAction"
- class="org.splat.simer.EditStepCommentAction" scope="prototype"
- parent="displayStudyStepAction">
- <property name="stepService" ref="stepService" />
- </bean>
-
- <bean id="editStudyDescriptionAction"
- class="org.splat.simer.EditStudyDescriptionAction" scope="prototype"
- parent="displayStudyStepAction">
- </bean>
-
-
- <!-- bean id="CompareStudyAction"
- class="org.splat.simer.CompareStudyAction" scope="prototype"
- parent="displayStudyStepAction">
- <property name="studyService" ref="studyService" />
- </bean-->
+ class="org.splat.simer.EditStepCommentAction" scope="prototype"
+ parent="displayStudyStepAction">
+ <property name="stepService" ref="stepService" />
+ </bean>
+
+ <bean id="editStudyDescriptionAction"
+ class="org.splat.simer.EditStudyDescriptionAction" scope="prototype"
+ parent="displayStudyStepAction" />
+
+
+ <!-- bean id="CompareStudyAction"
+ class="org.splat.simer.CompareStudyAction" scope="prototype"
+ parent="displayStudyStepAction">
+ <property name="studyService" ref="studyService" />
+ </bean-->
<!-- End of Inherited from displayStudyStepAction -->
<bean id="startAction" class="org.splat.simer.StartAction"
- scope="prototype" parent="baseAction">
- <property name="applicationSettings" ref="applicationSettings" />
- <property name="projectSettings" ref="projectSettings" />
- </bean>
+ scope="prototype" parent="baseAction" />
+
<bean id="connectionAction" class="org.splat.simer.ConnectionAction"
- scope="prototype" parent="baseAction">
- </bean>
+ scope="prototype" parent="baseAction" />
<bean id="menuAction" class="org.splat.simer.MenuAction"
- scope="prototype" parent="baseAction">
- </bean>
+ scope="prototype" parent="baseAction" />
<bean id="notYetImplementedAction"
class="org.splat.simer.NotYetImplementedAction" scope="prototype"
- parent="baseAction">
- </bean>
+ parent="baseAction" />
<bean id="searchStudyAction"
class="org.splat.simer.SearchStudyAction" scope="prototype"
parent="baseAction">
- <property name="projectSettings" ref="projectSettings" />
+ <property name="stepsConfigService" ref="stepsConfigService" />
<property name="searchService" ref="searchService" />
<property name="simulationContextService"
ref="simulationContextService" />
</bean>
<bean id="searchDocumentAction"
- class="org.splat.simer.SearchDocumentAction" scope="prototype">
- </bean>
+ class="org.splat.simer.SearchDocumentAction" scope="prototype" />
<bean id="displayKnowledgeAction"
class="org.splat.simer.DisplayKnowledgeAction" scope="prototype"
<bean id="uploadStudyAction"
class="org.splat.simer.UploadStudyAction" scope="prototype"
- parent="baseAction">
- </bean>
+ parent="baseAction" />
<bean id="versionDocumentAction"
class="org.splat.simer.VersionDocumentAction" scope="prototype"
<property name="projectSettings" ref="projectSettings" />
<property name="publicationService" ref="publicationService" />
<property name="stepService" ref="stepService" />
- <property name="studyService" ref="studyService" />
+ <property name="studyService" ref="studyService" />
<property name="repositoryService" ref="repositoryService" />
</bean>
<bean id="knowledgeElementAction"
class="org.splat.simer.admin.KnowledgeElementAction"
- scope="prototype">
- </bean>
+ scope="prototype" />
</beans>