Source Code Cross Referenced for StructuredArtifactDefinitionBean.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » metaobj » shared » model » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » sakai » org.sakaiproject.metaobj.shared.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-api/api/src/java/org/sakaiproject/metaobj/shared/model/StructuredArtifactDefinitionBean.java $
003:         * $Id: StructuredArtifactDefinitionBean.java 14069 2006-08-28 15:26:10Z chmaurer@iupui.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
007:         * 
008:         * Licensed under the Educational Community License, Version 1.0 (the "License"); 
009:         * you may not use this file except in compliance with the License. 
010:         * You may obtain a copy of the License at
011:         * 
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software 
015:         * distributed under the License is distributed on an "AS IS" BASIS, 
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
017:         * See the License for the specific language governing permissions and 
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.metaobj.shared.model;
021:
022:        import org.sakaiproject.exception.IdUnusedException;
023:        import org.sakaiproject.site.api.Site;
024:        import org.sakaiproject.site.cover.SiteService;
025:
026:        import java.text.MessageFormat;
027:        import java.util.Date;
028:
029:        /**
030:         * @author chmaurer
031:         */
032:        public class StructuredArtifactDefinitionBean extends
033:                IdentifiableObject implements  Comparable {
034:
035:            public static final int STATE_UNPUBLISHED = 0;
036:            public static final int STATE_WAITING_APPROVAL = 1;
037:            public static final int STATE_PUBLISHED = 2;
038:
039:            private Id id;
040:            private String documentRoot;
041:            private Agent owner;
042:            private Date created = new Date();
043:            private Date modified = new Date();
044:            private String schemaHash;
045:
046:            /**
047:             * system only SAD's are not available to users to populate via a web form, they are for internal system use only
048:             */
049:            private boolean systemOnly = false;
050:            private String description;
051:            private boolean modifiable = true;
052:            private Id xslConversionFileId;
053:            private String schemaFileName;
054:            private String xslFileName;
055:            private byte[] schema;
056:            private String siteId;
057:            private String externalType;
058:            private String instruction;
059:            private String filePickerAction;
060:
061:            private transient String decoratedDescription;
062:
063:            /**
064:             * should be one of the following states
065:             * <p/>
066:             * unpublished -> active
067:             */
068:            private int siteState;
069:
070:            /**
071:             * should be one of the following states
072:             * <p/>
073:             * unpublished -> waiting for approval-> active
074:             */
075:            private int globalState;
076:
077:            /**
078:             * used during edit process to store whether or not xsl transform is necessary
079:             */
080:            private boolean requiresXslFile = false;
081:
082:            /**
083:             * file id of schema file - used when add/editing artifact homes
084:             */
085:            private Id schemaFile;
086:
087:            /**
088:             * used in publishing web form to set action (publish to site, global, approve, etc)
089:             */
090:            private String action;
091:
092:            private static final MessageFormat format = new MessageFormat(
093:                    "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL={0}/member/viewArtifact.osp?artifactId={1}&artifactType={2}\">");
094:
095:            /**
096:             * @return Returns the action.
097:             */
098:            public String getAction() {
099:                return action;
100:            }
101:
102:            /**
103:             * @param action The action to set.
104:             */
105:            public void setAction(String action) {
106:                this .action = action;
107:            }
108:
109:            /**
110:             * @return Returns the created.
111:             */
112:            public Date getCreated() {
113:                return created;
114:            }
115:
116:            /**
117:             * @param created The created to set.
118:             */
119:            public void setCreated(Date created) {
120:                this .created = created;
121:            }
122:
123:            /**
124:             * @return Returns the description.
125:             */
126:            public String getDescription() {
127:                return description;
128:            }
129:
130:            /**
131:             * @param description The description to set.
132:             */
133:            public void setDescription(String description) {
134:                this .description = description;
135:            }
136:
137:            /**
138:             * @return Returns the documentRoot.
139:             */
140:            public String getDocumentRoot() {
141:                return documentRoot;
142:            }
143:
144:            /**
145:             * @param documentRoot The documentRoot to set.
146:             */
147:            public void setDocumentRoot(String documentRoot) {
148:                this .documentRoot = documentRoot;
149:            }
150:
151:            /**
152:             * gets the global published state
153:             *
154:             * @return Returns the globalState.
155:             */
156:            public int getGlobalState() {
157:                return globalState;
158:            }
159:
160:            /**
161:             * sets the global published state
162:             *
163:             * @param globalState The globalState to set.
164:             */
165:            public void setGlobalState(int globalState) {
166:                this .globalState = globalState;
167:            }
168:
169:            /**
170:             * @return Returns the modifiable.
171:             */
172:            public boolean isModifiable() {
173:                return modifiable;
174:            }
175:
176:            /**
177:             * @param modifiable The modifiable to set.
178:             */
179:            public void setModifiable(boolean modifiable) {
180:                this .modifiable = modifiable;
181:            }
182:
183:            /**
184:             * @return Returns the modified.
185:             */
186:            public Date getModified() {
187:                return modified;
188:            }
189:
190:            /**
191:             * @param modified The modified to set.
192:             */
193:            public void setModified(Date modified) {
194:                this .modified = modified;
195:            }
196:
197:            /**
198:             * @return Returns the owner.
199:             */
200:            public Agent getOwner() {
201:                return owner;
202:            }
203:
204:            /**
205:             * @param owner The owner to set.
206:             */
207:            public void setOwner(Agent owner) {
208:                this .owner = owner;
209:            }
210:
211:            /**
212:             * @return Returns the requiresXslFile.
213:             */
214:            public boolean getRequiresXslFile() {
215:                return requiresXslFile;
216:            }
217:
218:            /**
219:             * @param requiresXslFile The requiresXslFile to set.
220:             */
221:            public void setRequiresXslFile(boolean requiresXslFile) {
222:                this .requiresXslFile = requiresXslFile;
223:            }
224:
225:            /**
226:             * @return Returns the schemaFile.
227:             */
228:            public Id getSchemaFile() {
229:                return schemaFile;
230:            }
231:
232:            /**
233:             * @param schemaFile The schemaFile to set.
234:             */
235:            public void setSchemaFile(Id schemaFile) {
236:                this .schemaFile = schemaFile;
237:            }
238:
239:            /**
240:             * @return Returns the schemaFileName.
241:             */
242:            public String getSchemaFileName() {
243:                return schemaFileName;
244:            }
245:
246:            /**
247:             * @param schemaFileName The schemaFileName to set.
248:             */
249:            public void setSchemaFileName(String schemaFileName) {
250:                this .schemaFileName = schemaFileName;
251:            }
252:
253:            /**
254:             * gets the published state
255:             *
256:             * @return Returns the siteState.
257:             */
258:            public int getSiteState() {
259:                return siteState;
260:            }
261:
262:            /**
263:             * sets the published state
264:             *
265:             * @param siteState The siteState to set.
266:             */
267:            public void setSiteState(int siteState) {
268:                this .siteState = siteState;
269:            }
270:
271:            /**
272:             * @return Returns the systemOnly.
273:             */
274:            public boolean isSystemOnly() {
275:                return systemOnly;
276:            }
277:
278:            /**
279:             * @param systemOnly The systemOnly to set.
280:             */
281:            public void setSystemOnly(boolean systemOnly) {
282:                this .systemOnly = systemOnly;
283:            }
284:
285:            /**
286:             * @return Returns the xslConversionFileId.
287:             */
288:            public Id getXslConversionFileId() {
289:                return xslConversionFileId;
290:            }
291:
292:            /**
293:             * @param xslConversionFileId The xslConversionFileId to set.
294:             */
295:            public void setXslConversionFileId(Id xslConversionFileId) {
296:                this .xslConversionFileId = xslConversionFileId;
297:            }
298:
299:            /**
300:             * @return Returns the xslFileName.
301:             */
302:            public String getXslFileName() {
303:                return xslFileName;
304:            }
305:
306:            /**
307:             * @param xslFileName The xslFileName to set.
308:             */
309:            public void setXslFileName(String xslFileName) {
310:                this .xslFileName = xslFileName;
311:            }
312:
313:            public String getSiteId() {
314:                return siteId;
315:            }
316:
317:            public void setSiteId(String siteId) {
318:                this .siteId = siteId;
319:            }
320:
321:            public byte[] getSchema() {
322:                return schema;
323:            }
324:
325:            public void setSchema(byte[] schema) {
326:                this .schema = schema;
327:            }
328:
329:            public String getExternalType() {
330:                return externalType;
331:            }
332:
333:            public void setExternalType(String externalType) {
334:                this .externalType = externalType;
335:            }
336:
337:            public String getInstruction() {
338:                return instruction;
339:            }
340:
341:            public void setInstruction(String instruction) {
342:                this .instruction = instruction;
343:            }
344:
345:            /**
346:             * @return Returns the type.
347:             */
348:            public Type getType() {
349:                Type type = new Type();
350:                if (getId() != null) {
351:                    type.setId(getId());
352:                }
353:                if (getDescription() != null) {
354:                    type.setDescription(getDecoratedDescription());
355:                }
356:                type.setSystemOnly(isSystemOnly());
357:                return type;
358:            }
359:
360:            /**
361:             * This method doesn't do any authz, it simply checks the state
362:             *
363:             * @return true, if sad can be published to site.
364:             */
365:            public boolean getCanPublish() {
366:                return (siteState == STATE_UNPUBLISHED && globalState != STATE_PUBLISHED);
367:            }
368:
369:            public boolean getCanGlobalPublish() {
370:                return (globalState == STATE_UNPUBLISHED);
371:            }
372:
373:            /**
374:             * This method doesn't do any authz, it simply checks the state
375:             *
376:             * @return true, if sad can be suggested for global publish
377:             */
378:            public boolean getCanSuggestGlobalPublish() {
379:                return (globalState == STATE_UNPUBLISHED);
380:            }
381:
382:            /**
383:             * This method doesn't do any authz, it simply checks the state
384:             *
385:             * @return true, if sad can be published globally
386:             */
387:            public boolean getCanApproveGlobalPublish() {
388:                return (globalState == STATE_WAITING_APPROVAL);
389:            }
390:
391:            public boolean isGlobal() {
392:                //TODO fix this stubbed out method
393:                return false;
394:            }
395:
396:            public int compareTo(Object o) {
397:                StructuredArtifactDefinitionBean that = (StructuredArtifactDefinitionBean) o;
398:                return this .getType().getDescription().toLowerCase().compareTo(
399:                        that.getType().getDescription().toLowerCase());
400:            }
401:
402:            public String getFilePickerAction() {
403:                return filePickerAction;
404:            }
405:
406:            public void setFilePickerAction(String filePickerAction) {
407:                this .filePickerAction = filePickerAction;
408:            }
409:
410:            public String getSchemaHash() {
411:                return schemaHash;
412:            }
413:
414:            public void setSchemaHash(String schemaHash) {
415:                this .schemaHash = schemaHash;
416:            }
417:
418:            public boolean isPublished() {
419:                return getGlobalState() == STATE_PUBLISHED
420:                        || getSiteState() == STATE_PUBLISHED;
421:            }
422:
423:            public String getDecoratedDescription() {
424:                if (decoratedDescription == null) {
425:                    decoratedDescription = getDescription() + calcSiteName();
426:                }
427:                return decoratedDescription;
428:            }
429:
430:            protected String calcSiteName() {
431:                if (siteId == null) {
432:                    return "";
433:                }
434:
435:                Site site = null;
436:                try {
437:                    site = SiteService.getSite(siteId);
438:                } catch (IdUnusedException ignore) {
439:                    return "";
440:                }
441:
442:                return " (" + site.getTitle() + ")";
443:            }
444:
445:            public void setDecoratedDescription(String decoratedDescription) {
446:                this.decoratedDescription = decoratedDescription;
447:            }
448:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.