1 /*****************************************************************************
5 * Creation date 02.10.2012
6 * @author Author: Maria KRUCHININA
8 *****************************************************************************/
10 package org.splat.service;
12 import java.io.IOException;
13 import java.text.DecimalFormat;
14 import java.text.SimpleDateFormat;
15 import java.util.Calendar;
16 import java.util.Collections;
17 import java.util.Date;
18 import java.util.Iterator;
19 import java.util.List;
23 import org.hibernate.criterion.Restrictions;
24 import org.splat.dal.bo.kernel.Relation;
25 import org.splat.dal.bo.kernel.User;
26 import org.splat.dal.bo.som.ActorRelation;
27 import org.splat.dal.bo.som.ContributorRelation;
28 import org.splat.dal.bo.som.DescriptionAttribute;
29 import org.splat.dal.bo.som.Document;
30 import org.splat.dal.bo.som.DocumentType;
31 import org.splat.dal.bo.som.IDBuilder;
32 import org.splat.dal.bo.som.KnowledgeElement;
33 import org.splat.dal.bo.som.ProgressState;
34 import org.splat.dal.bo.som.Publication;
35 import org.splat.dal.bo.som.Scenario;
36 import org.splat.dal.bo.som.SimulationContext;
37 import org.splat.dal.bo.som.Study;
38 import org.splat.dal.bo.som.ValidationCycle;
39 import org.splat.dal.bo.som.ValidationCycleRelation;
40 import org.splat.dal.bo.som.ValidationStep;
41 import org.splat.dal.bo.som.Visibility;
42 import org.splat.dal.bo.som.Study.Properties;
43 import org.splat.dal.bo.som.ValidationCycle.Actor;
44 import org.splat.dal.dao.som.IDBuilderDAO;
45 import org.splat.dal.dao.som.ScenarioDAO;
46 import org.splat.dal.dao.som.StudyDAO;
47 import org.splat.dal.dao.som.ValidationCycleDAO;
48 import org.splat.kernel.InvalidPropertyException;
49 import org.splat.kernel.MissedPropertyException;
50 import org.splat.kernel.MultiplyDefinedException;
51 import org.splat.log.AppLogger;
52 import org.splat.service.technical.IndexService;
53 import org.splat.service.technical.ProjectSettingsService;
54 import org.splat.service.technical.ProjectSettingsServiceImpl;
55 import org.splat.som.Revision;
56 import org.springframework.transaction.annotation.Transactional;
59 * This class defines all methods for creation, modification the study.
61 * @author Maria KRUCHININA
64 public class StudyServiceImpl implements StudyService {
67 * logger for the service.
69 public final static AppLogger logger = AppLogger
70 .getLogger(StudyServiceImpl.class);
73 * Injected index service.
75 private IndexService _indexService;
78 * Injected step service.
80 private StepService _stepService;
83 * Injected project service.
85 private ProjectSettingsService _projectSettingsService;
88 * Injected project element service.
90 private ProjectElementService _projectElementService;
95 private StudyDAO _studyDAO;
98 * Injected scenario DAO.
100 private ScenarioDAO _scenarioDAO;
103 * Injected validation cycle DAO.
105 private ValidationCycleDAO _validationCycleDAO;
108 * Injected IDBuilder DAO.
110 private IDBuilderDAO _iDBuilderDAO;
113 * Injected document type service.
115 private DocumentTypeService _documentTypeService;
118 * Injected user service.
120 private UserService _userService;
125 * @see org.splat.service.StudyService#selectStudy(long)
128 public Study selectStudy(long index) {
129 Study result = getStudyDAO().get(index);
130 loadWorkflow(result);
135 * Get study by its reference.
138 * the study reference
139 * @return found study or null
141 @Transactional(readOnly = true)
142 public Study selectStudy(String refid) {
143 Study result = getStudyDAO().findByCriteria(
144 Restrictions.eq("sid", refid));
145 loadWorkflow(result);
152 * @see org.splat.service.StudyService#createStudy(org.splat.dal.bo.som.Study.Properties)
155 public Study createStudy(Study.Properties sprop)
156 throws MissedPropertyException, InvalidPropertyException,
157 MultiplyDefinedException {
158 sprop.setReference(getProjectSettings().getReferencePattern());
159 Study study = new Study(sprop);
161 buildReference(study);
162 getStudyDAO().create(study);
164 IndexService lucin = getIndex();
166 } catch (IOException error) {
167 logger.error("Unable to index the study '" + study.getIndex()
168 + "', reason:", error);
169 // Continue and try to index later
177 * @see org.splat.service.StudyService#addProjectContext(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.SimulationContext.Properties)
179 public SimulationContext addProjectContext(Study aStudy,
180 SimulationContext.Properties cprop) throws MissedPropertyException,
181 InvalidPropertyException, MultiplyDefinedException {
182 SimulationContext added = getStepService().addSimulationContext(
183 getProjectElementService().getFirstStep(aStudy), cprop);
191 * @see org.splat.service.StudyService#addProjectContext(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.SimulationContext)
193 public SimulationContext addProjectContext(Study aStudy,
194 SimulationContext context) {
195 SimulationContext added = getStepService().addSimulationContext(
196 getProjectElementService().getFirstStep(aStudy), context);
204 * @see org.splat.service.StudyService#addContributor(org.splat.dal.bo.som.Study, org.splat.dal.bo.kernel.User)
206 public boolean addContributor(Study aStudy, User user) {
207 List<User> contributor = getModifiableContributors(aStudy); // Initializes contributor
208 for (Iterator<User> i = contributor.iterator(); i.hasNext();) {
209 User present = i.next();
210 if (present.equals(user))
213 boolean absent = getModifiableActors(aStudy).add(user); // User may already be a reviewer or an approver
215 aStudy.addRelation(new ContributorRelation(aStudy, user));
217 update(aStudy); // Else, useless to re-index the study
218 contributor.add(user);
223 * Moves this study from the Public to the Reference area of the repository. For being moved to the Reference area, the study must
224 * previously be approved.
228 * @return true if the move succeeded.
229 * @see #moveToPublic()
231 * @see Publication#approve(Date)
233 public boolean moveToReference(Study aStudy) {
234 if (aStudy.getProgressState() != ProgressState.APPROVED)
236 if (aStudy.getVisibility() != Visibility.PUBLIC)
239 aStudy.setVisibility(Visibility.REFERENCE);
240 if (update(aStudy)) {
241 return updateKnowledgeElementsIndex(aStudy); // If fails, the database roll-back is under responsibility of the caller
249 * @see org.splat.service.StudyService#update(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.Study.Properties)
251 public boolean update(Study aStudy, Properties sprop)
252 throws InvalidPropertyException {
253 if (sprop.getTitle() != null)
254 aStudy.setTitle(sprop.getTitle());
255 if (sprop.getSummary() != null)
256 aStudy.setAttribute(new DescriptionAttribute(aStudy, sprop
258 // TODO: To be completed
259 return update(aStudy);
263 * Check if the document is published in the study.
269 * @return true if the document is published in the study
271 private boolean publishes(Study aStudy, Document doc) {
272 if (!aStudy.publishes(doc)) {
273 Scenario[] scene = aStudy.getScenarii();
274 for (int i = 0; i < scene.length; i++) {
275 if (scene[i].publishes(doc))
285 * @see org.splat.service.StudyService#removeContributor(org.splat.dal.bo.som.Study, org.splat.dal.bo.kernel.User[])
287 public boolean removeContributor(Study aStudy, User... users) {
288 List<User> contributor = getModifiableContributors(aStudy); // Initializes contributor
289 Boolean done = false;
290 for (int i = 0; i < users.length; i++) {
291 User user = users[i];
292 for (Iterator<User> j = contributor.iterator(); j.hasNext();) {
293 User present = j.next();
294 if (!present.equals(user))
297 aStudy.removeRelation(ContributorRelation.class, user);
298 j.remove(); // Updates the contributor shortcut
311 * @see org.splat.service.StudyService#removeProjectContext(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.SimulationContext)
313 public boolean removeProjectContext(Study aStudy, SimulationContext context) {
314 boolean done = getStepService().removeSimulationContext(
315 getProjectElementService().getFirstStep(aStudy), context);
323 * @see org.splat.service.StudyService#setValidationCycle(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.DocumentType,
324 * org.splat.dal.bo.som.ValidationCycle.Properties)
327 public void setValidationCycle(Study aStudy, DocumentType type,
328 ValidationCycle.Properties vprop) {
329 Map<String, ValidationCycle> validactor = aStudy.getValidationCycles();
330 if (validactor == null)
331 setShortCuts(aStudy); // Initializes validactor and actor
333 String cname = type.getName();
334 ValidationCycle cycle = validactor.get(cname);
336 if (cycle != null && cycle.isAssigned()) {
337 resetActors(cycle, vprop);
340 cycle = new ValidationCycle(aStudy, vprop.setDocumentType(type));
342 getValidationCycleDAO().create(cycle); // RKV
344 ValidationCycleRelation link = cycle.getContext();
345 // RKV: aStudy.addRelation(link);
346 aStudy.getAllRelations().add(link); // RKV
348 validactor.put(cname, link.getTo()); // Replaces the cycle if exists as default,
349 } catch (Exception error) {
350 logger.error("Unable to re-index Knowledge Elements, reason:",
354 resetActorsShortCut(aStudy);
355 update(aStudy); // Re-index the study, just in case
359 * Demotes this study from In-Check to In-Draft then In-Work states. This function is called internally when demoting the final result
360 * document of the study.
364 * @return true if the demotion succeeded.
366 public boolean demote(Study aStudy) {
367 if (aStudy.getProgressState() == ProgressState.inCHECK)
368 aStudy.setProgressState(ProgressState.inDRAFT);
369 else if (aStudy.getProgressState() == ProgressState.inDRAFT)
370 aStudy.setProgressState(ProgressState.inWORK);
373 return update(aStudy);
379 * @see org.splat.service.StudyService#generateLocalIndex(org.splat.dal.bo.som.Study)
382 public int generateLocalIndex(Study aStudy) {
383 aStudy.setLastLocalIndex(aStudy.getLastLocalIndex() + 1);
384 getStudyDAO().update(aStudy);
385 return aStudy.getLastLocalIndex();
389 * Promotes this study from In-Work to In-Draft then In-Check and APPROVED states. This function is called internally when promoting the
390 * final result document of the study.
394 * @return true if the demotion succeeded.
396 public boolean promote(Study aStudy) {
397 if (aStudy.getProgressState() == ProgressState.inWORK) {
398 aStudy.setProgressState(ProgressState.inDRAFT);
399 } else if (aStudy.getProgressState() == ProgressState.inDRAFT) {
400 aStudy.setProgressState(ProgressState.inCHECK);
401 Revision myvers = new Revision(aStudy.getVersion());
402 if (myvers.isMinor()) {
403 aStudy.setVersion(myvers.incrementAs(aStudy.getProgressState())
406 } else if (aStudy.getProgressState() == ProgressState.inCHECK) {
407 aStudy.setProgressState(ProgressState.APPROVED);
411 return update(aStudy);
415 * Moves this study from the Private to the Public area of the repository.
419 * @return true if the move succeeded.
422 public boolean moveToPublic(Study aStudy) {
423 boolean isOk = false;
424 if (aStudy.getVisibility() == Visibility.PRIVATE) {
425 aStudy.setVisibility(Visibility.PUBLIC);
426 if (update(aStudy)) {
427 isOk = updateKnowledgeElementsIndex(aStudy); // If fails, the database roll-back is under responsibility of the caller
434 * Update a study in the database.
437 * the study to update
438 * @return true if the study is updated successfully
441 private boolean update(Study aStudy) {
442 boolean isOk = false;
444 getStudyDAO().update(aStudy); // Update of relational base
445 setShortCuts(aStudy); // RKV: initialize transient actors set
446 getIndex().update(aStudy); // Update of Lucene index
448 } catch (Exception error) {
449 logger.error("Unable to re-index the study '" + aStudy.getIndex()
450 + "', reason:", error);
456 * Build reference for the study. The reference of the study is stored as a new reference pattern (IDBuilder).
460 * @return true if reference building is succeded
463 private boolean buildReference(Study aStudy) {
464 String pattern = aStudy.getReference(); // The study being supposed just created, its reference is the reference pattern
465 IDBuilder tool = selectIDBuilder(aStudy.getDate());
467 tool = new IDBuilder(aStudy.getDate());
468 getIDBuilderDAO().create(tool);
470 aStudy.setReference(buildReference(tool, pattern, aStudy));
475 * Build reference for the study. The reference of the study is stored as a new reference pattern (IDBuilder).
482 * the reference pattern
483 * @return true if reference building is succeded
486 public String buildReference(IDBuilder aBuilder, String pattern, Study study) {
487 char[] format = pattern.toCharArray();
488 char[] ref = new char[80]; // Better evaluate the length of the generated string
489 int next = aBuilder.getBase() + 1;
492 for (int i = 0; i < format.length; i++) {
494 // Insertion of attribute values
495 if (format[i] == '%') {
498 if (format[i] == 'y') { // Insertion of year in format 2 (e.g. 09) or 4 (e.g. 2009) digits
500 while (format[i] == 'y') {
502 if (i == format.length)
505 SimpleDateFormat tostring = new SimpleDateFormat("yyyy");
506 String year = tostring.format(study.getDate());
507 year = year.substring(4 - (i - n), 4); // 4-(i-n) must be equal to either 0 or 2
508 for (int j = 0; j < year.length(); j++) {
509 ref[count] = year.charAt(j);
512 i -= 1; // Back to the last 'y' character
513 } else if (format[i] == '0') { // Insertion of the index
515 while (format[i] == '0') {
517 if (i == format.length)
520 DecimalFormat tostring = new DecimalFormat(
521 pattern.substring(n, i));
522 String number = tostring.format(next);
523 for (int j = 0; j < number.length(); j++) {
524 ref[count] = number.charAt(j);
527 i -= 1; // Back to the last '0' character
529 // Keep the character
531 ref[count] = format[i];
535 // Incrementation of the number of study
536 aBuilder.setBase(next);
537 getIDBuilderDAO().update(aBuilder);
538 return String.copyValueOf(ref, 0, count);
542 * Find an id builder by date.
546 * @return found id builder
548 private IDBuilder selectIDBuilder(Date date) {
549 Calendar aDate = Calendar.getInstance();
551 return getIDBuilderDAO().findByCriteria(
552 Restrictions.eq("cycle", aDate.get(Calendar.YEAR)));
556 * Fill transient collection ModifiableActors of the study.
561 private void resetActorsShortCut(Study aStudy) {
562 getModifiableActors(aStudy).clear();
563 // Get all actors involved in validation cycles
564 for (Iterator<ValidationCycle> i = aStudy.getValidationCycles()
565 .values().iterator(); i.hasNext();) {
566 ValidationCycle cycle = i.next();
567 User[] user = cycle.getAllActors();
568 for (int j = 0; j < user.length; j++)
569 getModifiableActors(aStudy).add(user[j]);
571 // Get all other actors
572 for (Iterator<Relation> i = aStudy.getAllRelations().iterator(); i
574 Relation link = i.next();
575 Class<?> kindof = link.getClass().getSuperclass();
576 if (!kindof.equals(ActorRelation.class))
578 getModifiableActors(aStudy).add(((ActorRelation) link).getTo());
583 * Update lucene index for the study knowledge elements.
587 * @return true if reindexing succeeded
589 private boolean updateKnowledgeElementsIndex(Study aStudy) {
590 boolean isOk = false;
592 IndexService lucin = getIndex();
594 for (Iterator<Scenario> i = aStudy.getScenariiList().iterator(); i
596 Scenario scene = i.next();
597 for (Iterator<KnowledgeElement> j = scene
598 .getAllKnowledgeElements().iterator(); j.hasNext();) {
599 KnowledgeElement kelm = j.next();
604 } catch (Exception error) {
605 logger.error("Unable to re-index Knowledge Elements, reason:",
612 * Get lucene index service. Create a lucene index if it does not exist.
614 * @return index service
615 * @throws IOException
616 * if error occurs during lucene index creation
618 private IndexService getIndex() throws IOException {
619 IndexService lucin = getIndexService();
621 lucin.create(); // Happens when re-indexing all studies
626 * Create a new validation cycle for documents of the given study.
631 * the cycle description
632 * @return the new validation cycle
634 protected ValidationCycle createValidationCycle(Study from,
635 ProjectSettingsServiceImpl.ProjectSettingsValidationCycle cycle) {
636 // -----------------------------------------------------------------------------
637 Actor[] actype = cycle.getActorTypes();
638 User.Properties uprop = new User.Properties();
640 ValidationCycle aValidationCycle = new ValidationCycle();
641 aValidationCycle.setDocumentType(getDocumentTypeService().selectType(
642 cycle.getName())); // Null in case of default validation cycle
643 // context = new ValidationCycleRelation(from, this);
644 // RKV aValidationCycle.context = null; // Validation cycle defined in the workflow
645 for (int i = 0; i < actype.length; i++) {
647 if (actype[i] != null)
649 if (actype[i] == Actor.manager) {
650 actor = from.getAuthor();
651 } else if (actype[i] == Actor.Nx1) {
652 List<User> manager = getUserService()
653 .selectUsersWhere(uprop
654 .setOrganizationName("Nx1"));
655 if (manager.size() == 1)
656 actor = manager.get(0);
657 } else if (actype[i] == Actor.Nx2) {
658 List<User> manager = getUserService()
659 .selectUsersWhere(uprop
660 .setOrganizationName("Nx2"));
661 if (manager.size() == 1)
662 actor = manager.get(0);
663 } else { /* Actor.customer */
664 actor = from.getAuthor();
665 // TODO: Get the customer of the study, if exists
667 } catch (Exception e) { // Should not happen
671 aValidationCycle.setReviewer(actor);
673 aValidationCycle.setApprover(actor);
675 aValidationCycle.setSignatory(actor);
677 return aValidationCycle;
681 * Remove a validation step from the validation cycle.
683 * @param aValidationCycle
684 * the validation cycle
686 * the validation step to remove
689 protected void remove(ValidationCycle aValidationCycle, ValidationStep step) {
690 // ------------------------------------------
691 if (step == ValidationStep.REVIEW)
692 aValidationCycle.setReviewer(null);
693 else if (step == ValidationStep.APPROVAL)
694 aValidationCycle.setApprover(null);
695 else if (step == ValidationStep.ACCEPTANCE
696 || step == ValidationStep.REFUSAL)
697 aValidationCycle.setSignatory(null);
698 if (aValidationCycle.isSaved()) {
699 getValidationCycleDAO().update(aValidationCycle);
704 * Reset actors for the validation cycle.
706 * @param aValidationCycle
707 * the validation cycle to update
709 * new validation cycle properties containing new actors
712 public void resetActors(ValidationCycle aValidationCycle,
713 ValidationCycle.Properties vprop) {
714 aValidationCycle.setPublisher(vprop.getPublisher()); // May be null
715 aValidationCycle.setReviewer(vprop.getReviewer()); // May be null
716 aValidationCycle.setApprover(vprop.getApprover()); // May be null
717 aValidationCycle.setSignatory(vprop.getSignatory()); // May be null
718 if (aValidationCycle.isSaved()) {
719 getValidationCycleDAO().update(aValidationCycle);
724 * Set actor for the given validation cycle and validation step.
726 * @param aValidationCycle
727 * the validation cycle
729 * the validation step
734 protected void setActor(ValidationCycle aValidationCycle,
735 ValidationStep step, User actor) {
736 if (step == ValidationStep.PROMOTION) {
737 aValidationCycle.setPublisher(actor);
738 } else if (step == ValidationStep.REVIEW) {
739 aValidationCycle.setReviewer(actor);
740 } else if (step == ValidationStep.APPROVAL) {
741 aValidationCycle.setApprover(actor);
742 } else if (step == ValidationStep.ACCEPTANCE
743 || step == ValidationStep.REFUSAL) {
744 aValidationCycle.setSignatory(actor);
746 if (aValidationCycle.isSaved()) {
747 getValidationCycleDAO().update(aValidationCycle);
752 * Returns all actors of this study other than the author, including contributors, reviewers and approvers.
756 * @return the actors of this study
757 * @see #hasActor(User)
759 public Set<User> getActors(Study aStudy) {
760 if (aStudy.getActor() == null)
761 setShortCuts(aStudy);
762 return Collections.unmodifiableSet(aStudy.getActor());
766 * Returns all actors of this study other than the author, including contributors, reviewers and approvers.
770 * @return the modifiable set of actors of this study
771 * @see #hasActor(User)
773 public Set<User> getModifiableActors(Study aStudy) {
774 if (aStudy.getActor() == null)
775 setShortCuts(aStudy);
776 return aStudy.getActor();
780 * Returns unmodifiable initialized transient list of contributors of this study.
784 * @return the unmodifiable not null transient list of contributors of this study
786 public List<User> getContributors(Study aStudy) {
787 if (aStudy.getContributor() == null)
788 setShortCuts(aStudy);
789 return Collections.unmodifiableList(aStudy.getContributor()); // May be empty
793 * Returns modifiable initialized transient list of contributors of this study.
797 * @return the modifiable not null transient list of contributors of this study
799 public List<User> getModifiableContributors(Study aStudy) {
800 if (aStudy.getContributor() == null)
801 setShortCuts(aStudy);
802 return aStudy.getContributor(); // May be empty
806 * Returns the validation cycle of the given document type.
811 * the document type being subject of validation
812 * @return the validation cycle of the document, or null if not defined.
814 public ValidationCycle getValidationCycleOf(Study aStudy, DocumentType type) {
815 if (aStudy.getValidationCycles() == null)
816 setShortCuts(aStudy);
817 ValidationCycle result = aStudy.getValidationCycles().get(
819 if (result == null) {
820 if (type.isStepResult())
821 result = aStudy.getValidationCycles().get("default"); // "default" validation cycle defined in the configuration, if exist
823 result = aStudy.getValidationCycles().get("built-in");
829 * Checks if the given user is actor of this study. Actors include contributors, reviewers and approvers.
834 * the user to look for
835 * @return true if the given user is actor of this study.
838 public boolean hasActor(Study aStudy, User user) {
841 for (Iterator<User> i = getActors(aStudy).iterator(); i.hasNext();) {
842 User involved = i.next();
843 if (involved.equals(user))
850 * Checks if the given user participates to this study. The Study staff includes the author and contributors.
855 * the user to look for
856 * @return true if the given user is actor of this study.
857 * @see #getContributors()
859 public boolean isStaffedBy(Study aStudy, User user) {
863 if (aStudy == null) {
866 if (aStudy.getAuthor() == null) return false;
867 if (aStudy.getAuthor().equals(user))
869 for (Iterator<User> i = getContributors(aStudy).iterator(); i.hasNext();) {
870 if (i.next().equals(user))
877 * Initialize shortcuts of the study as its transient collections.
882 public void loadWorkflow(Study aStudy) {
883 setShortCuts(aStudy);
887 * Initialize shortcuts of the study as its transient collections.
892 public void setShortCuts(Study aStudy) {
893 aStudy.getContributor().clear();
894 aStudy.getValidationCycles().clear();
895 aStudy.getActor().clear();
897 // Get the contributors
898 for (Iterator<Relation> i = aStudy.getRelations(
899 ContributorRelation.class).iterator(); i.hasNext();) {
900 ContributorRelation link = (ContributorRelation) i.next();
901 aStudy.getContributor().add(link.getTo());
903 // Get the validation cycles specific to this study
904 for (Iterator<Relation> i = aStudy.getRelations(
905 ValidationCycleRelation.class).iterator(); i.hasNext();) {
906 ValidationCycleRelation link = (ValidationCycleRelation) i.next();
907 aStudy.getValidationCycles().put(link.getDocumentType().getName(),
908 link.getTo()); // The associated document type is necessarily not null in this
911 // Get the validation cycles coming from the configured workflow and not overridden in this study
912 for (Iterator<ProjectSettingsServiceImpl.ProjectSettingsValidationCycle> i = ProjectSettingsServiceImpl
913 .getAllValidationCycles().iterator(); i.hasNext();) {
914 ProjectSettingsServiceImpl.ProjectSettingsValidationCycle cycle = i
916 String type = cycle.getName();
917 if (!aStudy.getValidationCycles().containsKey(type))
918 aStudy.getValidationCycles().put(type,
919 createValidationCycle(aStudy, cycle));
921 // Get all corresponding actors
922 for (Iterator<ValidationCycle> i = aStudy.getValidationCycles()
923 .values().iterator(); i.hasNext();) {
924 ValidationCycle cycle = i.next();
925 User[] user = cycle.getAllActors();
926 for (int j = 0; j < user.length; j++)
927 aStudy.getActor().add(user[j]);
929 // Get all other actors
930 for (Iterator<Relation> i = aStudy.getAllRelations().iterator(); i
932 Relation link = i.next();
933 Class<?> kindof = link.getClass().getSuperclass();
934 if (!kindof.equals(ActorRelation.class))
936 aStudy.getActor().add(((ActorRelation) link).getTo());
941 * Get project settings.
943 * @return Project settings service
945 private ProjectSettingsService getProjectSettings() {
946 return _projectSettingsService;
950 * Set project settings service.
952 * @param projectSettingsService
953 * project settings service
955 public void setProjectSettings(ProjectSettingsService projectSettingsService) {
956 _projectSettingsService = projectSettingsService;
960 * Get the projectElementService.
962 * @return the projectElementService
964 public ProjectElementService getProjectElementService() {
965 return _projectElementService;
969 * Set the projectElementService.
971 * @param projectElementService
972 * the projectElementService to set
974 public void setProjectElementService(
975 ProjectElementService projectElementService) {
976 _projectElementService = projectElementService;
980 * Get the stepService.
982 * @return the stepService
984 public StepService getStepService() {
989 * Set the stepService.
992 * the stepService to set
994 public void setStepService(StepService stepService) {
995 _stepService = stepService;
999 * Get the indexService.
1001 * @return the indexService
1003 public IndexService getIndexService() {
1004 return _indexService;
1008 * Set the indexService.
1010 * @param indexService
1011 * the indexService to set
1013 public void setIndexService(IndexService indexService) {
1014 _indexService = indexService;
1020 * @return the studyDAO
1022 public StudyDAO getStudyDAO() {
1030 * the studyDAO to set
1032 public void setStudyDAO(StudyDAO studyDAO) {
1033 _studyDAO = studyDAO;
1037 * Get the iDBuilderDAO.
1039 * @return the iDBuilderDAO
1041 public IDBuilderDAO getIDBuilderDAO() {
1042 return _iDBuilderDAO;
1046 * Set the iDBuilderDAO.
1049 * the iDBuilderDAO to set
1051 public void setIDBuilderDAO(IDBuilderDAO builderDAO) {
1052 _iDBuilderDAO = builderDAO;
1056 * Get the scenarioDAO.
1058 * @return the scenarioDAO
1060 public ScenarioDAO getScenarioDAO() {
1061 return _scenarioDAO;
1065 * Set the scenarioDAO.
1067 * @param scenarioDAO
1068 * the scenarioDAO to set
1070 public void setScenarioDAO(ScenarioDAO scenarioDAO) {
1071 _scenarioDAO = scenarioDAO;
1075 * Get the validationCycleDAO.
1077 * @return the validationCycleDAO
1079 public ValidationCycleDAO getValidationCycleDAO() {
1080 return _validationCycleDAO;
1084 * Set the validationCycleDAO.
1086 * @param validationCycleDAO
1087 * the validationCycleDAO to set
1089 public void setValidationCycleDAO(ValidationCycleDAO validationCycleDAO) {
1090 _validationCycleDAO = validationCycleDAO;
1094 * Get the documentTypeService.
1096 * @return the documentTypeService
1098 public DocumentTypeService getDocumentTypeService() {
1099 return _documentTypeService;
1103 * Set the documentTypeService.
1105 * @param documentTypeService
1106 * the documentTypeService to set
1108 public void setDocumentTypeService(DocumentTypeService documentTypeService) {
1109 _documentTypeService = documentTypeService;
1113 * Get the userService.
1114 * @return the userService
1116 public UserService getUserService() {
1117 return _userService;
1121 * Set the userService.
1122 * @param userService the userService to set
1124 public void setUserService(UserService userService) {
1125 _userService = userService;