Source Code Cross Referenced for CreateAttributeBean.java in  » Portal » Open-Portal » com » sun » portal » admin » console » ssoa » 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 » Portal » Open Portal » com.sun.portal.admin.console.ssoa 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: CreateAttributeBean.java,v 1.4 2005/11/03 23:55:10 sorensen Exp $
003:         * Copyright 2005 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.admin.console.ssoa;
014:
015:        import java.util.*;
016:        import java.util.logging.Level;
017:        import com.sun.data.provider.impl.ObjectListDataProvider;
018:        import com.sun.web.ui.model.Option;
019:        import com.sun.web.ui.event.WizardEvent;
020:        import com.sun.web.ui.event.WizardEventListener;
021:
022:        import javax.faces.application.FacesMessage;
023:        import javax.faces.component.UIComponent;
024:        import javax.faces.context.FacesContext;
025:        import javax.faces.event.ActionEvent;
026:        import javax.faces.validator.ValidatorException;
027:        import javax.management.MBeanServerConnection;
028:        import javax.servlet.http.HttpServletRequest;
029:
030:        public class CreateAttributeBean extends TemplateAttributesBean {
031:
032:            private String type;
033:            //	private Option[] availableTypes;
034:            private String name;
035:            private String value;
036:            private boolean encrypted = false;
037:
038:            //    protected Map rbMap;
039:            //    public static final String RB_NAME = "ssoa";
040:
041:            //	public CreateAttributeBean() {
042:            //        rbMap = getResourceStringMap(RB_NAME);
043:            //	}
044:
045:            public String getType() {
046:                //log(Level.FINEST, "CreateAttributeBean.getType start");
047:                if (type == null) {
048:                    type = (String) getSessionAttribute(ATTR_TYPE);
049:                }
050:                return type;
051:            }
052:
053:            public void setType(String type) {
054:                //log(Level.FINEST, "CreateAttributeBean.setType start");
055:                this .type = type;
056:            }
057:
058:            public boolean getIsAdminType() {
059:                //log(Level.FINEST, "CreateAttributeBean.getIsAdminType start");
060:                return ADMIN_TYPE.equals(getType());
061:            }
062:
063:            //	public Option[] getAvailableTypes() {
064:            //		log(Level.FINEST, "CreateAttributeBean.getAvailableTypes start");
065:            //		return availableTypes;
066:            //	}
067:
068:            public String getValue() {
069:                return value;
070:            }
071:
072:            public void setValue(String value) {
073:                this .value = value;
074:            }
075:
076:            public String getName() {
077:                return name;
078:            }
079:
080:            public void setName(String name) {
081:                this .name = name;
082:            }
083:
084:            public boolean getEncrypted() {
085:                return encrypted;
086:            }
087:
088:            public void setEncrypted(boolean encrypted) {
089:                this .encrypted = encrypted;
090:            }
091:
092:            public String add() {
093:                log(Level.FINEST, "CreatAttributeBean.add start");
094:                log(Level.FINEST, "CreatAttributeBean.add bean is name:" + name
095:                        + " value:" + value + " encrypted:" + encrypted);
096:                if (ADMIN_TYPE.equals(getType())) {
097:                    //			if (value == null) value="";
098:                    AttributeBean ab = new AttributeBean(name, value, encrypted);
099:                    //List aal = adminAttributes.getList();
100:                    //aal.add(ab);
101:                    adminAttributes.addObject(ab);
102:                    adminAttributes.commitChanges();
103:                    saveTemplate();
104:                } else if (USER_TYPE.equals(getType())) {
105:                    AttributeBean ab = new AttributeBean(name, value, encrypted);
106:                    //List ual = userAttributes.getList();
107:                    //ual.add(ab);
108:                    userAttributes.addObject(ab);
109:                    userAttributes.commitChanges();
110:                    saveTemplate();
111:                } else {
112:                    log(Level.WARNING,
113:                            "CreatAttributeBean.add: Illegal attribute type "
114:                                    + type);
115:                }
116:                setSessionAttribute("resetSSOA", "true");
117:                return cancel();
118:            }
119:
120:            //============================================================
121:            // validator for unique attribute name
122:            //============================================================
123:            public void validateName(FacesContext ctx, UIComponent comp,
124:                    Object value) {
125:                log(Level.FINEST, "CreatAttributeBean.validateName start");
126:                resetAttributes();
127:                String sm = (String) rbMap.get("error.validation.summary");
128:                String dmAdmin = (String) rbMap
129:                        .get("error.duplicate.admin.attribute");
130:                String dmUser = (String) rbMap
131:                        .get("error.duplicate.user.attribute");
132:                String cn = (String) value;
133:                log(Level.FINEST,
134:                        "CreatAttributeBean.validateName Checking for duplicate of "
135:                                + cn);
136:                // Make sure this isn't in the list of admin or user attributes
137:                List aal = adminAttributes.getList();
138:                for (int i = 0; i < aal.size(); i++) {
139:                    AttributeBean ab = (AttributeBean) aal.get(i);
140:                    if (ab.getName().equals(cn)) {
141:                        log(Level.FINEST,
142:                                "CreatAttributeBean.validateName Duplicate found "
143:                                        + ab.getName());
144:                        throw new ValidatorException(new FacesMessage(sm,
145:                                dmAdmin));
146:                    }
147:                }
148:                List ual = userAttributes.getList();
149:                for (int i = 0; i < ual.size(); i++) {
150:                    AttributeBean ab = (AttributeBean) ual.get(i);
151:                    if (ab.getName().equals(cn)) {
152:                        log(Level.FINEST,
153:                                "CreatAttributeBean.validateName Duplicate found "
154:                                        + ab.getName());
155:                        throw new ValidatorException(new FacesMessage(sm,
156:                                dmUser));
157:                    }
158:                }
159:            }
160:
161:            public String cancel() {
162:                log(Level.FINEST, "CreateTemplateBean.cancel start");
163:                // Reset the bean
164:                name = null;
165:                value = null;
166:                type = null;
167:                encrypted = false;
168:                //adminAttributes =   null;	
169:                //userAttributes =   null;	
170:                return "cancel";
171:            }
172:
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.