]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java
Salome HOME
Show and Edit comments functionalities are implemented
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / StepServiceImpl.java
1 /*****************************************************************************
2  * Company         OPEN CASCADE
3  * Application     SIMAN
4  * File            $Id$ 
5  * Creation date   06.10.2012
6  * @author         $Author$
7  * @version        $Revision$
8  *****************************************************************************/
9
10 package org.splat.service;
11
12 import java.io.IOException;
13 import java.util.ArrayList;
14 import java.util.Iterator;
15 import java.util.List;
16
17 import org.hibernate.criterion.Restrictions;
18 import org.splat.dal.bo.kernel.Relation;
19 import org.splat.dal.bo.kernel.User;
20 import org.splat.dal.bo.som.ConvertsRelation;
21 import org.splat.dal.bo.som.Document;
22 import org.splat.dal.bo.som.DocumentType;
23 import org.splat.dal.bo.som.File;
24 import org.splat.dal.bo.som.KnowledgeElement;
25 import org.splat.dal.bo.som.ProjectElement;
26 import org.splat.dal.bo.som.Publication;
27 import org.splat.dal.bo.som.Scenario;
28 import org.splat.dal.bo.som.SimulationContext;
29 import org.splat.dal.bo.som.StepCommentAttribute;
30 import org.splat.dal.bo.som.UsedByRelation;
31 import org.splat.dal.bo.som.UsesRelation;
32 import org.splat.dal.bo.som.VersionsRelation;
33 import org.splat.dal.dao.kernel.RelationDAO;
34 import org.splat.dal.dao.kernel.UserDAO;
35 import org.splat.dal.dao.som.DocumentDAO;
36 import org.splat.dal.dao.som.FileDAO;
37 import org.splat.dal.dao.som.ProjectElementDAO;
38 import org.splat.dal.dao.som.PublicationDAO;
39 import org.splat.dal.dao.som.SimulationContextDAO;
40 import org.splat.dal.dao.som.StepCommentAttributeDAO;
41 import org.splat.dal.dao.som.VersionsRelationDAO;
42 import org.splat.exception.DocumentIsUsedException;
43 import org.splat.exception.InvalidParameterException;
44 import org.splat.kernel.InvalidPropertyException;
45 import org.splat.kernel.MismatchException;
46 import org.splat.kernel.MissedPropertyException;
47 import org.splat.kernel.MultiplyDefinedException;
48 import org.splat.kernel.NotApplicableException;
49 import org.splat.log.AppLogger;
50 import org.splat.service.dto.StepCommentDTO;
51 import org.splat.service.technical.IndexService;
52 import org.splat.service.technical.ProjectSettingsService;
53 import org.splat.som.Revision;
54 import org.splat.som.Step;
55 import org.splat.util.BeanHelper;
56 import org.springframework.transaction.annotation.Transactional;
57
58
59 /**
60  * Step service implementation.
61  * 
62  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
63  */
64 public class StepServiceImpl implements StepService {
65
66         /**
67          * logger for the service.
68          */
69         public final static AppLogger LOG = AppLogger
70                         .getLogger(StepServiceImpl.class);
71         /**
72          * Injected index service.
73          */
74         private IndexService _indexService;
75         /**
76          * Injected document service.
77          */
78         private DocumentService _documentService;
79         /**
80          * Injected document type service.
81          */
82         private DocumentTypeService _documentTypeService;
83         /**
84          * Injected document DAO.
85          */
86         private DocumentDAO _documentDAO;
87         /**
88          * Injected relation DAO.
89          */
90         private RelationDAO _relationDAO;
91         /**
92          * Injected file DAO.
93          */
94         private FileDAO _fileDAO;
95         /**
96          * Injected simulation context service.
97          */
98         private SimulationContextService _simulationContextService;
99         /**
100          * Injected simulation context DAO.
101          */
102         private SimulationContextDAO _simulationContextDAO;
103         /**
104          * Injected project element DAO.
105          */
106         private ProjectElementDAO _projectElementDAO;
107         /**
108          * Injected versions relation DAO.
109          */
110         private VersionsRelationDAO _versionsRelationDAO;
111         /**
112          * Injected project service.
113          */
114         private ProjectSettingsService _projectSettings;
115         /**
116          * Injected publication DAO.
117          */
118         private PublicationDAO _publicationDAO;
119
120         /**
121          * Injected text attribute DAO.
122          */
123         private StepCommentAttributeDAO _stepCommentAttributeDAO;
124
125         /**
126          * Injected user DAO.
127          */
128         private UserDAO _userDAO;
129         
130         
131         /**
132          * {@inheritDoc}
133          * 
134          * @see org.splat.service.StepService#addSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext.Properties)
135          */
136         @Override
137         public SimulationContext addSimulationContext(final Step aStep,
138                         final SimulationContext.Properties dprop)
139                         throws MissedPropertyException, InvalidPropertyException,
140                         MultiplyDefinedException {
141                 SimulationContext context = new SimulationContext(dprop.setStep(aStep
142                                 .getStep()));
143                 return addSimulationContext(aStep, context);
144         }
145
146         /**
147          * {@inheritDoc}
148          * 
149          * @see org.splat.service.StepService#addSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext)
150          */
151         @Override
152         @Transactional
153         public SimulationContext addSimulationContext(final Step aStep,
154                         final SimulationContext context) {
155                 SimulationContext res = null;
156                 getSimulationContextService().hold(context); // Increments the reference count of simulation context
157                 if (aStep.getOwner().isSaved()) {
158                         try {
159                                 if (!context.isSaved()) {
160                                         getSimulationContextDAO().create(context);
161                                 }
162                                 aStep.getOwner().add(context);
163                                 aStep.getContex().add(context); // The context is also referenced from this (transient) Step
164                                 getProjectElementDAO().update(aStep.getOwner());
165                                 updateKnowledgeElementsIndex(aStep);
166                                 res = context;
167                         } catch (Exception error) {
168                                 LOG.debug(error.getMessage(), error);
169                         }
170                 } else { // Happens when copying a scenario
171                         aStep.getOwner().add(context);
172                         aStep.getContex().add(context); // The context is also referenced from this (transient) Step
173                         // In case of owner scenario, the Knowledge Element index will be updated later, when saving the scenario
174                         res = context;
175                 }
176                 return res;
177         }
178
179         /**
180          * Update lucene index of knowledge elements of a scenario or a study which the given step is related to.
181          * 
182          * @param aStep
183          *            the step (activity)
184          */
185         private void updateKnowledgeElementsIndex(final Step aStep) {
186                 Scenario[] scenarii;
187                 if (aStep.getOwner() instanceof Scenario) {
188                         scenarii = new Scenario[1];
189                         scenarii[0] = (Scenario) aStep.getOwner();
190                 } else {
191                         scenarii = aStep.getOwnerStudy().getScenarii();
192                 }
193                 try {
194                         for (int i = 0; i < scenarii.length; i++) {
195                                 Scenario scene = scenarii[i];
196                                 List<KnowledgeElement> knelm = scene.getAllKnowledgeElements();
197                                 for (Iterator<KnowledgeElement> j = knelm.iterator(); j
198                                                 .hasNext();) {
199                                         KnowledgeElement kelm = j.next();
200                                         getIndexService().update(kelm);
201                                 }
202                                 updateScenarioIndex(scene);
203                         }
204                 } catch (Exception error) {
205                         LOG.error("Unable to re-index Knowledge Elements, reason:", error);
206                 }
207         }
208
209         /**
210          * Update lucene index for knowledge elements of the scenario.
211          * 
212          * @param scene
213          *            the scenario
214          * @throws IOException
215          *             if can't update lucene index
216          */
217         private void updateScenarioIndex(final Scenario scene) throws IOException {
218                 if (scene.getUcase() == null) {
219                         for (Iterator<KnowledgeElement> i = scene.getKnowledgeElements()
220                                         .iterator(); i.hasNext();) {
221                                 KnowledgeElement kelm = i.next();
222                                 if (!kelm.getType().equals("usecase")) {
223                                         continue;
224                                 }
225                                 scene.setUcase(kelm);
226                                 break;
227                         }
228                 }
229                 getIndexService().update(scene.getUcase());
230         }
231
232         /**
233          * {@inheritDoc}
234          * 
235          * @see org.splat.service.StepService#removeSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext)
236          */
237         @Override
238         @Transactional
239         public boolean removeSimulationContext(final Step aStep,
240                         final SimulationContext context) {
241                 SimulationContext torem = aStep
242                                 .getSimulationContext(context.getIndex());
243
244                 boolean isOk = (torem != null) && (aStep.getOwner().remove(torem));
245                 if (isOk) {
246
247                         aStep.getContex().remove(torem);
248                         getProjectElementDAO().update(aStep.getOwner());
249                         if (torem.isShared()) {
250                                 getSimulationContextService().release(torem);
251                                 getSimulationContextDAO().update(torem);
252                         } else {
253                                 getSimulationContextDAO().delete(torem);
254                         }
255                 }
256                 return isOk;
257         }
258
259         /**
260          * {@inheritDoc}
261          * 
262          * @see org.splat.service.StepService#createDocument(org.splat.som.Step, org.splat.dal.bo.som.Document.Properties)
263          */
264         @Override
265         @Transactional
266         public Publication createDocument(final Step aStep,
267                         final Document.Properties dprop) throws MissedPropertyException,
268                         InvalidPropertyException, MultiplyDefinedException, IOException {
269                 if (LOG.isDebugEnabled()) {
270                         LOG.debug("Local index before: "
271                                         + aStep.getOwnerStudy().getLastLocalIndex());
272                 }
273                 Document newdoc = new Document(dprop.setOwner(aStep.getOwner())
274                                 .setStep(aStep.getStep()));
275                 getDocumentService().generateDocumentId(newdoc, dprop);
276
277                 // Creation of the save directory
278                 java.io.File wdir = getDocumentService().getSaveDirectory(newdoc);
279                 if ((!wdir.exists()) && (!wdir.mkdirs())) {
280                         throw new IOException(
281                                         "Cannot create the repository vault directory");
282                 }
283
284                 // Identification and save
285                 if (LOG.isDebugEnabled()) {
286                         LOG.debug("Local index after: "
287                                         + aStep.getOwnerStudy().getLastLocalIndex());
288                 }
289                 getDocumentService().buildReferenceFrom(newdoc, aStep.getOwnerStudy());
290                 getDocumentDAO().create(newdoc);
291
292                 return new Publication(newdoc, aStep.getOwner());
293         }
294
295         /**
296          * {@inheritDoc}
297          * 
298          * @see org.splat.service.StepService#assignDocument(org.splat.som.Step, org.splat.dal.bo.som.Document.Properties)
299          */
300         @Override
301         public Publication assignDocument(final Step aStep,
302                         final Document.Properties dprop) throws MissedPropertyException,
303                         InvalidPropertyException, NotApplicableException {
304                 String refid = dprop.getReference();
305                 Publication res = null;
306                 if (refid != null) {
307                         Document slot = getDocumentService().selectDocument(refid,
308                                         new Revision().toString());
309                         if ((slot != null) && (slot.isUndefined())) {
310                                 getDocumentService().initialize(slot,
311                                                 dprop.setOwner(aStep.getOwnerStudy()));
312                                 res = new Publication(slot, aStep.getOwner());
313                         }
314                 }
315                 return res;
316         }
317
318         /**
319          * Create a new version of a document in the given study step.
320          * 
321          * @param aStep
322          *            the study step
323          * @param base
324          *            the base document published version
325          * @return the new version publication
326          * @throws MissedPropertyException
327          *             if a mandatory property is missed
328          * @throws InvalidPropertyException
329          *             if some property doesn't exist
330          * @throws MultiplyDefinedException
331          *             if some property is defined several times
332          * @throws IOException
333          *             if a file system error occurs
334          * @throws MismatchException
335          *             if the document is not applicable to the given study step
336          */
337         public Publication versionDocument(final Step aStep, final Publication base)
338                         throws MissedPropertyException, InvalidPropertyException,
339                         MultiplyDefinedException, IOException, MismatchException {
340                 return versionDocument(aStep, base, new Document.Properties());
341         }
342
343         /**
344          * Create a new version of a document in the given study step.
345          * 
346          * @param aStep
347          *            the study step
348          * @param base
349          *            the base document published version
350          * @param reason
351          *            the comment for the new version
352          * @return the new version publication
353          * @throws MissedPropertyException
354          *             if a mandatory property is missed
355          * @throws InvalidPropertyException
356          *             if some property doesn't exist
357          * @throws MultiplyDefinedException
358          *             if some property is defined several times
359          * @throws IOException
360          *             if a file system error occurs
361          * @throws MismatchException
362          *             if the document is not applicable to the given study step
363          */
364         public Publication versionDocument(final Step aStep,
365                         final Publication base, final String reason)
366                         throws MissedPropertyException, InvalidPropertyException,
367                         MultiplyDefinedException, IOException, MismatchException {
368                 return versionDocument(aStep, base, new Document.Properties()
369                                 .setDescription(reason));
370         }
371
372         /**
373          * Create a new version of a document in the given study step.
374          * 
375          * @param aStep
376          *            the study step
377          * @param base
378          *            the base document published version
379          * @param dprop
380          *            properties of the new version
381          * @return the new version publication
382          * @throws MissedPropertyException
383          *             if a mandatory property is missed
384          * @throws InvalidPropertyException
385          *             if some property doesn't exist
386          * @throws MultiplyDefinedException
387          *             if some property is defined several times
388          * @throws IOException
389          *             if a file system error occurs
390          * @throws MismatchException
391          *             if the document is not applicable to the given study step
392          */
393         @Override
394         @Transactional
395         public Publication versionDocument(final Step aStep,
396                         final Publication base, final Document.Properties dprop)
397                         throws MissedPropertyException, InvalidPropertyException,
398                         MultiplyDefinedException, IOException, MismatchException {
399                 Document previous = base.value();
400
401                 // RKV: Keep the new file format if it is related to the same document type on this step.
402                 String newFormat = dprop.getFormat();
403
404                 dprop.setDocument(previous, getProjectSettings().getStep(
405                                 base.getStep().getNumber())); // Initializes the Step property
406                 if (dprop.getStep().getNumber() != aStep.getNumber()) {
407                         throw new MismatchException();
408                 }
409
410                 if (newFormat != null
411                                 /*&& previous.getType().equals(
412                                                 getProjectSettings().getDefaultDocumentType(
413                                                                 aStep.getStep(), newFormat))*/) {
414                         dprop.setFormat(newFormat);
415                 }
416
417                 if (dprop.getAuthor() == null) {
418                         dprop.setAuthor(previous.getAuthor());
419                 }
420                 String summary = dprop.getDescription();
421
422                 // Creation of the document
423                 Document newdoc = new Document(dprop.setOwner(aStep.getOwner())
424                                 .setStep(aStep.getStep()));
425                 getDocumentService().generateDocumentId(newdoc, dprop);
426                 getDocumentService().buildReferenceFrom(newdoc, aStep.getOwner(),
427                                 previous);
428                 getDocumentDAO().create(newdoc);
429
430                 // Versioning
431                 VersionsRelation aRel;
432                 aRel = new VersionsRelation(newdoc, previous, summary);
433                 // getVersionsRelationDAO().create(aRel);
434                 newdoc.addRelation(aRel);
435
436                 // Update of usedby relations, if exist
437                 /*
438                  * RKV: Consider the new version as not used by old dependent documents. So these documents must be marked as outdated then. List<Relation>
439                  * relist = previous.getRelations(UsedByRelation.class); Study scope = aStep.getOwnerStudy(); for (Iterator<Relation> i =
440                  * relist.iterator(); i.hasNext();) { UsedByRelation relation = (UsedByRelation) i.next(); Document relatedoc = relation.getTo(); if
441                  * (scope.shares(relatedoc)) { relatedoc.addRelation(new UsesRelation(relatedoc, newdoc)); } else { relation.moveTo(newdoc); } }
442                  */
443                 return new Publication(newdoc, aStep.getOwner());
444         }
445
446         /**
447          * Get document types which are applicable for the given study step (activity).
448          * 
449          * @param aStep
450          *            the study step
451          * @return the list of document types
452          */
453         @Override
454         public List<DocumentType> getValidDocumentTypes(final Step aStep) {
455                 return getDocumentTypeService().selectTypesOf(aStep.getStep());
456         }
457
458         /**
459          * Add a document publication to the given step.
460          * 
461          * @param aStep
462          *            the target study step
463          * @param newdoc
464          *            the document publication to add
465          * @return true if publication succeeded
466          */
467         @Override
468         public boolean add(final Step aStep, final Publication newdoc) {
469                 boolean res = aStep.getOwner().add(newdoc); // Updates the study in memory
470                 if (res) {
471                         aStep.getDocuments().add(0, newdoc); // Updates this step
472                         getDocumentService().hold(newdoc.value()); // Increments the configuration tag count of document
473                         // If not yet saved, the Publication MUST NOT be saved here, although this creates a temporary inconsistent state into the
474                         // database (it will be saved later by cascading the update of owner scenario).
475                 }
476                 return res;
477         }
478
479         /**
480          * Remove a document publication from the given step.
481          * 
482          * @param aStep
483          *            the study step
484          * @param oldoc
485          *            the document publication to remove
486          * @return true if removing of the publication succeeded
487          */
488         @Override
489         public boolean remove(final Step aStep, final Publication oldoc) {
490                 aStep.getDocuments().remove(oldoc); // Updates this step
491                 aStep.getOwner().remove(oldoc); // remove from the parent project element
492                 getProjectElementDAO().merge(aStep.getOwner());
493                 getDocumentService().release(oldoc.value()); // Decrements the configuration tag count of document
494                 // The publication becoming orphan, it should automatically be removed from the database when updating of owner scenario.
495                 return true;
496         }
497
498         /**
499          * Remove a document from the given step and from the database if it is no more used.
500          * 
501          * @param aStep
502          *            the study step
503          * @param docId
504          *            the document id
505          * @return true if removing of the document succeeded
506          * @throws DocumentIsUsedException
507          *             if the document is used by other documents
508          */
509         @Override
510         @Transactional
511         public boolean removeDocument(final Step aStep, final long docId)
512                         throws DocumentIsUsedException {
513                 Publication torem = aStep.getDocument(docId);
514                 boolean res = (torem != null);
515                 if (res) {
516                         if (!torem.value().getRelations(UsedByRelation.class).isEmpty()) {
517                                 throw new DocumentIsUsedException(torem.value().getTitle());
518                         }
519                         remove(aStep, torem);
520                         Document value = torem.value();
521                         if (!value.isPublished() && !value.isVersioned()) { // The referenced document is no more used
522                                 List<Document> using = new ArrayList<Document>();
523                                 List<File> files = new ArrayList<File>();
524                                 for (Relation link : value.getAllRelations()) {
525                                         if (link.getClass().equals(ConvertsRelation.class)) { // File conversion
526                                                 files.add((File) link.getTo());
527                                         } else if (link.getClass().equals(UsesRelation.class)) { // Document dependency
528                                                 using.add((Document) link.getTo());
529                                         }
530                                 }
531                                 // Remove relations from depending documents
532                                 if (LOG.isDebugEnabled()) {
533                                         LOG.debug("Remove " + using.size() + " UsedByRelation(s).");
534                                 }
535                                 for (Document doc : using) {
536                                         if (LOG.isDebugEnabled()) {
537                                                 LOG.debug("Remove UsedByRelation from "
538                                                                 + doc.getTitle() + " to " + value.getTitle());
539                                                 LOG.debug("Nb relations of doc " + doc.getTitle()
540                                                                 + " before: " + doc.getAllRelations().size());
541                                         }
542                                         doc.removeRelation(UsedByRelation.class, value);
543                                         if (LOG.isDebugEnabled()) {
544                                                 LOG.debug("Nb relations of doc " + doc.getTitle()
545                                                                 + " after: " + doc.getAllRelations().size());
546                                         }
547                                         getDocumentDAO().merge(doc);
548                                 }
549                                 // Synchronize deleted objects with the database to avoid hibernate exception
550                                 // org.hibernate.PropertyValueException: not-null property references a null or transient value
551                                 getDocumentDAO().flush();
552                                 // The corresponding physical file is not removed from the vault
553                                 getDocumentDAO().delete(getDocumentDAO().merge(torem.value()));
554                                 // Delete document's files
555                                 for (File file : files) {
556                                         getFileDAO().delete(getFileDAO().merge(file)); // The corresponding physical file is not removed from the vault
557                                 }
558                         }
559                 }
560                 return res;
561         }
562         
563         /**
564          * {@inheritDoc}
565          *
566          * @see org.splat.service.StepService#addComment(org.splat.som.Step, org.splat.dal.bo.som.CommentAttribute)
567          */
568         @Override
569         @Transactional
570         public void addStepComment(final StepCommentDTO comment) throws InvalidParameterException {
571
572                 if(comment.getId()!= null) {
573                         throw new InvalidParameterException("id", String.valueOf(comment.getId()));
574                 }
575                 User user = getUserDAO().get(comment.getUserId());
576                 if (user == null) {
577                         throw new InvalidParameterException("userId", String.valueOf(comment.getUserId()));
578                 }
579                 ProjectElement projectElement = getProjectElementDAO().get(comment.getProjectElementId());
580                 if (projectElement==null) {
581                         throw new InvalidParameterException("projectElementId", comment.getProjectElementId().toString());
582                 }
583                 if(comment.getStep() == null || comment.getStep()<0) {
584                         throw new InvalidParameterException("step", String.valueOf(comment.getStep()));
585                 }
586                 if(comment.getDate() == null) {
587                         throw new InvalidParameterException("date", String.valueOf(comment.getDate()));
588                 }
589                 if(comment.getTitle() == null) {
590                         throw new InvalidParameterException("title", String.valueOf(comment.getTitle()));
591                 }
592
593                 StepCommentAttribute newComment = new StepCommentAttribute(
594                                 projectElement,
595                                 comment.getText(),
596                                 comment.getDate(),
597                                 comment.getStep(),
598                                 user,
599                                 comment.getTitle()
600                                 );
601
602                 Long resultKey=getStepCommentAttributeDAO().create(newComment);
603                 comment.setId(resultKey);
604         }
605
606         /**
607          * @see org.splat.service.StepService#getStepComments(org.splat.som.Step)
608          */
609         @Override
610         public List<StepCommentDTO> getStepComments(final Step step) throws InvalidParameterException {
611                 ProjectElement owner = _projectElementDAO.get(step.getOwner().getRid());
612                 if(owner == null) {
613                         throw new InvalidParameterException("step owner id",
614                                         Long.valueOf(step.getOwner().getRid()).toString());
615                 }
616                 List<StepCommentAttribute> comments = _stepCommentAttributeDAO.getFilteredList(
617                                 Restrictions.and(
618                                                 Restrictions.eq("step", Integer.valueOf(step.getNumber())),
619                                                 Restrictions.eq("owner", owner)));
620                 List<StepCommentDTO> commentDTOs = new ArrayList<StepCommentDTO>();
621                 for(StepCommentAttribute comment : comments) {
622                          StepCommentDTO stepCommentDTO = BeanHelper.copyBean(comment, StepCommentDTO.class);
623                          stepCommentDTO.setText(comment.getValue());
624                          stepCommentDTO.setId(Long.valueOf(comment.getRid()));
625                          commentDTOs.add(stepCommentDTO);
626                 }
627                 return commentDTOs;
628         }
629
630         /**
631          * Get the documentService.
632          * 
633          * @return the documentService
634          */
635         public DocumentService getDocumentService() {
636                 return _documentService;
637         }
638
639         /**
640          * Set the documentService.
641          * 
642          * @param documentService
643          *            the documentService to set
644          */
645         public void setDocumentService(final DocumentService documentService) {
646                 _documentService = documentService;
647         }
648
649         /**
650          * Get the simulationContextService.
651          * 
652          * @return the simulationContextService
653          */
654         public SimulationContextService getSimulationContextService() {
655                 return _simulationContextService;
656         }
657
658         /**
659          * Set the simulationContextService.
660          * 
661          * @param simulationContextService
662          *            the simulationContextService to set
663          */
664         public void setSimulationContextService(
665                         final SimulationContextService simulationContextService) {
666                 _simulationContextService = simulationContextService;
667         }
668
669         /**
670          * Get the documentDAO.
671          * 
672          * @return the documentDAO
673          */
674         public DocumentDAO getDocumentDAO() {
675                 return _documentDAO;
676         }
677
678         /**
679          * Set the documentDAO.
680          * 
681          * @param documentDAO
682          *            the documentDAO to set
683          */
684         public void setDocumentDAO(final DocumentDAO documentDAO) {
685                 _documentDAO = documentDAO;
686         }
687
688         /**
689          * Get the simulationContextDAO.
690          * 
691          * @return the simulationContextDAO
692          */
693         public SimulationContextDAO getSimulationContextDAO() {
694                 return _simulationContextDAO;
695         }
696
697         /**
698          * Set the simulationContextDAO.
699          * 
700          * @param simulationContextDAO
701          *            the simulationContextDAO to set
702          */
703         public void setSimulationContextDAO(
704                         final SimulationContextDAO simulationContextDAO) {
705                 _simulationContextDAO = simulationContextDAO;
706         }
707
708         /**
709          * Get the projectElementDAO.
710          * 
711          * @return the projectElementDAO
712          */
713         public ProjectElementDAO getProjectElementDAO() {
714                 return _projectElementDAO;
715         }
716
717         /**
718          * Set the projectElementDAO.
719          * 
720          * @param projectElementDAO
721          *            the projectElementDAO to set
722          */
723         public void setProjectElementDAO(final ProjectElementDAO projectElementDAO) {
724                 _projectElementDAO = projectElementDAO;
725         }
726
727         /**
728          * Get the indexService.
729          * 
730          * @return the indexService
731          */
732         public IndexService getIndexService() {
733                 return _indexService;
734         }
735
736         /**
737          * Set the indexService.
738          * 
739          * @param indexService
740          *            the indexService to set
741          */
742         public void setIndexService(final IndexService indexService) {
743                 _indexService = indexService;
744         }
745
746         /**
747          * Get the fileDAO.
748          * 
749          * @return the fileDAO
750          */
751         public FileDAO getFileDAO() {
752                 return _fileDAO;
753         }
754
755         /**
756          * Set the fileDAO.
757          * 
758          * @param fileDAO
759          *            the fileDAO to set
760          */
761         public void setFileDAO(final FileDAO fileDAO) {
762                 _fileDAO = fileDAO;
763         }
764
765         /**
766          * Get the documentTypeService.
767          * 
768          * @return the documentTypeService
769          */
770         public DocumentTypeService getDocumentTypeService() {
771                 return _documentTypeService;
772         }
773
774         /**
775          * Set the documentTypeService.
776          * 
777          * @param documentTypeService
778          *            the documentTypeService to set
779          */
780         public void setDocumentTypeService(
781                         final DocumentTypeService documentTypeService) {
782                 _documentTypeService = documentTypeService;
783         }
784
785         /**
786          * Get the versionsRelationDAO.
787          * 
788          * @return the versionsRelationDAO
789          */
790         public VersionsRelationDAO getVersionsRelationDAO() {
791                 return _versionsRelationDAO;
792         }
793
794         /**
795          * Set the versionsRelationDAO.
796          * 
797          * @param versionsRelationDAO
798          *            the versionsRelationDAO to set
799          */
800         public void setVersionsRelationDAO(
801                         final VersionsRelationDAO versionsRelationDAO) {
802                 _versionsRelationDAO = versionsRelationDAO;
803         }
804
805         /**
806          * Get project settings.
807          * 
808          * @return Project settings service
809          */
810         private ProjectSettingsService getProjectSettings() {
811                 return _projectSettings;
812         }
813         
814         /**
815          * Set project settings service.
816          * 
817          * @param projectSettingsService
818          *            project settings service
819          */
820         public void setProjectSettings(
821                         final ProjectSettingsService projectSettingsService) {
822                 _projectSettings = projectSettingsService;
823         }
824         
825         /**
826          * Get the stepCommentAttributeDAO.
827          * @return the stepCommentAttributeDAO
828          */
829         public StepCommentAttributeDAO getStepCommentAttributeDAO() {
830                 return _stepCommentAttributeDAO;
831         }
832
833         /**
834          * Set the stepCommentAttributeDAO.
835          * @param commentAttributeDAO the stepCommentAttributeDAO to set
836          */
837         public void setStepCommentAttributeDAO(
838                         final StepCommentAttributeDAO commentAttributeDAO) {
839                 _stepCommentAttributeDAO = commentAttributeDAO;
840         }
841
842         /**
843          * Get the userDAO.
844          * @return the userDAO
845          */
846         public UserDAO getUserDAO() {
847                 return _userDAO;
848         }
849         /**
850          * Set the userDAO.
851          * @param userDAO the userDAO to set
852          */
853         public void setUserDAO(final UserDAO userDAO) {
854                 _userDAO = userDAO;
855         }
856
857         /**
858          * Get the publicationDAO.
859          * 
860          * @return the publicationDAO
861          */
862         public PublicationDAO getPublicationDAO() {
863                 return _publicationDAO;
864         }
865
866         /**
867          * Set the publicationDAO.
868          * 
869          * @param publicationDAO
870          *            the publicationDAO to set
871          */
872         public void setPublicationDAO(final PublicationDAO publicationDAO) {
873                 this._publicationDAO = publicationDAO;
874         }
875
876         /**
877          * Get the relationDAO.
878          * 
879          * @return the relationDAO
880          */
881         public RelationDAO getRelationDAO() {
882                 return _relationDAO;
883         }
884
885         /**
886          * Set the relationDAO.
887          * 
888          * @param relationDAO
889          *            the relationDAO to set
890          */
891         public void setRelationDAO(final RelationDAO relationDAO) {
892                 _relationDAO = relationDAO;
893         }
894 }