Source Code Cross Referenced for ReferencedContent.java in  » J2EE » fleXive » com » flexive » shared » value » 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 » J2EE » fleXive » com.flexive.shared.value 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***************************************************************
002:         *  This file is part of the [fleXive](R) project.
003:         *
004:         *  Copyright (c) 1999-2008
005:         *  UCS - unique computing solutions gmbh (http://www.ucs.at)
006:         *  All rights reserved
007:         *
008:         *  The [fleXive](R) project is free software; you can redistribute
009:         *  it and/or modify it under the terms of the GNU General Public
010:         *  License as published by the Free Software Foundation;
011:         *  either version 2 of the License, or (at your option) any
012:         *  later version.
013:         *
014:         *  The GNU General Public License can be found at
015:         *  http://www.gnu.org/copyleft/gpl.html.
016:         *  A copy is found in the textfile GPL.txt and important notices to the
017:         *  license from the author are found in LICENSE.txt distributed with
018:         *  these libraries.
019:         *
020:         *  This library is distributed in the hope that it will be useful,
021:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
022:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
023:         *  GNU General Public License for more details.
024:         *
025:         *  For further information about UCS - unique computing solutions gmbh,
026:         *  please see the company website: http://www.ucs.at
027:         *
028:         *  For further information about [fleXive](R), please see the
029:         *  project website: http://www.flexive.org
030:         *
031:         *
032:         *  This copyright notice MUST APPEAR in all copies of the file!
033:         ***************************************************************/package com.flexive.shared.value;
034:
035:        import com.flexive.shared.content.FxContent;
036:        import com.flexive.shared.content.FxPK;
037:        import com.flexive.shared.exceptions.FxApplicationException;
038:        import com.flexive.shared.security.ACL;
039:        import com.flexive.shared.workflow.Step;
040:
041:        import java.io.Serializable;
042:
043:        /**
044:         * A referenced content - value class for FxReference
045:         *
046:         * @author Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
047:         */
048:        public class ReferencedContent extends FxPK implements  Serializable {
049:            private static final long serialVersionUID = 4530337199230606480L;
050:            private String caption;
051:            private Step step;
052:            private ACL acl;
053:            private FxContent content;
054:            private boolean accessGranted;
055:            private boolean resolved;
056:
057:            /**
058:             * Ctor
059:             *
060:             * @param pk      referenced primary key
061:             * @param caption caption of the referenced content, only available if loaded
062:             * @param step    the step
063:             * @param acl     the acl
064:             */
065:            public ReferencedContent(FxPK pk, String caption, Step step, ACL acl) {
066:                super (pk.getId(), pk.getVersion());
067:                this .caption = caption;
068:                this .step = step;
069:                this .acl = acl;
070:                this .content = null;
071:                this .accessGranted = false;
072:            }
073:
074:            /**
075:             * Ctor
076:             *
077:             * @param pk referenced primary key
078:             */
079:            public ReferencedContent(FxPK pk) {
080:                super (pk.getId(), pk.getVersion());
081:                this .caption = "";
082:                this .step = null;
083:                this .acl = null;
084:                this .content = null;
085:                this .accessGranted = false;
086:            }
087:
088:            /**
089:             * Ctor
090:             *
091:             * @param id      id
092:             * @param version version
093:             */
094:            public ReferencedContent(long id, int version) {
095:                super (id, version);
096:                this .caption = "";
097:                this .step = null;
098:                this .acl = null;
099:                this .content = null;
100:                this .accessGranted = false;
101:            }
102:
103:            /**
104:             * Ctor
105:             *
106:             * @param id id
107:             */
108:            public ReferencedContent(long id) {
109:                super (id);
110:                this .caption = "";
111:                this .step = null;
112:                this .acl = null;
113:                this .content = null;
114:                this .accessGranted = false;
115:            }
116:
117:            /**
118:             * Ctor
119:             */
120:            public ReferencedContent() {
121:                super ();
122:                this .caption = "";
123:                this .step = null;
124:                this .acl = null;
125:                this .content = null;
126:                this .accessGranted = false;
127:            }
128:
129:            /**
130:             * Get the caption of the referenced content, only available if loaded
131:             *
132:             * @return caption of the referenced content, only available if loaded
133:             */
134:            public String getCaption() {
135:                return caption;
136:            }
137:
138:            /**
139:             * Is a step known for this reference?
140:             *
141:             * @return if a step is known for this reference
142:             */
143:            public boolean hasStep() {
144:                return step != null;
145:            }
146:
147:            /**
148:             * Is an ACL known for this reference?
149:             *
150:             * @return if an ACL is known for this reference
151:             */
152:            public boolean hasACL() {
153:                return acl != null;
154:            }
155:
156:            /**
157:             * Get the step for this reference
158:             *
159:             * @return step of this reference
160:             */
161:            public Step getStep() {
162:                if (!hasStep())
163:                    throw new FxApplicationException(
164:                            "ex.content.reference.content.missing")
165:                            .asRuntimeException();
166:                return step;
167:            }
168:
169:            /**
170:             * Get the ACL for this reference
171:             *
172:             * @return ACL for this reference
173:             */
174:            public ACL getAcl() {
175:                if (!hasACL())
176:                    throw new FxApplicationException(
177:                            "ex.content.reference.content.missing")
178:                            .asRuntimeException();
179:                return acl;
180:            }
181:
182:            /**
183:             * Is a loaded FxContent assigned for this reference?
184:             *
185:             * @return if a loaded FxContent is assigned for this reference
186:             */
187:            public boolean hasContent() {
188:                return content != null;
189:            }
190:
191:            /**
192:             * Get the assigned FxContent for this reference
193:             *
194:             * @return the assigned FxContent for this reference
195:             */
196:            public synchronized FxContent getContent() {
197:                if (!hasContent())
198:                    throw new FxApplicationException(
199:                            "ex.content.reference.content.missing")
200:                            .asRuntimeException();
201:                return content;
202:            }
203:
204:            /**
205:             * Set the assigned FxContent for this reference
206:             *
207:             * @param content the assigned FxContent for this reference
208:             */
209:            public synchronized void setContent(FxContent content) {
210:                if (!resolved) {
211:                    this .content = content;
212:                    accessGranted = content != null;
213:                } else {
214:                    resolved = true;
215:                }
216:            }
217:
218:            /**
219:             * Is access to the referenced FxContent granted?
220:             *
221:             * @return if access to the referenced FxContent is granted
222:             */
223:            public boolean isAccessGranted() {
224:                return accessGranted;
225:            }
226:
227:            /**
228:             * Set if (read) access to the referenced instance is granted.
229:             * This flag is usually set during creation of a ReferencedContent.
230:             * Setting it to <code>true</code> will <b>not</b> enable you to read the referenced content ;-)
231:             *
232:             * @param accessGranted if access to the referenced content is granted
233:             */
234:            public void setAccessGranted(boolean accessGranted) {
235:                this .accessGranted = accessGranted;
236:            }
237:
238:            /**
239:             * {@inheritDoc}
240:             */
241:            @Override
242:            public int hashCode() {
243:                return super .hashCode() * 31 + caption.hashCode();
244:            }
245:
246:            /**
247:             * Evaluates the given string value to an object of type ReferencedContent.
248:             *
249:             * @param value string value to be evaluated
250:             * @return the value interpreted as ReferencedContent
251:             */
252:            public static ReferencedContent fromString(String value) {
253:                return new ReferencedContent(FxPK.fromString(value));
254:            }
255:
256:            public String toStringExtended() {
257:                return "ReferencedContent{pk=" + super .toString()
258:                        + ", caption=[" + caption + "]}";
259:            }
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.