From: rkv
Date: Fri, 2 Nov 2012 15:07:53 +0000 (+0000)
Subject: KnowledgeElementDTO is now used in KnowledgeElementFacade. Edit and rename knowledge...
X-Git-Tag: Root_Delivery1_2012_12_06~94
X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fd3185570eb0d0275a3eeee0a0632b8aaa593f5a;p=tools%2Fsiman.git
KnowledgeElementDTO is now used in KnowledgeElementFacade. Edit and rename knowledge action is modified so that now DTO is used. Ant build procedure is modified. Note: Add tools.jar from JDK to Ant classpath in Eclipse preferences.
---
diff --git a/Workspace/Siman-Common/build.properties b/Workspace/Siman-Common/build.properties
index aeda9b7..a72d532 100644
--- a/Workspace/Siman-Common/build.properties
+++ b/Workspace/Siman-Common/build.properties
@@ -11,3 +11,5 @@ compiler.generate.no.warnings=off
compiler.max.memory=256m
compiler.optimize=on
compiler.deprecation=on
+
+siman-common.project.name=Siman-Common
diff --git a/Workspace/Siman-Common/build.xml b/Workspace/Siman-Common/build.xml
index afb8714..446017a 100644
--- a/Workspace/Siman-Common/build.xml
+++ b/Workspace/Siman-Common/build.xml
@@ -36,13 +36,15 @@
-
-
+
+
+
-
-
-
+
+
+
@@ -54,9 +56,6 @@
-
-
diff --git a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementService.java b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementService.java
index a2f0f02..5ad86c6 100644
--- a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementService.java
+++ b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementService.java
@@ -9,11 +9,7 @@
package org.splat.service;
-import java.util.List;
-
import org.splat.dal.bo.som.KnowledgeElement;
-import org.splat.dal.bo.som.KnowledgeElementType;
-import org.splat.dal.bo.som.ProgressState;
import org.splat.kernel.InvalidPropertyException;
import org.splat.service.dto.KnowledgeElementDTO;
@@ -61,7 +57,7 @@ public interface KnowledgeElementService {
* @throws InvalidPropertyException
* if renaming is failed
*/
- public void rename(KnowledgeElement knowledgeElement, String title)
+ public void rename(KnowledgeElementDTO knowledgeElement, String title)
throws InvalidPropertyException;
/**
@@ -90,5 +86,5 @@ public interface KnowledgeElementService {
* @param description
* the new description
*/
- public void update(KnowledgeElement kelm, String description);
+ public void update(KnowledgeElementDTO kelm, String description);
}
diff --git a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementServiceImpl.java
index c01cd68..3c92945 100644
--- a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementServiceImpl.java
+++ b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementServiceImpl.java
@@ -34,7 +34,7 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
/**
* The logger for the service.
*/
- public final static AppLogger logger = AppLogger
+ public final static AppLogger LOGGER = AppLogger
.getLogger(KnowledgeElementServiceImpl.class);
/**
@@ -60,9 +60,10 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* @see org.splat.service.KnowledgeElementService#approve(org.splat.dal.bo.som.KnowledgeElement)
*/
@Transactional
- public boolean approve(KnowledgeElement knowledgeElement) {
- if (knowledgeElement.getProgressState() != ProgressState.inCHECK)
+ public boolean approve(final KnowledgeElement knowledgeElement) {
+ if (knowledgeElement.getProgressState() != ProgressState.inCHECK) {
return false;
+ }
knowledgeElement.setProgressState(ProgressState.APPROVED);
return update(knowledgeElement);
}
@@ -73,10 +74,11 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* @see org.splat.service.KnowledgeElementService#demote(org.splat.dal.bo.som.KnowledgeElement)
*/
@Transactional
- public boolean demote(KnowledgeElement knowledgeElement) {
+ public boolean demote(final KnowledgeElement knowledgeElement) {
if (knowledgeElement.getProgressState() != ProgressState.APPROVED
- && knowledgeElement.getProgressState() != ProgressState.inCHECK)
+ && knowledgeElement.getProgressState() != ProgressState.inCHECK) {
return false;
+ }
knowledgeElement.setProgressState(ProgressState.inDRAFT);
return update(knowledgeElement);
}
@@ -88,13 +90,13 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* the knowledge element to update
* @return true if updating succeeded
*/
- protected boolean update(KnowledgeElement knowledgeElement) {
+ protected boolean update(final KnowledgeElement knowledgeElement) {
try {
getKnowledgeElementDAO().update(knowledgeElement);
getIndexService().update(knowledgeElement);
return true;
} catch (Exception error) {
- logger.error("Unable to re-index the knowledge '"
+ LOGGER.error("Unable to re-index the knowledge '"
+ knowledgeElement.getIndex() + "', reason:", error);
return false;
}
@@ -106,10 +108,10 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* @see org.splat.service.KnowledgeElementService#promote(org.splat.dal.bo.som.KnowledgeElement)
*/
@Transactional
- public boolean promote(KnowledgeElement knowledgeElement) {
- // -------------------------
- if (knowledgeElement.getProgressState() != ProgressState.inDRAFT)
+ public boolean promote(final KnowledgeElement knowledgeElement) {
+ if (knowledgeElement.getProgressState() != ProgressState.inDRAFT) {
return false;
+ }
knowledgeElement.setProgressState(ProgressState.inCHECK);
return update(knowledgeElement);
}
@@ -120,12 +122,41 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* @see org.splat.service.KnowledgeElementService#rename(org.splat.dal.bo.som.KnowledgeElement, java.lang.String)
*/
@Transactional
- public void rename(KnowledgeElement knowledgeElement, String title)
+ public void rename(final KnowledgeElementDTO kelmDTO, final String title)
throws InvalidPropertyException {
- if (title.length() == 0)
+ if (title.length() == 0) {
throw new InvalidPropertyException("name");
- knowledgeElement.setTitle(title);
- update(knowledgeElement);
+ }
+ KnowledgeElement kelm = getKnowledgeElementDAO().get(kelmDTO.getIndex());
+ kelm.setTitle(title);
+ // Update lucene index.
+ update(kelm);
+ }
+
+ /**
+ * Update the description of the knowledge element.
+ *
+ * @param kelm
+ * the knoledge element to update
+ * @param description
+ * the new description
+ */
+ @Transactional
+ public void update(final KnowledgeElementDTO kelmDTO, final String description) {
+ KnowledgeElement kelm = getKnowledgeElementDAO().get(kelmDTO.getIndex());
+ kelm.setValue(description.trim());
+ if (!kelm.getValue().startsWith("")) {
+ StringBuffer text = new StringBuffer("
");
+ int index = kelm.getValue().indexOf("
");
+ if (index > 0) {
+ kelm.setValue(text.append(kelm.getValue().substring(0, index))
+ .append("
")
+ .append(kelm.getValue().substring(index)).toString());
+ } else {
+ kelm.setValue(text.append(kelm.getValue()).append("
")
+ .toString());
+ }
+ }
}
/**
@@ -134,7 +165,7 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* @see org.splat.service.KnowledgeElementService#selectKnowledgeElement(long)
*/
@Transactional(readOnly = true)
- public KnowledgeElement selectKnowledgeElement(long index) {
+ public KnowledgeElement selectKnowledgeElement(final long index) {
KnowledgeElement result = getKnowledgeElementDAO().get(index);
getStudyService().loadWorkflow(
result.getOwnerScenario().getOwnerStudy());
@@ -147,7 +178,7 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* @see org.splat.service.KnowledgeElementService#getKnowledgeElement(long)
*/
@Transactional(readOnly = true)
- public KnowledgeElementDTO getKnowledgeElement(long index) {
+ public KnowledgeElementDTO getKnowledgeElement(final long index) {
KnowledgeElement kelm = getKnowledgeElementDAO().get(index);
getStudyService().loadWorkflow(kelm.getOwnerScenario().getOwnerStudy());
KnowledgeElementDTO result = BeanHelper.copyBean(kelm,
@@ -163,7 +194,7 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* @param scenar the scenario
* @return collection of steps
*/
- private Collection extends Step> getAllSteps(Scenario scenar) {
+ private Collection extends Step> getAllSteps(final Scenario scenar) {
Vector result = new Vector();
Step[] step = getProjectElementService().getSteps(scenar);
@@ -174,44 +205,20 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
}
step = getProjectElementService().getSteps(scenar.getOwnerStudy());
for (int i = step.length - 1; i > -1; i--) {
- if (step[i].getNumber() >= base)
+ if (step[i].getNumber() >= base) {
continue;
+ }
result.add(0, step[i]);
}
for (int i = 0; i < step.length; i++) {
- if (step[i].getNumber() <= last)
+ if (step[i].getNumber() <= last) {
continue;
+ }
result.add(step[i]);
}
return result;
}
- /**
- * Update the description of the knowledge element.
- *
- * @param kelm
- * the knoledge element to update
- * @param description
- * the new description
- */
- @Transactional
- public void update(KnowledgeElement kelm, String description) {
- kelm.setValue(description.trim());
- if (!kelm.getValue().startsWith("")) {
- StringBuffer text = new StringBuffer("
");
- int index = kelm.getValue().indexOf("
");
- if (index > 0) {
- kelm.setValue(text.append(kelm.getValue().substring(0, index))
- .append("
")
- .append(kelm.getValue().substring(index)).toString());
- } else {
- kelm.setValue(text.append(kelm.getValue()).append("")
- .toString());
- }
- }
- getKnowledgeElementDAO().update(kelm); // No need to update the Lucene index
- }
-
/**
* Get the indexService.
*
@@ -227,7 +234,7 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* @param indexService
* the indexService to set
*/
- public void setIndexService(IndexService indexService) {
+ public void setIndexService(final IndexService indexService) {
_indexService = indexService;
}
@@ -246,7 +253,7 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* @param knowledgeElementDAO
* the knowledgeElementDAO to set
*/
- public void setKnowledgeElementDAO(KnowledgeElementDAO knowledgeElementDAO) {
+ public void setKnowledgeElementDAO(final KnowledgeElementDAO knowledgeElementDAO) {
_knowledgeElementDAO = knowledgeElementDAO;
}
@@ -265,7 +272,7 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* @param studyService
* the studyService to set
*/
- public void setStudyService(StudyService studyService) {
+ public void setStudyService(final StudyService studyService) {
_studyService = studyService;
}
@@ -281,7 +288,7 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService {
* Set the projectElementService.
* @param projectElementService the projectElementService to set
*/
- public void setProjectElementService(ProjectElementService projectElementService) {
+ public void setProjectElementService(final ProjectElementService projectElementService) {
_projectElementService = projectElementService;
}
}
diff --git a/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java
index 464eff5..6adbaba 100644
--- a/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java
+++ b/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java
@@ -122,7 +122,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* the projectElementService to set
*/
public void setProjectElementService(
- ProjectElementService projectElementService) {
+ final ProjectElementService projectElementService) {
_projectElementService = projectElementService;
}
@@ -141,7 +141,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* @param publicationService
* the publicationService to set
*/
- public void setPublicationService(PublicationService publicationService) {
+ public void setPublicationService(final PublicationService publicationService) {
_publicationService = publicationService;
}
@@ -160,7 +160,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* @param stepService
* the stepService to set
*/
- public void setStepService(StepService stepService) {
+ public void setStepService(final StepService stepService) {
_stepService = stepService;
}
@@ -182,8 +182,8 @@ public class ScenarioServiceImpl implements ScenarioService {
* if some property occurs several times
*/
@Transactional
- public Study createStudy(Study.Properties sprop, Scenario.Properties oprop,
- SimulationContext.Properties cprop) throws MissedPropertyException,
+ public Study createStudy(final Study.Properties sprop, final Scenario.Properties oprop,
+ final SimulationContext.Properties cprop) throws MissedPropertyException,
InvalidPropertyException, MultiplyDefinedException {
Study study = getStudyService().createStudy(sprop);
addScenario(study, oprop);
@@ -206,8 +206,8 @@ public class ScenarioServiceImpl implements ScenarioService {
* org.splat.dal.bo.som.KnowledgeElement.Properties)
*/
@Transactional
- public KnowledgeElement addKnowledgeElement(Scenario aScenarioDTO,
- KnowledgeElement.Properties kprop) throws MissedPropertyException,
+ public KnowledgeElement addKnowledgeElement(final Scenario aScenarioDTO,
+ final KnowledgeElement.Properties kprop) throws MissedPropertyException,
InvalidPropertyException, MultiplyDefinedException {
KnowledgeElement kelm = null;
try {
@@ -232,6 +232,11 @@ public class ScenarioServiceImpl implements ScenarioService {
} else if (aScenarioDTO.getKnowledgeElementsList() != null) { // If null, knowl will be initialized when needed
aScenarioDTO.getKnowledgeElementsList().add(kelm);
}
+
+ // Load the workflow for the parent study to take into account
+ // all study actors durng reindexing.
+ getStudyService().loadWorkflow(aScenario.getOwnerStudy());
+
// Update the lucene index of knowledge elements.
getIndexService().add(kelm);
if (logger.isDebugEnabled()) {
@@ -255,7 +260,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* @return true if updating succeeded
*/
@Transactional
- private boolean update(Scenario aScenario) {
+ private boolean update(final Scenario aScenario) {
boolean isOk = false;
try {
getScenarioDAO().update(aScenario); // Update of relational base
@@ -272,7 +277,7 @@ public class ScenarioServiceImpl implements ScenarioService {
*
* @see org.splat.service.ScenarioService#checkin(org.splat.dal.bo.som.Scenario)
*/
- public void checkin(Scenario aScenario) {
+ public void checkin(final Scenario aScenario) {
aScenario.setUser(null);
aScenario.setLastModificationDate(Calendar.getInstance().getTime());
getScenarioDAO().update(aScenario);
@@ -283,9 +288,10 @@ public class ScenarioServiceImpl implements ScenarioService {
*
* @see org.splat.service.ScenarioService#checkout(org.splat.dal.bo.som.Scenario, org.splat.dal.bo.kernel.User)
*/
- public boolean checkout(Scenario aScenario, User user) {
- if (!getStudyService().isStaffedBy(aScenario.getOwnerStudy(), user))
+ public boolean checkout(final Scenario aScenario, final User user) {
+ if (!getStudyService().isStaffedBy(aScenario.getOwnerStudy(), user)) {
return false;
+ }
aScenario.setUser(user);
aScenario.setLastModificationDate(Calendar.getInstance().getTime());
@@ -298,14 +304,15 @@ public class ScenarioServiceImpl implements ScenarioService {
*
* @see org.splat.service.ScenarioService#copyContentsUpTo(org.splat.dal.bo.som.Scenario, org.splat.som.Step)
*/
- public void copyContentsUpTo(Scenario scenario, Step lastep) {
+ public void copyContentsUpTo(final Scenario scenario, final Step lastep) {
Scenario base = (Scenario) lastep.getOwner();
Step[] from = getProjectElementService().getSteps(base);
Step[] to = getProjectElementService().getSteps(scenario);
for (int i = 0; i < from.length; i++) {
Step step = from[i];
- if (step.getNumber() > lastep.getNumber())
+ if (step.getNumber() > lastep.getNumber()) {
break;
+ }
List docs = step.getAllDocuments();
for (Iterator j = docs.iterator(); j.hasNext();) {
@@ -326,7 +333,7 @@ public class ScenarioServiceImpl implements ScenarioService {
*
* @see org.splat.service.ScenarioService#isEmpty(org.splat.dal.bo.som.Scenario)
*/
- public boolean isEmpty(Scenario scenario) {
+ public boolean isEmpty(final Scenario scenario) {
Step[] mystep = getProjectElementService().getSteps(scenario);
boolean isEmp = true;
for (int i = 0; i < mystep.length; i++) {
@@ -342,14 +349,16 @@ public class ScenarioServiceImpl implements ScenarioService {
* @param scenario
* @return
*/
- public boolean isFinished(Scenario scenario) {
+ public boolean isFinished(final Scenario scenario) {
Step[] mystep = getProjectElementService().getSteps(scenario);
boolean notempty = false; // If this is empty, this is not finished
for (int i = 0; i < mystep.length; i++) {
- if (!mystep[i].isStarted())
+ if (!mystep[i].isStarted()) {
continue;
- if (!mystep[i].isFinished())
+ }
+ if (!mystep[i].isFinished()) {
return false;
+ }
notempty = true;
}
return notempty;
@@ -361,15 +370,17 @@ public class ScenarioServiceImpl implements ScenarioService {
* @see org.splat.service.StudyService#addScenario(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.Scenario.Properties)
*/
@Transactional
- public Scenario addScenario(Study aStudy, Scenario.Properties sprop)
+ public Scenario addScenario(final Study aStudy, final Scenario.Properties sprop)
throws MissedPropertyException, InvalidPropertyException,
MultiplyDefinedException {
- if (sprop.getManager() == null)
+ if (sprop.getManager() == null) {
sprop.setManager(aStudy.getAuthor());
+ }
Scenario scenario = new Scenario(sprop.setOwnerStudy(aStudy));
- if (sprop.getBaseStep() != null)
+ if (sprop.getBaseStep() != null) {
copyContentsUpTo(scenario, sprop.getBaseStep());
+ }
Scenario previous = sprop.getInsertAfter();
if (previous == null) {
@@ -404,11 +415,12 @@ public class ScenarioServiceImpl implements ScenarioService {
* the knowledge element to remove
* @return true if removal succeeded
*/
- public boolean removeKnowledgeElement(Scenario scenario,
- KnowledgeElement kelm) {
+ public boolean removeKnowledgeElement(final Scenario scenario,
+ final KnowledgeElement kelm) {
KnowledgeElement torem = scenario.getKnowledgeElement(kelm.getIndex());
- if (torem == null)
+ if (torem == null) {
return false;
+ }
boolean done = scenario.getKnowledgeElements().remove(torem);
if (done) {
// Update of my transient data
@@ -416,8 +428,9 @@ public class ScenarioServiceImpl implements ScenarioService {
// RKV: List kelms = scenario.getKnowledgeByType().get(
// RKV: kelm.getType().getIndex());
// RKV: kelms.remove(torem);
- if (scenario.getKnowledgeElementsList() != null)
+ if (scenario.getKnowledgeElementsList() != null) {
scenario.getKnowledgeElementsList().remove(torem);
+ }
getScenarioDAO().update(scenario);
// TODO: If the owner study is not private, remove the knowledge from the Lucene index
return true;
@@ -441,7 +454,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* @param knowledgeElementDAO
* the knowledgeElementDAO to set
*/
- public void setKnowledgeElementDAO(KnowledgeElementDAO knowledgeElementDAO) {
+ public void setKnowledgeElementDAO(final KnowledgeElementDAO knowledgeElementDAO) {
_knowledgeElementDAO = knowledgeElementDAO;
}
@@ -460,7 +473,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* @param indexService
* the indexService to set
*/
- public void setIndexService(IndexService indexService) {
+ public void setIndexService(final IndexService indexService) {
_indexService = indexService;
}
@@ -479,7 +492,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* @param scenarioDAO
* the scenarioDAO to set
*/
- public void setScenarioDAO(ScenarioDAO scenarioDAO) {
+ public void setScenarioDAO(final ScenarioDAO scenarioDAO) {
_scenarioDAO = scenarioDAO;
}
@@ -498,7 +511,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* @param studyDAO
* the studyDAO to set
*/
- public void setStudyDAO(StudyDAO studyDAO) {
+ public void setStudyDAO(final StudyDAO studyDAO) {
_studyDAO = studyDAO;
}
@@ -518,7 +531,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* the knowledgeElementTypeService to set
*/
public void setKnowledgeElementTypeService(
- KnowledgeElementTypeService knowledgeElementTypeService) {
+ final KnowledgeElementTypeService knowledgeElementTypeService) {
_knowledgeElementTypeService = knowledgeElementTypeService;
}
@@ -537,7 +550,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* @param studyService
* the studyService to set
*/
- public void setStudyService(StudyService studyService) {
+ public void setStudyService(final StudyService studyService) {
_studyService = studyService;
}
@@ -556,7 +569,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* @param userService
* the userService to set
*/
- public void setUserService(UserService userService) {
+ public void setUserService(final UserService userService) {
_userService = userService;
}
@@ -575,7 +588,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* @param userDAO
* the userDAO to set
*/
- public void setUserDAO(UserDAO userDAO) {
+ public void setUserDAO(final UserDAO userDAO) {
_userDAO = userDAO;
}
@@ -595,7 +608,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* the knowledgeElementTypeDAO to set
*/
public void setKnowledgeElementTypeDAO(
- KnowledgeElementTypeDAO knowledgeElementTypeDAO) {
+ final KnowledgeElementTypeDAO knowledgeElementTypeDAO) {
_knowledgeElementTypeDAO = knowledgeElementTypeDAO;
}
@@ -615,7 +628,7 @@ public class ScenarioServiceImpl implements ScenarioService {
* the simulationContextService to set
*/
public void setSimulationContextService(
- SimulationContextService simulationContextService) {
+ final SimulationContextService simulationContextService) {
_simulationContextService = simulationContextService;
}
diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeElementDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeElementDTO.java
index fe1be2c..10b2332 100644
--- a/Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeElementDTO.java
+++ b/Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeElementDTO.java
@@ -60,9 +60,29 @@ public class KnowledgeElementDTO {
*/
private String _scenarioTitle;
- // ==============================================================================================================================
- // Public member functions
- // ==============================================================================================================================
+ /**
+ * Default constructor.
+ */
+ public KnowledgeElementDTO() {
+ // Create empty bean.
+ }
+
+ /**
+ * Constructor with fields values.
+ *
+ * @param index
+ * knowledge element primary key
+ * @param title
+ * knowledge title
+ * @param value
+ * knowledge value
+ */
+ public KnowledgeElementDTO(final long index, final String title,
+ final String value) {
+ _index = index;
+ _title = title;
+ _value = value;
+ }
/**
* Compare this knowledge element with the given one.
@@ -71,7 +91,7 @@ public class KnowledgeElementDTO {
* the knowledge element to compare to
* @return true if knowledge elements are equal
*/
- public boolean equals(final KnowledgeElementDTO given) { //NOPMD: RKV: TODO: to be refined
+ public boolean equals(final KnowledgeElementDTO given) { // NOPMD: RKV: TODO: to be refined
return (this.getType().equals(given.getType()) && this.getValue()
.equals(given.getValue()));
}
diff --git a/Workspace/Siman/build.xml b/Workspace/Siman/build.xml
index 1122424..1c35595 100644
--- a/Workspace/Siman/build.xml
+++ b/Workspace/Siman/build.xml
@@ -66,16 +66,19 @@
-
+
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
diff --git a/Workspace/Siman/src/hibernate.properties b/Workspace/Siman/src/hibernate.properties
index dd6d274..6c0cad6 100644
--- a/Workspace/Siman/src/hibernate.properties
+++ b/Workspace/Siman/src/hibernate.properties
@@ -1,4 +1,4 @@
-# Generated at 02/11/2012 08:35:56
+# Generated at 02/11/2012 05:50:20
# Don't edit manually. See the source in D:\users\rkv\SIMAN\SIMAN_SRC\Workspace\Siman\conf\templates.
# Connection properties
connection.driver_class=com.mysql.jdbc.Driver
diff --git a/Workspace/Siman/src/jdbc.properties b/Workspace/Siman/src/jdbc.properties
index 7573dfc..8404e7d 100644
--- a/Workspace/Siman/src/jdbc.properties
+++ b/Workspace/Siman/src/jdbc.properties
@@ -1,4 +1,4 @@
-# Generated at 02/11/2012 08:35:56
+# Generated at 02/11/2012 05:50:20
# Don't edit manually. See the source in D:\users\rkv\SIMAN\SIMAN_SRC\Workspace\Siman\conf\templates.
# Connection properties
connection.url=jdbc:mysql://localhost/simer
diff --git a/Workspace/Siman/src/org/splat/simer/EditKnowledgeElementAction.java b/Workspace/Siman/src/org/splat/simer/EditKnowledgeElementAction.java
index 94c4888..0346c98 100644
--- a/Workspace/Siman/src/org/splat/simer/EditKnowledgeElementAction.java
+++ b/Workspace/Siman/src/org/splat/simer/EditKnowledgeElementAction.java
@@ -7,6 +7,7 @@ import org.splat.dal.bo.som.Scenario;
import org.splat.service.KnowledgeElementService;
import org.splat.service.KnowledgeElementTypeService;
import org.splat.service.ScenarioService;
+import org.splat.service.dto.KnowledgeElementDTO;
import org.splat.som.Step;
/**
@@ -50,27 +51,23 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
private String _menuProperty;
/**
- * Value of the title bar property.
- * It can be: study, knowledge.
+ * Value of the title bar property. It can be: study, knowledge.
*/
private String _titleProperty;
/**
- * Property that indicates whether the current open study is editable or not.
- * On the screen it looks like pen on the status icon, pop-up menu also can be called.
- * It is necessary for correct building the title bar.
+ * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up
+ * menu also can be called. It is necessary for correct building the title bar.
*/
private String _editDisabledProperty = "false";
/**
- * Value of the tool bar property.
- * It can be: none, standard, study, back.
+ * Value of the tool bar property. It can be: none, standard, study, back.
*/
private String _toolProperty;
-
+
/**
- * Value of the left menu property.
- * It can be: open, study, knowledge, scenario.
+ * Value of the left menu property. It can be: open, study, knowledge, scenario.
*/
private String _leftMenuProperty;
@@ -88,13 +85,15 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
setMenuProperty("study");
setTitleProperty("study");
- if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) {
+ if ("true".equals(getWriteAccess())
+ && getUserRights().canCreateDocument()) {
setToolProperty("study");
} else {
setToolProperty("standard");
}
setLeftMenuProperty("study");
- initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty);
+ initializationFullScreenContext(_menuProperty, _titleProperty,
+ _editDisabledProperty, _toolProperty, _leftMenuProperty);
return SUCCESS;
}
@@ -108,13 +107,15 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
setMenuProperty("study");
setTitleProperty("study");
- if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) {
+ if ("true".equals(getWriteAccess())
+ && getUserRights().canCreateDocument()) {
setToolProperty("study");
} else {
setToolProperty("standard");
}
setLeftMenuProperty("study");
- initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty);
+ initializationFullScreenContext(_menuProperty, _titleProperty,
+ _editDisabledProperty, _toolProperty, _leftMenuProperty);
try {
User user = getConnectedUser();
@@ -123,7 +124,16 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
Step step = mystudy.getSelectedStep();
Scenario scene = (Scenario) step.getOwner(); // It is necessarily a Scenario
- if (title != null && value != null) { // Addition of a new Knowledge Element
+ if ((title == null) || (value == null)) {
+ KnowledgeElementDTO kelm = new KnowledgeElementDTO(Integer
+ .valueOf(type), title, value);
+ if (value == null) { // Renaming of an existing Knowledge Element
+ getKnowledgeElementService().rename(kelm, title);
+ } else { // Edition of a knowledge
+ getKnowledgeElementService().update(kelm, value);
+ }
+ mystudy.update(kelm); // For updating the truncated value
+ } else { // Addition of a new Knowledge Element
KnowledgeElement.Properties kprop = new KnowledgeElement.Properties();
KnowledgeElementType ktype = getKnowledgeElementTypeService()
.selectType(Integer.valueOf(type));
@@ -132,16 +142,6 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
mystudy.add(getScenarioService().addKnowledgeElement(scene,
kprop));
getMenu("study").selects(mystudy.getSelection()); // Updates the menu icon, in case of first added document
- } else if (title != null) { // Renaming of an existing Knowledge Element
- KnowledgeElement kelm = scene.getKnowledgeElement(Integer
- .valueOf(type));
- getKnowledgeElementService().rename(kelm, title);
- // Useless to update the open study
- } else if (value != null) { // Edition of a knowledge
- KnowledgeElement kelm = scene.getKnowledgeElement(Integer
- .valueOf(type));
- getKnowledgeElementService().update(kelm, value);
- mystudy.update(kelm); // For updating the truncated value
}
return SUCCESS;
} catch (RuntimeException saverror) {
@@ -215,13 +215,15 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
setMenuProperty("study");
setTitleProperty("study");
- if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) {
+ if ("true".equals(getWriteAccess())
+ && getUserRights().canCreateDocument()) {
setToolProperty("study");
} else {
setToolProperty("standard");
}
setLeftMenuProperty("study");
- initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty);
+ initializationFullScreenContext(_menuProperty, _titleProperty,
+ _editDisabledProperty, _toolProperty, _leftMenuProperty);
}
@@ -255,7 +257,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
* @param type
* the knowledge type name
*/
- public void setKnowledgeType(String type) {
+ public void setKnowledgeType(final String type) {
// ------------------------------------------
this.type = type;
}
@@ -266,7 +268,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
* @param title
* the new knowledge title
*/
- public void setKnowledgeTitle(String title) {
+ public void setKnowledgeTitle(final String title) {
// --------------------------------------------
this.title = title;
}
@@ -277,7 +279,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
* @param value
* the knowledge value
*/
- public void setKnowledgeValue(String value) {
+ public void setKnowledgeValue(final String value) {
// --------------------------------------------
this.value = value;
}
@@ -297,7 +299,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
* @param scenarioService
* the scenarioService to set
*/
- public void setScenarioService(ScenarioService scenarioService) {
+ public void setScenarioService(final ScenarioService scenarioService) {
_scenarioService = scenarioService;
}
@@ -317,7 +319,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
* the knowledgeElementService to set
*/
public void setKnowledgeElementService(
- KnowledgeElementService knowledgeElementService) {
+ final KnowledgeElementService knowledgeElementService) {
_knowledgeElementService = knowledgeElementService;
}
@@ -337,7 +339,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
* the knowledgeElementTypeService to set
*/
public void setKnowledgeElementTypeService(
- KnowledgeElementTypeService knowledgeElementTypeService) {
+ final KnowledgeElementTypeService knowledgeElementTypeService) {
_knowledgeElementTypeService = knowledgeElementTypeService;
}
@@ -346,6 +348,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
*
* @return the menuProperty
*/
+ @Override
public String getMenuProperty() {
return _menuProperty;
}
@@ -356,6 +359,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
* @param menuProperty
* the menuProperty to set
*/
+ @Override
public void setMenuProperty(final String menuProperty) {
this._menuProperty = menuProperty;
}
@@ -365,6 +369,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
*
* @return the _titleProperty
*/
+ @Override
public String getTitleProperty() {
return _titleProperty;
}
@@ -375,6 +380,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
* @param titleProperty
* the titleProperty to set
*/
+ @Override
public void setTitleProperty(final String titleProperty) {
_titleProperty = titleProperty;
}
@@ -384,6 +390,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
*
* @return the editDisabledProperty
*/
+ @Override
public String getEditDisabledProperty() {
return _editDisabledProperty;
}
@@ -394,6 +401,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
* @param editDisabledProperty
* the editDisabledProperty to set
*/
+ @Override
public void setEditDisabledProperty(final String editDisabledProperty) {
_editDisabledProperty = editDisabledProperty;
}
@@ -403,6 +411,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
*
* @return the toolProperty
*/
+ @Override
public String getToolProperty() {
return _toolProperty;
}
@@ -413,25 +422,30 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
* @param toolProperty
* the toolProperty to set
*/
+ @Override
public void setToolProperty(final String toolProperty) {
_toolProperty = toolProperty;
}
/**
* Get the leftMenuProperty.
+ *
* @return the leftMenuProperty
*/
+ @Override
public String getLeftMenuProperty() {
return _leftMenuProperty;
}
/**
* Set the leftMenuProperty.
- * @param leftMenuProperty the leftMenuProperty to set
+ *
+ * @param leftMenuProperty
+ * the leftMenuProperty to set
*/
+ @Override
public void setLeftMenuProperty(final String leftMenuProperty) {
_leftMenuProperty = leftMenuProperty;
}
-
}
\ No newline at end of file
diff --git a/Workspace/Siman/src/org/splat/simer/KnowledgeElementFacade.java b/Workspace/Siman/src/org/splat/simer/KnowledgeElementFacade.java
index 3d4c9ae..2564f29 100644
--- a/Workspace/Siman/src/org/splat/simer/KnowledgeElementFacade.java
+++ b/Workspace/Siman/src/org/splat/simer/KnowledgeElementFacade.java
@@ -1,130 +1,214 @@
package org.splat.simer;
-import org.splat.dal.bo.som.KnowledgeElement;
+import org.splat.service.dto.KnowledgeElementDTO;
import org.splat.wapp.PopupMenu;
-
public class KnowledgeElementFacade {
- private KnowledgeElement my;
- private State state;
- private String value;
- private PopupMenu popup;
-
- private enum State { closed, open }
-
-// ==============================================================================================================================
-// Constructor
-// ==============================================================================================================================
-
- public KnowledgeElementFacade (KnowledgeElement represented) {
-// ------------------------------------------------------------
- my = represented;
- state = State.closed;
-
- this.refresh(); // Initializes the presentation of my knowledge
- }
-
-// ==============================================================================================================================
-// Public member functions
-// ==============================================================================================================================
-
- public void develop () {
-// ----------------------
- state = State.open;
- }
-
- public void reduce () {
-// ---------------------
- state = State.closed;
- }
-
-// ==============================================================================================================================
-// Getters
-// ==============================================================================================================================
-
- public String getFullValue () {
-// -----------------------------
- return my.getValue().replaceAll("'", "").replaceAll("\"", """);
- }
- public String getIndex () {
-// -------------------------
- return String.valueOf(my.getIndex());
- }
- public PopupMenu getPopup () {
-// ----------------------------
- popup.setContext("feedbex", my); // Cannot be done at construction because pop-ups are shared
- return popup;
- }
- public String getPresentationState () {
-// -------------------------------------
- return state.toString();
- }
- public String getProgressState () {
-// ---------------------------------
- return my.getProgressState().toString();
- }
- public String getTitle () {
-// -------------------------
- return my.getTitle();
- }
- public String getValue () {
-// -------------------------
- if (state == State.closed) return value;
- else return my.getValue();
- }
- public boolean isFacadeOf (KnowledgeElement represented) {
-// --------------------------------------------------------
- return my.equals(represented);
- }
-
-// ==============================================================================================================================
-// Protected services
-// ==============================================================================================================================
-
- protected void refresh () {
-// -------------------------
- String[] tags = {"", "", "", "", "" };
-
- popup = ApplicationSettings.getPopupMenu("feedbex");
- value = my.getValue();
-
-// One line extract of the knowledge value
- int size = 70 + 3; // Maximum length displayable on 1 line, including the starting tag
- int i;
- for (i=0; i -1 && pos < size) size = size + 2*tags[i].length() + 1; // Inclusion of the open and close tags
- }
- if (value.startsWith("")) {
- int endex = value.indexOf("
");
- if ((i=value.indexOf("
0) if (i < endex) endex = i;
- if ((i=value.indexOf("")) > 0) if (i < endex) endex = i;
- if ((i=value.indexOf("")) > 0) if (i < endex) endex = i;
- int next = endex + 4; // Index of the next paragraph, if exist
- if (endex > size) {
- endex = size;
- char endchar = value.charAt(endex);
- if (endchar == '-' || endchar == ',' || endchar == ';' || endchar == '.') endex += 1;
- else if (endchar != ' ') while (--endex > 0) {
- endchar = value.charAt(endex);
- if (endchar == ' ') break;
- if (endchar == '-' || endchar == ',' || endchar == ';' || endchar == '.') {
- endex += 1;
- break;
- }
- }
- }
- else size = 0;
-
- value = value.substring(3, endex).trim();
- if ((i=value.lastIndexOf("b>")) > 0) if (value.charAt(i-1) == '<') value = value + "
";
- if ((i=value.lastIndexOf("i>")) > 0) if (value.charAt(i-1) == '<') value = value + "";
- if ((i=value.lastIndexOf("u>")) > 0) if (value.charAt(i-1) == '<') value = value + "";
- if (my.getValue().length() > next || size > 0) value = value + " ...";
- }
- else {
- if (value.length() > size-3) value = value.substring(0, size-3) + " ...";
- }
- }
+ private transient final KnowledgeElementDTO _my;
+ private transient State _state;
+ private transient String _value;
+ private transient PopupMenu _popup;
+
+ private enum State {
+ closed, open
+ }
+
+ // ==============================================================================================================================
+ // Constructor
+ // ==============================================================================================================================
+
+ public KnowledgeElementFacade(final KnowledgeElementDTO represented) {
+ _my = represented;
+ _state = State.closed;
+
+ this.refresh(); // Initializes the presentation of my knowledge
+ }
+
+ // ==============================================================================================================================
+ // Public member functions
+ // ==============================================================================================================================
+
+ public void develop() {
+ _state = State.open;
+ }
+
+ public void reduce() {
+ _state = State.closed;
+ }
+
+ // ==============================================================================================================================
+ // Getters
+ // ==============================================================================================================================
+
+ public String getFullValue() {
+ return _my.getValue().replaceAll("'", "").replaceAll("\"", """);
+ }
+
+ public String getIndex() {
+ return String.valueOf(_my.getIndex());
+ }
+
+ public PopupMenu getPopup() {
+ _popup.setContext("feedbex", _my); // Cannot be done at construction because pop-ups are shared
+ return _popup;
+ }
+
+ public String getPresentationState() {
+ return _state.toString();
+ }
+
+ public String getProgressState() {
+ return _my.getProgressState().toString();
+ }
+
+ public String getTitle() {
+ return _my.getTitle();
+ }
+
+ public String getValue() {
+ String res;
+ if (_state == State.closed) {
+ res = _value;
+ } else {
+ res = _my.getValue();
+ }
+ return res;
+ }
+
+ public boolean isFacadeOf(final KnowledgeElementDTO represented) {
+ return _my.equals(represented);
+ }
+
+ /**
+ * Set and refresh the knoledge element value.
+ *
+ * @param aValue
+ * the knowledge element to set
+ */
+ public void refresh(final KnowledgeElementDTO represented) {
+ if (represented.getTitle() != null) {
+ _my.setTitle(represented.getTitle());
+ }
+ if (represented.getValue() != null) {
+ _my.setValue(represented.getValue());
+ refresh();
+ }
+ }
+
+ // ==============================================================================================================================
+ // Protected services
+ // ==============================================================================================================================
+
+ /**
+ * Refresh knowledge element text and create a trimmed value for preview.
+ */
+ private void refresh() {
+ String[] tags = { "", "", "", "", "" };
+
+ _popup = ApplicationSettings.getPopupMenu("feedbex");
+ _value = _my.getValue();
+
+ // One line extract of the knowledge value
+ int size = 70 + 3; // Maximum length displayable on 1 line, including the starting tag
+ int i;
+ for (i = 0; i < tags.length; i++) {
+ int pos = _value.indexOf(tags[i]);
+ if (pos > -1 && pos < size) {
+ size = size + 2 * tags[i].length() + 1; // Inclusion of the open and close tags
+ }
+ }
+ if (_value.startsWith("
")) {
+ int endex = _value.indexOf("
");
+ endex = nearestPositionOf(_value, "
", endex);
+ endex = nearestPositionOf(_value, "", endex);
+ int next = endex + 4; // Index of the next paragraph, if exist
+ if (endex > size) {
+ endex = endOfExpressionPosition(_value, size);
+ } else {
+ size = 0;
+ }
+
+ _value = _value.substring(3, endex).trim();
+ _value = closeTag(_value, "b");
+ _value = closeTag(_value, "i");
+ _value = closeTag(_value, "u");
+ if (_my.getValue().length() > next || size > 0) {
+ _value = _value + " ...";
+ }
+ } else {
+ if (_value.length() > size - 3) {
+ _value = _value.substring(0, size - 3) + " ...";
+ }
+ }
+ }
+
+ /**
+ * Find the end position of an expression taking into account specific symbols.
+ *
+ * @param aValue
+ * the string
+ * @param size
+ * one line length limit
+ * @return actual end of expression position
+ */
+ private int endOfExpressionPosition(final String aValue, final int size) {
+ int res = size;
+ char endchar = aValue.charAt(res);
+ if (endchar == '-' || endchar == ',' || endchar == ';'
+ || endchar == '.') {
+ res += 1;
+ } else if (endchar != ' ') {
+ while (--res > 0) {
+ endchar = aValue.charAt(res);
+ if (endchar == ' ') {
+ break;
+ }
+ if (endchar == '-' || endchar == ',' || endchar == ';'
+ || endchar == '.') {
+ res += 1;
+ break;
+ }
+ }
+ }
+ return res;
+ }
+
+ /**
+ * Append a closing tag to the string.
+ *
+ * @param aValue
+ * the string
+ * @param aTag
+ * the tag to close
+ * @return the string with closed tag
+ */
+ private String closeTag(String aValue, final String aTag) {
+ int i = aValue.lastIndexOf(aTag + ">");
+ if ((i > 0) && (aValue.charAt(i - 1) == '<')) {
+ aValue = aValue + "" + aTag + ">";
+ }
+ return aValue;
+ }
+
+ /**
+ * Find a nearest position of the given substring looking from the beginning till the given position.
+ *
+ * @param aValue
+ * the string
+ * @param toFind
+ * the substring to search
+ * @param endex
+ * the end of expression position
+ * @return the position of the first occurrence or the given end of expression position
+ */
+ private int nearestPositionOf(final String aValue, final String toFind,
+ final int endex) {
+ int res = aValue.indexOf(toFind);
+ if ((res <= 0) || (res >= endex)) {
+ res = endex;
+ }
+ return res;
+ }
}
\ No newline at end of file
diff --git a/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java b/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java
index 63e7fff..7795dbe 100644
--- a/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java
+++ b/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java
@@ -21,11 +21,11 @@ public class OpenKnowledge extends OpenObject {
/**
* The open knowledge element DTO.
*/
- private KnowledgeElementDTO myknelm = new KnowledgeElementDTO();
+ private transient KnowledgeElementDTO _myknelm = new KnowledgeElementDTO();
/**
* Creation date.
*/
- private String credate;
+ private transient String _credate;
/**
* Knowledge element left menu.
@@ -37,7 +37,7 @@ public class OpenKnowledge extends OpenObject {
* @param context
* the list of steps
*/
- public Menu(List context) {
+ public Menu(final List context) {
super("steps", "study");
int i = 0;
int j = 0;
@@ -45,12 +45,14 @@ public class OpenKnowledge extends OpenObject {
Step step = k.next();
int number = step.getNumber();
String icon;
- if (step.mayContain(KnowledgeElement.class))
+ if (step.mayContain(KnowledgeElement.class)) {
j = i + 1; // Steps are numbered from 1 to N
- if (!step.isStarted())
- icon = "icon.empty.png";
- else
+ }
+ if (step.isStarted()) {
icon = "icon.done.png";
+ } else {
+ icon = "icon.empty.png";
+ }
addItem(String.valueOf(number), "folder.step." + number, icon,
"step-knowledge?selection=" + number);
}
@@ -69,7 +71,7 @@ public class OpenKnowledge extends OpenObject {
* the knowledge element DTO
* @return the open knowledge presentation
*/
- public OpenKnowledge open(KnowledgeElementDTO knelm) {
+ public OpenKnowledge open(final KnowledgeElementDTO knelm) {
ResourceBundle label = ResourceBundle.getBundle("labels",
getApplicationSettings().getCurrentLocale());
ResourceBundle custom = ResourceBundle.getBundle("som",
@@ -80,10 +82,10 @@ public class OpenKnowledge extends OpenObject {
String sceneTitle = knelm.getScenarioTitle();
String studyTitle = knelm.getStudyTitle();
- myknelm = knelm;
+ _myknelm = knelm;
// Preparation of the display
- credate = convert.format(myknelm.getDate());
+ _credate = convert.format(_myknelm.getDate());
// involving = getAllSteps(knelm.getOwnerScenario());
involving = knelm.getInvolving();
context = new ArrayList();
@@ -92,8 +94,9 @@ public class OpenKnowledge extends OpenObject {
int index = Integer.valueOf(selection);
for (Iterator i = involving.iterator(); i.hasNext();) {
Step next = i.next();
- if (next.getNumber() == index)
+ if (next.getNumber() == index) {
ustep = next;
+ }
for (Iterator j = next
.getAllSimulationContexts().iterator(); j.hasNext();) {
context.add(new SimulationContextFacade(j.next(),
@@ -117,50 +120,52 @@ public class OpenKnowledge extends OpenObject {
// ==============================================================================================================================
public String getAuthorName() {
- return myknelm.getAuthor().toString();
+ return _myknelm.getAuthor().toString();
}
public String getDate() {
- return credate;
+ return _credate;
}
public Long getIndex() {
- return myknelm.getIndex();
+ return _myknelm.getIndex();
}
+ @Override
public Menu getMenu() {
return (Menu) menu;
}
public ProgressState getProgressState() {
- return myknelm.getProgressState();
+ return _myknelm.getProgressState();
}
public String getReference() {
- return myknelm.getReference();
+ return _myknelm.getReference();
}
public KnowledgeElementDTO getKnowledgeObject() {
- return myknelm;
+ return _myknelm;
}
public String getTitle() {
- return myknelm.getTitle();
+ return _myknelm.getTitle();
}
public String getType() {
return ResourceBundle.getBundle("som",
getApplicationSettings().getCurrentLocale()).getString(
- "type.knowledge." + myknelm.getType().getName());
+ "type.knowledge." + _myknelm.getType().getName());
}
- public void setSelection(String step) {
+ public void setSelection(final String step) {
selection = step;
int index = Integer.valueOf(selection);
for (Iterator i = involving.iterator(); i.hasNext();) {
ustep = i.next();
- if (ustep.getNumber() == index)
+ if (ustep.getNumber() == index) {
break;
+ }
}
menu.selects(selection);
setupContents(); // The contents may have changed even if the selection is the same
diff --git a/Workspace/Siman/src/org/splat/simer/OpenObject.java b/Workspace/Siman/src/org/splat/simer/OpenObject.java
index a4a9bdd..b012106 100644
--- a/Workspace/Siman/src/org/splat/simer/OpenObject.java
+++ b/Workspace/Siman/src/org/splat/simer/OpenObject.java
@@ -12,14 +12,16 @@ import org.splat.dal.bo.som.DocumentType;
import org.splat.dal.bo.som.KnowledgeElement;
import org.splat.dal.bo.som.KnowledgeElementType;
import org.splat.dal.bo.som.ProgressState;
+import org.splat.dal.bo.som.Publication;
+import org.splat.dal.bo.som.Scenario;
import org.splat.service.KnowledgeElementTypeService;
import org.splat.service.ProjectElementService;
import org.splat.service.PublicationService;
+import org.splat.service.dto.KnowledgeElementDTO;
import org.splat.service.dto.Proxy;
import org.splat.service.technical.ProjectSettingsService;
-import org.splat.dal.bo.som.Publication;
-import org.splat.dal.bo.som.Scenario;
import org.splat.som.Step;
+import org.splat.util.BeanHelper;
import org.splat.wapp.Menu;
import org.splat.wapp.PopupMenu;
@@ -91,8 +93,8 @@ public abstract class OpenObject implements Proxy {
protected KnowledgeElementType type;
protected List list;
- public KnowledgeIterator(KnowledgeElementType type,
- List list) {
+ public KnowledgeIterator(final KnowledgeElementType type,
+ final List list) {
this.type = type;
this.list = list;
}
@@ -117,28 +119,31 @@ public abstract class OpenObject implements Proxy {
protected OpenObject() {
// -----------------------
// All member fields are supposed initialized by subclasses
- if (docpres == null)
+ if (docpres == null) {
docpres = new HashMap();
- if (knowpres == null)
+ }
+ if (knowpres == null) {
knowpres = new HashMap();
+ }
}
// ==============================================================================================================================
// Public member functions
// ==============================================================================================================================
- public void developDocument(String index) {
+ public void developDocument(final String index) {
// ------------------------------------------
for (Iterator i = contents.iterator(); i.hasNext();) {
DocumentFacade doc = i.next();
- if (!doc.getIndex().equals(index))
+ if (!doc.getIndex().equals(index)) {
continue;
+ }
doc.develop();
return;
}
}
- public void developKnowledge(String index) {
+ public void developKnowledge(final String index) {
// -------------------------------------------
for (Iterator i = knowledge.iterator(); i.hasNext();) {
List knowelms = i.next()
@@ -146,8 +151,9 @@ public abstract class OpenObject implements Proxy {
for (Iterator j = knowelms.iterator(); j
.hasNext();) {
KnowledgeElementFacade kelm = j.next();
- if (!kelm.getIndex().equals(index))
+ if (!kelm.getIndex().equals(index)) {
continue;
+ }
kelm.develop();
return;
}
@@ -160,7 +166,7 @@ public abstract class OpenObject implements Proxy {
knowpres.clear(); // For eventually reopening the knowledge from a fresh context
}
- public List collectInvolvedDocuments(DocumentType type) {
+ public List collectInvolvedDocuments(final DocumentType type) {
// ------------------------------------------------------------------
List found = new Vector();
for (Iterator i = involving.iterator(); i.hasNext();) {
@@ -168,8 +174,9 @@ public abstract class OpenObject implements Proxy {
List exist = step.getAllDocuments();
for (Iterator j = exist.iterator(); j.hasNext();) {
Document doc = j.next().value();
- if (doc.getType().equals(type))
+ if (doc.getType().equals(type)) {
found.add(doc);
+ }
}
}
return found;
@@ -230,29 +237,31 @@ public abstract class OpenObject implements Proxy {
return (popup != null); // The pop-up is supposed existed when the user is staffed on the study
}
- public void reduceDocument(String index) {
+ public void reduceDocument(final String index) {
// -----------------------------------------
for (Iterator i = contents.iterator(); i.hasNext();) {
DocumentFacade doc = i.next();
- if (!doc.getIndex().equals(index))
+ if (!doc.getIndex().equals(index)) {
continue;
+ }
doc.reduceAll();
return;
}
}
- public void reduceHistory(String index) {
+ public void reduceHistory(final String index) {
// ----------------------------------------
for (Iterator i = contents.iterator(); i.hasNext();) {
DocumentFacade doc = i.next();
- if (!doc.getIndex().equals(index))
+ if (!doc.getIndex().equals(index)) {
continue;
+ }
doc.reduce();
return;
}
}
- public void reduceKnowledge(String index) {
+ public void reduceKnowledge(final String index) {
// ------------------------------------------
for (Iterator i = knowledge.iterator(); i.hasNext();) {
List knowelms = i.next()
@@ -260,8 +269,9 @@ public abstract class OpenObject implements Proxy {
for (Iterator j = knowelms.iterator(); j
.hasNext();) {
KnowledgeElementFacade kelm = j.next();
- if (!kelm.getIndex().equals(index))
+ if (!kelm.getIndex().equals(index)) {
continue;
+ }
kelm.reduce();
return;
}
@@ -285,8 +295,9 @@ public abstract class OpenObject implements Proxy {
List kelms = scene.getAllKnowledgeElements();
Iterator more = kelms.iterator();
KnowledgeElement current = null;
- if (more.hasNext())
+ if (more.hasNext()) {
current = more.next();
+ }
knowledge = new Vector(types.size());
for (Iterator i = types.iterator(); i
@@ -298,14 +309,15 @@ public abstract class OpenObject implements Proxy {
KnowledgeElementFacade facade = knowpres.get(current
.getIndex());
if (facade == null) {
- facade = new KnowledgeElementFacade(current);
+ facade = new KnowledgeElementFacade(BeanHelper.copyBean(current, KnowledgeElementDTO.class));
knowpres.put(current.getIndex(), facade);
}
display.add(facade);
- if (more.hasNext())
+ if (more.hasNext()) {
current = more.next();
- else
+ } else {
current = null;
+ }
}
knowledge.add(new KnowledgeIterator(type, display));
}
@@ -357,7 +369,7 @@ public abstract class OpenObject implements Proxy {
* @param projectSettingsService
* project settings service
*/
- public void setProjectSettings(ProjectSettingsService projectSettingsService) {
+ public void setProjectSettings(final ProjectSettingsService projectSettingsService) {
_projectSettingsService = projectSettingsService;
}
@@ -367,7 +379,7 @@ public abstract class OpenObject implements Proxy {
* @param publicationService
* the publicationService to set
*/
- public void setPublicationService(PublicationService publicationService) {
+ public void setPublicationService(final PublicationService publicationService) {
_publicationService = publicationService;
}
@@ -377,7 +389,7 @@ public abstract class OpenObject implements Proxy {
* @param menu
* the menu to set
*/
- public void setMenu(Menu menu) {
+ public void setMenu(final Menu menu) {
this.menu = menu;
}
@@ -397,7 +409,7 @@ public abstract class OpenObject implements Proxy {
* the projectElementService to set
*/
public void setProjectElementService(
- ProjectElementService projectElementService) {
+ final ProjectElementService projectElementService) {
_projectElementService = projectElementService;
}
@@ -414,7 +426,7 @@ public abstract class OpenObject implements Proxy {
* @param knowledgeElementTypeService the knowledgeElementTypeService to set
*/
public void setKnowledgeElementTypeService(
- KnowledgeElementTypeService knowledgeElementTypeService) {
+ final KnowledgeElementTypeService knowledgeElementTypeService) {
_knowledgeElementTypeService = knowledgeElementTypeService;
}
@@ -430,7 +442,7 @@ public abstract class OpenObject implements Proxy {
* Set the applicationSettings.
* @param applicationSettings the applicationSettings to set
*/
- public void setApplicationSettings(ApplicationSettings applicationSettings) {
+ public void setApplicationSettings(final ApplicationSettings applicationSettings) {
_applicationSettings = applicationSettings;
}
}
\ No newline at end of file
diff --git a/Workspace/Siman/src/org/splat/simer/OpenStudy.java b/Workspace/Siman/src/org/splat/simer/OpenStudy.java
index 1edd57b..f1a6b5e 100644
--- a/Workspace/Siman/src/org/splat/simer/OpenStudy.java
+++ b/Workspace/Siman/src/org/splat/simer/OpenStudy.java
@@ -15,27 +15,29 @@ import java.util.List;
import java.util.ResourceBundle;
import org.apache.log4j.Logger;
-import org.splat.kernel.Do;
import org.splat.dal.bo.kernel.User;
-import org.splat.manox.Toolbox;
-import org.splat.manox.Writer;
import org.splat.dal.bo.som.Document;
import org.splat.dal.bo.som.DocumentType;
import org.splat.dal.bo.som.KnowledgeElement;
import org.splat.dal.bo.som.ProgressState;
+import org.splat.dal.bo.som.Publication;
+import org.splat.dal.bo.som.Scenario;
+import org.splat.dal.bo.som.SimulationContext;
+import org.splat.dal.bo.som.Study;
+import org.splat.kernel.Do;
+import org.splat.manox.Toolbox;
+import org.splat.manox.Writer;
import org.splat.service.DocumentService;
import org.splat.service.DocumentTypeService;
import org.splat.service.StepService;
import org.splat.service.StudyService;
+import org.splat.service.dto.KnowledgeElementDTO;
import org.splat.service.technical.RepositoryService;
-import org.splat.dal.bo.som.Publication;
import org.splat.som.Revision;
-import org.splat.dal.bo.som.Scenario;
-import org.splat.dal.bo.som.SimulationContext;
import org.splat.som.Step;
import org.splat.som.StepRights;
-import org.splat.dal.bo.som.Study;
import org.splat.som.StudyRights;
+import org.splat.util.BeanHelper;
import org.splat.wapp.ToolBar;
public class OpenStudy extends OpenObject implements OpenStudyServices {
@@ -43,15 +45,15 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
/**
* Serial version ID.
*/
- protected final static Logger logger = org.splat.simer.Action.logger;
-
- private Study mystudy;
- private StudyRights urightstudy; // User rights on the open study
- private StepRights urightstep; // User rights on the selected step
- private String version;
- private String credate;
- private String lasdate;
- private Publication selecdoc;
+ protected final static Logger LOGGER = org.splat.simer.Action.logger;
+
+ private transient Study _mystudy;
+ private transient StudyRights _urightstudy; // User rights on the open study
+ private transient StepRights _urightstep; // User rights on the selected step
+ private transient String _version;
+ private transient String _credate;
+ private transient String _lasdate;
+ private transient Publication _selecdoc;
/**
* Injected step service.
*/
@@ -86,8 +88,7 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
* the study to open
* @return this open study object
*/
- public OpenStudy open(User user, Study study) {
- // -----------------------------------------
+ public OpenStudy open(final User user, final Study study) {
ResourceBundle custom = ResourceBundle.getBundle("som",
getApplicationSettings().getCurrentLocale());
SimpleDateFormat datstring = new SimpleDateFormat(custom
@@ -96,18 +97,18 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
.getRevisionPattern());
cuser = user; // May be null if nobody connected
- mystudy = study;
+ _mystudy = study;
selection = "0.1"; // Default selection
- selecdoc = null;
+ _selecdoc = null;
// Preparation of the display
- version = verstring.format(mystudy.getVersion());
- credate = datstring.format(mystudy.getDate());
- lasdate = ""; // Not yet supported
- description = mystudy.getDescription();
+ _version = verstring.format(_mystudy.getVersion());
+ _credate = datstring.format(_mystudy.getDate());
+ _lasdate = ""; // Not yet supported
+ description = _mystudy.getDescription();
involving = new ArrayList(1);
context = new ArrayList();
- ustep = getProjectElementService().getFirstStep(mystudy);
+ ustep = getProjectElementService().getFirstStep(_mystudy);
ustep.setActor(cuser);
involving.add(ustep);
for (Iterator i = ustep.getAllSimulationContexts()
@@ -115,19 +116,20 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
context.add(new SimulationContextFacade(i.next(),
getProjectSettings().getAllSteps()));
}
- if (getStudyService().isStaffedBy(mystudy, cuser) || getStudyService().hasActor(mystudy, cuser)) {
+ if (getStudyService().isStaffedBy(_mystudy, cuser)
+ || getStudyService().hasActor(_mystudy, cuser)) {
// ProgressState state = mystudy.getProgressState();
// if (state == ProgressState.inCHECK) popup = getApplicationSettings().getPopupMenu("stapprovable");
// else if (state == ProgressState.APPROVED) popup = getApplicationSettings().getPopupMenu("stapproved");
- /* else */popup = getApplicationSettings()
- .getPopupMenu("steditable");
- popup.setContext("study", new StudyRights(cuser, mystudy));
+ /* else */popup = getApplicationSettings().getPopupMenu(
+ "steditable");
+ popup.setContext("study", new StudyRights(cuser, _mystudy));
}
- urightstudy = new StudyRights(cuser, mystudy);
- urightstep = new StepRights(cuser, ustep);
+ _urightstudy = new StudyRights(cuser, _mystudy);
+ _urightstep = new StepRights(cuser, ustep);
// RKV menu = new StudyMenu(mystudy);
- menu = ((StudyMenu) getMenu()).init(mystudy); // RKV
+ menu = (getMenu()).init(_mystudy); // RKV
menu.selects(selection); // Initializes menu items to be displayed
setupContents(); // Initializes documents and knowledge at ustep
return this;
@@ -138,105 +140,90 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
// ==============================================================================================================================
public String getAuthorName() {
- // -----------------------------
- return mystudy.getAuthor().toString();
+ return _mystudy.getAuthor().toString();
}
public Long getIndex() {
- // -------------------------
- return mystudy.getIndex();
+ return _mystudy.getIndex();
}
public String getDate() {
- // ------------------------
- return credate;
+ return _credate;
}
+ @Override
public StudyMenu getMenu() {
- // ---------------------------
return (StudyMenu) menu;
}
- public void setMenu(StudyMenu aMenu) {
+ public void setMenu(final StudyMenu aMenu) {
menu = aMenu;
}
public ProgressState getProgressState() {
- // ----------------------------------------
- return mystudy.getProgressState();
+ return _mystudy.getProgressState();
}
public String getLastModificationDate() {
- // ----------------------------------------
- return lasdate;
+ return _lasdate;
}
public ToolBar getModuleBar() {
- // ------------------------------
return getApplicationSettings().getModuleBar(getSelectedStep());
}
public String getReference() {
- // ----------------------------
- return mystudy.getReference();
+ return _mystudy.getReference();
}
public Publication getSelectedDocument() {
- // -----------------------------------------
- return selecdoc;
+ return _selecdoc;
}
public StepRights getSelectedStepRights() {
- // ------------------------------------------
- return urightstep;
+ return _urightstep;
}
public StudyRights getStudyRights() {
- // ------------------------------------
- return urightstudy;
+ return _urightstudy;
}
public Study getStudyObject() {
- // ------------------------------
- return mystudy;
+ return _mystudy;
}
public String getTitle() {
- // ------------------------
- return mystudy.getTitle();
+ return _mystudy.getTitle();
}
public String getType() {
- // ------------------------
return ResourceBundle.getBundle("labels",
- getApplicationSettings().getCurrentLocale())
- .getString("label.study");
+ getApplicationSettings().getCurrentLocale()).getString(
+ "label.study");
}
public String getVersion() {
- // ---------------------------
- return version;
+ return _version;
}
public boolean isStepEnabled() {
- // -------------------------------
- return urightstep.isEnabled();
+ return _urightstep.isEnabled();
}
// ==============================================================================================================================
// Public services
// ==============================================================================================================================
- public URL newTemplateBasedDocument(String typename, User author) {
- // ------------------------------------------------------------------
+ public URL newTemplateBasedDocument(final String typename, final User author) {
String filename = typename + ".xml"; // Only XML templates are writeable
File template = new File(getRepositoryService().getTemplatePath()
+ filename);
- if (!template.exists())
+ if (!template.exists()) {
return null;
+ }
-// Session connex = Database.getCurSession();
-// Transaction transax = connex.beginTransaction();
+ // Session connex = Database.getCurSession();
+ // Transaction transax = connex.beginTransaction();
try {
File udir = getRepositoryService().getDownloadDirectory(author);
File credoc = new File(udir.getPath() + "/" + filename);
@@ -248,13 +235,15 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
Document medoc = getStepService().createDocument(step,
dprop.setType(type).setFormat("xml").setAuthor(author))
.value();
-// transax.commit();
+ // transax.commit();
// Instantiation of the template into the user download directory
- if (!udir.exists())
+ if (!udir.exists()) {
udir.mkdir();
- if (credoc.exists())
+ }
+ if (credoc.exists()) {
credoc.delete();
+ }
Do.copy(template, credoc);
// Transfer to the document of all known properties
@@ -275,7 +264,7 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
}
}
tool.updateProperty("reference", medoc.getReference());
- tool.updateProperty("study", mystudy.getTitle());
+ tool.updateProperty("study", _mystudy.getTitle());
tool.updateProperty("step", locale.getString(
"folder.step." + step.getNumber()).replaceAll("''", "'"));
tool.updateProperty("author", author.getUsername().toUpperCase());
@@ -287,36 +276,35 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
return new URL(getApplicationSettings().getDownloadURL(author)
+ filename);
} catch (Exception saverror) {
- logger.error("Reason:", saverror);
+ LOGGER.error("Reason:", saverror);
return null;
}
}
- public void selectDocument(String docurl) {
- // ------------------------------------------
+ public void selectDocument(final String docurl) {
String prefix = getApplicationSettings().getRepositoryURL();
- if (docurl.startsWith(prefix))
+ if (docurl.startsWith(prefix)) {
try {
String path = docurl.substring(prefix.length());
Document value = getDocumentService().getDocumentByPath(path);
- selecdoc = ustep.getDocument(value.getIndex());
+ _selecdoc = ustep.getDocument(value.getIndex());
} catch (Exception error) {
- logger.error("Reason:", error);
+ LOGGER.error("Reason:", error);
}
+ }
}
- public void setSelection(String step) {
- // --------------------------------------
+ public void setSelection(final String step) {
if (!step.equals(selection)) {
selection = step;
- selecdoc = null;
+ _selecdoc = null;
setupPreviousToSelectedSteps();
updateSimulationContexts(); // Initializes contexts according to the selected steps
}
ustep = involving.get(involving.size() - 1);
- urightstep = new StepRights(cuser, ustep);
+ _urightstep = new StepRights(cuser, ustep);
ustep.setActor(cuser);
menu.selects(selection); // Updates menu items to be displayed
setupContents(); // The contents may have changed even if the selection is the same
@@ -326,30 +314,29 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
// Protected services
// ==============================================================================================================================
- protected void add(Publication doc) {
- // ------------------------------------
+ protected void add(final Publication doc) {
DocumentFacade facade = new DocumentFacade(this, doc,
getProjectSettings(), getPublicationService());
boolean first = (contents.size() == 0);
docpres.put(doc.getIndex(), facade);
contents.add(0, facade); // Prepend the new publication
- if (first)
+ if (first) {
this.getMenu().refreshSelectedItem();
+ }
}
- protected void add(SimulationContext contex) {
- // ---------------------------------------------
+ protected void add(final SimulationContext contex) {
SimulationContextFacade facade = new SimulationContextFacade(contex,
getProjectSettings().getAllSteps());
context.add(facade);
}
- protected void add(KnowledgeElement kelm) {
- // ------------------------------------------
- KnowledgeElementFacade facade = new KnowledgeElementFacade(kelm);
+ protected void add(final KnowledgeElement kelm) {
+ KnowledgeElementFacade facade = new KnowledgeElementFacade(BeanHelper
+ .copyBean(kelm, KnowledgeElementDTO.class));
// RKV KnowledgeIterator known = knowledge.get(kelm.getType().getIndex() - 2);
// Knowledges are ordered by type index, from 0 to n-1, the first one being reserved (reason for -2)
// RKV:Begin: Find a knowledge iterator for appropriate knowledge type
@@ -367,49 +354,48 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
}
}
- protected void remove(Publication doctag) {
- // ------------------------------------------
+ protected void remove(final Publication doctag) {
for (Iterator i = contents.iterator(); i.hasNext();) {
DocumentFacade facade = i.next();
- if (!facade.isFacadeOf(doctag))
+ if (!facade.isFacadeOf(doctag)) {
continue;
+ }
i.remove();
break;
}
- if (contents.size() == 0)
+ if (contents.size() == 0) {
this.getMenu().refreshSelectedItem();
+ }
}
- protected void changeUser(User user) {
- // -------------------------------------
+ protected void changeUser(final User user) {
cuser = user;
popup = null;
- if (getStudyService().isStaffedBy(mystudy, cuser)) {
+ if (getStudyService().isStaffedBy(_mystudy, cuser)) {
popup = getApplicationSettings().getPopupMenu("steditable");
- popup.setContext("study", new StudyRights(cuser, mystudy));
+ popup.setContext("study", new StudyRights(cuser, _mystudy));
}
- //ustep = getProjectElementService().getFirstStep(mystudy);
+ // ustep = getProjectElementService().getFirstStep(mystudy);
if (ustep != null) {
ustep.setActor(cuser);
}
- urightstudy = new StudyRights(cuser, mystudy);
- urightstep = new StepRights(cuser, ustep);
+ _urightstudy = new StudyRights(cuser, _mystudy);
+ _urightstep = new StepRights(cuser, ustep);
}
- protected void remove(SimulationContext contex) {
- // ------------------------------------------------
+ protected void remove(final SimulationContext contex) {
for (Iterator i = context.iterator(); i
.hasNext();) {
SimulationContextFacade facade = i.next();
- if (!facade.isFacadeOf(contex))
+ if (!facade.isFacadeOf(contex)) {
continue;
+ }
i.remove();
break;
}
}
- protected void remove(KnowledgeElement kelm) {
- // ---------------------------------------------
+ protected void remove(final KnowledgeElement kelm) {
KnowledgeIterator known = knowledge.get((int) (kelm.getType()
.getIndex() - 2));
// Knowledges are ordered by type index, from 0 to n-1, the first one being reserved (reason for -2)
@@ -417,31 +403,30 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
for (Iterator i = known.list.iterator(); i
.hasNext();) {
KnowledgeElementFacade facade = i.next();
- if (!facade.isFacadeOf(kelm))
+ if (!facade.isFacadeOf(BeanHelper.copyBean(kelm,
+ KnowledgeElementDTO.class))) {
continue;
+ }
i.remove();
break;
}
}
- protected void update(Publication doc) {
- // ---------------------------------------
+ protected void update(final Publication doc) {
DocumentFacade facade = docpres.get(doc.getIndex());
if (facade != null) {
facade.refresh();
}
}
- protected void update(KnowledgeElement kelm) {
- // ---------------------------------------------
+ protected void update(final KnowledgeElementDTO kelm) {
KnowledgeElementFacade facade = knowpres.get(kelm.getIndex());
if (facade != null) {
- facade.refresh();
+ facade.refresh(kelm);
}
}
protected void updateSimulationContexts() {
- // ------------------------------------------
context.clear();
for (Iterator i = involving.iterator(); i.hasNext();) {
for (Iterator j = i.next()
@@ -457,7 +442,6 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
// ==============================================================================================================================
private void setupPreviousToSelectedSteps() {
- // --------------------------------------------
String[] item = selection.split("\\x2E");
int major = Integer.valueOf(item[0]);
int minor = Integer.valueOf(item[1]);
@@ -466,12 +450,13 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
involving.clear();
if (major > 0) {
- Scenario[] branch = mystudy.getScenarii();
+ Scenario[] branch = _mystudy.getScenarii();
Scenario scenar = branch[0];
for (int i = 0; i < branch.length; i++) {
scenar = branch[i];
- if (scenar.getIndex() == major)
+ if (scenar.getIndex() == major) {
break; // Supposed exist
+ }
}
step = getProjectElementService().getSteps(scenar);
base = step[0].getNumber() - 1;
@@ -479,11 +464,12 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
involving.add(step[i]);
}
}
- step = getProjectElementService().getSteps(mystudy);
+ step = getProjectElementService().getSteps(_mystudy);
for (int i = step.length - 1; i > -1; i--) {
Step firstep = step[i];
- if (firstep.getNumber() > base)
+ if (firstep.getNumber() > base) {
continue;
+ }
involving.add(0, firstep);
}
}
@@ -503,7 +489,7 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
* @param stepService
* the stepService to set
*/
- public void setStepService(StepService stepService) {
+ public void setStepService(final StepService stepService) {
_stepService = stepService;
}
@@ -522,12 +508,13 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
* @param repositoryService
* the repositoryService to set
*/
- public void setRepositoryService(RepositoryService repositoryService) {
+ public void setRepositoryService(final RepositoryService repositoryService) {
_repositoryService = repositoryService;
}
/**
* Get the documentTypeService.
+ *
* @return the documentTypeService
*/
public DocumentTypeService getDocumentTypeService() {
@@ -536,9 +523,12 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
/**
* Set the documentTypeService.
- * @param documentTypeService the documentTypeService to set
+ *
+ * @param documentTypeService
+ * the documentTypeService to set
*/
- public void setDocumentTypeService(DocumentTypeService documentTypeService) {
+ public void setDocumentTypeService(
+ final DocumentTypeService documentTypeService) {
_documentTypeService = documentTypeService;
}
@@ -557,12 +547,13 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
* @param studyService
* the studyService to set
*/
- public void setStudyService(StudyService studyService) {
+ public void setStudyService(final StudyService studyService) {
_studyService = studyService;
}
/**
* Get the documentService.
+ *
* @return the documentService
*/
public DocumentService getDocumentService() {
@@ -571,17 +562,19 @@ public class OpenStudy extends OpenObject implements OpenStudyServices {
/**
* Set the documentService.
- * @param documentService the documentService to set
+ *
+ * @param documentService
+ * the documentService to set
*/
- public void setDocumentService(DocumentService documentService) {
+ public void setDocumentService(final DocumentService documentService) {
_documentService = documentService;
}
-
+
public Study getMystudy() {
- return mystudy;
+ return _mystudy;
}
- public void setMystudy(Study mystudy) {
- this.mystudy = mystudy;
+ public void setMystudy(final Study mystudy) {
+ this._mystudy = mystudy;
}
}
\ No newline at end of file