001: package org.enhydra.dm.api;
002:
003: import java.util.Properties;
004:
005: import org.enhydra.dm.api.exceptions.BaseException;
006: import org.enhydra.dm.api.loggers.Log;
007:
008: public interface DocumentManager {
009:
010: /**
011: * Method to document checkout. This method accepts document id and user as Strings and
012: * sets LOCK flag to true.
013: *
014: * @param id (Document ID)
015: * @param user (User ID)
016: * @return
017: * @throws BaseException - already checked out
018: */
019: public Document checkOut(String id, String user)
020: throws BaseException;
021:
022: /**
023: * Method to document unCheckout. This method accepts document id and user as Strings
024: * and sets LOCK flag to false.
025: *
026: * @param id
027: * @param user
028: * @throws BaseException - document isn't locked
029: */
030: public void unCheckOut(String id, String user) throws BaseException;
031:
032: /**
033: * Method to document checkin. This method accepts document id, byte array document
034: * content and user as Strings and sets LOCK flag to false.
035: *
036: * @param id
037: * @param documentPath
038: * @param user
039: * @throws BaseException - is document isn't checked out
040: */
041: public void checkIn(String id, String documentPath, String user)
042: throws BaseException;
043:
044: /**
045: * Method to document unlock. This method accepts document id and user as Strings and
046: * sets LOCK flag to false.
047: *
048: * @param id
049: * @param user
050: * @throws BaseException
051: */
052: public void unlock(String id, String user) throws BaseException;
053:
054: /**
055: * Method to document lock. This method accepts document id and user as Strings. and
056: * sets LOCK flag to false.
057: *
058: * @param id
059: * @param user
060: * @throws BaseException
061: */
062: public void lock(String id, String user) throws BaseException;
063:
064: /**
065: * Method to document update. This method will be executed after document save.
066: *
067: * @param id
068: * @param path
069: * @param user
070: * @param foDocumentId
071: * @throws BaseException
072: */
073: public void update(String id, String path, String user,
074: String foDocumentId) throws BaseException;
075:
076: /**
077: * Method to get document from database by document id.
078: *
079: * @param id
080: * @return
081: * @throws BaseException
082: */
083: public Document getDocument(String id) throws BaseException;
084:
085: /**
086: * Method to get documentVersion from database by document version id.
087: *
088: * @param id
089: * @return
090: * @throws BaseException
091: */
092: public DocumentVersion getDocumentVersion(String id)
093: throws BaseException;
094:
095: /**
096: * Method to delete document by document id. This method sets deleted flag to true and
097: * lastModifiedBy to user
098: *
099: * @param id
100: * @param user
101: * @throws BaseException
102: */
103:
104: public void delete(String id, String user) throws BaseException;
105:
106: /**
107: * Method that creates document in database.
108: *
109: * @param documentName
110: * @param documentPath
111: * @param mimeType
112: * @param user
113: * @param foDocumentId
114: * @param isTemplate
115: * @param getTemplateRef
116: * @return id
117: * @throws BaseException
118: */
119: public String create(String documentName, String documentPath,
120: String mimeType, String user, String foDocumentId,
121: boolean isTemplate, String templateId) throws BaseException;
122:
123: /**
124: * Getting document versions by document id.
125: *
126: * @param id
127: * @return
128: * @throws BaseException
129: */
130: public DocumentVersion[] getDocumentVersions(String id)
131: throws BaseException;
132:
133: /**
134: * Getting all available documents or templates.
135: *
136: * @param isTemplate
137: * @return
138: * @throws BaseException
139: */
140: public Document[] getDocuments(boolean isTemplate)
141: throws BaseException;
142:
143: /**
144: * Getting all deleted documents or templates.
145: *
146: * @param isTemplate
147: * @return
148: * @throws BaseException
149: */
150: public Document[] getDeleted(boolean isTemplate)
151: throws BaseException;
152:
153: /**
154: * Restore document version - set as current version.
155: *
156: * @param documentVersion
157: * @param user
158: * @throws BaseException
159: */
160: public void restoreDocumentVersion(String versionId, String user)
161: throws BaseException;
162:
163: /**
164: * Restore document version - set as current version.
165: *
166: * @param documentVersion
167: * @param user
168: * @throws BaseException
169: */
170: public void restore(String id, String user) throws BaseException;
171:
172: /**
173: * Autoversionable On/Off
174: *
175: * @param documentId
176: * @param user
177: * @throws BaseException
178: */
179: public void switchAutoVersionable(String documentId, String user)
180: throws BaseException;
181:
182: /**
183: * Archived On/Off
184: *
185: * @param documentId
186: * @param user
187: * @throws BaseException
188: */
189: public void switchArchived(String documentId, String user)
190: throws BaseException;
191:
192: /**
193: * Creates version for documents that are not autoversionable
194: *
195: * @param documentDO
196: * @param userName
197: * @return
198: * @throws BaseException
199: */
200: public void createVersion(String documentId, String user)
201: throws BaseException;
202:
203: /**
204: * Getter for logger
205: *
206: * @return
207: */
208: public Log getLogger();
209:
210: /**
211: * Setter for logger
212: *
213: * @param logger
214: */
215: public void setLogger(Log logger);
216:
217: /**
218: * Configure method that read parameters from Properties
219: *
220: * @param properties
221: * @throws BaseException
222: */
223: public void configure(Properties properties) throws BaseException;
224:
225: }
|