001: /******************************************************************************
002: * JBoss, a division of Red Hat *
003: * Copyright 2006, Red Hat Middleware, LLC, and individual *
004: * contributors as indicated by the @authors tag. See the *
005: * copyright.txt in the distribution for a full listing of *
006: * individual contributors. *
007: * *
008: * This is free software; you can redistribute it and/or modify it *
009: * under the terms of the GNU Lesser General Public License as *
010: * published by the Free Software Foundation; either version 2.1 of *
011: * the License, or (at your option) any later version. *
012: * *
013: * This software is distributed in the hope that it will be useful, *
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of *
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
016: * Lesser General Public License for more details. *
017: * *
018: * You should have received a copy of the GNU Lesser General Public *
019: * License along with this software; if not, write to the Free *
020: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
021: * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
022: ******************************************************************************/package org.jboss.portal.core.identity.services.metadata;
023:
024: import java.util.List;
025: import java.util.Map;
026:
027: import org.jboss.portal.identity.IdentityException;
028: import org.jboss.portal.identity.info.PropertyInfo;
029:
030: /**
031: *
032: * Core-Identity configuration class
033: *
034: * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
035: * @version $Revision$
036: */
037: public class UIComponentConfiguration {
038: /** Identity property reference */
039: private String propertyRef;
040:
041: /** UI reference name */
042: private String name;
043:
044: /** List of validators */
045: private List validators;
046:
047: /** The converter */
048: private String converter;
049:
050: /** Required flag */
051: private boolean required;
052:
053: /** ReadOnly flag */
054: private boolean readOnly;
055:
056: /** Property values */
057: private Map values;
058:
059: /** Reference for predefined values */
060: private String predefinedMapValues;
061:
062: /** Identity PropertyInfo */
063: private PropertyInfo propertyInfo;
064:
065: public String getPropertyRef() {
066: return propertyRef;
067: }
068:
069: public void setPropertyRef(String identifier)
070: throws IdentityException {
071: this .propertyRef = identifier;
072: }
073:
074: public String getName() {
075: return name;
076: }
077:
078: public void setName(String name) {
079: this .name = name;
080: }
081:
082: // returns the first validator
083: public String getValidator() {
084: return (String) validators.get(0);
085: }
086:
087: public List getValidators() {
088: return validators;
089: }
090:
091: public void setValidators(List validators) {
092: this .validators = validators;
093: }
094:
095: public boolean isRequired() {
096: // If profile-info is mandatory always return true
097: return this .propertyInfo.getUsage().equals("mandatory") ? true
098: : required;
099: }
100:
101: public void setRequired(boolean required) {
102: this .required = required;
103: }
104:
105: public boolean isReadOnly() {
106: // If profile-info is read-only always return true
107: return this .propertyInfo.getAccessMode().equals("read-only") ? true
108: : readOnly;
109: }
110:
111: public void setReadOnly(boolean readOnly) {
112: this .readOnly = readOnly;
113: }
114:
115: public String getConverter() {
116: return converter;
117: }
118:
119: public void setConverter(String converter) {
120: this .converter = converter;
121: }
122:
123: public Map getValues() {
124: return values;
125: }
126:
127: public void setValues(Map values) {
128: this .values = values;
129: }
130:
131: public PropertyInfo getPropertyInfo() {
132: return propertyInfo;
133: }
134:
135: public void setPropertyInfo(PropertyInfo propertyInfo) {
136: this .propertyInfo = propertyInfo;
137: }
138:
139: public String getPredefinedMapValues() {
140: return predefinedMapValues;
141: }
142:
143: public void setPredefinedMapValues(String predefinedMapValues) {
144: this .predefinedMapValues = predefinedMapValues;
145: }
146:
147: public Class getPropertyClass() throws ClassNotFoundException {
148: // Returns the Class of the Property
149: return ClassLoader.getSystemClassLoader().loadClass(
150: this.propertyInfo.getType());
151: }
152: }
|