Salome HOME
Beans initialization is fixed. Document can be added to study now.
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / dal / bo / som / Document.java
1 package org.splat.dal.bo.som;
2
3 /**
4  * 
5  * @author    Daniel Brunier-Coulin
6  * @copyright OPEN CASCADE 2012
7  */
8
9 import java.text.DecimalFormat;
10 import java.text.SimpleDateFormat;
11 import java.util.Arrays;
12 import java.util.Calendar;
13 import java.util.Date;
14 import java.util.Iterator;
15 import java.util.List;
16 import java.util.Vector;
17
18 import org.hibernate.Hibernate;
19 import org.hibernate.Session;
20
21 import org.splat.dal.bo.kernel.Persistent;
22 import org.splat.dal.bo.kernel.Relation;
23 import org.splat.dal.bo.kernel.User;
24 import org.splat.dal.bo.som.Timestamp.ComparatorByDate;
25 import org.splat.dal.dao.som.Database;
26 import org.splat.kernel.NotApplicableException;
27 import org.splat.kernel.InvalidPropertyException;
28 import org.splat.kernel.MissedPropertyException;
29 import org.splat.kernel.MultiplyDefinedException;
30 import org.splat.manox.Reader;
31 import org.splat.manox.Toolbox;
32 import org.splat.service.StudyService;
33 import org.splat.service.technical.ProjectSettingsService;
34 import org.splat.service.technical.ProjectSettingsServiceImpl;
35 import org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming;
36 import org.splat.som.Revision;
37 import org.splat.som.Step;
38
39 public class Document extends Entity {
40
41         // Persistent fields
42         private DocumentType type; // User expendable types
43         private File myfile;
44         private String did;
45         private int step;
46         private ProgressState state;
47         private String name;
48         private String version;
49         private int countag;
50         private int history;
51         private User author;
52         private Date lasdate;
53         private ProjectSettingsService _projectSettingsService;
54         private StudyService _studyService;
55
56         // Transient fields
57         public static String suformat = "00"; // Format of the suffix number of document did and file name
58
59         // ==============================================================================================================================
60         // Construction
61         // ==============================================================================================================================
62
63         // Fields initialization class
64         public static class Properties extends Persistent.Properties {
65                 // ------------------------------------------------------------
66                 private DocumentType type = null;
67                 private String did = null; // Only for searching from a given reference
68                 private ProjectElement owner = null; // Only for constructing a document
69                 private ProjectSettingsService.Step step = null;
70                 private ProgressState state = null;
71                 private String name = null;
72                 protected String format = null;
73                 private String version = null;
74                 private User author = null;
75                 protected Date date = null;
76                 private String summary = null; // Only for versioning a document
77                 private String path = null; // Only for searching from a given path
78
79                 // - Public services
80
81                 public void clear() {
82                         super.clear();
83                         type = null;
84                         did = null;
85                         owner = null;
86                         step = null;
87                         state = null;
88                         name = null;
89                         format = null;
90                         version = null;
91                         author = null;
92                         date = null;
93                         summary = null;
94                         path = null;
95                 }
96
97                 public Properties copy() {
98                         Properties copy = new Properties();
99                         copy.type = this.type;
100                         copy.did = this.did;
101                         copy.owner = this.owner;
102                         copy.step = this.step;
103                         copy.state = this.state;
104                         copy.name = this.name;
105                         copy.format = this.format;
106                         copy.version = this.version;
107                         copy.author = this.author;
108                         copy.date = this.date;
109                         copy.summary = this.summary;
110                         copy.path = this.path;
111                         return copy;
112                 }
113
114                 // - Protected services
115
116                 public User getAuthor() {
117                         return author;
118                 }
119
120                 public String getDescription() {
121                         return summary;
122                 }
123
124                 public String getLocalPath() {
125                         return path;
126                 }
127
128                 public String getReference() {
129                         return did;
130                 }
131
132                 public ProjectSettingsService.Step getStep() {
133                         return step;
134                 }
135
136                 public DocumentType getType() {
137                         return type;
138                 }
139
140                 // - Property setters
141
142                 public Properties setAuthor(User user) {
143                         this.author = user;
144                         return this;
145                 }
146
147                 public Properties setDate(Date date) {
148                         this.date = date;
149                         return this;
150                 }
151
152                 /**
153                  * Get the date.
154                  * @return the date
155                  */
156                 public Date getDate() {
157                         return date;
158                 }
159
160                 public Properties setDescription(String summary)
161                                 throws InvalidPropertyException {
162                         if (summary.length() == 0)
163                                 throw new InvalidPropertyException("description");
164                         this.summary = summary;
165                         return this;
166                 }
167
168                 public Properties setDocument(Document base) {
169                         type = base.type;
170                         step = ProjectSettingsServiceImpl.getStep(base.step);
171                         name = base.name;
172                         format = base.getFormat();
173                         state = ProgressState.inWORK; // For incrementing the version number at save time
174                         version = base.version;
175                         return this;
176                 }
177
178                 public Properties setExternReference(String ref)
179                                 throws InvalidPropertyException {
180                         if (ref.length() == 0)
181                                 throw new InvalidPropertyException("reference");
182                         if (ref.equals(new Revision().toString()))
183                                 throw new InvalidPropertyException("reference"); // Internal version number
184                         this.version = ref;
185                         return this;
186                 }
187
188                 public Properties setFormat(String format)
189                                 throws InvalidPropertyException {
190                         if (format.length() == 0)
191                                 throw new InvalidPropertyException("format");
192                         this.format = format;
193                         return this;
194                 }
195
196                 // Required only for passing search arguments
197                 public Properties setLocalPath(String path)
198                                 throws InvalidPropertyException {
199                         if (path.length() == 0)
200                                 throw new InvalidPropertyException("path");
201                         this.path = path;
202                         return this;
203                 }
204
205                 public Properties setName(String name) throws InvalidPropertyException {
206                         if (name.length() == 0)
207                                 throw new InvalidPropertyException("name");
208                         this.name = name;
209                         return this;
210                 }
211                 
212                 public String getName() {
213                         return this.name;
214                 }
215
216                 public Properties setOwner(ProjectElement owner) {
217                         this.owner = owner;
218                         return this;
219                 }
220
221                 public ProjectElement getOwner() {
222                         return this.owner;
223                 }
224                 // Required only for passing search arguments
225                 public Properties setReference(String did)
226                                 throws InvalidPropertyException {
227                         if (did.length() == 0)
228                                 throw new InvalidPropertyException("reference");
229                         this.did = did;
230                         return this;
231                 }
232
233                 public Properties setState(ProgressState state)
234                                 throws InvalidPropertyException {
235                         if (state == ProgressState.inPROGRESS
236                                         || state == ProgressState.TEMPLATE)
237                                 throw new InvalidPropertyException("state"); // Non document states
238                         this.state = state;
239                         return this;
240                 }
241
242                 public Properties setStep(ProjectSettingsService.Step step) {
243                         this.step = step;
244                         return this;
245                 }
246
247                 public Properties setType(DocumentType type) {
248                         this.type = type;
249                         return this;
250                 }
251
252                 // - Global validity check
253
254                 public void checkValidity() throws MissedPropertyException,
255                                 InvalidPropertyException, MultiplyDefinedException {
256                         if (type == null)
257                                 throw new MissedPropertyException("type");
258                         if (owner == null)
259                                 throw new MissedPropertyException("owner");
260                         if (step == null)
261                                 throw new MissedPropertyException("step");
262                         if (author == null)
263                                 throw new MissedPropertyException("author");
264                         if (format == null)
265                                 throw new MissedPropertyException("format");
266                         if (owner instanceof Study && !step.appliesTo(Study.class))
267                                 throw new InvalidPropertyException("step");
268                         if (!type.isContentInto(step))
269                                 throw new InvalidPropertyException("step");
270                         if (state != null && state != ProgressState.EXTERN) {
271                                 // inDRAFT, inCHECK or APPROVED + version = imposed version (future use)
272                                 // inWORK + version = base version incremented at save time (used for versioning)
273                                 if (version == null)
274                                         throw new InvalidPropertyException("state");
275                         }
276                         if (version != null) {
277                                 if (state == null)
278                                         state = ProgressState.EXTERN;
279                         }
280                 }
281         }
282
283         // Database fetch constructor
284         protected Document() {
285         }
286
287         // Internal constructor
288         public Document(Properties dprop) throws MissedPropertyException,
289                         InvalidPropertyException, MultiplyDefinedException {
290                 // -------------------------------------
291                 super(dprop); // Throws one of the above exception if not valid
292                 myfile = new File(null, dprop.format, dprop.date); // The path is initialized below
293                 type = dprop.type;
294                 step = dprop.step.getNumber();
295                 name = dprop.name;
296                 version = dprop.version;
297                 author = dprop.author;
298                 countag = 0;
299                 history = 0;
300                 lasdate = myfile.getDate(); // Today if not defined in the properties
301
302                 state = dprop.state;
303                 if (state == null) {
304                         state = ProgressState.inWORK; // Promoted when saving this document
305                         version = new Revision().toString();
306                 }
307                 if (name == null) { // Newed document
308                         this.name = "%n"; // Named later at publication
309                         this.history = -1; // Marks the document as undefined for future assignment
310                 }
311         }
312
313         // ==============================================================================================================================
314         // Public member functions
315         // ==============================================================================================================================
316
317         public File getAttachedFile(String format) {
318                 // -------------------------------------------
319                 List<Relation> exports = getRelations(ConvertsRelation.class);
320
321                 for (Iterator<Relation> i = exports.iterator(); i.hasNext();) {
322                         File export = (File) i.next().getTo();
323                         if (export.getFormat().equals(format))
324                                 return export;
325                 }
326                 return null;
327         }
328
329         public User getAuthor() {
330                 // ------------------------
331                 return author;
332         }
333
334         public Date getCreationDate() {
335                 // ------------------------------
336                 return myfile.getDate();
337         }
338
339         public Date getLastModificationDate() {
340                 // --------------------------------------
341                 return lasdate;
342         }
343         
344         public void setLastModificationDate(Date aDate) {
345                 lasdate = aDate;
346         }
347
348         public String getFormat() {
349                 // --------------------------
350                 return myfile.getFormat();
351         }
352
353         public Document getPreviousVersion() {
354                 // -------------------------------------
355                 Relation previous = getFirstRelation(VersionsRelation.class);
356                 if (previous != null)
357                         return (Document) previous.getTo();
358                 else
359                         return null;
360         }
361
362         public ProgressState getProgressState() {
363                 // ----------------------------------------
364                 return state;
365         }
366
367         /**
368          * Returns the path where all physical files attached to this document are saved. This path is relative to the vault of the repository
369          * and include the file name, without extension, common to all physical files attached to this document.
370          * 
371          * @return the path of the document
372          */
373         public String getRelativePath() {
374                 // --------------------------------
375                 String[] table = myfile.getRelativePath().split("\\x2E");
376                 StringBuffer path = new StringBuffer(table[0]);
377                 for (int i = 1; i < table.length - 1; i++)
378                         path.append('.').append(table[i]);
379                 return path.toString();
380         }
381
382         /**
383          * Returns the global unique reference of this document lineage. The document reference is common to all versions of the document
384          * (versioning a document does not change its reference). It is made of the owner study reference suffixed by a document identifier
385          * unique in the scope of the study.
386          * 
387          * @return the document reference
388          */
389         public String getReference() {
390                 // -----------------------------
391                 return did;
392         }
393
394         public java.io.File getSaveDirectory() {
395                 // ---------------------------------------
396                 String mypath = Database.getRepositoryVaultPath()
397                                 + myfile.getRelativePath();
398                 String[] table = mypath.split("/");
399
400                 // Cutting the filename
401                 StringBuffer path = new StringBuffer(table[0]);
402                 for (int i = 1; i < table.length - 1; i++)
403                         path = path.append("/").append(table[i]);
404                 return new java.io.File(path.append("/").toString());
405         }
406
407         public File getSourceFile() {
408                 // ----------------------------
409                 return myfile;
410         }
411
412         /**
413          * Returns the stamps such as review and approval attached to this document, if exist. If several stamps exist, they are returned in
414          * ascending order of dates.
415          * 
416          * @return the stamps of the document in ascending order of dates, or an empty array if no stamp exist.
417          */
418         public Timestamp[] getStamps() {
419                 // -------------------------------
420                 Vector<Timestamp> stamps = new Vector<Timestamp>();
421
422                 for (Iterator<Relation> i = this.getAllRelations().iterator(); i
423                                 .hasNext();) {
424                         Relation link = i.next();
425                         if (link instanceof StampRelation)
426                                 stamps.add(((StampRelation) link).getTo());
427                 }
428                 Timestamp[] result = stamps.toArray(new Timestamp[stamps.size()]);
429                 ComparatorByDate bydate = new Timestamp.ComparatorByDate();
430
431                 Arrays.sort(result, bydate);
432                 return result;
433         }
434
435         /**
436          * Returns the title of this document.
437          * 
438          * @return the document title, or an empty string is this document is undefined.
439          * @see #isUndefined()
440          */
441         public String getTitle() {
442                 // -------------------------
443                 if (this.isUndefined())
444                         return "";
445                 else
446                         return name;
447         }
448         
449         /**
450          * Set document title.
451          * @param aTitle document title to set
452          */
453         public void setTitle(String aTitle) {
454                 this.name = aTitle;
455         }
456
457         public DocumentType getType() {
458                 // ------------------------------
459                 return type;
460         }
461
462         /**
463          * Returns the version number of this document. The version number, when exists, is either of the internal form (m.n.s) usable for
464          * building a Revision object, or any string in case of external document (document with EXTERN state).<br/> <br/> Note: document slots
465          * have a version number equal to "0.0.0".
466          * 
467          * @return the version number of this document, or null if this is EXTERN.
468          * @see #isUndefined()
469          */
470         public String getVersion() {
471                 // ---------------------------
472                 return version;
473         }
474
475         /**
476          * Returns true if this document is undefined. An undefined document is a meta-document created for reserving the persistent reference
477          * of a new document before saving (or importing) this later into the repository. The working copy of a such document may include this
478          * reference.
479          * 
480          * @see #getTitle()
481          * @see #getVersion()
482          * @see #initialize(Properties)
483          */
484         public boolean isUndefined() {
485                 // -----------------------------
486                 return (history == -1);
487         }
488
489         public boolean isInto(Step container) {
490                 // --------------------------------------
491                 return (step == container.getNumber());
492         }
493
494         public boolean isPublished() {
495                 // -----------------------------
496                 return (countag > 0);
497         }
498
499         public boolean isShared() {
500                 // --------------------------
501                 return (countag + history > 1);
502         }
503
504         public boolean isVersioned() {
505                 // -----------------------------
506                 return (history > 0);
507         }
508
509         // ==============================================================================================================================
510         // Public services
511         // ==============================================================================================================================
512
513         public static DocumentType createType(DocumentType.Properties tprop)
514                         throws MissedPropertyException, InvalidPropertyException,
515                         MultiplyDefinedException, RuntimeException {
516                 // ---------------------------------------------------------------------
517                 // TODO: Check for duplicate definition
518                 DocumentType type = new DocumentType(tprop);
519                 Session session = Database.getSession();
520                 session.save(type);
521
522                 return type;
523         }
524
525         public static Properties extractProperties(java.io.File file) {
526                 // --------------------------------------------------------------
527                 Properties fprop = new Properties();
528                 Reader tool = Toolbox.getReader(file);
529                 String value;
530                 if (tool != null)
531                         try {
532                                 value = tool.extractProperty("title");
533                                 if (value != null)
534                                         fprop.setName(value);
535
536                                 value = tool.extractProperty("reference");
537                                 if (value != null)
538                                         fprop.setReference(value);
539                         } catch (Exception e) {
540                         }
541                 return fprop;
542         }
543
544         @SuppressWarnings("unchecked")
545         public static List<DocumentType> selectAllTypes() {
546                 // --------------------------------------------------
547                 String query = "from DocumentType";
548
549                 List<DocumentType> types = Database.getSession().createQuery(query)
550                                 .list();
551                 for (Iterator<DocumentType> i = types.iterator(); i.hasNext();) {
552                         Hibernate.initialize(i.next()); // Supposed fetching document types
553                 }
554                 return types;
555         }
556
557         @SuppressWarnings("unchecked")
558         public static List<DocumentType> selectResultTypes() {
559                 // -----------------------------------------------------
560                 String query = "from DocumentType where result is not null order by result asc";
561
562                 return Database.getSession().createQuery(query).list();
563         }
564
565         public static DocumentType selectType(String name) {
566                 // ---------------------------------------------------
567                 String query = new StringBuffer("from DocumentType where name='")
568                                 .append(name).append("'").toString();
569
570                 return (DocumentType) Database.getSession().createQuery(query)
571                                 .uniqueResult();
572         }
573
574         public static DocumentType selectType(int index) {
575                 // -------------------------------------------------
576                 String query = new StringBuffer("from DocumentType where rid='")
577                                 .append(index).append("'").toString();
578
579                 return (DocumentType) Database.getSession().createQuery(query)
580                                 .uniqueResult();
581         }
582
583         @SuppressWarnings("unchecked")
584         public static List<DocumentType> selectTypesOf(
585                         ProjectSettingsService.Step step) {
586                 // --------------------------------------------------------------------------
587                 Integer number = step.getNumber();
588                 String query = new StringBuffer("from DocumentType").append(
589                                 " where step like '%-").append(number).append("-%'").toString();
590
591                 List<DocumentType> types = Database.getSession().createQuery(query)
592                                 .list();
593                 for (Iterator<DocumentType> i = types.iterator(); i.hasNext();) {
594                         Hibernate.initialize(i.next()); // For fetching document types
595                 }
596                 return types;
597         }
598
599         // ==============================================================================================================================
600         // Protected services
601         // ==============================================================================================================================
602
603         protected ConvertsRelation attach(String format) {
604                 // -------------------------------------------------
605                 return attach(format, null);
606         }
607
608         protected ConvertsRelation attach(String format, String description) {
609                 // ---------------------------------------------------------------------
610                 String path = this.getRelativePath();
611                 File export = new File(path + "." + format);
612                 ConvertsRelation attach = new ConvertsRelation(this, export,
613                                 description);
614                 Session session = Database.getSession();
615
616                 session.save(export);
617                 session.save(attach);
618
619                 this.addRelation(attach); // Updates this
620
621                 return attach;
622         }
623
624         public boolean buildReferenceFrom(ProjectElement scope, Document lineage) {
625                 // -----------------------------------------------------------------------------
626                 if (state != ProgressState.inWORK)
627                         return false;
628                 Study owner = null;
629                 Scenario context = null;
630                 if (scope instanceof Study)
631                         owner = (Study) scope;
632                 else {
633                         context = ((Scenario) scope);
634                         owner = context.getOwnerStudy();
635                 }
636                 did = lineage.did;
637                 if (context != null && (lineage.isVersioned() || owner.shares(lineage))) {
638                         version = new Revision(version).setBranch(context.getReference())
639                                         .toString();
640                 }
641                 return true;
642         }
643
644         public boolean buildReferenceFrom(Study scope) {
645                 // --------------------------------------------------
646                 if (state != ProgressState.inWORK && state != ProgressState.EXTERN)
647                         return false;
648                 DecimalFormat tostring = new DecimalFormat(suformat);
649
650                 did = did.replace("%" + suformat, tostring.format(scope
651                                 .getLastLocalIndex()));
652                 return true;
653         }
654
655         public boolean demote() {
656                 // ---------------------------
657                 ValidationStep torem;
658
659                 if (state == ProgressState.inCHECK) {
660                         state = ProgressState.inDRAFT;
661                         torem = ValidationStep.REVIEW;
662                         // This operation must not change the version number of documents.
663                         // Consequently, inDRAFT documents may have a minor version number equal to zero.
664                 } else if (state == ProgressState.inDRAFT) {
665                         state = ProgressState.inWORK;
666                         torem = ValidationStep.PROMOTION;
667                 } else {
668                         return false;
669                 }
670                 for (Iterator<Relation> i = this.getAllRelations().iterator(); i
671                                 .hasNext();) {
672                         Relation link = i.next();
673                         if (!(link instanceof StampRelation))
674                                 continue;
675                         if (((StampRelation) link).getStampType() != torem)
676                                 continue;
677                         i.remove();
678                         break;
679                 }
680                 Database.getSession().update(this);
681                 return true;
682         }
683
684         /**
685          * Increments the reference count of this document following its publication into a Study step.
686          * 
687          * @see #release()
688          */
689         public void hold() {
690                 // ----------------------
691                 countag += 1;
692                 if (this.isSaved())
693                         Database.getSession().update(this);
694         }
695
696         public boolean promote(Timestamp stamp) {
697                 // -------------------------------------------
698                 ProgressState newstate = null;
699
700                 if (state == ProgressState.inWORK) {
701                         newstate = ProgressState.inDRAFT; // Promotion to being reviewed
702                 } else if (state == ProgressState.inDRAFT) {
703                         newstate = ProgressState.inCHECK; // Promotion to approval
704                         Revision myvers = new Revision(version);
705                         if (myvers.isMinor()) {
706                                 version = myvers.incrementAs(newstate).toString();
707                                 // TODO: If my physical file is programatically editable, update its (property) version number
708                                 // ISSUE: What about attached files such as PDF if exist, should we remove them ?
709                         }
710                 } else if (state == ProgressState.inCHECK) {
711                         newstate = ProgressState.APPROVED;
712                 }
713                 this.state = newstate;
714                 if (stamp != null)
715                         this.addRelation(stamp.getContext());
716                 Database.getSession().update(this);
717                 return true;
718         }
719
720         /**
721          * Decrements the reference count of this document following the removal of a Publication from a Study step.
722          * 
723          * @see #hold()
724          */
725         public void release() {
726                 // -------------------------
727                 countag -= 1;
728                 if (this.isSaved())
729                         Database.getSession().update(this);
730         }
731
732         protected void rename(String title) throws InvalidPropertyException {
733                 // ------------------------------------
734                 if (title.length() == 0)
735                         throw new InvalidPropertyException("name");
736
737                 Calendar current = Calendar.getInstance();
738                 this.name = title;
739                 this.lasdate = current.getTime(); // Today
740                 Database.getSession().update(this);
741         }
742
743         public void updateAs(Revision newvers) {
744                 // ------------------------------------------
745                 version = newvers.setBranch(version).toString(); // Branch names are propagated by the versionning
746                 ProgressState newstate = ProgressState.inCHECK;
747                 if (newvers.isMinor())
748                         newstate = ProgressState.inWORK;
749                 state = null; // Just to tell updateAs(sate) to not increment the version number
750                 updateAs(newstate);
751         }
752
753         public void updateAs(ProgressState state) {
754                 // ---------------------------------------------
755                 Document previous = null;
756
757                 // Set of version number
758                 if (state == ProgressState.EXTERN) {
759                         if (this.state != ProgressState.EXTERN)
760                                 this.version = null; // Strange use-case...
761                 } else {
762                         Revision myvers = new Revision(version);
763                         if (!myvers.isNull()) { // Versionning context
764                                 for (Iterator<Relation> i = getAllRelations().iterator(); i
765                                                 .hasNext();) {
766                                         Relation link = i.next();
767                                         if (!link.getClass().equals(VersionsRelation.class))
768                                                 continue;
769                                         previous = (Document) link.getTo(); // Versioned document
770                                         break;
771                                 }
772                         }
773                         if (this.state != null)
774                                 myvers.incrementAs(state); // Incrementation if the reversion number is not imposed
775                         this.version = myvers.toString();
776                 }
777                 // Update this document and the previous version, if exit
778                 Session session = Database.getSession();
779                 if (previous != null) {
780                         previous.history += 1;
781                         session.update(previous);
782                 }
783                 this.state = state;
784                 session.update(this);
785         }
786
787         // protected void upgrade () {
788         // -------------------------
789         // if (this.state != ProgressState.inWORK) return;
790         //
791         // Calendar current = Calendar.getInstance();
792         // for (Iterator<Relation> i=getAllRelations().iterator(); i.hasNext();) {
793         // Relation link = i.next();
794         // if (!link.getClass().equals(UsesRelation.class)) continue;
795         //
796         // Document used = (Document)link.getTo();
797         // if (!used.isVersioned()) continue;
798         // TODO: Update the uses relation
799         // }
800         // this.promote();
801         // this.lasdate = current.getTime(); // Today
802         // Database.getSession().update(this);
803         //
804         // TODO: Promote documents using this one
805         // }
806
807         /**
808          * @return
809          */
810         private ProjectSettingsService getProjectSettingsService() {
811                 return _projectSettingsService;
812         }
813
814         public void setProjectSettingsService(
815                         ProjectSettingsService projectSettingsService) {
816                 _projectSettingsService = projectSettingsService;
817         }
818
819         /**
820          * @return
821          */
822         public StudyService getStudyService() {
823                 return _studyService;
824         }
825
826         public void setStudyService(StudyService studyService) {
827                 _studyService = studyService;
828         }
829
830         /**
831          * Get the step.
832          * @return the step
833          */
834         public int getStep() {
835                 return step;
836         }
837
838         /**
839          * Set the step.
840          * @param step the step to set
841          */
842         public void setStep(int step) {
843                 this.step = step;
844         }
845
846         /**
847          * Get the did.
848          * @return the did
849          */
850         public String getDid() {
851                 return did;
852         }
853
854         /**
855          * Set the did.
856          * @param did the did to set
857          */
858         public void setDid(String did) {
859                 this.did = did;
860         }
861
862         /**
863          * Get the myfile.
864          * @return the myfile
865          */
866         public File getFile() {
867                 return myfile;
868         }
869
870         /**
871          * Set the myfile.
872          * @param myfile the myfile to set
873          */
874         public void setFile(File myfile) {
875                 this.myfile = myfile;
876         }
877
878         /**
879          * Get the history.
880          * @return the history
881          */
882         public int getHistory() {
883                 return history;
884         }
885
886         /**
887          * Set the history.
888          * @param history the history to set
889          */
890         public void setHistory(int history) {
891                 this.history = history;
892         }
893 }