View Javadoc

1   /**
2    * Copyright (C) 2005-2009 Alfresco Software Limited.
3    *
4    * This file is part of the Spring Surf Extension project.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.springframework.extensions.surf;
20  
21  import java.io.Serializable;
22  import java.util.Map;
23  
24  import org.dom4j.Document;
25  
26  /**
27   * @author muzquiano
28   */
29  public interface ModelObject extends Serializable
30  {
31      // properties
32      public static String PROP_ID = "id";
33      public static String PROP_TITLE = "title";
34      public static String PROP_TITLE_ID = "title-id";
35      public static String PROP_DESCRIPTION = "description";
36      public static String PROP_DESCRIPTION_ID = "description-id";
37      
38      /**
39       * Returns the model object key instance
40       * 
41       * @return
42       */
43      public ModelPersisterInfo getKey();
44      
45      /**
46       * Returns the id of the model object.
47       * 
48       * @return The id
49       */
50      public String getId();
51      
52      /**
53       * Returns the type id of the model object.
54       * 
55       * @return The type id
56       */
57      public String getTypeId();
58      
59      /**
60       * Returns the title property of the model object.
61       * 
62       * @return The title
63       */
64      public String getTitle();
65      
66      /**
67       * Sets the title property of the model object
68       * 
69       * @param The new title
70       */
71      public void setTitle(String value);
72      
73      /**
74       * Returns the title id property of the model object.
75       * 
76       * @return The title id
77       */
78      public String getTitleId();
79      
80      /**
81       * Sets the title id property of the model object
82       * 
83       * @param The new title id
84       */
85      public void setTitleId(String value);
86      
87      /**
88       * Returns the description property of the model object
89       * 
90       * @return The description
91       */
92      public String getDescription();
93      
94      /**
95       * Sets the description property of the model object
96       * 
97       * @param The description
98       */
99      public void setDescription(String value);
100     
101     /**
102      * Returns the description id property of the model object
103      * 
104      * @return The description id
105      */
106     public String getDescriptionId();
107     
108     /**
109      * Sets the description id property of the model object
110      * 
111      * @param The description id
112      */
113     public void setDescriptionId(String value);
114         
115     /**
116      * Indicates whether the object is currently persisted (saved)
117      * or not.  A new object will have this flag set to false prior
118      * to a save and true once the save operation has completed.
119      * 
120      * @return Whether the object is currently saved
121      */
122     public boolean isSaved();
123 
124     /**
125      * Serializes the object to XML.  By default, this uses a 
126      * pretty XML renderer so that the resulting XML is
127      * human readable.
128      * 
129      * @return The XML string
130      */
131     public String toXML();
132 
133     // general property accessors
134     public boolean getBooleanProperty(String propertyName);
135     public String getProperty(String propertyName);
136     public void setProperty(String propertyName, String propertyValue);
137     public void removeProperty(String propertyName);
138     public Map<String, Serializable> getProperties();
139 
140     // model properties
141     public String getModelProperty(String propertyName);
142     public void setModelProperty(String propertyName, String propertyValue);
143     public void removeModelProperty(String propertyName);
144     public Map<String, Serializable> getModelProperties();
145     
146     // custom properties
147     public String getCustomProperty(String propertyName);
148     public void setCustomProperty(String propertyName, String propertyValue);
149     public void removeCustomProperty(String propertyName);
150     public Map<String, Serializable> getCustomProperties();
151     
152     // persistence
153     public String getStoragePath();
154     public String getPersisterId();
155     public long getModificationTime();
156     public void touch();
157     
158     // version
159     public String getModelVersion();
160     
161     // allow xml retrieval via document
162     public Document getDocument();    
163 }