001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.om.page.psml;
018:
019: import java.util.HashMap;
020: import java.util.Iterator;
021: import java.util.List;
022: import java.util.Map;
023:
024: import org.apache.jetspeed.om.page.PageSecurity;
025: import org.apache.jetspeed.om.page.SecurityConstraintsDef;
026:
027: /**
028: * <p>
029: * SecurityImpl
030: * </p>
031: * <p>
032: *
033: * </p>
034: * @author <a href="mailto:rwatler@finali.com">Randy Watler</a>
035: * @version $Id: PageSecurityImpl.java 516448 2007-03-09 16:25:47Z ate $
036: *
037: */
038: public class PageSecurityImpl extends DocumentImpl implements
039: PageSecurity {
040: private List constraintsDefsList;
041:
042: private Map constraintsDefsMap;
043:
044: private List globalConstraintsRefs;
045:
046: /**
047: * <p>
048: * getType
049: * </p>
050: *
051: * @see org.apache.jetspeed.om.page.Document#getType()
052: * @return
053: */
054: public String getType() {
055: return DOCUMENT_TYPE;
056: }
057:
058: /**
059: * <p>
060: * getSecurityConstraintsDefs
061: * </p>
062: *
063: * @see org.apache.jetspeed.om.page.PageSecurity#getSecurityConstraintsDefs()
064: * @return
065: */
066: public List getSecurityConstraintsDefs() {
067: return constraintsDefsList;
068: }
069:
070: /**
071: * <p>
072: * setSecurityConstraintsDefs
073: * </p>
074: *
075: * @see org.apache.jetspeed.om.page.PageSecurity#setSecurityConstraintsDefs(java.util.List)
076: * @param defintions
077: */
078: public void setSecurityConstraintsDefs(List definitions) {
079: constraintsDefsList = definitions;
080: constraintsDefsMap = null;
081: }
082:
083: /**
084: * <p>
085: * newSecurityConstraintsDef
086: * </p>
087: *
088: * @see org.apache.jetspeed.om.page.PageSecurity#newSecurityConstraintsDef()
089: * @return security constraints definition
090: */
091: public SecurityConstraintsDef newSecurityConstraintsDef() {
092: return new SecurityConstraintsDefImpl();
093: }
094:
095: /**
096: * <p>
097: * getSecurityConstraintsDef
098: * </p>
099: *
100: * @see org.apache.jetspeed.om.page.PageSecurity#getSecurityConstraintsDef(java.lang.String)
101: * @param name
102: * @return
103: */
104: public SecurityConstraintsDef getSecurityConstraintsDef(String name) {
105: if ((constraintsDefsList != null)
106: && (constraintsDefsMap == null)) {
107: constraintsDefsMap = new HashMap((constraintsDefsList
108: .size() * 2) + 1);
109: Iterator definitionsIter = constraintsDefsList.iterator();
110: while (definitionsIter.hasNext()) {
111: SecurityConstraintsDef definition = (SecurityConstraintsDef) definitionsIter
112: .next();
113: constraintsDefsMap
114: .put(definition.getName(), definition);
115: }
116: }
117: if (constraintsDefsMap != null) {
118: return (SecurityConstraintsDef) constraintsDefsMap
119: .get(name);
120: }
121: return null;
122: }
123:
124: /**
125: * <p>
126: * getGlobalSecurityConstraintsRefs
127: * </p>
128: *
129: * @see org.apache.jetspeed.om.page.PageSecurity#getGlobalSecurityConstraintsRefs()
130: * @return
131: */
132: public List getGlobalSecurityConstraintsRefs() {
133: return globalConstraintsRefs;
134: }
135:
136: /**
137: * <p>
138: * setGlobalSecurityConstraintsRefs
139: * </p>
140: *
141: * @see org.apache.jetspeed.om.page.PageSecurity#setGlobalSecurityConstraintsRefs(java.util.List)
142: * @param constraintsRefs
143: */
144: public void setGlobalSecurityConstraintsRefs(List constraintsRefs) {
145: globalConstraintsRefs = constraintsRefs;
146: }
147: }
|