Source Code Cross Referenced for WorkflowProfile.java in  » Content-Management-System » harmonise » org » openharmonise » rm » workflow » 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 » Content Management System » harmonise » org.openharmonise.rm.workflow 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.rm.workflow;
020:
021:        import java.sql.*;
022:        import java.util.*;
023:        import java.util.logging.*;
024:
025:        import org.openharmonise.commons.dsi.*;
026:        import org.openharmonise.commons.dsi.dml.SelectStatement;
027:        import org.openharmonise.rm.*;
028:        import org.openharmonise.rm.factory.*;
029:        import org.openharmonise.rm.metadata.*;
030:        import org.openharmonise.rm.resources.*;
031:        import org.openharmonise.rm.resources.metadata.properties.Property;
032:        import org.openharmonise.rm.resources.metadata.properties.domains.Domain;
033:        import org.openharmonise.rm.resources.workflow.properties.WorkflowProperty;
034:        import org.openharmonise.rm.resources.workflow.values.WorkflowStageValue;
035:
036:        /**
037:         * Profile specifically for holding <code>WorkflowPropertyInstances</code>.
038:         * 
039:         * @author Michael Bell
040:         * @version $Revision: 1.2 $
041:         *
042:         */
043:        public class WorkflowProfile extends Profile {
044:
045:            public static final String WORKFLOW_PROFILE_NAME = "Workflow";
046:
047:            private static final Logger m_logger = Logger
048:                    .getLogger(WorkflowProfile.class.getName());
049:
050:            {
051:                try {
052:                    super .setName(WORKFLOW_PROFILE_NAME);
053:                } catch (InvalidNameException e) {
054:                    // shouldn't be a problem but log exception anyway
055:                    m_logger.log(Level.WARNING, e.getLocalizedMessage(), e);
056:                }
057:            }
058:
059:            /**
060:             * 
061:             */
062:            public WorkflowProfile() {
063:                super ();
064:
065:            }
066:
067:            /**
068:             * @param dbintrf
069:             */
070:            public WorkflowProfile(AbstractDataStoreInterface dbintrf) {
071:                super (dbintrf);
072:
073:            }
074:
075:            /**
076:             * @param dbintrf
077:             * @param obj
078:             */
079:            public WorkflowProfile(AbstractDataStoreInterface dbintrf,
080:                    AbstractProfiledObject obj) {
081:                super (dbintrf, obj);
082:
083:            }
084:
085:            /**
086:             * @param dbintrf
087:             * @param nId
088:             * @param obj
089:             */
090:            public WorkflowProfile(AbstractDataStoreInterface dbintrf, int nId,
091:                    AbstractProfiledObject obj) {
092:                super (dbintrf, nId, obj);
093:
094:            }
095:
096:            /* (non-Javadoc)
097:             * @see org.openharmonise.rm.resources.AbstractObject#getName()
098:             */
099:            public String getName() throws DataAccessException {
100:                return WORKFLOW_PROFILE_NAME;
101:            }
102:
103:            /* (non-Javadoc)
104:             * @see org.openharmonise.rm.resources.AbstractObject#setName(java.lang.String)
105:             */
106:            public void setName(String sName) {
107:                //no nothing, can't set name
108:            }
109:
110:            /* (non-Javadoc)
111:             * @see org.openharmonise.rm.metadata.Profile#isValid(org.openharmonise.rm.resources.AbstractProfiledObject)
112:             */
113:            public boolean isValid(AbstractProfiledObject profObj)
114:                    throws DataAccessException {
115:
116:                //don't make any restriction - at most should only allow RBS props
117:                return true;
118:            }
119:
120:            /**
121:             * @param dsi
122:             * @return
123:             * @throws DataAccessException
124:             */
125:            static public List getWorkflowProperties(
126:                    AbstractDataStoreInterface dsi) throws DataAccessException {
127:                List wkflw_props = new ArrayList();
128:                String sClassname = WorkflowProperty.class.getName();
129:                ResultSet rs = null;
130:                try {
131:                    SelectStatement select = new SelectStatement();
132:
133:                    select.addSelectColumn(AbstractObject.getColumnRef(
134:                            sClassname, AbstractObject.ATTRIB_ID));
135:
136:                    select.addWhereCondition(AbstractObject.getColumnRef(
137:                            sClassname, AbstractObject.ATTRIB_TYPE), "=",
138:                            WorkflowProperty.class.getName());
139:
140:                    rs = dsi.execute(select);
141:
142:                    while (rs.next()) {
143:                        WorkflowProperty prop = (WorkflowProperty) HarmoniseObjectFactory
144:                                .instantiateHarmoniseObject(dsi, sClassname, rs
145:                                        .getInt(1));
146:                        wkflw_props.add(prop);
147:                    }
148:
149:                } catch (DataStoreException e) {
150:                    throw new DataAccessException(e.getLocalizedMessage(), e);
151:                } catch (SQLException e) {
152:                    throw new DataAccessException(e.getLocalizedMessage(), e);
153:                } catch (HarmoniseFactoryException e) {
154:                    throw new DataAccessException(e.getLocalizedMessage(), e);
155:                } finally {
156:                    try {
157:                        rs.close();
158:                    } catch (SQLException e) {
159:                        throw new DataAccessException(e.getLocalizedMessage(),
160:                                e);
161:                    }
162:                }
163:
164:                return wkflw_props;
165:            }
166:
167:            /**
168:             * Returns the available workflow properties for the given profiled
169:             * object.
170:             * 
171:             * @param profObj
172:             * @return
173:             * @throws DataAccessException
174:             */
175:            public static List getAvailableWorkflowProperties(
176:                    AbstractProfiledObject profObj) throws DataAccessException {
177:                List props = new ArrayList();
178:
179:                List normProps = Domain.getAvailableProperties(profObj
180:                        .getDataStoreInterface(), profObj);
181:
182:                Iterator iter = normProps.iterator();
183:
184:                while (iter.hasNext()) {
185:                    Property tmpProp = (Property) iter.next();
186:
187:                    if (tmpProp instanceof  WorkflowProperty) {
188:                        props.add(tmpProp);
189:                    }
190:                }
191:
192:                return props;
193:            }
194:
195:            /* (non-Javadoc)
196:             * @see org.openharmonise.rm.metadata.Profile#getAvailableProperties()
197:             */
198:            public List getAvailableProperties() throws DataAccessException {
199:                return getWorkflowProperties(m_dsi);
200:            }
201:
202:            /* (non-Javadoc)
203:             * @see org.openharmonise.rm.resources.AbstractObject#markAsNew()
204:             */
205:            public void markAsNew() throws PopulateException {
206:
207:                try {
208:                    List propInsts = getPropertyInstances();
209:
210:                    Iterator iter = propInsts.iterator();
211:
212:                    while (iter.hasNext()) {
213:                        WorkflowPropertyInstance propInst = (WorkflowPropertyInstance) iter
214:                                .next();
215:
216:                        List vals = propInst.getValues();
217:
218:                        Iterator valIter = vals.iterator();
219:
220:                        while (valIter.hasNext()) {
221:                            WorkflowStageValue stage = (WorkflowStageValue) valIter
222:                                    .next();
223:
224:                            if (stage.isInheritable() == false) {
225:                                propInst.removeValue(stage);
226:                            }
227:                        }
228:                    }
229:                } catch (DataAccessException e) {
230:                    throw new PopulateException(e.getLocalizedMessage(), e);
231:                } catch (InvalidPropertyValueException e) {
232:                    throw new PopulateException(e.getLocalizedMessage(), e);
233:                }
234:
235:                super .markAsNew();
236:            }
237:
238:            /**
239:             * Returns the workflow property instance sPropName from the profiled object profObj
240:             * if the object has that workflow property instance. otherwise, it returns null.
241:             * @param profObj The Profiled object
242:             * @param sPropName The name of the property instance to be returned
243:             * @return A WorkflowPropertyInstance if the object has it, or null otherwise.
244:             * @throws InvalidPropertyInstanceException
245:             * @throws DataAccessException
246:             */
247:            public static WorkflowPropertyInstance getWorkflowPropertyInstance(
248:                    AbstractProfiledObject profObj, String sPropName)
249:                    throws InvalidPropertyInstanceException,
250:                    DataAccessException {
251:                WorkflowProfile workflowProf = (WorkflowProfile) profObj
252:                        .getProfile(WORKFLOW_PROFILE_NAME);
253:                return (WorkflowPropertyInstance) workflowProf
254:                        .getPropertyInstance(sPropName);
255:            }
256:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.