Source Code Cross Referenced for AddScaffoldingController.java in  » ERP-CRM-Financial » sakai » org » theospi » portfolio » matrix » control » 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.theospi.portfolio.matrix.control 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/matrix/tool/src/java/org/theospi/portfolio/matrix/control/AddScaffoldingController.java $
003:         * $Id: AddScaffoldingController.java 21844 2007-02-22 19:50:05Z jmpease@syr.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 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.theospi.portfolio.matrix.control;
021:
022:        import java.util.HashMap;
023:        import java.util.Iterator;
024:        import java.util.Map;
025:        import java.util.Set;
026:        import java.util.List;
027:
028:        import org.sakaiproject.content.api.ContentHostingService;
029:        import org.sakaiproject.entity.api.EntityManager;
030:        import org.sakaiproject.metaobj.security.AuthenticationManager;
031:        import org.sakaiproject.metaobj.shared.model.Id;
032:        import org.sakaiproject.metaobj.utils.mvc.intf.CustomCommandController;
033:        import org.sakaiproject.metaobj.utils.mvc.intf.FormController;
034:        import org.sakaiproject.metaobj.worksite.mgt.WorksiteManager;
035:        import org.sakaiproject.tool.api.SessionManager;
036:        import org.springframework.validation.Errors;
037:        import org.springframework.web.servlet.ModelAndView;
038:        import org.theospi.portfolio.matrix.model.Scaffolding;
039:        import org.theospi.portfolio.matrix.model.ScaffoldingCell;
040:        import org.theospi.portfolio.matrix.model.Matrix;
041:        import org.theospi.portfolio.matrix.model.WizardPage;
042:        import org.theospi.portfolio.matrix.model.Cell;
043:        import org.theospi.portfolio.review.mgt.ReviewManager;
044:
045:        /**
046:         * @author chmaurer
047:         */
048:        public class AddScaffoldingController extends BaseScaffoldingController
049:                implements  FormController, CustomCommandController {
050:
051:            private WorksiteManager worksiteManager = null;
052:            private AuthenticationManager authManager = null;
053:            private SessionManager sessionManager;
054:            private ContentHostingService contentHosting;
055:            private EntityManager entityManager;
056:            private ReviewManager reviewManager;
057:
058:            /* (non-Javadoc)
059:             * @see org.theospi.utils.mvc.intf.FormController#referenceData(java.util.Map, java.lang.Object, org.springframework.validation.Errors)
060:             */
061:            public Map referenceData(Map request, Object command, Errors errors) {
062:                Map model = new HashMap();
063:
064:                model.put("isInSession",
065:                        EditedScaffoldingStorage.STORED_SCAFFOLDING_FLAG);
066:
067:                Scaffolding scaffolding = null;
068:                if (command instanceof  Scaffolding)
069:                    scaffolding = (Scaffolding) command;
070:
071:                if (scaffolding != null)
072:                    model.put("isMatrixUsed", scaffolding.isPublished()
073:                            && isMatrixUsed(scaffolding.getId()));
074:                else
075:                    model.put("isMatrixUsed", false);
076:
077:                return model;
078:            }
079:
080:            /* (non-Javadoc)
081:             * @see org.theospi.utils.mvc.intf.Controller#handleRequest(java.lang.Object, java.util.Map, java.util.Map, java.util.Map, org.springframework.validation.Errors)
082:             */
083:            public ModelAndView handleRequest(Object requestModel, Map request,
084:                    Map session, Map application, Errors errors) {
085:                String action = (String) request.get("action");
086:                if (action == null)
087:                    action = (String) request.get("submitAction");
088:                String generateAction = (String) request.get("generateAction");
089:                String cancelAction = (String) request.get("cancelAction");
090:
091:                Id worksiteId = worksiteManager.getCurrentWorksiteId();
092:                Map model = new HashMap();
093:
094:                EditedScaffoldingStorage sessionBean = (EditedScaffoldingStorage) session
095:                        .get(EditedScaffoldingStorage.EDITED_SCAFFOLDING_STORAGE_SESSION_KEY);
096:                Scaffolding scaffolding = sessionBean.getScaffolding();
097:                scaffolding.setWorksiteId(worksiteId);
098:
099:                scaffolding.setOwner(authManager.getAgent());
100:
101:                if (generateAction != null) {
102:                    if (scaffolding.isPublished()) {
103:                        return new ModelAndView("editScaffoldingConfirm");
104:                    }
105:
106:                    scaffolding = saveScaffolding(scaffolding);
107:                    session
108:                            .remove(EditedScaffoldingStorage.STORED_SCAFFOLDING_FLAG);
109:                    session
110:                            .remove(EditedScaffoldingStorage.EDITED_SCAFFOLDING_STORAGE_SESSION_KEY);
111:                    model.put("scaffolding_id", scaffolding.getId());
112:                    return new ModelAndView("view", model);
113:                }
114:                if (cancelAction != null) {
115:                    return new ModelAndView("return");
116:                }
117:
118:                if (action != null) {
119:                    if (action.equals("forward")) {
120:                        String forwardView = (String) request.get("dest");
121:                        model.put("label", request.get("label"));
122:                        model.put("finalDest", request.get("finalDest"));
123:                        model.put("displayText", request.get("displayText"));
124:                        String params = (String) request.get("params");
125:                        model.put("params", params);
126:                        if (!params.equals("")) {
127:                            String[] paramsList = params.split(":");
128:                            for (int i = 0; i < paramsList.length; i++) {
129:                                String[] pair = paramsList[i].split("=");
130:                                String val = null;
131:                                if (pair.length > 1)
132:                                    val = pair[1];
133:                                model.put(pair[0], val);
134:                            }
135:                        }
136:                        //matrixManager.storeScaffolding(scaffolding);
137:
138:                        //touchAllCells(scaffolding);
139:                        sessionBean.setScaffolding(scaffolding);
140:                        model.put("scaffolding_id", scaffolding.getId());
141:
142:                        return new ModelAndView(forwardView, model);
143:
144:                    }
145:                }
146:                return new ModelAndView("success");
147:            }
148:
149:            /*
150:             private void touchAllScaffolding(Scaffolding scaffolding) {
151:             scaffolding.getLevels().size();
152:             scaffolding.getCriteria().size();
153:             for (Iterator iter = scaffolding.getScaffoldingCells().iterator(); iter.hasNext();) {
154:             ScaffoldingCell sCell = (ScaffoldingCell) iter.next();
155:             sCell.getCells().size();
156:             //sCell.getExpectations().size();
157:             }
158:             }
159:             */
160:            protected void touchAllCells(Scaffolding scaffolding) {
161:                for (Iterator iter = scaffolding.getScaffoldingCells()
162:                        .iterator(); iter.hasNext();) {
163:                    ScaffoldingCell sCell = (ScaffoldingCell) iter.next();
164:                    sCell.getCells().size();
165:                }
166:
167:            }
168:
169:            /**
170:             * @return Returns the worksiteManager.
171:             */
172:            public WorksiteManager getWorksiteManager() {
173:                return worksiteManager;
174:            }
175:
176:            /**
177:             * @param worksiteManager The worksiteManager to set.
178:             */
179:            public void setWorksiteManager(WorksiteManager worksiteManager) {
180:                this .worksiteManager = worksiteManager;
181:            }
182:
183:            /**
184:             * @return Returns the authManager.
185:             */
186:            public AuthenticationManager getAuthManager() {
187:                return authManager;
188:            }
189:
190:            /**
191:             * @param authManager The authManager to set.
192:             */
193:            public void setAuthManager(AuthenticationManager authManager) {
194:                this .authManager = authManager;
195:            }
196:
197:            public SessionManager getSessionManager() {
198:                return sessionManager;
199:            }
200:
201:            public void setSessionManager(SessionManager sessionManager) {
202:                this .sessionManager = sessionManager;
203:            }
204:
205:            public ContentHostingService getContentHosting() {
206:                return contentHosting;
207:            }
208:
209:            public void setContentHosting(ContentHostingService contentHosting) {
210:                this .contentHosting = contentHosting;
211:            }
212:
213:            public EntityManager getEntityManager() {
214:                return entityManager;
215:            }
216:
217:            public void setEntityManager(EntityManager entityManager) {
218:                this .entityManager = entityManager;
219:            }
220:
221:            /**
222:             * @return Returns the reviewManager.
223:             */
224:            public ReviewManager getReviewManager() {
225:                return reviewManager;
226:            }
227:
228:            /**
229:             * @param reviewManager The reviewManager to set.
230:             */
231:            public void setReviewManager(ReviewManager reviewManager) {
232:                this .reviewManager = reviewManager;
233:            }
234:
235:            /**
236:             ** Determine if any matrix with the specified scaffoldingId has been 'used'
237:             ** (e.g. containing reflections and/or added form items)
238:             **/
239:            private boolean isMatrixUsed(Id scaffoldingId) {
240:                List matrices = getMatrixManager().getMatrices(scaffoldingId);
241:
242:                for (Iterator matrixIt = matrices.iterator(); matrixIt
243:                        .hasNext();) {
244:                    Matrix matrix = (Matrix) matrixIt.next();
245:                    Set cells = matrix.getCells();
246:
247:                    for (Iterator cellIt = cells.iterator(); cellIt.hasNext();) {
248:                        Cell cell = (Cell) cellIt.next();
249:                        WizardPage wizardPage = cell.getWizardPage();
250:                        String pageId = wizardPage.getId().getValue();
251:                        if (wizardPage.getReflections() != null
252:                                && wizardPage.getReflections().size() > 0)
253:                            return true;
254:                        if (wizardPage.getPageForms() != null
255:                                && wizardPage.getPageForms().size() > 0)
256:                            return true;
257:                        if (wizardPage.getAttachments() != null
258:                                && wizardPage.getAttachments().size() > 0)
259:                            return true;
260:                        if (reviewManager.getReviewsByParent(pageId) != null
261:                                && reviewManager.getReviewsByParent(pageId)
262:                                        .size() > 0)
263:                            return true;
264:                        // note: wizardPage.[get|set]Feedback() does not appear to be used
265:                    }
266:                }
267:
268:                return false;
269:            }
270:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.