001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     * http://www.opensource.org/licenses/ecl2.php
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.kfs.sec.businessobject;
017    
018    import java.util.LinkedHashMap;
019    
020    import org.kuali.kfs.sys.KFSPropertyConstants;
021    import org.kuali.kfs.sys.context.SpringContext;
022    import org.kuali.rice.kim.bo.Person;
023    import org.kuali.rice.kns.bo.TransientBusinessObjectBase;
024    import org.kuali.rice.kns.util.KualiInteger;
025    
026    /**
027     * Holds fields needed to run a security simulation and the display results
028     */
029    public class AccessSecuritySimulation extends TransientBusinessObjectBase {
030        // search fields
031        private String principalId;
032        private String templateId;
033        private String attributeName;
034        private String financialSystemDocumentTypeCode;
035        private String inquiryNamespaceCode;
036    
037        // return fields
038        private String attributeValue;
039        private String attributeValueName;
040    
041        private Person securityPerson;
042    
043        public AccessSecuritySimulation() {
044    
045        }
046    
047    
048        /**
049         * Gets the attributeName attribute.
050         * 
051         * @return Returns the attributeName.
052         */
053        public String getAttributeName() {
054            return attributeName;
055        }
056    
057    
058        /**
059         * Sets the attributeName attribute value.
060         * 
061         * @param attributeName The attributeName to set.
062         */
063        public void setAttributeName(String attributeName) {
064            this.attributeName = attributeName;
065        }
066    
067    
068        /**
069         * Gets the principalId attribute.
070         * 
071         * @return Returns the principalId.
072         */
073        public String getPrincipalId() {
074            return principalId;
075        }
076    
077    
078        /**
079         * Sets the principalId attribute value.
080         * 
081         * @param principalId The principalId to set.
082         */
083        public void setPrincipalId(String principalId) {
084            this.principalId = principalId;
085        }
086    
087    
088        /**
089         * Gets the templateId attribute.
090         * 
091         * @return Returns the templateId.
092         */
093        public String getTemplateId() {
094            return templateId;
095        }
096    
097    
098        /**
099         * Sets the templateId attribute value.
100         * 
101         * @param templateId The templateId to set.
102         */
103        public void setTemplateId(String templateId) {
104            this.templateId = templateId;
105        }
106    
107    
108        /**
109         * Gets the financialSystemDocumentTypeCode attribute.
110         * 
111         * @return Returns the financialSystemDocumentTypeCode.
112         */
113        public String getFinancialSystemDocumentTypeCode() {
114            return financialSystemDocumentTypeCode;
115        }
116    
117    
118        /**
119         * Sets the financialSystemDocumentTypeCode attribute value.
120         * 
121         * @param financialSystemDocumentTypeCode The financialSystemDocumentTypeCode to set.
122         */
123        public void setFinancialSystemDocumentTypeCode(String financialSystemDocumentTypeCode) {
124            this.financialSystemDocumentTypeCode = financialSystemDocumentTypeCode;
125        }
126    
127    
128        /**
129         * Gets the inquiryNamespaceCode attribute.
130         * 
131         * @return Returns the inquiryNamespaceCode.
132         */
133        public String getInquiryNamespaceCode() {
134            return inquiryNamespaceCode;
135        }
136    
137    
138        /**
139         * Sets the inquiryNamespaceCode attribute value.
140         * 
141         * @param inquiryNamespaceCode The inquiryNamespaceCode to set.
142         */
143        public void setInquiryNamespaceCode(String inquiryNamespaceCode) {
144            this.inquiryNamespaceCode = inquiryNamespaceCode;
145        }
146    
147    
148        /**
149         * Gets the attributeValue attribute.
150         * 
151         * @return Returns the attributeValue.
152         */
153        public String getAttributeValue() {
154            return attributeValue;
155        }
156    
157    
158        /**
159         * Sets the attributeValue attribute value.
160         * 
161         * @param attributeValue The attributeValue to set.
162         */
163        public void setAttributeValue(String attributeValue) {
164            this.attributeValue = attributeValue;
165        }
166    
167    
168        /**
169         * Gets the attributeValueName attribute.
170         * 
171         * @return Returns the attributeValueName.
172         */
173        public String getAttributeValueName() {
174            return attributeValueName;
175        }
176    
177    
178        /**
179         * Sets the attributeValueName attribute value.
180         * 
181         * @param attributeValueName The attributeValueName to set.
182         */
183        public void setAttributeValueName(String attributeValueName) {
184            this.attributeValueName = attributeValueName;
185        }
186    
187        /**
188         * Gets the securityPerson attribute.
189         * 
190         * @return Returns the securityPerson.
191         */
192        public Person getSecurityPerson() {
193            securityPerson = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(principalId, securityPerson);
194            return securityPerson;
195        }
196    
197    
198        /**
199         * Sets the securityPerson attribute value.
200         * 
201         * @param securityPerson The securityPerson to set.
202         */
203        public void setSecurityPerson(Person securityPerson) {
204            this.securityPerson = securityPerson;
205        }
206    
207    
208        @Override
209        protected LinkedHashMap toStringMapper() {
210            LinkedHashMap m = new LinkedHashMap();
211    
212            m.put(KFSPropertyConstants.PRINCIPAL_ID, this.principalId);
213    
214            return m;
215        }
216    
217    }