From 6aa0788ecdb5449f2cc19256750aeb77f3df3dd5 Mon Sep 17 00:00:00 2001 From: rkv Date: Mon, 3 Dec 2012 06:07:26 +0000 Subject: [PATCH] Document name is generated now for new documents during checkin. Unit test is updated. During checkout applet calls to the server for checkout before launching an executable module. For that the new checkoutAction is created and the new checkout method is added to ScenarioService. Log messages configuration is fixed. Close study bug is fixed (in french locale the URL of the link was invalid). --- .../src/conf/log-messages.properties | 28 +-- .../src/conf/log-messages_en.properties | 28 +-- .../common/properties/MessageKeyEnum.java | 40 ++-- .../src/org/splat/i18n/I18nUtils.java | 9 +- .../splat/kernel/NotApplicableException.java | 8 + .../org/splat/service/ScenarioService.java | 15 ++ .../splat/service/ScenarioServiceImpl.java | 91 +++++++-- .../splat/service/TestScenarioService.java | 127 +++++++----- .../src/test/spring/ut-applicationContext.xml | 4 +- .../Siman/WebContent/jap/splat-launcher.jar | Bin 8700 -> 9951 bytes .../WebContent/jap/splat-signedlauncher.jar | Bin 10323 -> 11677 bytes .../WebContent/study/jsonCheckoutRes.jsp | 5 + .../launcher/ConfigurationException.java | 35 ++++ .../src/org/splat/launcher/ToolbarApplet.java | 154 ++++++++++----- .../src/org/splat/simer/CheckoutAction.java | 149 ++++++++++++++ .../Siman/src/org/splat/simer/OpenStudy.java | 28 +-- .../Siman/src/spring/applicationContext.xml | 186 +++++++----------- Workspace/Siman/src/struts.xml | 4 + 18 files changed, 632 insertions(+), 279 deletions(-) create mode 100644 Workspace/Siman/WebContent/study/jsonCheckoutRes.jsp create mode 100644 Workspace/Siman/src/org/splat/launcher/ConfigurationException.java create mode 100644 Workspace/Siman/src/org/splat/simer/CheckoutAction.java diff --git a/Workspace/Siman-Common/src/conf/log-messages.properties b/Workspace/Siman-Common/src/conf/log-messages.properties index 3f69b0f..8669c7b 100644 --- a/Workspace/Siman-Common/src/conf/log-messages.properties +++ b/Workspace/Siman-Common/src/conf/log-messages.properties @@ -1,14 +1,18 @@ #Lock service exception values -LCK-000001=Lock reference already exists for user {2}. +LCK-000001=Lock reference already exists for user {0}. LCK-000002=Lock reference does not exists. -LCK-000003=Lock reference protected and can be only deleted or updated by user {2}. -LCK-000004=Lock reference is timeout and could have been modified by user {2}. -STD-000001=Unable to re-index the study #{1}, reason: {2} -SCN-000001=Scenario doesn't contain the step number #{1} -SCN-000002=Scenario doesn't contain the document #{1} -SCN-000003=The existing file {1} has been deleted when check-in the scenario #{2} -SCN-000004=Can not delete the existing destination file to move file from {1} to {2} when check-in the scenario #{3} -SCN-000005=Can not move file from {1} to {2} when check-in the scenario #{3} -KNT-000001=Knowledge element type "{1}" already exists -SCT-000001=Simulation context type "{1}" already exists -DCT-000001=Document type "{1}" already exists +LCK-000003=Lock reference protected and can be only deleted or updated by user {0}. +LCK-000004=Lock reference is timeout and could have been modified by user {0}. +STD-000001=Unable to re-index the study #{0}, reason: {1} +SCN-000001=Scenario doesn't contain the step number #{0} +SCN-000002=Scenario doesn't contain the document #{0} +SCN-000003=The existing file {0} has been deleted when check-in the scenario #{0} +SCN-000004=Can not delete the existing destination file to move file from {0} to {1} when check-in the scenario #{2} +SCN-000005=Can not move file from {0} to {1} when check-in the scenario #{2} +SCN-000006=Scenario #{0} is not found +SCN-000007=The user {0} does not participate in the scenario #{1} +SCN-000008=The scenario #{0} is already checked out by the user {1} +USR-000001=User {0} is not found in the database +KNT-000001=Knowledge element type "{0}" already exists +SCT-000001=Simulation context type "{0}" already exists +DCT-000001=Document type "{0}" already exists diff --git a/Workspace/Siman-Common/src/conf/log-messages_en.properties b/Workspace/Siman-Common/src/conf/log-messages_en.properties index 3f69b0f..8669c7b 100644 --- a/Workspace/Siman-Common/src/conf/log-messages_en.properties +++ b/Workspace/Siman-Common/src/conf/log-messages_en.properties @@ -1,14 +1,18 @@ #Lock service exception values -LCK-000001=Lock reference already exists for user {2}. +LCK-000001=Lock reference already exists for user {0}. LCK-000002=Lock reference does not exists. -LCK-000003=Lock reference protected and can be only deleted or updated by user {2}. -LCK-000004=Lock reference is timeout and could have been modified by user {2}. -STD-000001=Unable to re-index the study #{1}, reason: {2} -SCN-000001=Scenario doesn't contain the step number #{1} -SCN-000002=Scenario doesn't contain the document #{1} -SCN-000003=The existing file {1} has been deleted when check-in the scenario #{2} -SCN-000004=Can not delete the existing destination file to move file from {1} to {2} when check-in the scenario #{3} -SCN-000005=Can not move file from {1} to {2} when check-in the scenario #{3} -KNT-000001=Knowledge element type "{1}" already exists -SCT-000001=Simulation context type "{1}" already exists -DCT-000001=Document type "{1}" already exists +LCK-000003=Lock reference protected and can be only deleted or updated by user {0}. +LCK-000004=Lock reference is timeout and could have been modified by user {0}. +STD-000001=Unable to re-index the study #{0}, reason: {1} +SCN-000001=Scenario doesn't contain the step number #{0} +SCN-000002=Scenario doesn't contain the document #{0} +SCN-000003=The existing file {0} has been deleted when check-in the scenario #{0} +SCN-000004=Can not delete the existing destination file to move file from {0} to {1} when check-in the scenario #{2} +SCN-000005=Can not move file from {0} to {1} when check-in the scenario #{2} +SCN-000006=Scenario #{0} is not found +SCN-000007=The user {0} does not participate in the scenario #{1} +SCN-000008=The scenario #{0} is already checked out by the user {1} +USR-000001=User {0} is not found in the database +KNT-000001=Knowledge element type "{0}" already exists +SCT-000001=Simulation context type "{0}" already exists +DCT-000001=Document type "{0}" already exists diff --git a/Workspace/Siman-Common/src/org/splat/common/properties/MessageKeyEnum.java b/Workspace/Siman-Common/src/org/splat/common/properties/MessageKeyEnum.java index e7b4366..ce03ca8 100644 --- a/Workspace/Siman-Common/src/org/splat/common/properties/MessageKeyEnum.java +++ b/Workspace/Siman-Common/src/org/splat/common/properties/MessageKeyEnum.java @@ -18,7 +18,7 @@ package org.splat.common.properties; public enum MessageKeyEnum { /** - * Lock reference already exists for user {2}. + * Lock reference already exists for user {0}. */ LCK_000001("LCK-000001"), /** @@ -26,47 +26,63 @@ public enum MessageKeyEnum { */ LCK_000002("LCK-000002"), /** - * Lock reference protected and can be only deleted or updated by user {2}. + * Lock reference protected and can be only deleted or updated by user {0}. */ LCK_000003("LCK-000003"), /** - * Lock reference is timeout and could have been modified by user {2}. + * Lock reference is timeout and could have been modified by user {0}. */ LCK_000004("LCK-000004"), /** - * Unable to re-index the study #{1}, reason: {2}. + * Unable to re-index the study #{0}, reason: {1}. */ STD_000001("STD-000001"), /** - * Scenario doesn't contain the step number #{1}. + * Scenario doesn't contain the step number #{0}. */ SCN_000001("SCN-000001"), /** - * Scenario doesn't contain the document #{1}. + * Scenario doesn't contain the document #{0}. */ SCN_000002("SCN-000002"), /** - * The existing file {1} has been deleted when check-in the scenario #{2}. + * The existing file {0} has been deleted when check-in the scenario #{1}. */ SCN_000003("SCN-000003"), /** - * Can not delete the existing destination file to move file from {1} to {2} when check-in the scenario #{3}. + * Can not delete the existing destination file to move file from {0} to {1} when check-in the scenario #{2}. */ SCN_000004("SCN-000004"), /** - * Can not move file from {1} to {2} when check-in the scenario #{3}. + * Can not move file from {0} to {1} when check-in the scenario #{2}. */ SCN_000005("SCN-000005"), /** - * Simulation context type "{1}" already exists. + * SCN-000006=Scenario #{0} is not found. + */ + SCN_000006("SCN-000006"), + /** + * SCN-000007=The user {0} does not participate in the scenario #{1}. + */ + SCN_000007("SCN-000007"), + /** + * SCN-000008=The scenario #{0} is already checked out by the user {1}. + */ + SCN_000008("SCN-000008"), + /** + * USR-000001=User {0} is not found in the database. + */ + USR_000001("USR-000001"), + /** + * Simulation context type "{0}" already exists. */ KNT_000001("KNT-000001"), /** - * Knowledge element type "{1}" already exists. + * Knowledge element type "{0}" already exists. */ SCT_000001("SCT-000001"), /** - * Document type "{1}" already exists. + * Document type "{0}" already exists. */ DCT_000001("DCT-000001"); diff --git a/Workspace/Siman-Common/src/org/splat/i18n/I18nUtils.java b/Workspace/Siman-Common/src/org/splat/i18n/I18nUtils.java index 690574e..5ba5f37 100644 --- a/Workspace/Siman-Common/src/org/splat/i18n/I18nUtils.java +++ b/Workspace/Siman-Common/src/org/splat/i18n/I18nUtils.java @@ -11,6 +11,7 @@ package org.splat.i18n; import java.util.Locale; +import org.springframework.context.NoSuchMessageException; import org.springframework.context.support.ResourceBundleMessageSource; /** @@ -68,7 +69,13 @@ public final class I18nUtils { * @return Translated message */ public static String getMessageLocaleDefault(final String code, final Object... context) { - return getMessage(Locale.getDefault(), code, context); + String res = ""; + try { + res = getMessage(Locale.getDefault(), code, context); + } catch (NoSuchMessageException nsme) { + res = getMessage(new Locale(""), code, context); + } + return res; } diff --git a/Workspace/Siman-Common/src/org/splat/kernel/NotApplicableException.java b/Workspace/Siman-Common/src/org/splat/kernel/NotApplicableException.java index 26b8116..6848e36 100644 --- a/Workspace/Siman-Common/src/org/splat/kernel/NotApplicableException.java +++ b/Workspace/Siman-Common/src/org/splat/kernel/NotApplicableException.java @@ -22,4 +22,12 @@ public class NotApplicableException extends BusinessException { public NotApplicableException (final String message) { super(message); } + + /** + * @param messageKey + * @param context + */ + public NotApplicableException(final String messageKey, final Object... context) { + super(messageKey, context); + } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java b/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java index de0ed29..9087b19 100644 --- a/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java +++ b/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java @@ -154,6 +154,21 @@ public interface ScenarioService { */ boolean checkout(Scenario aScenario, User user); + /** + * Mark the given scenario as checked out by the given user. + * + * @param scenarioId + * the scenario id + * @param username + * the username of the user performing the check out + * @throws InvalidPropertyException + * if the user or the scenario is not found in the database + * @throws NotApplicableException + * if the given user can not check out the scenario + */ + public void checkout(final long scenarioId, final String username) + throws InvalidPropertyException, NotApplicableException; + /** * Copy contents from other scenario up to its given step into the given scenario. * diff --git a/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java index 0303a5f..98949f1 100644 --- a/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java @@ -357,8 +357,9 @@ public class ScenarioServiceImpl implements ScenarioService { + " is added to the scenario #" + aScenario.getIndex()); } } catch (IOException error) { - LOG.error("Unable to index the knowedge element '" - + kelm.getIndex() + "', reason:", error); + LOG.error( + "Unable to index the knowedge element '" + kelm.getIndex() + + "', reason:", error); kelm = null; } @@ -379,8 +380,9 @@ public class ScenarioServiceImpl implements ScenarioService { getScenarioDAO().update(aScenario); // Update of relational base isOk = true; } catch (Exception error) { - LOG.error("Unable to re-index the knowledge element '" - + aScenario.getIndex() + "', reason:", error); + LOG.error( + "Unable to re-index the knowledge element '" + + aScenario.getIndex() + "', reason:", error); } return isOk; } @@ -568,8 +570,6 @@ public class ScenarioServiceImpl implements ScenarioService { java.io.File upfile = new java.io.File(file.getPath()); String fileFormat = upfile.getName().substring( upfile.getName().lastIndexOf('.') + 1); - String docname = upfile.getName().substring(0, - upfile.getName().lastIndexOf('.')); // Create a new document or a new version of the document dprop.setAuthor(aUser).setDate(aDate); @@ -584,8 +584,8 @@ public class ScenarioServiceImpl implements ScenarioService { MessageKeyEnum.SCN_000002.toString(), doc.getId()); } if (pub.value() == null) { - throw new MismatchException(MessageKeyEnum.SCN_000002 - .toString(), doc.getId()); + throw new MismatchException( + MessageKeyEnum.SCN_000002.toString(), doc.getId()); } newPub = getStepService().versionDocument(step, pub, dprop); // Remeber the link from the old document to the new document version @@ -602,8 +602,18 @@ public class ScenarioServiceImpl implements ScenarioService { } else { dprop.setType(resType); } - dprop.setDescription("Checked in").setName(docname).setFormat( - fileFormat); + // New document title generation as _N + String docname = dprop.getType().getName(); + int i = 1; + for (Publication scenPub : step.getOwner().getDocums()) { + if (scenPub.value().getTitle().startsWith(docname)) { + i++; + } + } + docname += "_" + i; // The generated new document title + + dprop.setDescription("Checked in").setName(docname) + .setFormat(fileFormat); newPub = getStepService().createDocument(step, dprop); // Remeber the new document @@ -618,8 +628,8 @@ public class ScenarioServiceImpl implements ScenarioService { } if (updir.exists()) { if (updir.delete()) { - LOG.info(MessageKeyEnum.SCN_000003.toString(), updir - .getAbsoluteFile(), step.getOwner().getIndex()); + LOG.info(MessageKeyEnum.SCN_000003.toString(), + updir.getAbsoluteFile(), step.getOwner().getIndex()); } else { throw new IOException( "Can't delete the existing destination file to move file from " @@ -661,8 +671,8 @@ public class ScenarioServiceImpl implements ScenarioService { } while ((step == null) && (i < steps.length)); if (step == null) { - throw new InvalidPropertyException(MessageKeyEnum.SCN_000001 - .toString(), stepDTO.getNumber()); + throw new InvalidPropertyException( + MessageKeyEnum.SCN_000001.toString(), stepDTO.getNumber()); } return step; } @@ -689,11 +699,56 @@ public class ScenarioServiceImpl implements ScenarioService { if (res) { aScenario.setUser(user); aScenario.setLastModificationDate(Calendar.getInstance().getTime()); - getScenarioDAO().update(aScenario); + // RKV: getScenarioDAO().update(aScenario); } return res; } + /** + * Mark the given scenario as checked out by the given user. + * + * @param scenarioId + * the scenario id + * @param username + * the username of the user performing the check out + * @throws InvalidPropertyException + * if the user or the scenario is not found in the database + * @throws NotApplicableException + * if the given user can not check out the scenario + */ + @Transactional + public void checkout(final long scenarioId, final String username) + throws InvalidPropertyException, NotApplicableException { + User aUser = getUserService().selectUser(username); + if (aUser == null) { + // User not found + throw new InvalidPropertyException( + MessageKeyEnum.USR_000001.toString(), username); + } + Scenario aScenario = getScenarioDAO().get(scenarioId); + if (aScenario == null) { + // Scenario not found + throw new InvalidPropertyException( + MessageKeyEnum.SCN_000006.toString(), scenarioId); + } + boolean res = getStudyService().isStaffedBy(aScenario.getOwnerStudy(), + aUser); + if (res) { + if (aScenario.isCheckedout() + && (!aScenario.getUser().getUsername().equals(username))) { + throw new NotApplicableException( + MessageKeyEnum.SCN_000008.toString(), scenarioId, + aScenario.getUser().getUsername()); + } + aScenario.setUser(aUser); + aScenario.setLastModificationDate(Calendar.getInstance().getTime()); + } else { + // User doesn't participate in the scenario + throw new NotApplicableException( + MessageKeyEnum.SCN_000007.toString(), username, scenarioId); + } + } + /** * {@inheritDoc} * @@ -799,9 +854,9 @@ public class ScenarioServiceImpl implements ScenarioService { Restrictions.like("role", "%sysadmin%")).get(0); User admin = getUserDAO().getFilteredList( Restrictions.eq("role", adminRole), Order.asc("rid")).get(0); // First sysadmin in the database - - kprop.setType(ucase).setTitle(aStudy.getTitle()).setValue( - scenario.getTitle()).setAuthor(admin); // Internal Knowledge Element required by the validation process of + + kprop.setType(ucase).setTitle(aStudy.getTitle()) + .setValue(scenario.getTitle()).setAuthor(admin); // Internal Knowledge Element required by the validation process of // knowledges addKnowledgeElement(scenario, kprop); return scenario; diff --git a/Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java b/Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java index b858a29..5a391b7 100644 --- a/Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java +++ b/Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java @@ -23,6 +23,7 @@ import java.util.Set; import org.splat.dal.bo.kernel.Relation; import org.splat.dal.bo.kernel.User; 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.KnowledgeElementType; import org.splat.dal.bo.som.Publication; @@ -32,7 +33,6 @@ import org.splat.dal.bo.som.SimulationContextType; import org.splat.dal.bo.som.Study; import org.splat.dal.bo.som.UsedByRelation; import org.splat.dal.bo.som.UsesRelation; -import org.splat.dal.bo.som.Document.Properties; import org.splat.dal.dao.som.Database; import org.splat.dal.dao.som.ScenarioDAO; import org.splat.kernel.InvalidPropertyException; @@ -51,13 +51,14 @@ import org.splat.service.dto.DocumentDTO; import org.splat.service.dto.FileDTO; import org.splat.service.dto.StepDTO; import org.splat.service.technical.ProjectSettingsService; -import org.splat.service.technical.RepositoryService; import org.splat.service.technical.ProjectSettingsService.Step; +import org.splat.service.technical.RepositoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.orm.hibernate3.HibernateTemplate; import org.testng.Assert; import org.testng.annotations.Test; +import org.testng.reporters.Files; import test.splat.common.BaseTest; @@ -116,7 +117,7 @@ public class TestScenarioService extends BaseTest { @Autowired @Qualifier("simulationContextService") private transient SimulationContextService _simulationContextService; - + /** * The ProjectSettingsService. Later injected by Spring. */ @@ -176,7 +177,7 @@ public class TestScenarioService extends BaseTest { SQLException { LOG.debug(">>>>> BEGIN testGetScenarioInfo()"); startNestedTransaction(); - + long scenarioId = createScenario(); // Call DAO's create method for a good transient knowledge element. List steps = _scenarioService.getScenarioInfo(scenarioId); @@ -219,9 +220,8 @@ public class TestScenarioService extends BaseTest { Assert.assertEquals(doc.getTitle(), docName); Assert.assertNotNull(doc.getFiles(), "Document files list must not be null."); - Assert - .assertTrue(doc.getFiles().size() > 1, - "Document must have more then 1 attached file."); + Assert.assertTrue(doc.getFiles().size() > 1, + "Document must have more then 1 attached file."); for (FileDTO file : doc.getFiles()) { Assert.assertNotNull(file.getPath(), @@ -256,10 +256,9 @@ public class TestScenarioService extends BaseTest { } else { // Outdated Assert.assertEquals(file.getState(), 'O', "File state must be outdated ('O')."); - Assert - .assertEquals(file.getProcessing(), - "file-download", - "Outdated document should not be imported but downloaded."); + Assert.assertEquals(file.getProcessing(), + "file-download", + "Outdated document should not be imported but downloaded."); } } } @@ -272,8 +271,7 @@ public class TestScenarioService extends BaseTest { try { steps = _scenarioService.getScenarioInfo(-1L); // getHibernateTemplate().flush(); - Assert - .fail("Getting an object with not existing id must be failed."); + Assert.fail("Getting an object with not existing id must be failed."); } catch (Exception e) { LOG.debug("Expected exception is thrown: " + e.getClass().getSimpleName() + ": " + e.getMessage()); @@ -294,6 +292,7 @@ public class TestScenarioService extends BaseTest { *
  • uses relations are copied correctly
  • *
  • files are moved correctly
  • *
  • new documents are created for new data
  • + *
  • new documents have correctly generated names
  • *
  • uses relations are created correctly
  • *
  • files are moved correctly
  • * @@ -337,7 +336,7 @@ public class TestScenarioService extends BaseTest { SQLException, MismatchException, NotApplicableException { LOG.debug(">>>>> BEGIN testCheckin()"); startNestedTransaction(); - + _projectSettings.getAllSteps().clear(); // Clear config to be able to load it again _projectSettings.configure(ClassLoader .getSystemResource("test/som.xml").getPath()); @@ -389,7 +388,8 @@ public class TestScenarioService extends BaseTest { } } } - Assert.assertTrue(found, + Assert.assertTrue( + found, "New version of the existing checked in document \"" + docDTO.getTitle() + "\" (id=" + docDTO.getId() @@ -445,11 +445,18 @@ public class TestScenarioService extends BaseTest { Publication newPub = null; for (Publication pub : aScen.getDocums()) { if (pub.value().getPreviousVersion() == null) { - found = (docDTO.getTitle().equals(pub.value() - .getTitle())); + found = (pub.value().getTitle().startsWith(pub + .value().getType().getName())); if (found) { // Found next published version of the checked in document - newPub = pub; - break; + String fcontent = Files.readFile(pub + .getSourceFile().asFile()); + found = fcontent.contains(docDTO.getTitle()); + if (found) { + LOG.debug("Found new document with generated title: " + + pub.value().getTitle()); + newPub = pub; + break; + } } } } @@ -457,6 +464,14 @@ public class TestScenarioService extends BaseTest { "New document is not created for checked in document \"" + docDTO.getTitle() + "\"."); // Check that uses relations are created correctly + Assert.assertTrue( + newPub.value() + .getTitle() + .startsWith( + newPub.value().getType().getName() + + "_"), + "Document title newPub.value().getTitle() must start with " + + newPub.value().getType().getName() + "_"); // 1. Find the document type used by this document type Set usedTypes = newPub.value().getType() @@ -484,13 +499,12 @@ public class TestScenarioService extends BaseTest { // Call checkin method for a not existing id. try { _scenarioService.checkin(-1, userId, stepsToCheckin); - Assert - .fail("Check in for scenario with not existing id must be failed."); + Assert.fail("Check in for scenario with not existing id must be failed."); } catch (Exception e) { LOG.debug("Expected exception is thrown: " + e.getClass().getSimpleName() + ": " + e.getMessage()); } - + rollbackNestedTransaction(); LOG.debug(">>>>> END testCheckin()"); } @@ -592,8 +606,8 @@ public class TestScenarioService extends BaseTest { } // Prepare new data stepToCheckin.addDoc(0, "newdoc" + stepFrom.getNumber()).addFile( - createDownloadedFile(userId, "newdoc" - + stepFrom.getNumber(), "brep")); + createDownloadedFile(userId, + "newdoc" + stepFrom.getNumber(), "brep")); } return stepToCheckin; } @@ -633,7 +647,8 @@ public class TestScenarioService extends BaseTest { // Prepare download directory File tmpDir = _repositoryService.getDownloadDirectory(userId); if (!tmpDir.exists()) { - Assert.assertTrue(tmpDir.mkdir(), + Assert.assertTrue( + tmpDir.mkdir(), "Can't create temporary directory: " + tmpDir.getAbsolutePath()); } @@ -678,21 +693,23 @@ public class TestScenarioService extends BaseTest { User.Properties uprop = new User.Properties(); uprop.setUsername("TST_Username").setName("TST_SimanUnitTestsUser") .setFirstName("TST_FirstName").setDisplayName("TST_test.user") - .addRole("TST_user").setMailAddress( - "noreply@salome-platform.org"); + .addRole("TST_user") + .setMailAddress("noreply@salome-platform.org"); uprop.disableCheck(); User anAuthor = new User(uprop); ht.saveOrUpdate(anAuthor); // Create a test study - Study.Properties stprops = new Study.Properties().setReference( - "TST_SID_01").setTitle("TST_Study").setManager(anAuthor); + Study.Properties stprops = new Study.Properties() + .setReference("TST_SID_01").setTitle("TST_Study") + .setManager(anAuthor); Study aStudy = new Study(stprops); ht.saveOrUpdate(aStudy); // Create a test scenario - Scenario.Properties sprops = new Scenario.Properties().setTitle( - "TST_Scenario").setManager(anAuthor).setOwnerStudy(aStudy); + Scenario.Properties sprops = new Scenario.Properties() + .setTitle("TST_Scenario").setManager(anAuthor) + .setOwnerStudy(aStudy); Scenario aScenario = new Scenario(sprops); aStudy.getScenariiList().add(aScenario); ht.saveOrUpdate(anAuthor); @@ -750,8 +767,9 @@ public class TestScenarioService extends BaseTest { Assert.assertTrue(ht.find("from Document").size() > 0, "No documents in the database."); - Assert.assertNotNull(ht.find("from Publication where owner=" - + aScenario.getIndex()), "No publications in the database."); + Assert.assertNotNull( + ht.find("from Publication where owner=" + aScenario.getIndex()), + "No publications in the database."); Assert.assertTrue( ht.find("from Publication where owner=" + aScenario.getIndex()) .size() > 0, "No publications in the database."); @@ -777,9 +795,7 @@ public class TestScenarioService extends BaseTest { "More then one document must be in the database"); // Check created uses relations - Assert - .assertTrue(usedMap.size() > 0, - "Uses relations must be created."); + Assert.assertTrue(usedMap.size() > 0, "Uses relations must be created."); boolean foundAny = false; for (Long usingId : usedMap.keySet()) { for (Publication pub : aScen.getDocums()) { @@ -855,7 +871,6 @@ public class TestScenarioService extends BaseTest { return pub; } - /** * Test check-in scenario operation to be performed after SALOME session.
    * Description :
    @@ -911,38 +926,42 @@ public class TestScenarioService extends BaseTest { SQLException, MismatchException, NotApplicableException { LOG.debug(">>>>> BEGIN testCreateStudy()"); startNestedTransaction(); - + Database.getInstance().reset(); _projectSettings.getAllSteps().clear(); // Clear config to be able to load it again _projectSettings.configure(ClassLoader .getSystemResource("test/som.xml").getPath()); - + // Create a test user User.Properties uprop = new User.Properties(); uprop.setUsername("TST_Username").setName("TST_SimanUnitTestsUser") .setFirstName("TST_FirstName").setDisplayName("TST_test.user") - .addRole("TST_user").setMailAddress( - "noreply@salome-platform.org"); + .addRole("TST_user") + .setMailAddress("noreply@salome-platform.org"); uprop.disableCheck(); User anAuthor = new User(uprop); - + getHibernateTemplate().saveOrUpdate(anAuthor); - KnowledgeElementType ucase = _knowledgeElementTypeService.selectType("usecase"); - Assert.assertNotNull(ucase, "Knowledge type 'usecase' must be created in the database."); - SimulationContextType prodtype = _simulationContextService.selectType("product"); - Assert.assertNotNull(prodtype, "Simulation context type 'product' must be created in the database."); - + KnowledgeElementType ucase = _knowledgeElementTypeService + .selectType("usecase"); + Assert.assertNotNull(ucase, + "Knowledge type 'usecase' must be created in the database."); + SimulationContextType prodtype = _simulationContextService + .selectType("product"); + Assert.assertNotNull(prodtype, + "Simulation context type 'product' must be created in the database."); + // Create admin uprop.clear(); uprop.setUsername("TST_Admin").setName("TST_SimanUnitTestsAdmin") - .setFirstName("TST_AdminFirstName").setDisplayName("TST_test.admin") - .addRole("TST_user,sysadmin").setMailAddress( - "noreply@salome-platform.org"); + .setFirstName("TST_AdminFirstName") + .setDisplayName("TST_test.admin").addRole("TST_user,sysadmin") + .setMailAddress("noreply@salome-platform.org"); uprop.disableCheck(); - + getHibernateTemplate().saveOrUpdate(new User(uprop)); getHibernateTemplate().flush(); - + Study.Properties sprop = new Study.Properties(); sprop.setTitle("Test study creation").setManager(anAuthor); Scenario.Properties oprop = new Scenario.Properties(); @@ -952,9 +971,9 @@ public class TestScenarioService extends BaseTest { SimulationContext.Properties cprop = new SimulationContext.Properties(); // Input of new project context cprop.setType(_simulationContextService.selectType("product")) - .setValue("Test Simulation Context: Product"); + .setValue("Test Simulation Context: Product"); Study study = _scenarioService.createStudy(sprop, oprop, cprop); - + rollbackNestedTransaction(); LOG.debug(">>>>> END testCreateStudy()"); } diff --git a/Workspace/Siman-Common/src/test/spring/ut-applicationContext.xml b/Workspace/Siman-Common/src/test/spring/ut-applicationContext.xml index 221c133..1a59c70 100644 --- a/Workspace/Siman-Common/src/test/spring/ut-applicationContext.xml +++ b/Workspace/Siman-Common/src/test/spring/ut-applicationContext.xml @@ -27,8 +27,8 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> class="org.springframework.context.support.ResourceBundleMessageSource"> - application - log-messages + som + conf/log-messages diff --git a/Workspace/Siman/WebContent/jap/splat-launcher.jar b/Workspace/Siman/WebContent/jap/splat-launcher.jar index a95e95ccbf969132a787c8444fa1f5f2aae34d73..afb3cbf4013dbc4e5f1dea8ff6d86a1f9110d05d 100644 GIT binary patch delta 5190 zcmZvgcQjmE*v5y^Ym_kL<`^u zQ2k!m%UfuJ9|r)y-rR!dTt+&Syqhb+!Oq9i%G<%sRS{`p>;C&ez{c6i%PU^9N&^>m zE9gag8Vw#yhzjyBsaxGySS%`f!}`UT;HLk3iDS${w(!(-d~$SjbU4&Y=G$D`Sm5PB@{wI66WgsNYGfJ(?3bYM+n^u={?s8FQGE%LHT>rU=#_MXo-jT zJnkZOA{TsLXldqav!$z`-GhPyRdQ(_CC5|qeawpDPA+J==$jig6SHd8K}XCbt14}-9a)(&5N^;DnRV=!BTQ4*y~D>Zuc=qSoW{K zD$nuk1keg$pEfIeb~Q)(@H&cHN88B`*4p^)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^kP;AOqW)>80;h~U?MDOJe_Rr$U-ZZB!3*0se?*-k z)71LeG2Rv_e5X@0q5L(=r7cR1etvF`Qd48T%Qb!d>g-(JC$uAx9cY2kR9xz18WA2h z>uHM8z5AR-LZ?9QISo@f9V_|dwImQ~6QI0w3-_X->3QF7WfRetB4d;_FXKLvS2;2v zXp+LeKL<^^A#5?#BRCsZOiWnSorp0&?U@Kj!KLHrE-eOG$zNgl9C!PcUAn=1*ZqR@ z8ZAk~hGKJ3NJ_r$`Q@?xAw=?$FnSACAGjJ8yQ zT+gMMUaBzGCGQpn^vyZhd$R8mx0Sl!$|9Y0`zjEX_O@DJ%moTF(@|LXFgrIUYtJ!1 z^X^Bu)_6#`OzUtx&=4J(H2(d9ZXkPI40tQGf%2HR9Ob0wiLb#>a@ISrP7Gi!yv$F* zZo)ROfi^oub^8i5a%yoe)M&PQmeo7-sRt{0*e4~R-xV5$t9W5guG*#AOyPmHL=N`y zg?=Qr+h)lp!MYif9HuuK*zCVw?NZNj78HOgp_>v^-ZJh7!?r~YmAmbxm-#*(XI%qr zk5l4Y!JzNckrom;0Ur84Fc^U z$Y?K??kJTN)Cc8eslc{Ij@ezi_~9>WJDkm@rOJuRO;({}=f(=Tih?&T)d!c}Il;8XDbIvxYykJG^gNmOS}#|y^N zQ2*9Qe4dEPzaEJvi$JM=+aex(S%7Ek|19ww6({vS;`yg%d|BY!FFfip-!D0ebr98h&m+^PSz-RkeO$m87fA4Rm2LL4gjRNwY WMDhOy<d{~hH diff --git a/Workspace/Siman/WebContent/jap/splat-signedlauncher.jar b/Workspace/Siman/WebContent/jap/splat-signedlauncher.jar index d0b487386b69bf1e48b794469f9e3e22ece94a27..bfb539491a9dd52b8d646f820bde9fdb9b418d65 100644 GIT binary patch delta 6287 zcmaKwWl&sAx3+=7HOSyF1h?QM!7aGE1`UI|4LS+#kPH$Wg1ZF??hKy6EfCxjEI8yN zdCxiZJnxTh@7ld~b=_;NuD-ka$2FyqWsIkx3_vA8!hC$YUxmE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3a)~76122#zM|x(IK^XNpFOIawYBm zG&fcQ=UPaEe9KGDc8!?|f9?^1aQ|=xkj=a-H|ROb%S>;C4+1&6+6ijGu&{|i|6uBG zJSB%PWBDQ>5JvXvZ}?X<>OW$EKp*gt*<`dxZwTp)P|n!a0=Pa+l@J8t`j>F@A0a&- z_(sT3@BS+G8jgLg&*%J?@FU4}L@uNc-#-!m{IT5s5{8f?-%#E~4)BrQVDc;tTMK!Q7qS-hTjQTpvaN diff --git a/Workspace/Siman/WebContent/study/jsonCheckoutRes.jsp b/Workspace/Siman/WebContent/study/jsonCheckoutRes.jsp new file mode 100644 index 0000000..b266101 --- /dev/null +++ b/Workspace/Siman/WebContent/study/jsonCheckoutRes.jsp @@ -0,0 +1,5 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ taglib prefix="s" uri="/struts-tags"%> +<%@ page import="org.splat.launcher.ToolbarApplet"%> +{<%=ToolbarApplet.CHECKOUT_RES%> ""} \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/launcher/ConfigurationException.java b/Workspace/Siman/src/org/splat/launcher/ConfigurationException.java new file mode 100644 index 0000000..b9623fc --- /dev/null +++ b/Workspace/Siman/src/org/splat/launcher/ConfigurationException.java @@ -0,0 +1,35 @@ +/***************************************************************************** + * Company OPEN CASCADE + * Application SIMAN + * File $Id$ + * Creation date 02.12.2012 + * @author $Author$ + * @version $Revision$ + * @copyright OPEN CASCADE 2012 + *****************************************************************************/ + +package org.splat.launcher; + +/** + * Exception thrown when configuration problem appears during an executable module launching. + * + * @author Roman Kozlov (RKV) + */ +public class ConfigurationException extends Exception { + + /** + * Constructs a configuration exception with its reason description. + * + * @param message + * error message + */ + public ConfigurationException(final String message) { + super(message); + } + + /** + * Serialization version id. + */ + private static final long serialVersionUID = -8886811002435115163L; + +} diff --git a/Workspace/Siman/src/org/splat/launcher/ToolbarApplet.java b/Workspace/Siman/src/org/splat/launcher/ToolbarApplet.java index 3a7c590..0de0756 100644 --- a/Workspace/Siman/src/org/splat/launcher/ToolbarApplet.java +++ b/Workspace/Siman/src/org/splat/launcher/ToolbarApplet.java @@ -5,11 +5,16 @@ import java.awt.ComponentOrientation; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; import java.io.ObjectInputStream; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; +import java.net.URLEncoder; /** * Applet providing a set of buttons. Each button is defined by three parameters:
    @@ -27,6 +32,11 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener */ private static final long serialVersionUID = 3243053622061086715L; + /** + * The response key string: '"canCheckout" :'. + */ + public static final String CHECKOUT_RES = "\"canCheckout\" :"; + // ============================================================================================================================== // Overridden functions // ============================================================================================================================== @@ -106,50 +116,8 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener // Opening an application on the local machine - if (module.equals("runSalome")) { - // Run SALOME - // To get the SALOME_HOME environment variable - String SALOME_HOME = System.getenv("SALOME_ROOT_DIR"); - // If SALOME_ROOT_DIR does not exist the SALOME_HOME equals to null. - if (SALOME_HOME == null) { - // TODO: Use logger to be more user friendly - getAppletContext() - .showDocument( - new URL( - getCodeBase().toString() - + "error.jsp?message=launch&value=" - + "SALOME_ROOT_DIR environment variable is not defined."), - "_blank"); - throw new Exception( - "SALOME_ROOT_DIR nevironment variable is not defined."); - } else if (!SALOME_HOME.endsWith(File.separator)) { - SALOME_HOME += File.separator; - } - String pathToScript = SALOME_HOME + "runSalome"; - - File script = new File(pathToScript); - if (!script.exists()) { - script = new File(pathToScript + ".bat"); - if (!script.exists()) { - script = new File(pathToScript + ".cmd"); - } - } - - if (script.exists()) { - // Execute the runSalome script. - // filename here indeed a string containing parameters for runSalome. - Runtime.getRuntime().exec( - new String[] { script.getAbsolutePath(), filename }); - } else { - // TODO: Use logger to be more user friendly - getAppletContext().showDocument( - new URL(getCodeBase().toString() - + "error.jsp?message=launch&value=" - + "SALOME module is not found: " - + script.getAbsolutePath()), "_blank"); - throw new FileNotFoundException( - "SALOME module is not found: " + script.getAbsolutePath()); - } + if ("runSalome".equals(module)) { + salomeCheckout(filename); } else if (module.endsWith(".exe") || module.endsWith(".EXE")) { @@ -205,4 +173,100 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener error.printStackTrace(); // RKV: NOPMD: TODO: try to use logger } } + + /** + * Checkout a scenario and start Salome with it. + * + * @param params + * Salome parameters + * @throws IOException + * if URL connection opening/reading is failed + * @throws ConfigurationException + * if SALOME_ROOT_DIR environment variable is not defined or Salome launcher script is not found + */ + private void salomeCheckout(final String params) + throws ConfigurationException, IOException { + // Run SALOME + // To get the SALOME_HOME environment variable + String SALOME_HOME = System.getenv("SALOME_ROOT_DIR"); + // If SALOME_ROOT_DIR does not exist the SALOME_HOME equals to null. + if (SALOME_HOME == null) { + // TODO: Use logger to be more user friendly + showError("SALOME_ROOT_DIR environment variable is not defined."); + throw new ConfigurationException( + "SALOME_ROOT_DIR nevironment variable is not defined."); + } else if (!SALOME_HOME.endsWith(File.separator)) { + SALOME_HOME += File.separator; + } + String pathToScript = SALOME_HOME + "runSalome"; + + File script = new File(pathToScript); + if (!script.exists()) { + script = new File(pathToScript + ".bat"); + if (!script.exists()) { + script = new File(pathToScript + ".cmd"); + } + } + + if (script.exists()) { + + // Checkout the scenario + URL checkoutUrl = new URL(getCodeBase().toString() + + "checkout.action?" + + params.replaceAll("siman-", "").replaceAll("--", "-") + .replaceAll("-", "&").replaceAll("\\s", "")); + + BufferedReader buffer = new BufferedReader(new InputStreamReader( + checkoutUrl.openStream())); + boolean isOk = false; + String response = buffer.readLine(); + while ((response != null)) { + if (response.contains(CHECKOUT_RES)) { + isOk = response.contains(CHECKOUT_RES + " \"true\""); + break; + } + response = buffer.readLine(); + } + buffer.close(); + + if (isOk) { + // Execute the runSalome script. + // filename here indeed a string containing parameters for runSalome. + Runtime.getRuntime().exec( + new String[] { script.getAbsolutePath(), params }); + } else { + // Checkout of the scenario is failed at the beginning. + if (response != null) { + response = response + .substring( + response.indexOf(CHECKOUT_RES) + + CHECKOUT_RES.length()) + .replace('}', ' ').replace('"', ' '); + } + showError(response); + } + } else { + // TODO: Use logger to be more user friendly + showError("SALOME module is not found: " + script.getAbsolutePath()); + throw new ConfigurationException("SALOME module is not found: " + + script.getAbsolutePath()); + } + } + + /** + * Show error message in the new window. + * + * @param message + * the error message + * @throws MalformedURLException + * if built URL is incorrect + * @throws UnsupportedEncodingException + * if UTF-8 encoding is not supported + */ + private void showError(final String message) throws MalformedURLException, + UnsupportedEncodingException { + getAppletContext().showDocument( + new URL(getCodeBase().toString() + "../error.jsp?error=" + + URLEncoder.encode(message, "UTF-8")), "_blank"); + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/CheckoutAction.java b/Workspace/Siman/src/org/splat/simer/CheckoutAction.java new file mode 100644 index 0000000..ed95b20 --- /dev/null +++ b/Workspace/Siman/src/org/splat/simer/CheckoutAction.java @@ -0,0 +1,149 @@ +/***************************************************************************** + * Company OPEN CASCADE + * Application SIMAN + * File $Id$ + * Creation date 02.12.2012 + * @author $Author$ + * @version $Revision$ + * @copyright OPEN CASCADE 2012 + *****************************************************************************/ + +package org.splat.simer; + +import org.splat.exception.BusinessException; +import org.splat.log.AppLogger; +import org.splat.service.ScenarioService; + +import com.opensymphony.xwork2.ActionSupport; + +/** + * Action to checkout a scenario. + * + * @author Roman Kozlov (RKV) + */ +public class CheckoutAction extends ActionSupport { + + /** + * Serialization version id. + */ + private static final long serialVersionUID = 6140789360802711199L; + + /** + * Action logger. + */ + protected static final AppLogger LOG = AppLogger + .getLogger(CheckoutAction.class); + + /** + * Result message. If the scenario is successfully checked out then result is "true", otherwise it contains the error message. + */ + private String _result; + /** + * Scenario id action parameter. Defines the scenario to check out. + */ + private long _scenario; + /** + * User login name action parameter. Defines the user who performs check out. + */ + private String _user; + /** + * Injected scenario service. + */ + private ScenarioService _scenarioService; + + /** + * Mark the currently selected scenario as checked out. If the scenario is successfully checked out then result is "true", otherwise it + * contains the error message. + * + * @return SUCCESS + */ + public String doCheckout() { + try { + getScenarioService().checkout(getScenario(), getUser()); + setResult("true"); + } catch (BusinessException e) { + setResult(e.getMessage()); + } + if (LOG.isDebugEnabled()) { + LOG.debug("Can checkout scenario #" + getScenario() + + " by the user " + getUser() + ": " + getResult()); + } + return SUCCESS; + } + + /** + * Get the scenarioService. + * + * @return the scenarioService + */ + public ScenarioService getScenarioService() { + return _scenarioService; + } + + /** + * Set the scenarioService. + * + * @param scenarioService + * the scenarioService to set + */ + public void setScenarioService(final ScenarioService scenarioService) { + _scenarioService = scenarioService; + } + + /** + * Result message. If the scenario is successfully checked out then result is "true", otherwise it contains the error message. + * + * @return the result + */ + public String getResult() { + return _result; + } + + /** + * Set the result. + * + * @param result + * the result to set + */ + public void setResult(final String result) { + _result = result; + } + + /** + * Get the scenario. + * + * @return the scenario + */ + public long getScenario() { + return _scenario; + } + + /** + * Set the scenario. + * + * @param scenario + * the scenario to set + */ + public void setScenario(final long scenario) { + _scenario = scenario; + } + + /** + * Get the user. + * + * @return the user + */ + public String getUser() { + return _user; + } + + /** + * Set the user. + * + * @param user + * the user to set + */ + public void setUser(final String user) { + _user = user; + } +} diff --git a/Workspace/Siman/src/org/splat/simer/OpenStudy.java b/Workspace/Siman/src/org/splat/simer/OpenStudy.java index 256f84c..82dcc0e 100644 --- a/Workspace/Siman/src/org/splat/simer/OpenStudy.java +++ b/Workspace/Siman/src/org/splat/simer/OpenStudy.java @@ -97,8 +97,8 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { public OpenStudy open(final User user, final Study study) { ResourceBundle custom = ResourceBundle.getBundle("som", getApplicationSettings().getCurrentLocale()); - SimpleDateFormat datstring = new SimpleDateFormat(custom - .getString("date.format")); + SimpleDateFormat datstring = new SimpleDateFormat( + custom.getString("date.format")); Revision.Format verstring = new Revision.Format(getProjectSettings() .getRevisionPattern()); @@ -204,9 +204,10 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { } public String getType() { - return ResourceBundle.getBundle("labels", - getApplicationSettings().getCurrentLocale()).getString( - "label.study"); + /* + * RKV: return ResourceBundle.getBundle("labels", getApplicationSettings().getCurrentLocale()).getString( "label.study"); + */ + return "study"; } public String getVersion() { @@ -256,8 +257,8 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { // Transfer to the document of all known properties ResourceBundle locale = ResourceBundle.getBundle("som", getApplicationSettings().getCurrentLocale()); - SimpleDateFormat get = new SimpleDateFormat(locale - .getString("date.format")); + SimpleDateFormat get = new SimpleDateFormat( + locale.getString("date.format")); Writer tool = Toolbox.getWriter(credoc); List slist = getInvolvedSteps(); for (Iterator i = slist.iterator(); i.hasNext();) { @@ -266,14 +267,15 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { for (Iterator j = clist.iterator(); j .hasNext();) { SimulationContext context = j.next(); - tool.updateProperty(context.getType().getName(), context - .getValue()); + tool.updateProperty(context.getType().getName(), + context.getValue()); } } tool.updateProperty("reference", medoc.getReference()); tool.updateProperty("study", _mystudy.getTitle()); - tool.updateProperty("step", locale.getString( - "folder.step." + step.getNumber()).replaceAll("''", "'")); + tool.updateProperty("step", + locale.getString("folder.step." + step.getNumber()) + .replaceAll("''", "'")); tool.updateProperty("author", author.getUsername().toUpperCase()); tool.updateProperty("date", get.format(medoc.getCreationDate())); tool.updateProperty("history", locale.getString("label.creation") @@ -343,8 +345,8 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { } protected void add(final KnowledgeElement kelm) { - KnowledgeElementFacade facade = new KnowledgeElementFacade(BeanHelper - .copyBean(kelm, KnowledgeElementDTO.class), + KnowledgeElementFacade facade = new KnowledgeElementFacade( + BeanHelper.copyBean(kelm, KnowledgeElementDTO.class), getApplicationSettings()); // 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) diff --git a/Workspace/Siman/src/spring/applicationContext.xml b/Workspace/Siman/src/spring/applicationContext.xml index 70c4bb4..6867411 100644 --- a/Workspace/Siman/src/spring/applicationContext.xml +++ b/Workspace/Siman/src/spring/applicationContext.xml @@ -1,7 +1,6 @@ - + - application - log-messages + conf/log-messages - + @@ -56,13 +53,12 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - + - + @@ -70,17 +66,14 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - + - + - - + + @@ -94,8 +87,8 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> parent="openObject" scope="session"> - + @@ -109,23 +102,24 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - + - - + + - + + + + + @@ -134,17 +128,15 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - + - + @@ -153,46 +145,37 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> scope="prototype" parent="displayStudyStepAction"> - - + + - + - - + + - + - - - + + + - + @@ -200,45 +183,37 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> scope="prototype" parent="baseAction"> - + - + - + - + - + - - + + - + - - + + - + - + - + - + - - + - + - - + - + diff --git a/Workspace/Siman/src/struts.xml b/Workspace/Siman/src/struts.xml index 9a2da59..ea10f3f 100644 --- a/Workspace/Siman/src/struts.xml +++ b/Workspace/Siman/src/struts.xml @@ -72,6 +72,10 @@ page.error.study + + /study/jsonCheckoutRes.jsp + + -- 2.39.2