From 9fda852a4a9e79db45d8d462b4d4fddefa5a89a5 Mon Sep 17 00:00:00 2001 From: rkv Date: Thu, 1 Nov 2012 11:58:08 +0000 Subject: [PATCH] ProjectSettingsService is now well documented and has no static methods. --- .../src/org/splat/dal/bo/som/Document.java | 123 ++++--- .../org/splat/dal/bo/som/ValidationCycle.java | 94 +++--- .../splat/service/DocumentServiceImpl.java | 164 ++++++---- .../service/SimulationContextServiceImpl.java | 39 +-- .../org/splat/service/StepServiceImpl.java | 126 ++++--- .../org/splat/service/StudyServiceImpl.java | 248 ++++++++------ .../technical/ProjectSettingsService.java | 157 ++++++++- .../technical/ProjectSettingsServiceImpl.java | 309 ++++++++++++------ .../src/spring/businessServiceContext.xml | 2 + 9 files changed, 831 insertions(+), 431 deletions(-) diff --git a/Workspace/Siman-Common/src/org/splat/dal/bo/som/Document.java b/Workspace/Siman-Common/src/org/splat/dal/bo/som/Document.java index f084a22..e39ccba 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/bo/som/Document.java +++ b/Workspace/Siman-Common/src/org/splat/dal/bo/som/Document.java @@ -69,6 +69,7 @@ public class Document extends Entity { // - Public services + @Override public void clear() { super.clear(); type = null; @@ -130,12 +131,12 @@ public class Document extends Entity { // - Property setters - public Properties setAuthor(User user) { + public Properties setAuthor(final User user) { this.author = user; return this; } - public Properties setDate(Date date) { + public Properties setDate(final Date date) { this.date = date; return this; } @@ -148,17 +149,18 @@ public class Document extends Entity { return date; } - public Properties setDescription(String summary) + public Properties setDescription(final String summary) throws InvalidPropertyException { - if (summary.length() == 0) + if (summary.length() == 0) { throw new InvalidPropertyException("description"); + } this.summary = summary; return this; } - public Properties setDocument(Document base) { + public Properties setDocument(final Document base, final ProjectSettingsService.Step aStep) { type = base.type; - step = ProjectSettingsServiceImpl.getStep(base.step); + step = aStep; name = base.name; format = base.getFormat(); state = ProgressState.inWORK; // For incrementing the version number at save time @@ -166,36 +168,41 @@ public class Document extends Entity { return this; } - public Properties setExternReference(String ref) + public Properties setExternReference(final String ref) throws InvalidPropertyException { - if (ref.length() == 0) + if (ref.length() == 0) { throw new InvalidPropertyException("reference"); - if (ref.equals(new Revision().toString())) + } + if (ref.equals(new Revision().toString())) { throw new InvalidPropertyException("reference"); // Internal version number + } this.version = ref; return this; } - public Properties setFormat(String format) + public Properties setFormat(final String format) throws InvalidPropertyException { - if (format.length() == 0) + if (format.length() == 0) { throw new InvalidPropertyException("format"); + } this.format = format; return this; } // Required only for passing search arguments - public Properties setLocalPath(String path) + public Properties setLocalPath(final String path) throws InvalidPropertyException { - if (path.length() == 0) + if (path.length() == 0) { throw new InvalidPropertyException("path"); + } this.path = path; return this; } - public Properties setName(String name) throws InvalidPropertyException { - if (name.length() == 0) + public Properties setName(final String name) throws InvalidPropertyException { + if (name.length() == 0) { throw new InvalidPropertyException("name"); + } this.name = name; return this; } @@ -204,7 +211,7 @@ public class Document extends Entity { return this.name; } - public Properties setOwner(ProjectElement owner) { + public Properties setOwner(final ProjectElement owner) { this.owner = owner; return this; } @@ -213,29 +220,31 @@ public class Document extends Entity { return this.owner; } // Required only for passing search arguments - public Properties setReference(String did) + public Properties setReference(final String did) throws InvalidPropertyException { - if (did.length() == 0) + if (did.length() == 0) { throw new InvalidPropertyException("reference"); + } this.did = did; return this; } - public Properties setState(ProgressState state) + public Properties setState(final ProgressState state) throws InvalidPropertyException { if (state == ProgressState.inPROGRESS - || state == ProgressState.TEMPLATE) + || state == ProgressState.TEMPLATE) { throw new InvalidPropertyException("state"); // Non document states + } this.state = state; return this; } - public Properties setStep(ProjectSettingsService.Step step) { + public Properties setStep(final ProjectSettingsService.Step step) { this.step = step; return this; } - public Properties setType(DocumentType type) { + public Properties setType(final DocumentType type) { this.type = type; return this; } @@ -244,29 +253,38 @@ public class Document extends Entity { public void checkValidity() throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException { - if (type == null) + if (type == null) { throw new MissedPropertyException("type"); - if (owner == null) + } + if (owner == null) { throw new MissedPropertyException("owner"); - if (step == null) + } + if (step == null) { throw new MissedPropertyException("step"); - if (author == null) + } + if (author == null) { throw new MissedPropertyException("author"); - if (format == null) + } + if (format == null) { throw new MissedPropertyException("format"); - if (owner instanceof Study && !step.appliesTo(Study.class)) + } + if (owner instanceof Study && !step.appliesTo(Study.class)) { throw new InvalidPropertyException("step"); - if (!type.isContentInto(step)) + } + if (!type.isContentInto(step)) { throw new InvalidPropertyException("step"); + } if (state != null && state != ProgressState.EXTERN) { // inDRAFT, inCHECK or APPROVED + version = imposed version (future use) // inWORK + version = base version incremented at save time (used for versioning) - if (version == null) + if (version == null) { throw new InvalidPropertyException("state"); + } } if (version != null) { - if (state == null) + if (state == null) { state = ProgressState.EXTERN; + } } } } @@ -276,7 +294,7 @@ public class Document extends Entity { } // Internal constructor - public Document(Properties dprop) throws MissedPropertyException, + public Document(final Properties dprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException { // ------------------------------------- super(dprop); // Throws one of the above exception if not valid @@ -305,14 +323,15 @@ public class Document extends Entity { // Public member functions // ============================================================================================================================== - public File getAttachedFile(String format) { + public File getAttachedFile(final String format) { // ------------------------------------------- List exports = getRelations(ConvertsRelation.class); for (Iterator i = exports.iterator(); i.hasNext();) { File export = (File) i.next().getTo(); - if (export.getFormat().equals(format)) + if (export.getFormat().equals(format)) { return export; + } } return null; } @@ -332,7 +351,7 @@ public class Document extends Entity { return lasdate; } - public void setLastModificationDate(Date aDate) { + public void setLastModificationDate(final Date aDate) { lasdate = aDate; } @@ -344,10 +363,11 @@ public class Document extends Entity { public Document getPreviousVersion() { // ------------------------------------- Relation previous = getFirstRelation(VersionsRelation.class); - if (previous != null) + if (previous != null) { return (Document) previous.getTo(); - else + } else { return null; + } } public ProgressState getProgressState() { @@ -365,8 +385,9 @@ public class Document extends Entity { // -------------------------------- String[] table = myfile.getRelativePath().split("\\x2E"); StringBuffer path = new StringBuffer(table[0]); - for (int i = 1; i < table.length - 1; i++) + for (int i = 1; i < table.length - 1; i++) { path.append('.').append(table[i]); + } return path.toString(); } @@ -400,8 +421,9 @@ public class Document extends Entity { for (Iterator i = this.getAllRelations().iterator(); i .hasNext();) { Relation link = i.next(); - if (link instanceof StampRelation) + if (link instanceof StampRelation) { stamps.add(((StampRelation) link).getTo()); + } } Timestamp[] result = stamps.toArray(new Timestamp[stamps.size()]); ComparatorByDate bydate = new Timestamp.ComparatorByDate(); @@ -418,17 +440,18 @@ public class Document extends Entity { */ public String getTitle() { // ------------------------- - if (this.isUndefined()) + if (this.isUndefined()) { return ""; - else + } else { return name; + } } /** * Set document title. * @param aTitle document title to set */ - public void setTitle(String aTitle) { + public void setTitle(final String aTitle) { this.name = aTitle; } @@ -464,7 +487,7 @@ public class Document extends Entity { return (history == -1); } - public boolean isInto(Step container) { + public boolean isInto(final Step container) { // -------------------------------------- return (step == container.getNumber()); } @@ -496,7 +519,7 @@ public class Document extends Entity { * Set the step. * @param step the step to set */ - public void setStep(int step) { + public void setStep(final int step) { this.step = step; } @@ -512,7 +535,7 @@ public class Document extends Entity { * Set the did. * @param did the did to set */ - public void setDid(String did) { + public void setDid(final String did) { this.did = did; } @@ -528,7 +551,7 @@ public class Document extends Entity { * Set the myfile. * @param myfile the myfile to set */ - public void setFile(File myfile) { + public void setFile(final File myfile) { this.myfile = myfile; } @@ -544,7 +567,7 @@ public class Document extends Entity { * Set the history. * @param history the history to set */ - public void setHistory(int history) { + public void setHistory(final int history) { this.history = history; } @@ -552,7 +575,7 @@ public class Document extends Entity { * Set the version. * @param version the version to set */ - public void setVersion(String version) { + public void setVersion(final String version) { this.version = version; } @@ -560,7 +583,7 @@ public class Document extends Entity { * Set the state. * @param state the state to set */ - public void setProgressState(ProgressState state) { + public void setProgressState(final ProgressState state) { this.state = state; } @@ -576,7 +599,7 @@ public class Document extends Entity { * Set the countag. * @param countag the countag to set */ - public void setCountag(int countag) { + public void setCountag(final int countag) { this.countag = countag; } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/dal/bo/som/ValidationCycle.java b/Workspace/Siman-Common/src/org/splat/dal/bo/som/ValidationCycle.java index 9b7579b..072130a 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/bo/som/ValidationCycle.java +++ b/Workspace/Siman-Common/src/org/splat/dal/bo/som/ValidationCycle.java @@ -33,7 +33,6 @@ import org.splat.dal.bo.kernel.User; import org.splat.kernel.InvalidPropertyException; import org.splat.kernel.MissedPropertyException; import org.splat.kernel.MultiplyDefinedException; -import org.splat.service.technical.ProjectSettingsServiceImpl; public class ValidationCycle extends Persistent { @@ -66,7 +65,8 @@ public class ValidationCycle extends Persistent { // - Public services - public void clear () { + @Override + public void clear () { super.clear(); doctype = null; publisher = null; @@ -76,26 +76,33 @@ public class ValidationCycle extends Persistent { } // - Protected services - public Properties setDocumentType (DocumentType type) + public Properties setDocumentType (final DocumentType type) { doctype = type; return this; } // - Properties setter - public Properties setActor (ValidationStep step, User actor) + public Properties setActor (final ValidationStep step, final User actor) { - if (step == ValidationStep.PROMOTION) publisher = actor; - else if (step == ValidationStep.REVIEW) reviewer = actor; - else if (step == ValidationStep.APPROVAL) approver = actor; - else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) signatory = actor; + if (step == ValidationStep.PROMOTION) { + publisher = actor; + } else if (step == ValidationStep.REVIEW) { + reviewer = actor; + } else if (step == ValidationStep.APPROVAL) { + approver = actor; + } else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) { + signatory = actor; + } return this; } // - Global validity check public void checkValidity() throws MissedPropertyException { - if (doctype == null) throw new MissedPropertyException("type"); + if (doctype == null) { + throw new MissedPropertyException("type"); + } } /** @@ -133,8 +140,7 @@ public class ValidationCycle extends Persistent { // Database fetch constructor public ValidationCycle () { } - public ValidationCycle (Study from, Properties vprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException { -// -------------------------------------------------------- + public ValidationCycle (final Study from, final Properties vprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException { super(vprop); // Throws one of the above exception if not valid mytype = vprop.doctype; publisher = vprop.publisher; // May be null @@ -153,12 +159,16 @@ public class ValidationCycle extends Persistent { * @param step the validation step checked. * @return true if the given validation step is enabled. */ - public boolean enables (ValidationStep step) { -// ------------------------------------------- - if (step == ValidationStep.PROMOTION) return true; - else if (step == ValidationStep.REVIEW) return (reviewer != null); - else if (step == ValidationStep.APPROVAL) return (approver != null); - else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) return (signatory != null); + public boolean enables (final ValidationStep step) { + if (step == ValidationStep.PROMOTION) { + return true; + } else if (step == ValidationStep.REVIEW) { + return (reviewer != null); + } else if (step == ValidationStep.APPROVAL) { + return (approver != null); + } else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) { + return (signatory != null); + } return false; } @@ -173,12 +183,16 @@ public class ValidationCycle extends Persistent { * @see #getAllActors() * @see #enables */ - public User getActor (ValidationStep step) { -// ----------------------------------------- - if (step == ValidationStep.PROMOTION) return publisher; - else if (step == ValidationStep.REVIEW) return reviewer; - else if (step == ValidationStep.APPROVAL) return approver; - else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) return signatory; + public User getActor (final ValidationStep step) { + if (step == ValidationStep.PROMOTION) { + return publisher; + } else if (step == ValidationStep.REVIEW) { + return reviewer; + } else if (step == ValidationStep.APPROVAL) { + return approver; + } else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) { + return signatory; + } return null; } @@ -193,10 +207,18 @@ public class ValidationCycle extends Persistent { public User[] getAllActors () { // ----------------------------- Vector result = new Vector(); - if (publisher != null) result.add(publisher); - if (reviewer != null) result.add(reviewer); - if (approver != null) result.add(approver); - if (signatory != null) result.add(signatory); + if (publisher != null) { + result.add(publisher); + } + if (reviewer != null) { + result.add(reviewer); + } + if (approver != null) { + result.add(approver); + } + if (signatory != null) { + result.add(signatory); + } return result.toArray(new User[result.size()]); } @@ -208,7 +230,6 @@ public class ValidationCycle extends Persistent { * @see #isDefault() */ public DocumentType getDocumentType () { - // -------------------------------------- return mytype; // May be null } @@ -216,7 +237,7 @@ public class ValidationCycle extends Persistent { * Set a document type for the validation cycle. * @param aType the document type */ - public void setDocumentType (DocumentType aType) { + public void setDocumentType (final DocumentType aType) { mytype = aType; // May be null } @@ -227,7 +248,6 @@ public class ValidationCycle extends Persistent { * @return true if this validation cycle is assigned to a study. */ public boolean isAssigned () { -// ---------------------------- return (context != null); } @@ -239,17 +259,11 @@ public class ValidationCycle extends Persistent { * * @return true if this validation cycle is a default one. * @see #getDocumentType() - * @see ProjectSettingsServiceImpl#getNewValidationCycle() */ public boolean isDefault () { -// --------------------------- return (mytype == null); } -// ============================================================================================================================== -// Protected services -// ============================================================================================================================== - public ValidationCycleRelation getContext () { // ----------------------------------------------- return context; @@ -258,28 +272,28 @@ public class ValidationCycle extends Persistent { * Set the publisher. * @param publisher the publisher to set */ - public void setPublisher(User publisher) { + public void setPublisher(final User publisher) { this.publisher = publisher; } /** * Set the reviewer. * @param reviewer the reviewer to set */ - public void setReviewer(User reviewer) { + public void setReviewer(final User reviewer) { this.reviewer = reviewer; } /** * Set the approver. * @param approver the approver to set */ - public void setApprover(User approver) { + public void setApprover(final User approver) { this.approver = approver; } /** * Set the signatory. * @param signatory the signatory to set */ - public void setSignatory(User signatory) { + public void setSignatory(final User signatory) { this.signatory = signatory; } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/service/DocumentServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/DocumentServiceImpl.java index 5381141..5c87bae 100644 --- a/Workspace/Siman-Common/src/org/splat/service/DocumentServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/DocumentServiceImpl.java @@ -41,7 +41,6 @@ import org.splat.kernel.NotApplicableException; import org.splat.manox.Reader; import org.splat.manox.Toolbox; import org.splat.service.technical.ProjectSettingsService; -import org.splat.service.technical.ProjectSettingsServiceImpl; import org.splat.service.technical.RepositoryService; import org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming; import org.splat.som.Revision; @@ -90,7 +89,7 @@ public class DocumentServiceImpl implements DocumentService { * @see org.splat.service.DocumentService#selectDocument(long) */ @Transactional(readOnly = true) - public Document selectDocument(long index) { + public Document selectDocument(final long index) { return getDocumentDAO().get(index); } @@ -100,7 +99,7 @@ public class DocumentServiceImpl implements DocumentService { * @see org.splat.service.DocumentService#selectDocument(java.lang.String, java.lang.String) */ @Transactional(readOnly = true) - public Document selectDocument(String refid, String version) { + public Document selectDocument(final String refid, final String version) { Criterion aCondition = Restrictions.and(Restrictions.eq("did", refid), Restrictions.eq("version", version)); return getDocumentDAO().findByCriteria(aCondition); @@ -112,24 +111,25 @@ public class DocumentServiceImpl implements DocumentService { * @see org.splat.service.DocumentService#generateDocumentId(org.splat.dal.bo.som.Document, org.splat.dal.bo.som.Document.Properties) */ @Transactional - public void generateDocumentId(Document aDoc, Properties dprop) { + public void generateDocumentId(final Document aDoc, final Properties dprop) { Study owner = null; - if (dprop.getOwner() instanceof Study) + if (dprop.getOwner() instanceof Study) { owner = (Study) dprop.getOwner(); - else + } else { owner = ((Scenario) dprop.getOwner()).getOwnerStudy(); + } // Synchronize the object with the current Hibernate session. owner = getStudyDAO().get(owner.getIndex()); - + SimpleDateFormat tostring = new SimpleDateFormat("yyyy"); String year = tostring.format(owner.getDate()); String filename = generateEncodedName(aDoc, owner); String path = owner.getReference(); - ProjectSettingsService.Step step = ProjectSettingsServiceImpl - .getStep(aDoc.getStep()); - aDoc.setDid(new StringBuffer(path).append(".%") - .append(Document.suformat).toString()); // Document reference + ProjectSettingsService.Step step = getProjectSettings().getStep( + aDoc.getStep()); + aDoc.setDid(new StringBuffer(path).append(".%").append( + Document.suformat).toString()); // Document reference path = new StringBuffer(year).append("/").append(path).append("/") .append(step.getPath()) // File path relative to the repository vault @@ -148,7 +148,7 @@ public class DocumentServiceImpl implements DocumentService { * the study * @return document reference name */ - private String generateEncodedName(Document aDoc, Study scope) { + private String generateEncodedName(final Document aDoc, final Study scope) { StringBuffer encoding = new StringBuffer(); FileNaming scheme = getProjectSettings().getFileNamingScheme(); DecimalFormat tostring = new DecimalFormat(Document.suformat); @@ -156,11 +156,11 @@ public class DocumentServiceImpl implements DocumentService { int number = getStudyService().generateLocalIndex(scope); if (scheme == FileNaming.encoded) { - encoding.append(scope.getReference()).append(".") - .append(tostring.format(number)); + encoding.append(scope.getReference()).append(".").append( + tostring.format(number)); } else { // title and (temporarily) asis - encoding.append(aDoc.getTitle()).append(".") - .append(tostring.format(number)); + encoding.append(aDoc.getTitle()).append(".").append( + tostring.format(number)); } return encoding.toString(); } @@ -174,13 +174,14 @@ public class DocumentServiceImpl implements DocumentService { * the study * @return file name */ - private String getEncodedRootName(Document aDoc, Study scope) { + private String getEncodedRootName(final Document aDoc, final Study scope) { FileNaming scheme = getProjectSettings().getFileNamingScheme(); - if (scheme == FileNaming.encoded) + if (scheme == FileNaming.encoded) { return scope.getReference(); - else + } else { return aDoc.getTitle(); + } } /** @@ -189,31 +190,32 @@ public class DocumentServiceImpl implements DocumentService { * @see org.splat.service.DocumentService#initialize(org.splat.dal.bo.som.Document, org.splat.dal.bo.som.Document.Properties) */ @Transactional - public void initialize(Document aDoc, Properties dprop) + public void initialize(final Document aDoc, final Properties dprop) throws MissedPropertyException, InvalidPropertyException, NotApplicableException { - if (!aDoc.isUndefined()) + if (!aDoc.isUndefined()) { throw new NotApplicableException( "Cannot initialize an existing Document"); - if (dprop.getName() == null) + } + if (dprop.getName() == null) { throw new MissedPropertyException("name"); - if (dprop.getName().length() == 0) + } + if (dprop.getName().length() == 0) { throw new InvalidPropertyException("name"); - if (dprop.getOwner() == null) + } + if (dprop.getOwner() == null) { throw new MissedPropertyException("owner"); + } // if (dprop.owner instanceof Study && !ProjectSettings.getStep(step).appliesTo(Study.class)) { // throw new InvalidPropertyException("step"); // } aDoc.setTitle(dprop.getName()); aDoc.getFile().changePath( - aDoc.getFile() - .getRelativePath() - .replace( - "%n", - getEncodedRootName(aDoc, - (Study) dprop.getOwner()))); - if (aDoc.getHistory() == -1) + aDoc.getFile().getRelativePath().replace("%n", + getEncodedRootName(aDoc, (Study) dprop.getOwner()))); + if (aDoc.getHistory() == -1) { aDoc.setHistory(0); + } if (dprop.getDate() == null) { Calendar current = Calendar.getInstance(); aDoc.setLastModificationDate(current.getTime()); // Today @@ -228,15 +230,16 @@ public class DocumentServiceImpl implements DocumentService { * * @see org.splat.service.DocumentService#getSaveDirectory(org.splat.dal.bo.som.Document) */ - public java.io.File getSaveDirectory(Document aDoc) { + public java.io.File getSaveDirectory(final Document aDoc) { String mypath = getRepositoryService().getRepositoryVaultPath() + aDoc.getSourceFile().getRelativePath(); String[] table = mypath.split("/"); // Cutting the filename StringBuffer path = new StringBuffer(table[0]); - for (int i = 1; i < table.length - 1; i++) + for (int i = 1; i < table.length - 1; i++) { path = path.append("/").append(table[i]); + } return new java.io.File(path.append("/").toString()); } @@ -247,21 +250,24 @@ public class DocumentServiceImpl implements DocumentService { * the file to parse * @return the extracted properties */ - public Properties extractProperties(java.io.File file) { + public Properties extractProperties(final java.io.File file) { Properties fprop = new Properties(); Reader tool = Toolbox.getReader(file); String value; - if (tool != null) + if (tool != null) { try { value = tool.extractProperty("title"); - if (value != null) + if (value != null) { fprop.setName(value); + } value = tool.extractProperty("reference"); - if (value != null) + if (value != null) { fprop.setReference(value); + } } catch (Exception e) { } + } return fprop; } @@ -274,7 +280,7 @@ public class DocumentServiceImpl implements DocumentService { * the format * @return the created "Converts" relation */ - public ConvertsRelation attach(Document aDoc, String format) { + public ConvertsRelation attach(final Document aDoc, final String format) { return attach(aDoc, format, null); } @@ -290,8 +296,8 @@ public class DocumentServiceImpl implements DocumentService { * @return the created "Converts" relation */ @Transactional - public ConvertsRelation attach(Document aDoc, String format, - String description) { + public ConvertsRelation attach(final Document aDoc, final String format, + final String description) { String path = aDoc.getRelativePath(); File export = new File(path + "." + format); ConvertsRelation attach = new ConvertsRelation(aDoc, export, @@ -319,15 +325,16 @@ public class DocumentServiceImpl implements DocumentService { * the original document * @return true if the new reference is set */ - public boolean buildReferenceFrom(Document aDoc, ProjectElement scope, - Document lineage) { - if (aDoc.getProgressState() != ProgressState.inWORK) + public boolean buildReferenceFrom(final Document aDoc, final ProjectElement scope, + final Document lineage) { + if (aDoc.getProgressState() != ProgressState.inWORK) { return false; + } Study owner = null; Scenario context = null; - if (scope instanceof Study) + if (scope instanceof Study) { owner = (Study) scope; - else { + } else { context = ((Scenario) scope); owner = context.getOwnerStudy(); } @@ -348,10 +355,11 @@ public class DocumentServiceImpl implements DocumentService { * the study * @return true if the new reference is set */ - public boolean buildReferenceFrom(Document aDoc, Study scope) { + public boolean buildReferenceFrom(final Document aDoc, final Study scope) { if (aDoc.getProgressState() != ProgressState.inWORK - && aDoc.getProgressState() != ProgressState.EXTERN) + && aDoc.getProgressState() != ProgressState.EXTERN) { return false; + } DecimalFormat tostring = new DecimalFormat(Document.suformat); aDoc.setDid(aDoc.getDid().replace("%" + Document.suformat, @@ -367,7 +375,7 @@ public class DocumentServiceImpl implements DocumentService { * @return true if demoting succeeded */ @Transactional - public boolean demote(Document aDoc) { + public boolean demote(final Document aDoc) { ValidationStep torem; if (aDoc.getProgressState() == ProgressState.inCHECK) { @@ -384,10 +392,12 @@ public class DocumentServiceImpl implements DocumentService { for (Iterator i = aDoc.getAllRelations().iterator(); i .hasNext();) { Relation link = i.next(); - if (!(link instanceof StampRelation)) + if (!(link instanceof StampRelation)) { continue; - if (((StampRelation) link).getStampType() != torem) + } + if (((StampRelation) link).getStampType() != torem) { continue; + } i.remove(); break; } @@ -405,7 +415,7 @@ public class DocumentServiceImpl implements DocumentService { * @return true if promotion succeeded */ @Transactional - public boolean promote(Document aDoc, Timestamp stamp) { + public boolean promote(final Document aDoc, final Timestamp stamp) { ProgressState newstate = null; if (aDoc.getProgressState() == ProgressState.inWORK) { @@ -438,7 +448,7 @@ public class DocumentServiceImpl implements DocumentService { * @see #release() */ @Transactional - public void hold(Document aDoc) { + public void hold(final Document aDoc) { aDoc.setCountag(aDoc.getCountag() + 1); if (aDoc.isSaved()) { getDocumentDAO().update(aDoc); @@ -453,7 +463,7 @@ public class DocumentServiceImpl implements DocumentService { * @see #hold() */ @Transactional - public void release(Document aDoc) { + public void release(final Document aDoc) { aDoc.setCountag(aDoc.getCountag() - 1); if (aDoc.isSaved()) { getDocumentDAO().merge(aDoc); @@ -471,10 +481,11 @@ public class DocumentServiceImpl implements DocumentService { * if the new title is empty */ @Transactional - public void rename(Document aDoc, String title) + public void rename(final Document aDoc, final String title) throws InvalidPropertyException { - if (title.length() == 0) + if (title.length() == 0) { throw new InvalidPropertyException("name"); + } Calendar current = Calendar.getInstance(); aDoc.setTitle(title); @@ -490,11 +501,12 @@ public class DocumentServiceImpl implements DocumentService { * @param newvers * the new version */ - public void updateAs(Document aDoc, Revision newvers) { + public void updateAs(final Document aDoc, final Revision newvers) { aDoc.setVersion(newvers.setBranch(aDoc.getVersion()).toString()); // Branch names are propagated by the versionning ProgressState newstate = ProgressState.inCHECK; - if (newvers.isMinor()) + if (newvers.isMinor()) { newstate = ProgressState.inWORK; + } aDoc.setProgressState(null); // Just to tell updateAs(state) to not increment the version number updateAs(aDoc, newstate); } @@ -508,27 +520,30 @@ public class DocumentServiceImpl implements DocumentService { * the new state */ @Transactional - public void updateAs(Document aDoc, ProgressState state) { + public void updateAs(final Document aDoc, final ProgressState state) { Document previous = null; // Set of version number if (state == ProgressState.EXTERN) { - if (aDoc.getProgressState() != ProgressState.EXTERN) + if (aDoc.getProgressState() != ProgressState.EXTERN) { aDoc.setVersion(null); // Strange use-case... + } } else { Revision myvers = new Revision(aDoc.getVersion()); if (!myvers.isNull()) { // Versionning context for (Iterator i = aDoc.getAllRelations().iterator(); i .hasNext();) { Relation link = i.next(); - if (!link.getClass().equals(VersionsRelation.class)) + if (!link.getClass().equals(VersionsRelation.class)) { continue; + } previous = (Document) link.getTo(); // Versioned document break; } } - if (aDoc.getProgressState() != null) + if (aDoc.getProgressState() != null) { myvers.incrementAs(state); // Incrementation if the reversion number is not imposed + } aDoc.setVersion(myvers.toString()); } // Update this document and the previous version, if exit @@ -570,7 +585,7 @@ public class DocumentServiceImpl implements DocumentService { * @see #isStepResult() * @see #isResultOf(org.splat.service.technical.ProjectSettingsServiceImpl.Step) */ - public boolean isStudyResult(DocumentType aType) { + public boolean isStudyResult(final DocumentType aType) { // ------------------------------- List step = getProjectSettings() .getAllSteps(); @@ -580,10 +595,12 @@ public class DocumentServiceImpl implements DocumentService { /** * Get document by its path. - * @param path the document path + * + * @param path + * the document path * @return the document if found or null */ - @Transactional(readOnly=true) + @Transactional(readOnly = true) public Document getDocumentByPath(String path) { String[] parse = path.split("'"); @@ -610,7 +627,7 @@ public class DocumentServiceImpl implements DocumentService { * @param studyService * the studyService to set */ - public void setStudyService(StudyService studyService) { + public void setStudyService(final StudyService studyService) { _studyService = studyService; } @@ -629,7 +646,7 @@ public class DocumentServiceImpl implements DocumentService { * @param projectSettingsService * project settings service */ - public void setProjectSettings(ProjectSettingsService projectSettingsService) { + public void setProjectSettings(final ProjectSettingsService projectSettingsService) { _projectSettingsService = projectSettingsService; } @@ -648,7 +665,7 @@ public class DocumentServiceImpl implements DocumentService { * @param documentDAO * the documentDAO to set */ - public void setDocumentDAO(DocumentDAO documentDAO) { + public void setDocumentDAO(final DocumentDAO documentDAO) { _documentDAO = documentDAO; } @@ -667,7 +684,7 @@ public class DocumentServiceImpl implements DocumentService { * @param repositoryService * the repositoryService to set */ - public void setRepositoryService(RepositoryService repositoryService) { + public void setRepositoryService(final RepositoryService repositoryService) { _repositoryService = repositoryService; } @@ -686,7 +703,7 @@ public class DocumentServiceImpl implements DocumentService { * @param documentTypeDAO * the documentTypeDAO to set */ - public void setDocumentTypeDAO(DocumentTypeDAO documentTypeDAO) { + public void setDocumentTypeDAO(final DocumentTypeDAO documentTypeDAO) { _documentTypeDAO = documentTypeDAO; } @@ -705,12 +722,13 @@ public class DocumentServiceImpl implements DocumentService { * @param fileDAO * the fileDAO to set */ - public void setFileDAO(FileDAO fileDAO) { + public void setFileDAO(final FileDAO fileDAO) { _fileDAO = fileDAO; } /** * Get the studyDAO. + * * @return the studyDAO */ public StudyDAO getStudyDAO() { @@ -719,9 +737,11 @@ public class DocumentServiceImpl implements DocumentService { /** * Set the studyDAO. - * @param studyDAO the studyDAO to set + * + * @param studyDAO + * the studyDAO to set */ - public void setStudyDAO(StudyDAO studyDAO) { + public void setStudyDAO(final StudyDAO studyDAO) { _studyDAO = studyDAO; } diff --git a/Workspace/Siman-Common/src/org/splat/service/SimulationContextServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/SimulationContextServiceImpl.java index 29bb008..209d963 100644 --- a/Workspace/Siman-Common/src/org/splat/service/SimulationContextServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/SimulationContextServiceImpl.java @@ -25,7 +25,6 @@ import org.splat.kernel.InvalidPropertyException; import org.splat.log.AppLogger; import org.splat.service.dto.SimulationContextFacade; import org.splat.service.technical.ProjectSettingsService; -import org.splat.service.technical.ProjectSettingsServiceImpl; import org.springframework.transaction.annotation.Transactional; /** @@ -66,7 +65,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { */ @Transactional(readOnly=true) public Vector getSimulationContextsInState( - ProgressState aState) throws InvalidPropertyException { + final ProgressState aState) throws InvalidPropertyException { SimulationContext.Properties cprop = new SimulationContext.Properties(); List context = selectSimulationContextsWhere(cprop .setState(aState)); @@ -85,7 +84,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { * * @see org.splat.service.SimulationContextService#selectSimulationContext(int) */ - public SimulationContext selectSimulationContext(long index) { + public SimulationContext selectSimulationContext(final long index) { return getSimulationContextDAO().get(index); } @@ -95,14 +94,15 @@ public class SimulationContextServiceImpl implements SimulationContextService { * @see org.splat.service.SimulationContextService#selectSimulationContext(org.splat.dal.bo.som.SimulationContextType, java.lang.String) */ public SimulationContext selectSimulationContext( - SimulationContextType celt, String value) { + final SimulationContextType celt, final String value) { SimulationContext result = null; try { SimulationContext.Properties cprop = new SimulationContext.Properties(); List clist = selectSimulationContextsWhere(cprop .setType(celt).setValue(value)); - if (!clist.isEmpty()) + if (!clist.isEmpty()) { result = clist.get(0); // Supposed being the most used one if many exist + } } catch (InvalidPropertyException error) { logger.info("Attempt to select a simulation context \"" + celt.getName() + "\" with an invalid value."); @@ -117,7 +117,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { */ @Transactional(readOnly = true) public List selectSimulationContextsWhere( - SimulationContext.Properties cprop) { + final SimulationContext.Properties cprop) { // StringBuffer query = new StringBuffer("from SimulationContext"); // String separator = " where"; SimulationContextType celt = cprop.getType(); @@ -188,7 +188,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { * @see org.splat.service.SimulationContextService#selectTypesOf(org.splat.service.technical.ProjectSettingsService.Step[]) */ public List selectTypesOf( - ProjectSettingsService.Step... step) { + final ProjectSettingsService.Step... step) { // StringBuffer query = new StringBuffer( // "from SimulationContextType where step='").append( // step[0].getNumber()).append("'"); @@ -212,7 +212,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { * @see org.splat.service.SimulationContextService#selectTypesWhere(org.splat.dal.bo.som.SimulationContextType.Properties) */ public List selectTypesWhere( - SimulationContextType.Properties sprop) { + final SimulationContextType.Properties sprop) { // StringBuffer query = new StringBuffer("from SimulationContextType"); // String separator = " where"; ProjectSettingsService.Step step = sprop.getStep(); @@ -264,7 +264,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { * @see org.splat.service.SimulationContextService#selectType(java.lang.String) */ @Transactional(readOnly = true) - public SimulationContextType selectType(String name) { + public SimulationContextType selectType(final String name) { return getSimulationContextTypeDAO().findByCriteria( Restrictions.eq("name", name)); } @@ -274,7 +274,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { * * @see org.splat.service.SimulationContextService#selectType(long) */ - public SimulationContextType selectType(long index) { + public SimulationContextType selectType(final long index) { return getSimulationContextTypeDAO().get(index); } @@ -283,7 +283,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { * * @see org.splat.service.SimulationContextService#hold(org.splat.dal.bo.som.SimulationContext) */ - public void hold(SimulationContext simCtx) { + public void hold(final SimulationContext simCtx) { simCtx.setCounter(simCtx.getCounter() + 1); if (simCtx.isSaved()) { getSimulationContextDAO().update(simCtx); @@ -295,7 +295,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { * * @see org.splat.service.SimulationContextService#release(org.splat.dal.bo.som.SimulationContext) */ - public void release(SimulationContext simCtx) { + public void release(final SimulationContext simCtx) { simCtx.setCounter(simCtx.getCounter() - 1); if (simCtx.isSaved()) { getSimulationContextDAO().update(simCtx); @@ -309,9 +309,10 @@ public class SimulationContextServiceImpl implements SimulationContextService { * the context to approve * @return true if approval succeeded */ - public boolean approve(SimulationContext simCtx) { - if (simCtx.getProgressState() != ProgressState.inCHECK) + public boolean approve(final SimulationContext simCtx) { + if (simCtx.getProgressState() != ProgressState.inCHECK) { return false; + } simCtx.setProgressState(ProgressState.APPROVED); // The type name is supposed being localized if (simCtx.isSaved()) { getSimulationContextDAO().update(simCtx); @@ -324,8 +325,8 @@ public class SimulationContextServiceImpl implements SimulationContextService { * @return */ public ProjectSettingsService.Step getAttachedStep( - SimulationContextType simCtxType) { - return ProjectSettingsServiceImpl.getStep(simCtxType.getStep()); + final SimulationContextType simCtxType) { + return getProjectSettings().getStep(simCtxType.getStep()); } /** @@ -344,7 +345,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { * the simulationContextDAO to set */ public void setSimulationContextDAO( - SimulationContextDAO simulationContextDAO) { + final SimulationContextDAO simulationContextDAO) { _simulationContextDAO = simulationContextDAO; } @@ -364,7 +365,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { * the simulationContextTypeDAO to set */ public void setSimulationContextTypeDAO( - SimulationContextTypeDAO simulationContextTypeDAO) { + final SimulationContextTypeDAO simulationContextTypeDAO) { _simulationContextTypeDAO = simulationContextTypeDAO; } @@ -383,7 +384,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { * @param projectSettingsService * project settings service */ - public void setProjectSettings(ProjectSettingsService projectSettingsService) { + public void setProjectSettings(final ProjectSettingsService projectSettingsService) { _projectSettingsService = projectSettingsService; } } diff --git a/Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java index b90cce1..ea57a73 100644 --- a/Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java @@ -40,6 +40,7 @@ import org.splat.kernel.MultiplyDefinedException; import org.splat.kernel.NotApplicableException; import org.splat.log.AppLogger; import org.splat.service.technical.IndexService; +import org.splat.service.technical.ProjectSettingsService; import org.splat.som.Revision; import org.splat.som.Step; import org.springframework.transaction.annotation.Transactional; @@ -92,14 +93,18 @@ public class StepServiceImpl implements StepService { * Injected versions relation DAO. */ private VersionsRelationDAO _versionsRelationDAO; + /** + * Injected project service. + */ + private ProjectSettingsService _projectSettingsService; /** * {@inheritDoc} * * @see org.splat.service.StepService#addSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext.Properties) */ - public SimulationContext addSimulationContext(Step aStep, - SimulationContext.Properties dprop) throws MissedPropertyException, + public SimulationContext addSimulationContext(final Step aStep, + final SimulationContext.Properties dprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException { SimulationContext context = new SimulationContext(dprop.setStep(aStep .getStep())); @@ -112,13 +117,14 @@ public class StepServiceImpl implements StepService { * @see org.splat.service.StepService#addSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext) */ @Transactional - public SimulationContext addSimulationContext(Step aStep, - SimulationContext context) { + public SimulationContext addSimulationContext(final Step aStep, + final SimulationContext context) { getSimulationContextService().hold(context); // Increments the reference count of simulation context - if (aStep.getOwner().isSaved()) + if (aStep.getOwner().isSaved()) { try { - if (!context.isSaved()) + if (!context.isSaved()) { getSimulationContextDAO().create(context); + } aStep.getOwner().add(context); aStep.getContex().add(context); // The context is also referenced from this (transient) Step getProjectElementDAO().update(aStep.getOwner()); @@ -126,7 +132,7 @@ public class StepServiceImpl implements StepService { } catch (Exception error) { return null; } - else { // Happens when copying a scenario + } else { // Happens when copying a scenario aStep.getOwner().add(context); aStep.getContex().add(context); // The context is also referenced from this (transient) Step // In case of owner scenario, the Knowledge Element index will be updated later, when saving the scenario @@ -140,7 +146,7 @@ public class StepServiceImpl implements StepService { * @param aStep * the step (activity) */ - private void updateKnowledgeElementsIndex(Step aStep) { + private void updateKnowledgeElementsIndex(final Step aStep) { Scenario[] scenarii; if (aStep.getOwner() instanceof Scenario) { scenarii = new Scenario[1]; @@ -173,13 +179,14 @@ public class StepServiceImpl implements StepService { * @throws IOException * if can't update lucene index */ - private void updateScenarioIndex(Scenario scene) throws IOException { + private void updateScenarioIndex(final Scenario scene) throws IOException { if (scene.getUcase() == null) { for (Iterator i = scene.getKnowledgeElements() .iterator(); i.hasNext();) { KnowledgeElement kelm = i.next(); - if (!kelm.getType().equals("usecase")) + if (!kelm.getType().equals("usecase")) { continue; + } scene.setUcase(kelm); break; } @@ -193,7 +200,7 @@ public class StepServiceImpl implements StepService { * @see org.splat.service.StepService#removeSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext) */ @Transactional - public boolean removeSimulationContext(Step aStep, SimulationContext context) { + public boolean removeSimulationContext(final Step aStep, final SimulationContext context) { boolean isOk = false; SimulationContext torem = aStep .getSimulationContext(context.getIndex()); @@ -219,7 +226,7 @@ public class StepServiceImpl implements StepService { * @see org.splat.service.StepService#createDocument(org.splat.som.Step, org.splat.dal.bo.som.Document.Properties) */ @Transactional - public Publication createDocument(Step aStep, Document.Properties dprop) + public Publication createDocument(final Step aStep, final Document.Properties dprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, IOException { Document newdoc = new Document(dprop.setOwner(aStep.getOwner()) @@ -228,10 +235,12 @@ public class StepServiceImpl implements StepService { // Creation of the save directory java.io.File wdir = getDocumentService().getSaveDirectory(newdoc); - if (!wdir.exists()) - if (!wdir.mkdirs()) + if (!wdir.exists()) { + if (!wdir.mkdirs()) { throw new IOException( "Cannot create the repository vault directory"); + } + } // Identification and save getDocumentService().buildReferenceFrom(newdoc, aStep.getOwnerStudy()); @@ -245,19 +254,22 @@ public class StepServiceImpl implements StepService { * * @see org.splat.service.StepService#assignDocument(org.splat.som.Step, org.splat.dal.bo.som.Document.Properties) */ - public Publication assignDocument(Step aStep, Document.Properties dprop) + public Publication assignDocument(final Step aStep, final Document.Properties dprop) throws MissedPropertyException, InvalidPropertyException, NotApplicableException { String refid = dprop.getReference(); - if (refid == null) + if (refid == null) { return null; + } Document slot = getDocumentService().selectDocument(refid, new Revision().toString()); - if (slot == null) + if (slot == null) { return null; - if (!slot.isUndefined()) + } + if (!slot.isUndefined()) { return null; // Should not happen + } getDocumentService().initialize(slot, dprop.setOwner(aStep.getOwnerStudy())); @@ -283,7 +295,7 @@ public class StepServiceImpl implements StepService { * @throws MismatchException * if the document is not applicable to the given study step */ - public Publication versionDocument(Step aStep, Publication base) + public Publication versionDocument(final Step aStep, final Publication base) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, IOException, MismatchException { return versionDocument(aStep, base, new Document.Properties()); @@ -310,8 +322,8 @@ public class StepServiceImpl implements StepService { * @throws MismatchException * if the document is not applicable to the given study step */ - public Publication versionDocument(Step aStep, Publication base, - String reason) throws MissedPropertyException, + public Publication versionDocument(final Step aStep, final Publication base, + final String reason) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, IOException, MismatchException { return versionDocument(aStep, base, new Document.Properties() @@ -340,18 +352,20 @@ public class StepServiceImpl implements StepService { * if the document is not applicable to the given study step */ @Transactional - public Publication versionDocument(Step aStep, Publication base, - Document.Properties dprop) throws MissedPropertyException, + public Publication versionDocument(final Step aStep, final Publication base, + final Document.Properties dprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, IOException, MismatchException { Document previous = base.value(); - dprop.setDocument(previous); // Initializes the Step property - if (dprop.getStep().getNumber() != aStep.getNumber()) + dprop.setDocument(previous, getProjectSettings().getStep(base.getStep().getNumber())); // Initializes the Step property + if (dprop.getStep().getNumber() != aStep.getNumber()) { throw new MismatchException(); + } - if (dprop.getAuthor() == null) + if (dprop.getAuthor() == null) { dprop.setAuthor(previous.getAuthor()); + } String summary = dprop.getDescription(); // Creation of the document @@ -374,10 +388,11 @@ public class StepServiceImpl implements StepService { for (Iterator i = relist.iterator(); i.hasNext();) { UsedByRelation relation = (UsedByRelation) i.next(); Document relatedoc = relation.getTo(); - if (scope.shares(relatedoc)) + if (scope.shares(relatedoc)) { relatedoc.addRelation(new UsesRelation(relatedoc, newdoc)); - else + } else { relation.moveTo(newdoc); + } } return new Publication(newdoc, aStep.getOwner()); } @@ -389,7 +404,7 @@ public class StepServiceImpl implements StepService { * the study step * @return the list of document types */ - public List getValidDocumentTypes(Step aStep) { + public List getValidDocumentTypes(final Step aStep) { return getDocumentTypeService().selectTypesOf(aStep.getStep()); } @@ -402,9 +417,10 @@ public class StepServiceImpl implements StepService { * the document publication to add * @return true if publication succeeded */ - public boolean add(Step aStep, Publication newdoc) { - if (!aStep.getOwner().add(newdoc)) + public boolean add(final Step aStep, final Publication newdoc) { + if (!aStep.getOwner().add(newdoc)) { return false; // Updates the study in memory + } aStep.getDocuments().add(0, newdoc); // Updates this step getDocumentService().hold(newdoc.value()); // Increments the configuration tag count of document // If not yet saved, the Publication MUST NOT be saved here, although this creates a temporary inconsistent state into the @@ -421,9 +437,10 @@ public class StepServiceImpl implements StepService { * the document publication to remove * @return true if removing of the publication succeeded */ - public boolean remove(Step aStep, Publication oldoc) { - if (!aStep.getOwner().remove(oldoc)) + public boolean remove(final Step aStep, final Publication oldoc) { + if (!aStep.getOwner().remove(oldoc)) { return false; // Updates the study in memory + } aStep.getDocuments().remove(oldoc); // Updates this step getDocumentService().release(oldoc.value()); // Decrements the configuration tag count of document // The publication becoming orphan, it should automatically be removed from the database when updating of owner scenario. @@ -440,13 +457,14 @@ public class StepServiceImpl implements StepService { * @return true if removing of the document succeeded */ @Transactional - public boolean removeDocument(Step aStep, Publication doctag) { + public boolean removeDocument(final Step aStep, final Publication doctag) { Document value = doctag.value(); getDocumentDAO().update(value); Publication torem = aStep.getDocument(value.getIndex()); - if (torem == null) + if (torem == null) { return false; + } remove(aStep, torem); getProjectElementDAO().update(aStep.getOwner()); @@ -484,7 +502,7 @@ public class StepServiceImpl implements StepService { * @param documentService * the documentService to set */ - public void setDocumentService(DocumentService documentService) { + public void setDocumentService(final DocumentService documentService) { _documentService = documentService; } @@ -504,7 +522,7 @@ public class StepServiceImpl implements StepService { * the simulationContextService to set */ public void setSimulationContextService( - SimulationContextService simulationContextService) { + final SimulationContextService simulationContextService) { _simulationContextService = simulationContextService; } @@ -523,7 +541,7 @@ public class StepServiceImpl implements StepService { * @param documentDAO * the documentDAO to set */ - public void setDocumentDAO(DocumentDAO documentDAO) { + public void setDocumentDAO(final DocumentDAO documentDAO) { _documentDAO = documentDAO; } @@ -543,7 +561,7 @@ public class StepServiceImpl implements StepService { * the simulationContextDAO to set */ public void setSimulationContextDAO( - SimulationContextDAO simulationContextDAO) { + final SimulationContextDAO simulationContextDAO) { _simulationContextDAO = simulationContextDAO; } @@ -562,7 +580,7 @@ public class StepServiceImpl implements StepService { * @param projectElementDAO * the projectElementDAO to set */ - public void setProjectElementDAO(ProjectElementDAO projectElementDAO) { + public void setProjectElementDAO(final ProjectElementDAO projectElementDAO) { _projectElementDAO = projectElementDAO; } @@ -581,7 +599,7 @@ public class StepServiceImpl implements StepService { * @param indexService * the indexService to set */ - public void setIndexService(IndexService indexService) { + public void setIndexService(final IndexService indexService) { _indexService = indexService; } @@ -600,7 +618,7 @@ public class StepServiceImpl implements StepService { * @param fileDAO * the fileDAO to set */ - public void setFileDAO(FileDAO fileDAO) { + public void setFileDAO(final FileDAO fileDAO) { _fileDAO = fileDAO; } @@ -619,7 +637,7 @@ public class StepServiceImpl implements StepService { * @param documentTypeService * the documentTypeService to set */ - public void setDocumentTypeService(DocumentTypeService documentTypeService) { + public void setDocumentTypeService(final DocumentTypeService documentTypeService) { _documentTypeService = documentTypeService; } @@ -635,7 +653,27 @@ public class StepServiceImpl implements StepService { * Set the versionsRelationDAO. * @param versionsRelationDAO the versionsRelationDAO to set */ - public void setVersionsRelationDAO(VersionsRelationDAO versionsRelationDAO) { + public void setVersionsRelationDAO(final VersionsRelationDAO versionsRelationDAO) { _versionsRelationDAO = versionsRelationDAO; } + + /** + * Get project settings. + * + * @return Project settings service + */ + private ProjectSettingsService getProjectSettings() { + return _projectSettingsService; + } + + /** + * Set project settings service. + * + * @param projectSettingsService + * project settings service + */ + public void setProjectSettings( + final ProjectSettingsService projectSettingsService) { + _projectSettingsService = projectSettingsService; + } } diff --git a/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java index e6a6191..b035562 100644 --- a/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java @@ -125,7 +125,7 @@ public class StudyServiceImpl implements StudyService { * @see org.splat.service.StudyService#selectStudy(long) */ @Transactional - public Study selectStudy(long index) { + public Study selectStudy(final long index) { Study result = getStudyDAO().get(index); loadWorkflow(result); return result; @@ -139,7 +139,7 @@ public class StudyServiceImpl implements StudyService { * @return found study or null */ @Transactional(readOnly = true) - public Study selectStudy(String refid) { + public Study selectStudy(final String refid) { Study result = getStudyDAO().findByCriteria( Restrictions.eq("sid", refid)); loadWorkflow(result); @@ -152,7 +152,7 @@ public class StudyServiceImpl implements StudyService { * @see org.splat.service.StudyService#createStudy(org.splat.dal.bo.som.Study.Properties) */ @Transactional - public Study createStudy(Study.Properties sprop) + public Study createStudy(final Study.Properties sprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException { sprop.setReference(getProjectSettings().getReferencePattern()); @@ -177,9 +177,10 @@ public class StudyServiceImpl implements StudyService { * @see org.splat.service.StudyService#addProjectContext(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.SimulationContext.Properties) */ @Transactional - public SimulationContext addProjectContext(Study aStudy, - SimulationContext.Properties cprop) throws MissedPropertyException, - InvalidPropertyException, MultiplyDefinedException { + public SimulationContext addProjectContext(final Study aStudy, + final SimulationContext.Properties cprop) + throws MissedPropertyException, InvalidPropertyException, + MultiplyDefinedException { SimulationContext added = getStepService().addSimulationContext( getProjectElementService().getFirstStep(aStudy), cprop); update(aStudy); @@ -192,8 +193,8 @@ public class StudyServiceImpl implements StudyService { * @see org.splat.service.StudyService#addProjectContext(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.SimulationContext) */ @Transactional - public SimulationContext addProjectContext(Study aStudy, - SimulationContext context) { + public SimulationContext addProjectContext(final Study aStudy, + final SimulationContext context) { SimulationContext added = getStepService().addSimulationContext( getProjectElementService().getFirstStep(aStudy), context); update(aStudy); @@ -205,18 +206,20 @@ public class StudyServiceImpl implements StudyService { * * @see org.splat.service.StudyService#addContributor(org.splat.dal.bo.som.Study, org.splat.dal.bo.kernel.User) */ - public boolean addContributor(Study aStudy, User user) { + public boolean addContributor(final Study aStudy, final User user) { List contributor = getModifiableContributors(aStudy); // Initializes contributor for (Iterator i = contributor.iterator(); i.hasNext();) { User present = i.next(); - if (present.equals(user)) + if (present.equals(user)) { return false; + } } boolean absent = getModifiableActors(aStudy).add(user); // User may already be a reviewer or an approver aStudy.addRelation(new ContributorRelation(aStudy, user)); - if (absent) + if (absent) { update(aStudy); // Else, useless to re-index the study + } contributor.add(user); return true; } @@ -232,11 +235,13 @@ public class StudyServiceImpl implements StudyService { * @see #isPublic() * @see Publication#approve(Date) */ - public boolean moveToReference(Study aStudy) { - if (aStudy.getProgressState() != ProgressState.APPROVED) + public boolean moveToReference(final Study aStudy) { + if (aStudy.getProgressState() != ProgressState.APPROVED) { return false; - if (aStudy.getVisibility() != Visibility.PUBLIC) + } + if (aStudy.getVisibility() != Visibility.PUBLIC) { return false; + } aStudy.setVisibility(Visibility.REFERENCE); if (update(aStudy)) { @@ -250,13 +255,15 @@ public class StudyServiceImpl implements StudyService { * * @see org.splat.service.StudyService#update(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.Study.Properties) */ - public boolean update(Study aStudy, Properties sprop) + public boolean update(final Study aStudy, final Properties sprop) throws InvalidPropertyException { - if (sprop.getTitle() != null) + if (sprop.getTitle() != null) { aStudy.setTitle(sprop.getTitle()); - if (sprop.getSummary() != null) + } + if (sprop.getSummary() != null) { aStudy.setAttribute(new DescriptionAttribute(aStudy, sprop .getSummary())); + } // TODO: To be completed return update(aStudy); } @@ -270,12 +277,13 @@ public class StudyServiceImpl implements StudyService { * the document * @return true if the document is published in the study */ - private boolean publishes(Study aStudy, Document doc) { + private boolean publishes(final Study aStudy, final Document doc) { if (!aStudy.publishes(doc)) { Scenario[] scene = aStudy.getScenarii(); for (int i = 0; i < scene.length; i++) { - if (scene[i].publishes(doc)) + if (scene[i].publishes(doc)) { return true; + } } } return false; @@ -286,15 +294,16 @@ public class StudyServiceImpl implements StudyService { * * @see org.splat.service.StudyService#removeContributor(org.splat.dal.bo.som.Study, org.splat.dal.bo.kernel.User[]) */ - public boolean removeContributor(Study aStudy, User... users) { + public boolean removeContributor(final Study aStudy, final User... users) { List contributor = getModifiableContributors(aStudy); // Initializes contributor Boolean done = false; for (int i = 0; i < users.length; i++) { User user = users[i]; for (Iterator j = contributor.iterator(); j.hasNext();) { User present = j.next(); - if (!present.equals(user)) + if (!present.equals(user)) { continue; + } aStudy.removeRelation(ContributorRelation.class, user); j.remove(); // Updates the contributor shortcut @@ -302,8 +311,9 @@ public class StudyServiceImpl implements StudyService { break; } } - if (done) + if (done) { update(aStudy); + } return done; } @@ -312,7 +322,8 @@ public class StudyServiceImpl implements StudyService { * * @see org.splat.service.StudyService#removeProjectContext(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.SimulationContext) */ - public boolean removeProjectContext(Study aStudy, SimulationContext context) { + public boolean removeProjectContext(final Study aStudy, + final SimulationContext context) { boolean done = getStepService().removeSimulationContext( getProjectElementService().getFirstStep(aStudy), context); update(aStudy); @@ -326,18 +337,19 @@ public class StudyServiceImpl implements StudyService { * org.splat.dal.bo.som.ValidationCycle.Properties) */ @Transactional - public void setValidationCycle(Study aStudy, DocumentType type, - ValidationCycle.Properties vprop) { + public void setValidationCycle(final Study aStudy, final DocumentType type, + final ValidationCycle.Properties vprop) { Map validactor = aStudy.getValidationCycles(); - if (validactor == null) + if (validactor == null) { setShortCuts(aStudy); // Initializes validactor and actor + } String cname = type.getName(); ValidationCycle cycle = validactor.get(cname); if (cycle != null && cycle.isAssigned()) { resetActors(cycle, vprop); - } else + } else { try { cycle = new ValidationCycle(aStudy, vprop.setDocumentType(type)); @@ -353,6 +365,7 @@ public class StudyServiceImpl implements StudyService { error); return; } + } resetActorsShortCut(aStudy); update(aStudy); // Re-index the study, just in case } @@ -365,13 +378,14 @@ public class StudyServiceImpl implements StudyService { * a study to demote * @return true if the demotion succeeded. */ - public boolean demote(Study aStudy) { - if (aStudy.getProgressState() == ProgressState.inCHECK) + public boolean demote(final Study aStudy) { + if (aStudy.getProgressState() == ProgressState.inCHECK) { aStudy.setProgressState(ProgressState.inDRAFT); - else if (aStudy.getProgressState() == ProgressState.inDRAFT) + } else if (aStudy.getProgressState() == ProgressState.inDRAFT) { aStudy.setProgressState(ProgressState.inWORK); - else + } else { return false; + } return update(aStudy); } @@ -381,7 +395,7 @@ public class StudyServiceImpl implements StudyService { * @see org.splat.service.StudyService#generateLocalIndex(org.splat.dal.bo.som.Study) */ @Transactional - public int generateLocalIndex(Study aStudy) { + public int generateLocalIndex(final Study aStudy) { aStudy.setLastLocalIndex(aStudy.getLastLocalIndex() + 1); getStudyDAO().update(aStudy); return aStudy.getLastLocalIndex(); @@ -395,7 +409,7 @@ public class StudyServiceImpl implements StudyService { * a study to promote * @return true if the demotion succeeded. */ - public boolean promote(Study aStudy) { + public boolean promote(final Study aStudy) { if (aStudy.getProgressState() == ProgressState.inWORK) { aStudy.setProgressState(ProgressState.inDRAFT); } else if (aStudy.getProgressState() == ProgressState.inDRAFT) { @@ -407,8 +421,9 @@ public class StudyServiceImpl implements StudyService { } } else if (aStudy.getProgressState() == ProgressState.inCHECK) { aStudy.setProgressState(ProgressState.APPROVED); - } else + } else { return false; + } return update(aStudy); } @@ -421,7 +436,7 @@ public class StudyServiceImpl implements StudyService { * @return true if the move succeeded. * @see #isPublic() */ - public boolean moveToPublic(Study aStudy) { + public boolean moveToPublic(final Study aStudy) { boolean isOk = false; if (aStudy.getVisibility() == Visibility.PRIVATE) { aStudy.setVisibility(Visibility.PUBLIC); @@ -440,7 +455,7 @@ public class StudyServiceImpl implements StudyService { * @return true if the study is updated successfully */ @Transactional - private boolean update(Study aStudy) { + private boolean update(final Study aStudy) { boolean isOk = false; try { getStudyDAO().update(aStudy); // Update of relational base @@ -461,7 +476,7 @@ public class StudyServiceImpl implements StudyService { * @return true if reference building is succeded */ @Transactional - private boolean buildReference(Study aStudy) { + private boolean buildReference(final Study aStudy) { String pattern = aStudy.getReference(); // The study being supposed just created, its reference is the reference pattern IDBuilder tool = selectIDBuilder(aStudy.getDate()); if (tool == null) { @@ -484,7 +499,8 @@ public class StudyServiceImpl implements StudyService { * @return true if reference building is succeded */ @Transactional - public String buildReference(IDBuilder aBuilder, String pattern, Study study) { + public String buildReference(final IDBuilder aBuilder, + final String pattern, final Study study) { char[] format = pattern.toCharArray(); char[] ref = new char[80]; // Better evaluate the length of the generated string int next = aBuilder.getBase() + 1; @@ -500,8 +516,9 @@ public class StudyServiceImpl implements StudyService { int n = i; while (format[i] == 'y') { i += 1; - if (i == format.length) + if (i == format.length) { break; + } } SimpleDateFormat tostring = new SimpleDateFormat("yyyy"); String year = tostring.format(study.getDate()); @@ -515,8 +532,9 @@ public class StudyServiceImpl implements StudyService { int n = i; while (format[i] == '0') { i += 1; - if (i == format.length) + if (i == format.length) { break; + } } DecimalFormat tostring = new DecimalFormat(pattern .substring(n, i)); @@ -546,7 +564,7 @@ public class StudyServiceImpl implements StudyService { * the date * @return found id builder */ - private IDBuilder selectIDBuilder(Date date) { + private IDBuilder selectIDBuilder(final Date date) { Calendar aDate = Calendar.getInstance(); aDate.setTime(date); return getIDBuilderDAO().findByCriteria( @@ -559,23 +577,25 @@ public class StudyServiceImpl implements StudyService { * @param aStudy * the study */ - private void resetActorsShortCut(Study aStudy) { + private void resetActorsShortCut(final Study aStudy) { getModifiableActors(aStudy).clear(); // Get all actors involved in validation cycles for (Iterator i = aStudy.getValidationCycles() .values().iterator(); i.hasNext();) { ValidationCycle cycle = i.next(); User[] user = cycle.getAllActors(); - for (int j = 0; j < user.length; j++) + for (int j = 0; j < user.length; j++) { getModifiableActors(aStudy).add(user[j]); + } } // Get all other actors for (Iterator i = aStudy.getAllRelations().iterator(); i .hasNext();) { Relation link = i.next(); Class kindof = link.getClass().getSuperclass(); - if (!kindof.equals(ActorRelation.class)) + if (!kindof.equals(ActorRelation.class)) { continue; + } getModifiableActors(aStudy).add(((ActorRelation) link).getTo()); } } @@ -587,7 +607,7 @@ public class StudyServiceImpl implements StudyService { * the study * @return true if reindexing succeeded */ - private boolean updateKnowledgeElementsIndex(Study aStudy) { + private boolean updateKnowledgeElementsIndex(final Study aStudy) { boolean isOk = false; try { IndexService lucin = getIndex(); @@ -618,8 +638,9 @@ public class StudyServiceImpl implements StudyService { */ private IndexService getIndex() throws IOException { IndexService lucin = getIndexService(); - if (!lucin.exists()) + if (!lucin.exists()) { lucin.create(); // Happens when re-indexing all studies + } return lucin; } @@ -632,33 +653,35 @@ public class StudyServiceImpl implements StudyService { * the cycle description * @return the new validation cycle */ - protected ValidationCycle createValidationCycle(Study from, - ProjectSettingsServiceImpl.ProjectSettingsValidationCycle cycle) { - // ----------------------------------------------------------------------------- + protected ValidationCycle createValidationCycle( + final Study from, + final ProjectSettingsServiceImpl.ProjectSettingsValidationCycle cycle) { Actor[] actype = cycle.getActorTypes(); User.Properties uprop = new User.Properties(); ValidationCycle aValidationCycle = new ValidationCycle(); aValidationCycle.setDocumentType(getDocumentTypeService().selectType( cycle.getName())); // Null in case of default validation cycle - // context = new ValidationCycleRelation(from, this); + // context = new ValidationCycleRelation(from, vprop); // RKV aValidationCycle.context = null; // Validation cycle defined in the workflow for (int i = 0; i < actype.length; i++) { User actor = null; - if (actype[i] != null) + if (actype[i] != null) { try { if (actype[i] == Actor.manager) { actor = from.getAuthor(); } else if (actype[i] == Actor.Nx1) { List manager = getUserService().selectUsersWhere( uprop.setOrganizationName("Nx1")); - if (manager.size() == 1) + if (manager.size() == 1) { actor = manager.get(0); + } } else if (actype[i] == Actor.Nx2) { List manager = getUserService().selectUsersWhere( uprop.setOrganizationName("Nx2")); - if (manager.size() == 1) + if (manager.size() == 1) { actor = manager.get(0); + } } else { /* Actor.customer */ actor = from.getAuthor(); // TODO: Get the customer of the study, if exists @@ -666,12 +689,14 @@ public class StudyServiceImpl implements StudyService { } catch (Exception e) { // Should not happen actor = null; } - if (i == 0) + } + if (i == 0) { aValidationCycle.setReviewer(actor); - else if (i == 1) + } else if (i == 1) { aValidationCycle.setApprover(actor); - else if (i == 2) + } else if (i == 2) { aValidationCycle.setSignatory(actor); + } } return aValidationCycle; } @@ -685,15 +710,16 @@ public class StudyServiceImpl implements StudyService { * the validation step to remove */ @Transactional - protected void remove(ValidationCycle aValidationCycle, ValidationStep step) { - // ------------------------------------------ - if (step == ValidationStep.REVIEW) + protected void remove(final ValidationCycle aValidationCycle, + final ValidationStep step) { + if (step == ValidationStep.REVIEW) { aValidationCycle.setReviewer(null); - else if (step == ValidationStep.APPROVAL) + } else if (step == ValidationStep.APPROVAL) { aValidationCycle.setApprover(null); - else if (step == ValidationStep.ACCEPTANCE - || step == ValidationStep.REFUSAL) + } else if (step == ValidationStep.ACCEPTANCE + || step == ValidationStep.REFUSAL) { aValidationCycle.setSignatory(null); + } if (aValidationCycle.isSaved()) { getValidationCycleDAO().update(aValidationCycle); } @@ -708,8 +734,8 @@ public class StudyServiceImpl implements StudyService { * new validation cycle properties containing new actors */ @Transactional - public void resetActors(ValidationCycle aValidationCycle, - ValidationCycle.Properties vprop) { + public void resetActors(final ValidationCycle aValidationCycle, + final ValidationCycle.Properties vprop) { aValidationCycle.setPublisher(vprop.getPublisher()); // May be null aValidationCycle.setReviewer(vprop.getReviewer()); // May be null aValidationCycle.setApprover(vprop.getApprover()); // May be null @@ -730,8 +756,8 @@ public class StudyServiceImpl implements StudyService { * the actor to set */ @Transactional - protected void setActor(ValidationCycle aValidationCycle, - ValidationStep step, User actor) { + protected void setActor(final ValidationCycle aValidationCycle, + final ValidationStep step, final User actor) { if (step == ValidationStep.PROMOTION) { aValidationCycle.setPublisher(actor); } else if (step == ValidationStep.REVIEW) { @@ -755,9 +781,10 @@ public class StudyServiceImpl implements StudyService { * @return the actors of this study * @see #hasActor(User) */ - public Set getActors(Study aStudy) { - if (aStudy.getActor() == null) + public Set getActors(final Study aStudy) { + if (aStudy.getActor() == null) { setShortCuts(aStudy); + } return Collections.unmodifiableSet(aStudy.getActor()); } @@ -769,9 +796,10 @@ public class StudyServiceImpl implements StudyService { * @return the modifiable set of actors of this study * @see #hasActor(User) */ - public Set getModifiableActors(Study aStudy) { - if (aStudy.getActor() == null) + public Set getModifiableActors(final Study aStudy) { + if (aStudy.getActor() == null) { setShortCuts(aStudy); + } return aStudy.getActor(); } @@ -782,9 +810,10 @@ public class StudyServiceImpl implements StudyService { * the study * @return the unmodifiable not null transient list of contributors of this study */ - public List getContributors(Study aStudy) { - if (aStudy.getContributor() == null) + public List getContributors(final Study aStudy) { + if (aStudy.getContributor() == null) { setShortCuts(aStudy); + } return Collections.unmodifiableList(aStudy.getContributor()); // May be empty } @@ -795,9 +824,10 @@ public class StudyServiceImpl implements StudyService { * the study * @return the modifiable not null transient list of contributors of this study */ - public List getModifiableContributors(Study aStudy) { - if (aStudy.getContributor() == null) + public List getModifiableContributors(final Study aStudy) { + if (aStudy.getContributor() == null) { setShortCuts(aStudy); + } return aStudy.getContributor(); // May be empty } @@ -810,16 +840,20 @@ public class StudyServiceImpl implements StudyService { * the document type being subject of validation * @return the validation cycle of the document, or null if not defined. */ - public ValidationCycle getValidationCycleOf(Study aStudy, DocumentType type) { - if (aStudy.getValidationCycles() == null) + public ValidationCycle getValidationCycleOf(final Study aStudy, + final DocumentType type) { + if (aStudy.getValidationCycles() == null) { setShortCuts(aStudy); + } ValidationCycle result = aStudy.getValidationCycles().get( type.getName()); if (result == null) { - if (type.isStepResult()) + if (type.isStepResult()) { result = aStudy.getValidationCycles().get("default"); // "default" validation cycle defined in the configuration, if exist - if (result == null) + } + if (result == null) { result = aStudy.getValidationCycles().get("built-in"); + } } return result; } @@ -834,13 +868,15 @@ public class StudyServiceImpl implements StudyService { * @return true if the given user is actor of this study. * @see #getActors() */ - public boolean hasActor(Study aStudy, User user) { - if (user == null) + public boolean hasActor(final Study aStudy, final User user) { + if (user == null) { return false; + } for (Iterator i = getActors(aStudy).iterator(); i.hasNext();) { User involved = i.next(); - if (involved.equals(user)) + if (involved.equals(user)) { return true; + } } return false; } @@ -855,19 +891,23 @@ public class StudyServiceImpl implements StudyService { * @return true if the given user is actor of this study. * @see #getContributors() */ - public boolean isStaffedBy(Study aStudy, User user) { + public boolean isStaffedBy(final Study aStudy, final User user) { if (user == null) { return false; } if (aStudy == null) { return false; } - if (aStudy.getAuthor() == null) return false; - if (aStudy.getAuthor().equals(user)) + if (aStudy.getAuthor() == null) { + return false; + } + if (aStudy.getAuthor().equals(user)) { return true; + } for (Iterator i = getContributors(aStudy).iterator(); i.hasNext();) { - if (i.next().equals(user)) + if (i.next().equals(user)) { return true; + } } return false; } @@ -878,7 +918,7 @@ public class StudyServiceImpl implements StudyService { * @param aStudy * the study */ - public void loadWorkflow(Study aStudy) { + public void loadWorkflow(final Study aStudy) { setShortCuts(aStudy); } @@ -888,7 +928,7 @@ public class StudyServiceImpl implements StudyService { * @param aStudy * the study */ - public void setShortCuts(Study aStudy) { + public void setShortCuts(final Study aStudy) { aStudy.getContributor().clear(); aStudy.getValidationCycles().clear(); aStudy.getActor().clear(); @@ -908,30 +948,33 @@ public class StudyServiceImpl implements StudyService { // context } // Get the validation cycles coming from the configured workflow and not overridden in this study - for (Iterator i = ProjectSettingsServiceImpl + for (Iterator i = getProjectSettings() .getAllValidationCycles().iterator(); i.hasNext();) { ProjectSettingsServiceImpl.ProjectSettingsValidationCycle cycle = i .next(); String type = cycle.getName(); - if (!aStudy.getValidationCycles().containsKey(type)) + if (!aStudy.getValidationCycles().containsKey(type)) { aStudy.getValidationCycles().put(type, createValidationCycle(aStudy, cycle)); + } } // Get all corresponding actors for (Iterator i = aStudy.getValidationCycles() .values().iterator(); i.hasNext();) { ValidationCycle cycle = i.next(); User[] user = cycle.getAllActors(); - for (int j = 0; j < user.length; j++) + for (int j = 0; j < user.length; j++) { aStudy.getActor().add(user[j]); + } } // Get all other actors for (Iterator i = aStudy.getAllRelations().iterator(); i .hasNext();) { Relation link = i.next(); Class kindof = link.getClass().getSuperclass(); - if (!kindof.equals(ActorRelation.class)) + if (!kindof.equals(ActorRelation.class)) { continue; + } aStudy.getActor().add(((ActorRelation) link).getTo()); } } @@ -951,7 +994,8 @@ public class StudyServiceImpl implements StudyService { * @param projectSettingsService * project settings service */ - public void setProjectSettings(ProjectSettingsService projectSettingsService) { + public void setProjectSettings( + final ProjectSettingsService projectSettingsService) { _projectSettingsService = projectSettingsService; } @@ -971,7 +1015,7 @@ public class StudyServiceImpl implements StudyService { * the projectElementService to set */ public void setProjectElementService( - ProjectElementService projectElementService) { + final ProjectElementService projectElementService) { _projectElementService = projectElementService; } @@ -990,7 +1034,7 @@ public class StudyServiceImpl implements StudyService { * @param stepService * the stepService to set */ - public void setStepService(StepService stepService) { + public void setStepService(final StepService stepService) { _stepService = stepService; } @@ -1009,7 +1053,7 @@ public class StudyServiceImpl implements StudyService { * @param indexService * the indexService to set */ - public void setIndexService(IndexService indexService) { + public void setIndexService(final IndexService indexService) { _indexService = indexService; } @@ -1028,7 +1072,7 @@ public class StudyServiceImpl implements StudyService { * @param studyDAO * the studyDAO to set */ - public void setStudyDAO(StudyDAO studyDAO) { + public void setStudyDAO(final StudyDAO studyDAO) { _studyDAO = studyDAO; } @@ -1047,7 +1091,7 @@ public class StudyServiceImpl implements StudyService { * @param builderDAO * the iDBuilderDAO to set */ - public void setIDBuilderDAO(IDBuilderDAO builderDAO) { + public void setIDBuilderDAO(final IDBuilderDAO builderDAO) { _iDBuilderDAO = builderDAO; } @@ -1066,7 +1110,7 @@ public class StudyServiceImpl implements StudyService { * @param scenarioDAO * the scenarioDAO to set */ - public void setScenarioDAO(ScenarioDAO scenarioDAO) { + public void setScenarioDAO(final ScenarioDAO scenarioDAO) { _scenarioDAO = scenarioDAO; } @@ -1085,7 +1129,8 @@ public class StudyServiceImpl implements StudyService { * @param validationCycleDAO * the validationCycleDAO to set */ - public void setValidationCycleDAO(ValidationCycleDAO validationCycleDAO) { + public void setValidationCycleDAO( + final ValidationCycleDAO validationCycleDAO) { _validationCycleDAO = validationCycleDAO; } @@ -1104,7 +1149,8 @@ public class StudyServiceImpl implements StudyService { * @param documentTypeService * the documentTypeService to set */ - public void setDocumentTypeService(DocumentTypeService documentTypeService) { + public void setDocumentTypeService( + final DocumentTypeService documentTypeService) { _documentTypeService = documentTypeService; } @@ -1123,7 +1169,7 @@ public class StudyServiceImpl implements StudyService { * @param userService * the userService to set */ - public void setUserService(UserService userService) { + public void setUserService(final UserService userService) { _userService = userService; } } diff --git a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsService.java b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsService.java index d979f0f..c6f4f97 100644 --- a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsService.java +++ b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsService.java @@ -17,65 +17,194 @@ import java.util.Set; import org.splat.dal.bo.som.ProjectElement; import org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming; +import org.splat.service.technical.ProjectSettingsServiceImpl.ProjectSettingsValidationCycle; /** - * @author rkv - * + * Project settings service interface. */ public interface ProjectSettingsService { + /** + * Transient study step data. + */ public static class Step { - // ------------------------ + /** + * The sequential number of the step. + */ int number; - private Class level; // Study or Scenario - Set> contents; // Set of Document and/or Knowledge + + /** + * The owner of the step: study or scenario. + */ + private Class level; + /** + * Set of Document and/or Knowledge applicable on this step. + */ + Set> contents; + /** + * Data path for this step. + */ private String path; - Step(int number, Class level, String path) { + /** + * Create a transient study step definition. + * + * @param number + * the step sequential number + * @param level + * the level (study or scenario) the step is applied to + * @param path + * the step data path + */ + Step(final int number, final Class level, + final String path) { this.initialize(number, level, path); } - private Step(int number, Class level, - Class contents, String path) { + /** + * Create a transient study step definition. + * + * @param number + * the step sequential number + * @param level + * the level (study or scenario) the step is applied to + * @param contents + * the set of applicable data types + * @param path + * the step data path + */ + @SuppressWarnings("unused") + private Step(final int number, + final Class level, + final Class contents, final String path) { this.initialize(number, level, path); this.contents.add(contents); } - private void initialize(int number, - Class level, String path) { + /** + * Initialize the study step. + * + * @param number + * the step sequential number + * @param level + * the level (study or scenario) the step is applied to + * @param path + * the step data path + */ + private void initialize(final int number, + final Class level, final String path) { this.number = number; this.level = level; this.path = path + "/"; this.contents = new HashSet>(); } - public boolean appliesTo(Class level) { + /** + * Check if the step is applied to a study or a scenario level. + * + * @param level + * the study or a scenario to check the step applicability + * @return true if the step is applied to the given level + */ + public boolean appliesTo(final Class level) { return (level == this.level); } - public boolean mayContain(Class type) { + /** + * Check if the step can contain documents or knowledges of the given type. + * + * @param type + * the document type + * @return true if the step can contain data of the given type + */ + public boolean mayContain(final Class type) { return contents.contains(type); } + /** + * Get the sequential number of the step. + * + * @return the sequential number of the step + */ public int getNumber() { return number; } + /** + * Get data path for this step. + * + * @return data path for this step + */ public String getPath() { return path; } } - public FileNaming getFileNamingScheme(); - + /** + * Return the validation cycles of result documents defined in the workflow, ordered by study activities and ending by the default + * validation cycle, if defined. + * + * @return the validation cycles of the workflow + */ + public List getAllValidationCycles(); + + /** + * Get a study step by its sequential number. + * + * @param number + * the step number + * @return the step + */ + public ProjectSettingsService.Step getStep(final int number); + + /** + * Get ordered list of (transient) study steps. + * + * @return the list of steps from project settings + */ public List getAllSteps(); + /** + * Get file naming scheme setting. + * + * @return file naming scheme + * @see org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming + */ + public FileNaming getFileNamingScheme(); + + /** + * Get a pattern of study references. + * + * @return the reference pattern + */ public String getReferencePattern(); + /** + * Get a pattern of the presentation of version numbers. + * + * @return the version numbers presentation pattern + */ public String getRevisionPattern(); + /** + * Load workflow configuration from the given file.
Create necessary default staff in the database if it is not initialized yet. + * + * @param filename + * the workflow configuration file + * @throws IOException + * if there is a file reading or index creation problem + * @throws SQLException + * if there is a database population problem + */ public void configure(String filename) throws IOException, SQLException; + /** + * Get steps of the given project element (study or scenario). + * + * @param level + * the project element (study or scenario) + * @return the list of steps + */ public List getStepsOf( Class level); } diff --git a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java index 14eda46..b537b10 100644 --- a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java @@ -22,10 +22,6 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.log4j.Logger; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - import org.splat.dal.bo.som.Document; import org.splat.dal.bo.som.DocumentType; import org.splat.dal.bo.som.KnowledgeElement; @@ -40,7 +36,13 @@ import org.splat.manox.XDOM; import org.splat.service.DocumentTypeService; import org.splat.service.KnowledgeElementTypeService; import org.splat.service.SimulationContextTypeService; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +/** + * SIMAN configuration data service. + */ public class ProjectSettingsServiceImpl implements ProjectSettingsService { /** @@ -50,22 +52,57 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { .getLogger(ProjectSettingsServiceImpl.class); // Non persistent configuration information - private Properties reprop; // Repository settings - private String pattern; // Pattern of study references - private FileNaming naming; // Scheme of file names stored into the repository - private String versioning; // Pattern of the presentation of version numbers - private Vector steps; // Ordered list of (transient) study steps - private Vector concycles; // Configuration document validation cycles + /** + * Repository settings. + */ + private final Properties reprop = new Properties(); + /** + * Pattern of study references. + */ + private String pattern; + /** + * Scheme of file names stored into the repository. + */ + private FileNaming naming; + /** + * Pattern of the presentation of version numbers. + */ + private String versioning; + /** + * Ordered list of (transient) study steps. + */ + private final Vector steps = new Vector(); + /** + * Configuration document validation cycles. + */ + private Vector concycles; // Temporary attributes initialized from the configuration file for populating the database with object types - private LinkedHashMap mapuse; // Document type names and uses mapping - private Vector context; // Simulation Context type names - private Vector kname; // Knowledge Element type names - private Vector flows; // Document flows - private Vector sclass; // Study classifications + /** + * Document type names and uses mapping. + */ + private LinkedHashMap mapuse; + /** + * Simulation Context type names. + */ + private Vector context; + /** + * Knowledge Element type names. + */ + private Vector kname; + /** + * Document flows. + */ + private Vector flows; + /** + * Study classifications. + */ + private Vector sclass; // Other resources - private static ProjectSettingsServiceImpl my = null; // Singleton instance + /** + * Database service to check its version, etc. + */ private Database _database; /** * Injected simulation context type service. @@ -84,48 +121,80 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { title, encoded, asis } + /** + * Validation cycle defined in the XML configuration. + */ public static class ProjectSettingsValidationCycle { - // ----------------------------------- - private String name; - private Actor[] actor; - + /** + * Cycle (document) type name. + */ + private final String name; + /** + * Array of cycle actors positions in the organization. TODO: Must be replaced by Roles. + */ + private final Actor[] actor; + + /** + * Default constructor. + */ private ProjectSettingsValidationCycle() { this.name = "built-in"; this.actor = new Actor[] { null, null, null }; } - private ProjectSettingsValidationCycle(String name, Actor[] actor) { + /** + * Create a validation cycle definition for the given document type name and actors positions. + * + * @param name + * the document type name + * @param actor + * the array of actors positions + */ + private ProjectSettingsValidationCycle(final String name, + final Actor[] actor) { this.name = name; this.actor = actor; } + /** + * The processed document type name. + * + * @return the document type name + */ public String getName() { return name; } + /** + * Get an array of cycle actors positions. + * + * @return the array of actors positions + * @see org.splat.dal.bo.som.ValidationCycle.Actor + */ public Actor[] getActorTypes() { return actor; } } - // ============================================================================================================================== - // Construction - // ============================================================================================================================== - protected ProjectSettingsServiceImpl() { - // ---------------------------- - reprop = new Properties(); - steps = new Vector(); - my = this; - } - // ============================================================================================================================== // Public functions // ============================================================================================================================== - public void configure(String filename) throws IOException, SQLException { - // --------------------------------------- - if (!steps.isEmpty()) + /** + * Load workflow configuration from the given file.
Create necessary default staff in the database if it is not initialized yet. + * + * @param filename + * the workflow configuration file + * @throws IOException + * if there is a file reading or index creation problem + * @throws SQLException + * if there is a database population problem + */ + public void configure(final String filename) throws IOException, + SQLException { + if (!steps.isEmpty()) { return; // Project already configured + } Database base = getDatabase().getCheckedDB(); File config = new File(filename); @@ -143,8 +212,12 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { } } + /** + * Get ordered list of (transient) study steps. + * + * @return the list of steps from project settings + */ public List getAllSteps() { - // --------------------------------------- return steps; } @@ -154,59 +227,79 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * * @return the validation cycles of the workflow */ - public static List getAllValidationCycles() { - // ------------------------------------------------------------- - return my.concycles; + public List getAllValidationCycles() { + return concycles; } + /** + * Get file naming scheme setting. + * + * @return file naming scheme + * @see org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming + */ public FileNaming getFileNamingScheme() { - // ----------------------------------------------- return naming; } - public static ProjectSettingsValidationCycle getNewValidationCycle() { - // ------------------------------------------------------ - return new ProjectSettingsValidationCycle(); - } - + /** + * Get a pattern of study references. + * + * @return the reference pattern + */ public String getReferencePattern() { return pattern; } + /** + * Get a pattern of the presentation of version numbers. + * + * @return the version numbers presentation pattern + */ public String getRevisionPattern() { - // ------------------------------------------ return versioning; } - public static ProjectSettingsService.Step getStep(int number) { - // --------------------------------------- - for (int i = 0; i < my.steps.size(); i++) { - ProjectSettingsService.Step step = my.steps.get(i); - if (step.number == number) + /** + * Get a study step by its sequential number. + * + * @param number + * the step number + * @return the step + */ + public ProjectSettingsService.Step getStep(final int number) { + for (int i = 0; i < steps.size(); i++) { + ProjectSettingsService.Step step = steps.get(i); + if (step.number == number) { return step; + } } return null; } + /** + * Get steps of the given project element (study or scenario). + * + * @param level + * the project element (study or scenario) + * @return the list of steps + */ public List getStepsOf( - Class level) { - // --------------------------------------------------------------------------- + final Class level) { Vector result = new Vector(); for (int i = 0; i < steps.size(); i++) { ProjectSettingsService.Step step = steps.get(i); - if (step.appliesTo(level)) + if (step.appliesTo(level)) { result.add(step); + } } return result; } - // ============================================================================================================================== - // Protected member function - // ============================================================================================================================== - - public void initialize() { - // ---------------------------- + /** + * Initialize the database: create all necessary default staff defined in the configuration file. + */ + protected void initialize() { createDocumentTypes(); createSimulationContextTypes(); createKnowledgeElementTypes(); @@ -216,8 +309,13 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { // Private member function // ============================================================================================================================== - private void loadCustomization(File config) { - // -------------------------------------------- + /** + * Read the configuration file and fill transient project settings fields. + * + * @param config + * the configuration XML file + */ + private void loadCustomization(final File config) { try { DocumentBuilderFactory dfactory = javax.xml.parsers.DocumentBuilderFactory .newInstance(); @@ -233,8 +331,9 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { String disk = datag.get("repository").getAttributes().getNamedItem( "disk").getNodeValue(); - if (!disk.endsWith("/")) + if (!disk.endsWith("/")) { disk = disk + "/"; + } logger.info("Database root set to " + disk); reprop.setProperty("repository", disk); @@ -266,8 +365,9 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { NodeList slist = child.getChildNodes(); for (int j = 0; j < slist.getLength(); j++) { child = slist.item(j); - if (!child.getNodeName().equals("step")) + if (!child.getNodeName().equals("step")) { continue; + } HashMap tags = XDOM .getNamedChildNodes(child); @@ -280,14 +380,16 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { natr = tags.get("flow").getAttributes(); flist.add(natr); child = natr.getNamedItem("result"); - if (child != null) + if (child != null) { resultype.add(child.getNodeValue()); + } child = tags.get("classification"); - if (child != null) + if (child != null) { clist.add(child.getAttributes()); - else + } else { clist.add(null); + } if (natr.getNamedItem("contents").getNodeValue() .equals("knowledge")) { @@ -300,8 +402,9 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { snum += 1; } } else { - if (!child.getNodeName().equals("step")) + if (!child.getNodeName().equals("step")) { continue; + } HashMap tags = XDOM.getNamedChildNodes(child); natr = tags.get("storage").getAttributes(); // Mandatory information @@ -313,14 +416,16 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { natr = tags.get("flow").getAttributes(); flist.add(natr); child = natr.getNamedItem("result"); - if (child != null) + if (child != null) { resultype.add(child.getNodeValue()); + } child = tags.get("classification"); // Optional information - if (child != null) + if (child != null) { clist.add(child.getAttributes()); - else + } else { clist.add(null); + } if (natr.getNamedItem("contents").getNodeValue().equals( "knowledge")) { @@ -343,21 +448,24 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { Actor[] actor = { null, null, null }; String name = i.next(); child = datag.get(name); - if (child == null) + if (child == null) { continue; // Document type not subject of any validation + } natr = child.getAttributes(); for (int j = 0; j < step.length; j++) { child = natr.getNamedItem(step[j]); - if (child == null) + if (child == null) { continue; // Validation step not required + } actor[j] = Actor.valueOf(child.getNodeValue()); } concycles.add(new ProjectSettingsValidationCycle(name, actor)); } concycles.add(new ProjectSettingsValidationCycle()); // Adds the built-in validation cycle - if (getDatabase().getCheckedDB().isInitialized()) + if (getDatabase().getCheckedDB().isInitialized()) { return; // No need to load object type definitions as they are already stored + } // Documents tag child = children.get("documents"); @@ -368,15 +476,17 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { mapuse = new LinkedHashMap(); for (int i = 0; i < nlist.getLength(); i++) { child = nlist.item(i); - if (!child.getNodeName().equals("article")) + if (!child.getNodeName().equals("article")) { continue; + } natr = child.getAttributes(); String type = natr.getNamedItem("type").getNodeValue(); String uses = null; child = natr.getNamedItem("uses"); - if (child != null) + if (child != null) { uses = child.getNodeValue(); + } mapuse.put(type, uses); // Must be added to the map even if no (null) uses } // Simulation Contexts tag @@ -386,8 +496,9 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { context = new Vector(); for (int i = 0; i < nlist.getLength(); i++) { child = nlist.item(i); - if (!child.getNodeName().equals("article")) + if (!child.getNodeName().equals("article")) { continue; + } context.add(child.getAttributes().getNamedItem("type") .getNodeValue()); @@ -399,8 +510,9 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { kname = new Vector(); for (int i = 0; i < nlist.getLength(); i++) { child = nlist.item(i); - if (!child.getNodeName().equals("article")) + if (!child.getNodeName().equals("article")) { continue; + } kname.add(child.getAttributes().getNamedItem("type") .getNodeValue()); @@ -410,8 +522,10 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { } } + /** + * Create in the database document types defined in the custom configuration. + */ private void createDocumentTypes() { - // ----------------------------------- DocumentType.Properties tprop = new DocumentType.Properties(); HashMap> mapsteps = new HashMap>(); HashMap mapresult = new HashMap(); @@ -433,14 +547,16 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { continue; } slist = mapsteps.get(type); - if (slist == null) + if (slist == null) { slist = new Vector(); + } slist.add(step); mapsteps.put(type, slist); } Node result = flow.getNamedItem("result"); - if (result != null) + if (result != null) { mapresult.put(result.getNodeValue(), step); + } } try { DocumentType tdoc = null; @@ -458,15 +574,17 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { .size()])); if (uses != null) { tdoc = maptype.get(uses); - if (tdoc == null) + if (tdoc == null) { logger .warn("Undefined \"" + uses + "\" document type."); - else + } else { tprop.setUses(tdoc); + } } - if (step != null) + if (step != null) { tprop.setResult(step); + } tprop.disableCheck(); tdoc = getDocumentTypeService().createType(tprop); // Creation of Document Types @@ -478,8 +596,10 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { } } + /** + * Create in the database knowledge types defined in the custom configuration. + */ private void createKnowledgeElementTypes() { - // ------------------------------------------- try { KnowledgeElementType ktype = getKnowledgeElementTypeService() .createType("usecase"); // Internal reserved knowledge element type @@ -495,14 +615,17 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { } } + /** + * Create in the database simulation contexts types defined in the custom configuration. + */ private void createSimulationContextTypes() { - // -------------------------------------------- HashMap mapstep = new HashMap(); int snum = 0; for (Iterator i = sclass.iterator(); i.hasNext(); snum++) { NamedNodeMap clatr = i.next(); - if (clatr == null) + if (clatr == null) { continue; + } String[] clist = clatr.getNamedItem("context").getNodeValue() .split(","); @@ -545,7 +668,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * @param database * the database to set */ - public void setDatabase(Database database) { + public void setDatabase(final Database database) { _database = database; } @@ -565,7 +688,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * the simulationContextTypeService to set */ public void setSimulationContextTypeService( - SimulationContextTypeService simulationContextTypeService) { + final SimulationContextTypeService simulationContextTypeService) { _simulationContextTypeService = simulationContextTypeService; } @@ -585,12 +708,13 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * the knowledgeElementTypeService to set */ public void setKnowledgeElementTypeService( - KnowledgeElementTypeService knowledgeElementTypeService) { + final KnowledgeElementTypeService knowledgeElementTypeService) { _knowledgeElementTypeService = knowledgeElementTypeService; } /** * Get the documentTypeService. + * * @return the documentTypeService */ public DocumentTypeService getDocumentTypeService() { @@ -599,9 +723,12 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { /** * 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; } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/spring/businessServiceContext.xml b/Workspace/Siman-Common/src/spring/businessServiceContext.xml index 9dbba55..e27afec 100644 --- a/Workspace/Siman-Common/src/spring/businessServiceContext.xml +++ b/Workspace/Siman-Common/src/spring/businessServiceContext.xml @@ -111,11 +111,13 @@ http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> + +