KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > version > JahiaSaveVersion


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12
//
13
// JahiaSaveVersion
14
// DJ 03/05/02
15
//
16

17 package org.jahia.services.version;
18
19 import org.jahia.registries.ServicesRegistry;
20
21 /**
22  * Class describing which version of a field/container/containerlist to save
23  */

24 public class JahiaSaveVersion {
25
26     private boolean staging;
27     private boolean versioning;
28     private int versionID;
29
30     private ServicesRegistry sr = ServicesRegistry.getInstance();
31
32    /**
33     * constructor to be used when we know the versionStatus and the versionID to save
34     */

35     public JahiaSaveVersion (boolean staging, boolean versioning, int versionID)
36     {
37         this.staging = staging;
38         this.versioning = versioning;
39         this.versionID = versionID;
40     }
41    /**
42     * constructor to be used when you want to get the current versionID automatically
43     */

44
45     public JahiaSaveVersion (boolean staging, boolean versioning)
46     {
47         this.staging = staging;
48         this.versioning = versioning;
49         this.versionID = sr.getJahiaVersionService().getCurrentVersionID();
50     }
51
52     public int getVersionID() { return versionID; }
53
54     public int getWorkflowState() { return staging?2:1; }
55
56     public boolean isCurrent()
57     {
58         return (!staging);
59     }
60
61     public boolean isStaging()
62     {
63         return (staging);
64     }
65
66     public boolean isVersioned()
67     {
68         return (versioning);
69     }
70
71     public String JavaDoc toString()
72     {
73         return new String JavaDoc ("[SAVE:staging="+staging+", versioning="+versioning+", versionID="+versionID+"]");
74     }
75
76
77 } // end JahiaSaveVersion
78
Popular Tags