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.coa.identity;
017
018 import java.sql.Date;
019 import java.util.ArrayList;
020 import java.util.Collections;
021 import java.util.HashMap;
022 import java.util.LinkedHashMap;
023 import java.util.List;
024 import java.util.Map;
025
026 import org.apache.commons.lang.StringUtils;
027 import org.kuali.kfs.coa.businessobject.Chart;
028 import org.kuali.kfs.coa.businessobject.Organization;
029 import org.kuali.kfs.sys.KFSConstants;
030 import org.kuali.kfs.sys.context.SpringContext;
031 import org.kuali.rice.kew.doctype.bo.DocumentTypeEBO;
032 import org.kuali.rice.kew.service.impl.KEWModuleService;
033 import org.kuali.rice.kew.util.CodeTranslator;
034 import org.kuali.rice.kim.bo.Group;
035 import org.kuali.rice.kim.bo.Person;
036 import org.kuali.rice.kim.bo.Role;
037 import org.kuali.rice.kim.bo.role.dto.DelegateMemberCompleteInfo;
038 import org.kuali.rice.kim.bo.role.dto.DelegateTypeInfo;
039 import org.kuali.rice.kim.bo.role.dto.RoleMemberCompleteInfo;
040 import org.kuali.rice.kim.bo.role.dto.RoleResponsibilityActionInfo;
041 import org.kuali.rice.kim.bo.types.dto.AttributeSet;
042 import org.kuali.rice.kim.bo.types.dto.KimTypeAttributeInfo;
043 import org.kuali.rice.kim.bo.types.dto.KimTypeInfo;
044 import org.kuali.rice.kim.service.KIMServiceLocator;
045 import org.kuali.rice.kim.util.KimConstants;
046 import org.kuali.rice.kns.bo.Inactivateable;
047 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
048 import org.kuali.rice.kns.service.KualiConfigurationService;
049 import org.kuali.rice.kns.service.KualiModuleService;
050 import org.kuali.rice.kns.util.KNSConstants;
051 import org.kuali.rice.kns.util.KualiDecimal;
052 import org.kuali.rice.kns.util.TypedArrayList;
053 import org.kuali.rice.kns.web.comparator.StringValueComparator;
054
055 /**
056 * @author Kuali Rice Team (kuali-rice@googlegroups.com)
057 */
058 public class OrgReviewRole extends PersistableBusinessObjectBase implements Inactivateable {
059 protected static final String ORR_INQUIRY_TITLE_PROPERTY = "message.inquiry.org.review.role.title";
060 protected static String INQUIRY_TITLE_VALUE = null;
061
062 //Dummy variable
063 protected String organizationTypeCode = "99";
064 private static final long serialVersionUID = 1L;
065
066 public static final String REVIEW_ROLES_INDICATOR_FIELD_NAME = "reviewRolesIndicator";
067 public static final String ROLE_NAME_FIELD_NAMESPACE_CODE = "roleMemberRoleNamespaceCode";
068 public static final String ROLE_NAME_FIELD_NAME = "roleMemberRoleName";
069 public static final String GROUP_NAME_FIELD_NAMESPACE_CODE = "groupMemberGroupNamespaceCode";
070 public static final String GROUP_NAME_FIELD_NAME = "groupMemberGroupName";
071 public static final String PRINCIPAL_NAME_FIELD_NAME = "principalMemberPrincipalName";
072 public static final String CHART_CODE_FIELD_NAME = "chartOfAccountsCode";
073 public static final String ORG_CODE_FIELD_NAME = "organizationCode";
074 public static final String DOC_TYPE_NAME_FIELD_NAME = "financialSystemDocumentTypeCode";
075 public static final String DELEGATE_FIELD_NAME = "delegate";
076 public static final String DELEGATION_TYPE_CODE = "delegationTypeCode";
077 public static final String FROM_AMOUNT_FIELD_NAME = "fromAmount";
078 public static final String TO_AMOUNT_FIELD_NAME = "toAmount";
079 public static final String OVERRIDE_CODE_FIELD_NAME = "overrideCode";
080 public static final String ACTION_TYPE_CODE_FIELD_NAME = "actionTypeCode";
081 public static final String PRIORITY_CODE_FIELD_NAME = "priorityNumber";
082 public static final String ACTION_POLICY_CODE_FIELD_NAME = "actionPolicyCode";
083 public static final String FORCE_ACTION_FIELD_NAME = "forceAction";
084
085 public static final String ORIGINAL_DELEGATION_MEMBER_ID_TO_MODIFY = "ODelMId";
086 public static final String ORIGINAL_ROLE_MEMBER_ID_TO_MODIFY = "ORMId";
087
088 public static final String NEW_DELEGATION_ID_KEY_VALUE = "New";
089
090 String methodToCall;
091 protected String kimTypeId;
092
093 protected String orgReviewRoleMemberId;
094 protected Chart chart = new Chart();
095 protected Organization organization = new Organization();
096 private boolean edit;
097 private boolean copy;
098
099 protected DelegateTypeInfo delegation = new DelegateTypeInfo();
100 protected DelegateMemberCompleteInfo delegationMemberRole = new DelegateMemberCompleteInfo();
101 protected DelegateMemberCompleteInfo delegationMemberGroup = new DelegateMemberCompleteInfo();
102 protected DelegateMemberCompleteInfo delegationMemberPerson = new DelegateMemberCompleteInfo();
103
104 protected RoleMemberCompleteInfo memberRole = new RoleMemberCompleteInfo();
105 protected RoleMemberCompleteInfo memberGroup = new RoleMemberCompleteInfo();
106 protected RoleMemberCompleteInfo memberPerson = new RoleMemberCompleteInfo();
107
108 protected Role role;
109 protected Group group;
110 protected Person person;
111
112 protected List<KfsKimDocumentAttributeData> attributes = new TypedArrayList(KfsKimDocumentAttributeData.class);
113 protected List<RoleResponsibilityActionInfo> roleRspActions = new TypedArrayList(RoleResponsibilityActionInfo.class);
114
115 //Identifying information for the 3 kinds of role members this document caters to
116 protected String roleMemberRoleId;
117 protected String roleMemberRoleNamespaceCode;
118 protected String roleMemberRoleName;
119
120 protected String groupMemberGroupId;
121 protected String groupMemberGroupNamespaceCode;
122 protected String groupMemberGroupName;
123
124 protected String principalMemberPrincipalId;
125 protected String principalMemberPrincipalName;
126
127 //The role id this object corresponds to
128 protected String roleId;
129 protected String namespaceCode;
130 protected String roleName;
131
132 //Identifying information for a single member (of any type)
133 protected String memberId;
134 protected String memberTypeCode;
135 protected String memberName;
136 protected String memberNamespaceCode;
137
138 //In case the document is dealing with delegations
139 protected String delegationTypeCode;
140
141 protected String delegationMemberId;
142 protected String roleMemberId;
143
144 protected String oDelMId;
145 protected String oRMId;
146
147 protected String financialSystemDocumentTypeCode;
148 protected DocumentTypeEBO financialSystemDocumentType;
149 protected List<String> roleNamesToConsider;
150 private String reviewRolesIndicator;
151
152 protected String actionTypeCode;
153 protected String priorityNumber;
154 protected String actionPolicyCode;
155 protected boolean forceAction;
156 protected String chartOfAccountsCode;
157 protected String organizationCode;
158 protected KualiDecimal fromAmount;
159 protected KualiDecimal toAmount;
160 protected String overrideCode;
161 protected boolean active = true;
162 protected boolean delegate;
163
164 protected Date activeFromDate;
165 protected Date activeToDate;
166
167 public String getReportsToChartOfAccountsCode() {
168 return organization.getReportsToChartOfAccountsCode();
169 }
170 public String getReportsToOrganizationCode() {
171
172 return organization.getReportsToOrganizationCode();
173 }
174 /**
175 * Gets the active attribute.
176 * @return Returns the active.
177 */
178 public boolean isActive() {
179 return active;
180 }
181 /**
182 * Sets the active attribute value.
183 * @param active The active to set.
184 */
185 public void setActive(boolean active) {
186 this.active = active;
187 }
188 /**
189 * Gets the delegate attribute.
190 * @return Returns the delegate.
191 */
192 public boolean isDelegate() {
193 return delegate;
194 }
195 /**
196 * Sets the delegate attribute value.
197 * @param delegate The delegate to set.
198 */
199 public void setDelegate(boolean delegate) {
200 this.delegate = delegate;
201 }
202 /**
203 * Gets the chart attribute.
204 * @return Returns the chart.
205 */
206 public Chart getChart() {
207 return chart;
208 }
209 /**
210 * Sets the chart attribute value.
211 * @param chart The chart to set.
212 */
213 public void setChart(Chart chart) {
214 this.chart = chart;
215 }
216 /**
217 * Gets the delegation attribute.
218 * @return Returns the delegation.
219 */
220 public DelegateTypeInfo getDelegation() {
221 return delegation;
222 }
223 /**
224 * Sets the delegation attribute value.
225 * @param delegation The delegation to set.
226 */
227 public void setDelegation(DelegateTypeInfo delegation) {
228 this.delegation = delegation;
229 }
230 /**
231 * Gets the groupMemberGroupId attribute.
232 * @return Returns the groupMemberGroupId.
233 */
234 public String getGroupMemberGroupId() {
235 return groupMemberGroupId;
236 }
237 /**
238 * Sets the groupMemberGroupId attribute value.
239 * @param groupMemberGroupId The groupMemberGroupId to set.
240 */
241 public void setGroupMemberGroupId(String groupMemberGroupId) {
242 this.groupMemberGroupId = groupMemberGroupId;
243 memberGroup.setMemberId(groupMemberGroupId);
244 delegationMemberGroup.setMemberId(groupMemberGroupId);
245 }
246 /**
247 * Gets the groupMemberGroupName attribute.
248 * @return Returns the groupMemberGroupName.
249 */
250 public String getGroupMemberGroupName() {
251 return groupMemberGroupName;
252 }
253 /**
254 * Sets the groupMemberGroupName attribute value.
255 * @param groupMemberGroupName The groupMemberGroupName to set.
256 */
257 public void setGroupMemberGroupName(String groupMemberGroupName) {
258 this.groupMemberGroupName = groupMemberGroupName;
259 memberGroup.setMemberName(groupMemberGroupName);
260 delegationMemberGroup.setMemberName(groupMemberGroupName);
261 }
262 /**
263 * Gets the groupMemberGroupNamespaceCode attribute.
264 * @return Returns the groupMemberGroupNamespaceCode.
265 */
266 public String getGroupMemberGroupNamespaceCode() {
267 return groupMemberGroupNamespaceCode;
268 }
269 /**
270 * Sets the groupMemberGroupNamespaceCode attribute value.
271 * @param groupMemberGroupNamespaceCode The groupMemberGroupNamespaceCode to set.
272 */
273 public void setGroupMemberGroupNamespaceCode(String groupMemberGroupNamespaceCode) {
274 this.groupMemberGroupNamespaceCode = groupMemberGroupNamespaceCode;
275 memberGroup.setMemberNamespaceCode(groupMemberGroupNamespaceCode);
276 delegationMemberGroup.setMemberNamespaceCode(groupMemberGroupNamespaceCode);
277 }
278 /**
279 * Gets the principalMemberPrincipalId attribute.
280 * @return Returns the principalMemberPrincipalId.
281 */
282 public String getPrincipalMemberPrincipalId() {
283 return principalMemberPrincipalId;
284 }
285 /**
286 * Sets the principalMemberPrincipalId attribute value.
287 * @param principalMemberPrincipalId The principalMemberPrincipalId to set.
288 */
289 public void setPrincipalMemberPrincipalId(String principalMemberPrincipalId) {
290 this.principalMemberPrincipalId = principalMemberPrincipalId;
291 memberPerson.setMemberId(principalMemberPrincipalId);
292 delegationMemberPerson.setMemberId(principalMemberPrincipalId);
293 }
294 /**
295 * Gets the principalMemberPrincipalName attribute.
296 * @return Returns the principalMemberPrincipalName.
297 */
298 public String getPrincipalMemberPrincipalName() {
299 return principalMemberPrincipalName;
300 }
301 /**
302 * Sets the principalMemberPrincipalName attribute value.
303 * @param principalMemberPrincipalName The principalMemberPrincipalName to set.
304 */
305 public void setPrincipalMemberPrincipalName(String principalMemberPrincipalName) {
306 this.principalMemberPrincipalName = principalMemberPrincipalName;
307 memberPerson.setMemberName(principalMemberPrincipalName);
308 delegationMemberPerson.setMemberName(principalMemberPrincipalName);
309 }
310 /**
311 * Gets the roleMemberRoleId attribute.
312 * @return Returns the roleMemberRoleId.
313 */
314 public String getRoleMemberRoleId() {
315 return roleMemberRoleId;
316 }
317 /**
318 * Sets the roleMemberRoleId attribute value.
319 * @param roleMemberRoleId The roleMemberRoleId to set.
320 */
321 public void setRoleMemberRoleId(String roleMemberRoleId) {
322 this.roleMemberRoleId = roleMemberRoleId;
323 memberRole.setMemberId(roleMemberRoleId);
324 delegationMemberRole.setMemberId(roleMemberRoleId);
325 }
326 /**
327 * Gets the roleMemberRoleName attribute.
328 * @return Returns the roleMemberRoleName.
329 */
330 public String getRoleMemberRoleName() {
331 return roleMemberRoleName;
332 }
333 /**
334 * Sets the roleMemberRoleName attribute value.
335 * @param roleMemberRoleName The roleMemberRoleName to set.
336 */
337 public void setRoleMemberRoleName(String roleMemberRoleName) {
338 this.roleMemberRoleName = roleMemberRoleName;
339 memberRole.setMemberName(roleMemberRoleName);
340 delegationMemberRole.setMemberName(roleMemberRoleName);
341 }
342 /**
343 * Gets the roleMemberRoleNamespaceCode attribute.
344 * @return Returns the roleMemberRoleNamespaceCode.
345 */
346 public String getRoleMemberRoleNamespaceCode() {
347 return roleMemberRoleNamespaceCode;
348 }
349 /**
350 * Sets the roleMemberRoleNamespaceCode attribute value.
351 * @param roleMemberRoleNamespaceCode The roleMemberRoleNamespaceCode to set.
352 */
353 public void setRoleMemberRoleNamespaceCode(String roleMemberRoleNamespaceCode) {
354 this.roleMemberRoleNamespaceCode = roleMemberRoleNamespaceCode;
355 memberRole.setMemberNamespaceCode(roleMemberRoleNamespaceCode);
356 delegationMemberRole.setMemberNamespaceCode(roleMemberRoleNamespaceCode);
357 }
358 /**
359 * Gets the organization attribute.
360 * @return Returns the organization.
361 */
362 public Organization getOrganization() {
363 return organization;
364 }
365 /**
366 * Sets the organization attribute value.
367 * @param organization The organization to set.
368 */
369 public void setOrganization(Organization organization) {
370 this.organization = organization;
371 }
372 private void updateAttributeValue(String attributeName, String attributeValue){
373 if(StringUtils.isNotEmpty(attributeName)){
374 KfsKimDocumentAttributeData attributeData = getAttribute(attributeName);
375 if(attributeData==null){
376 attributeData = new KfsKimDocumentAttributeData();
377 KimTypeAttributeInfo attribute = new KimTypeAttributeInfo();
378 attribute.setAttributeName(attributeName);
379 attributeData.setKimAttribute(attribute);
380 attributeData.setAttrVal(attributeValue);
381 attributes.add(attributeData);
382 } else
383 attributeData.setAttrVal(attributeValue);
384 }
385 }
386 /**
387 * Gets the overrideCode attribute.
388 * @return Returns the overrideCode.
389 */
390 public String getOverrideCode() {
391 return this.overrideCode;
392 }
393 /**
394 * Sets the overrideCode attribute value.
395 * @param overrideCode The overrideCode to set.
396 */
397 public void setOverrideCode(String overrideCode) {
398 //updateAttributeValue(KfsKimAttributes.ACCOUNTING_LINE_OVERRIDE_CODE, overrideCode);
399 this.overrideCode = overrideCode;
400 }
401 /**
402 * Gets the fromAmount attribute.
403 * @return Returns the fromAmount.
404 */
405 public KualiDecimal getFromAmount() {
406 return fromAmount;
407 }
408
409 public String getFromAmountStr() {
410 return fromAmount==null?null:fromAmount.toString();
411 }
412
413 /**
414 * Sets the fromAmount attribute value.
415 * @param fromAmount The fromAmount to set.
416 */
417 public void setFromAmount(KualiDecimal fromAmount) {
418 this.fromAmount = fromAmount;
419 }
420
421 public void setFromAmount(String fromAmount) {
422 if(StringUtils.isNotEmpty(fromAmount))
423 this.fromAmount = new KualiDecimal(fromAmount);
424 else
425 this.fromAmount = null;
426 }
427
428 /**
429 * Gets the toAmount attribute.
430 * @return Returns the toAmount.
431 */
432 public KualiDecimal getToAmount() {
433 return toAmount;
434 }
435
436 public String getToAmountStr() {
437 return toAmount==null?null:toAmount.toString();
438 }
439
440 /**
441 * Sets the toAmount attribute value.
442 * @param toAmount The toAmount to set.
443 */
444 public void setToAmount(KualiDecimal toAmount) {
445 this.toAmount = toAmount;
446 }
447
448 public void setToAmount(String toAmount) {
449 if(StringUtils.isNotEmpty(toAmount))
450 this.toAmount = new KualiDecimal(toAmount);
451 else
452 this.toAmount = null;
453 }
454
455 /**
456 * Gets the memberName attribute.
457 * @return Returns the memberName.
458 */
459 public String getMemberName() {
460 return memberName;
461 }
462 /**
463 * Sets the memberName attribute value.
464 * @param memberName The memberName to set.
465 */
466 public void setMemberName(String memberName) {
467 this.memberName = memberName;
468 }
469 /**
470 * Gets the activeFromDate attribute.
471 * @return Returns the activeFromDate.
472 */
473 public Date getActiveFromDate() {
474 return activeFromDate;
475 }
476 /**
477 * Sets the activeFromDate attribute value.
478 * @param activeFromDate The activeFromDate to set.
479 */
480 public void setActiveFromDate(java.util.Date activeFromDate) {
481 if ( activeFromDate != null ) {
482 this.activeFromDate = new java.sql.Date( activeFromDate.getTime() );
483 } else {
484 this.activeFromDate = null;
485 }
486 }
487 public void setActiveFromDate(java.sql.Date activeFromDate) {
488 this.activeFromDate = activeFromDate;
489 }
490 /**
491 * Gets the activeToDate attribute.
492 * @return Returns the activeToDate.
493 */
494 public Date getActiveToDate() {
495 return activeToDate;
496 }
497 /**
498 * Sets the activeToDate attribute value.
499 * @param activeToDate The activeToDate to set.
500 */
501 public void setActiveToDate(java.util.Date activeToDate) {
502 if ( activeToDate != null ) {
503 this.activeToDate = new java.sql.Date( activeToDate.getTime() );
504 } else {
505 this.activeToDate = null;
506 }
507 }
508 public void setActiveToDate(java.sql.Date activeToDate) {
509 this.activeToDate = activeToDate;
510 }
511 /**
512 * Gets the orgReviewRoleMemberId attribute.
513 * @return Returns the orgReviewRoleMemberId.
514 */
515 public String getOrgReviewRoleMemberId() {
516 return orgReviewRoleMemberId;
517 }
518 /**
519 * Sets the orgReviewRoleMemberId attribute value.
520 * @param orgReviewRoleMemberId The orgReviewRoleMemberId to set.
521 */
522 public void setOrgReviewRoleMemberId(String orgReviewRoleMemberId) {
523 this.orgReviewRoleMemberId = orgReviewRoleMemberId;
524 }
525
526 public void refresh(){
527
528 }
529
530 /**
531 * Gets the financialSystemDocumentTypeCode attribute.
532 * @return Returns the financialSystemDocumentTypeCode.
533 */
534 public DocumentTypeEBO getFinancialSystemDocumentType() {
535 return financialSystemDocumentType = SpringContext.getBean(KEWModuleService.class).retrieveExternalizableBusinessObjectIfNecessary(this, financialSystemDocumentType, "financialSystemDocumentType");
536 }
537
538 /**
539 * Gets the financialDocumentTypeCode attribute.
540 * @return Returns the financialDocumentTypeCode.
541 */
542 public String getFinancialSystemDocumentTypeCode() {
543 return financialSystemDocumentTypeCode;
544 }
545 /**
546 * Sets the financialDocumentTypeCode attribute value.
547 * @param financialDocumentTypeCode The financialDocumentTypeCode to set.
548 */
549 public void setFinancialSystemDocumentTypeCode(String financialSystemDocumentTypeCode) {
550 String oldFinancialSystemDocumentTypeCode = this.financialSystemDocumentTypeCode;
551 boolean isChanged = false;
552 if(StringValueComparator.getInstance().compare(this.financialSystemDocumentTypeCode, financialSystemDocumentTypeCode)!=0){
553 isChanged = true;
554 }
555 this.financialSystemDocumentTypeCode = financialSystemDocumentTypeCode;
556 setRoleNamesAndReviewIndicator(isChanged);
557 }
558
559 private void setRoleNamesAndReviewIndicator(boolean hasFinancialSystemDocumentTypeCodeChanged){
560 if(hasFinancialSystemDocumentTypeCodeChanged){
561 //If role id is populated role names to consider have already been narrowed down
562 if(StringUtils.isNotEmpty(getRoleId()) && StringUtils.isNotEmpty(getRoleName())){
563 List<String> narrowedDownRoleNames = new ArrayList<String>();
564 narrowedDownRoleNames.add(getRoleName());
565 setRoleNamesToConsider(roleNamesToConsider);
566 } else{
567 setRoleNamesToConsider();
568 }
569 if(isBothReviewRolesIndicator())
570 setReviewRolesIndicatorOnDocTypeChange(KFSConstants.COAConstants.ORG_REVIEW_ROLE_ORG_ACC_BOTH_CODE);
571 else if(isAccountingOrgReviewRoleIndicator())
572 setReviewRolesIndicatorOnDocTypeChange(KFSConstants.COAConstants.ORG_REVIEW_ROLE_ORG_ACC_ONLY_CODE);
573 else if(isOrgReviewRoleIndicator())
574 setReviewRolesIndicatorOnDocTypeChange(KFSConstants.COAConstants.ORG_REVIEW_ROLE_ORG_ONLY_CODE);
575
576 }
577
578 }
579
580 /**
581 * Sets the financialSystemDocumentTypeCode attribute value.
582 * @param financialSystemDocumentTypeCode The financialSystemDocumentTypeCode to set.
583 */
584 public void setFinancialSystemDocumentType(DocumentTypeEBO financialSystemDocumentType) {
585 this.financialSystemDocumentType = financialSystemDocumentType;
586 }
587 /**
588 * Gets the delegationTypeCode attribute.
589 * @return Returns the delegationTypeCode.
590 */
591 public String getDelegationTypeCode() {
592 return delegationTypeCode;
593 }
594
595 public String getDelegationTypeCodeDescription() {
596 return KimConstants.KimUIConstants.DELEGATION_TYPES.get(delegationTypeCode);
597 }
598
599 /**
600 * Sets the delegationTypeCode attribute value.
601 * @param delegationTypeCode The delegationTypeCode to set.
602 */
603 public void setDelegationTypeCode(String delegationTypeCode) {
604 this.delegationTypeCode = delegationTypeCode;
605 }
606 /**
607 * Gets the memberNamespaceCode attribute.
608 * @return Returns the memberNamespaceCode.
609 */
610 public String getMemberNamespaceCode() {
611 return memberNamespaceCode;
612 }
613 /**
614 * Sets the memberNamespaceCode attribute value.
615 * @param memberNamespaceCode The memberNamespaceCode to set.
616 */
617 public void setMemberNamespaceCode(String memberNamespaceCode) {
618 this.memberNamespaceCode = memberNamespaceCode;
619 }
620 /**
621 * Gets the memberTypeCode attribute.
622 * @return Returns the memberTypeCode.
623 */
624 public String getMemberTypeCodeDescription() {
625 return KimConstants.KimUIConstants.KIM_MEMBER_TYPES_MAP.get(memberTypeCode);
626 }
627 /**
628 * Sets the memberTypeCode attribute value.
629 * @param memberTypeCode The memberTypeCode to set.
630 */
631 public void setMemberTypeCode(String memberTypeCode) {
632 this.memberTypeCode = memberTypeCode;
633 }
634 /**
635 * Sets the memberId attribute value.
636 * @param memberId The memberId to set.
637 */
638 public void setMemberId(String memberId) {
639 this.memberId = memberId;
640 }
641 /**
642 * Gets the attributes attribute.
643 * @return Returns the attributes.
644 */
645 public List<KfsKimDocumentAttributeData> getAttributes() {
646 return attributes;
647 }
648 /**
649 * Sets the attributes attribute value.
650 * @param attributes The attributes to set.
651 */
652 public void setAttributes(List<KfsKimDocumentAttributeData> attributes) {
653 this.attributes = attributes;
654 }
655
656 public String getAttributeValue(String attributeName){
657 String attributeValue = "";
658 if(StringUtils.isEmpty(attributeName))
659 attributeValue = "";
660 KfsKimDocumentAttributeData attributeData = getAttribute(attributeName);
661 return attributeData==null?"":attributeData.getAttrVal();
662 }
663
664 private KfsKimDocumentAttributeData getAttribute(String attributeName){
665 KfsKimDocumentAttributeData attributeData = null;
666 if(StringUtils.isNotEmpty(attributeName))
667 for(KfsKimDocumentAttributeData attribute: attributes){
668 if(attribute.getKimAttribute()!=null && attribute.getKimAttribute().getAttributeName()!=null &&
669 attribute.getKimAttribute().getAttributeName().equals(attributeName)){
670 attributeData = attribute;
671 break;
672 }
673 }
674 return attributeData;
675 }
676
677 /**
678 * Gets the chartCode attribute.
679 * @return Returns the chartCode.
680 */
681 public String getChartOfAccountsCode() {
682 return this.chartOfAccountsCode;
683 }
684 /**
685 * Gets the organizationCode attribute.
686 * @return Returns the organizationCode.
687 */
688 public String getOrganizationCode() {
689 return this.organizationCode;
690 }
691 /**
692 * Sets the organizationCode attribute value.
693 * @param organizationCode The organizationCode to set.
694 */
695 public void setOrganizationCode(String organizationCode) {
696 this.organizationCode = organizationCode;
697 }
698 /**
699 * Sets the chartOfAccountsCode attribute value.
700 * @param chartOfAccountsCode The chartOfAccountsCode to set.
701 */
702 public void setChartOfAccountsCode(String chartOfAccountsCode) {
703 this.chartOfAccountsCode = chartOfAccountsCode;
704 }
705 /**
706 * Gets the roleNamesToConsider attribute.
707 * @return Returns the roleNamesToConsider.
708 */
709 public List<String> getRoleNamesToConsider() {
710 if(roleNamesToConsider==null && getFinancialSystemDocumentTypeCode()!=null)
711 setRoleNamesToConsider();
712 return roleNamesToConsider;
713 }
714 public void setRoleNamesToConsider(List<String> narrowedDownRoleNames) {
715 roleNamesToConsider = new ArrayList<String>();
716 roleNamesToConsider.addAll(narrowedDownRoleNames);
717 }
718 /**
719 * Sets the roleNamesToConsider attribute value.
720 * @param roleNamesToConsider The roleNamesToConsider to set.
721 */
722 public void setRoleNamesToConsider() {
723 OrgReviewRoleLookupableHelperServiceImpl orrLHSI = new OrgReviewRoleLookupableHelperServiceImpl();
724 roleNamesToConsider = orrLHSI.getRolesToConsider(getFinancialSystemDocumentTypeCode());
725 }
726 /**
727 * Gets the accountingOrgReviewRoleIndicator attribute.
728 * @return Returns the accountingOrgReviewRoleIndicator.
729 */
730 public boolean isAccountingOrgReviewRoleIndicator() {
731 return getRoleNamesToConsider()!=null &&
732 getRoleNamesToConsider().contains(KFSConstants.SysKimConstants.ACCOUNTING_REVIEWER_ROLE_NAME);
733 }
734 /**
735 * Gets the bothReviewRolesIndicator attribute.
736 * @return Returns the bothReviewRolesIndicator.
737 */
738 public boolean isBothReviewRolesIndicator() {
739 return getRoleNamesToConsider()!=null &&
740 getRoleNamesToConsider().contains(KFSConstants.SysKimConstants.ORGANIZATION_REVIEWER_ROLE_NAME) &&
741 getRoleNamesToConsider().contains(KFSConstants.SysKimConstants.ACCOUNTING_REVIEWER_ROLE_NAME);
742 }
743 /**
744 * Gets the orgReviewRoleIndicator attribute.
745 * @return Returns the orgReviewRoleIndicator.
746 */
747 public boolean isOrgReviewRoleIndicator() {
748 return getRoleNamesToConsider()!=null &&
749 getRoleNamesToConsider().contains(KFSConstants.SysKimConstants.ORGANIZATION_REVIEWER_ROLE_NAME);
750 }
751 /**
752 * Gets the actionTypeCode attribute.
753 * @return Returns the actionTypeCode.
754 */
755 public String getActionTypeCode() {
756 /*if(StringUtils.isNotEmpty(actionTypeCode) && (roleRspActions==null || roleRspActions.size()<1 || StringUtils.isEmpty(roleRspActions.get(0).getActionTypeCode()))){
757 setActionTypeCode(actionTypeCode);
758 }
759 if(roleRspActions==null || roleRspActions.size()<1)
760 actionTypeCode = "";
761 else
762 actionTypeCode = roleRspActions.get(0).getActionTypeCode();
763 */
764 return actionTypeCode;
765 }
766
767 public String getActionTypeCodeToDisplay() {
768 if(roleRspActions==null || roleRspActions.size()<1)
769 return "";
770 else
771 return roleRspActions.get(0).getActionTypeCode();
772 }
773
774 /**
775 *
776 * This method fore readonlyalterdisplay
777 *
778 * @return
779 */
780 public String getActionTypeCodeDescription() {
781 String actionTypeCodeDesc = (String)CodeTranslator.arLabels.get(getActionTypeCodeToDisplay());
782 return actionTypeCodeDesc==null?"":actionTypeCodeDesc;
783 }
784
785 /**
786 * Sets the actionTypeCode attribute value.
787 * @param actionTypeCode The actionTypeCode to set.
788 */
789 public void setActionTypeCode(String actionTypeCode) {
790 /*if(roleRspActions==null || roleRspActions.size()<1){
791 KfsKimDocumentRoleResponsibilityAction roleRespAction = new KfsKimDocumentRoleResponsibilityAction();
792 roleRespAction.setActionTypeCode(actionTypeCode);
793 roleRspActions.add(roleRespAction);
794 } else{
795 roleRspActions.get(0).setActionTypeCode(actionTypeCode);
796 }*/
797 this.actionTypeCode = actionTypeCode;
798 }
799 /**
800 * Gets the priorityNumber attribute.
801 * @return Returns the priorityNumber.
802 */
803 public String getPriorityNumber() {
804 return priorityNumber;
805 }
806
807 public String getPriorityNumberToDisplay() {
808 if(roleRspActions==null || roleRspActions.size()<1)
809 return "";
810 else
811 return roleRspActions.get(0).getPriorityNumber()==null?"":roleRspActions.get(0).getPriorityNumber()+"";
812 }
813
814 /**
815 * Sets the priorityNumber attribute value.
816 * @param priorityNumber The priorityNumber to set.
817 */
818 public void setPriorityNumber(String priorityNumber) {
819 this.priorityNumber = priorityNumber;
820 }
821 /**
822 * Gets the actionPolicyCode attribute.
823 * @return Returns the actionPolicyCode.
824 */
825 public String getActionPolicyCode() {
826 return actionPolicyCode;
827 }
828 /**
829 * Sets the actionPolicyCode attribute value.
830 * @param actionPolicyCode The actionPolicyCode to set.
831 */
832 public void setActionPolicyCode(String actionPolicyCode) {
833 this.actionPolicyCode = actionPolicyCode;
834 }
835 /**
836 * Gets the ignorePrevious attribute.
837 * @return Returns the ignorePrevious.
838 */
839 public boolean isForceAction() {
840 return forceAction;
841 }
842 /**
843 * Sets the ignorePrevious attribute value.
844 * @param ignorePrevious The ignorePrevious to set.
845 */
846 public void setForceAction(boolean forceAction) {
847 this.forceAction = forceAction;
848 }
849
850 /**
851 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
852 */
853 protected LinkedHashMap toStringMapper() {
854 LinkedHashMap m = new LinkedHashMap();
855
856 m.put("chartOfAccountsCode", this.chartOfAccountsCode);
857 m.put("organizationCode", this.organizationCode);
858
859 return m;
860 }
861 /**
862 * Gets the roleId attribute.
863 * @return Returns the roleId.
864 */
865 public String getRoleId() {
866 return roleId;
867 }
868 /**
869 * Sets the roleId attribute value.
870 * @param roleId The roleId to set.
871 */
872 public void setRoleId(String roleId) {
873 this.roleId = roleId;
874 }
875 /**
876 * Gets the reviewRolesIndicator attribute.
877 * @return Returns the reviewRolesIndicator.
878 */
879 public String getReviewRolesIndicator() {
880 return reviewRolesIndicator;
881 }
882 /**
883 * Sets the reviewRolesIndicator attribute value.
884 * @param reviewRolesIndicator The reviewRolesIndicator to set.
885 */
886 public void setReviewRolesIndicator(String reviewRolesIndicator) {
887 this.reviewRolesIndicator = reviewRolesIndicator;
888 }
889 /**
890 * Sets the reviewRolesIndicator attribute value.
891 * @param reviewRolesIndicator The reviewRolesIndicator to set.
892 */
893 private void setReviewRolesIndicatorOnDocTypeChange(String reviewRolesIndicator) {
894 this.reviewRolesIndicator = reviewRolesIndicator;
895 }
896
897
898 public boolean hasRole(){
899 return StringUtils.isNotEmpty(roleMemberRoleNamespaceCode) && StringUtils.isNotEmpty(roleMemberRoleName);
900 }
901
902 public boolean hasGroup(){
903 return StringUtils.isNotEmpty(groupMemberGroupNamespaceCode) && StringUtils.isNotEmpty(groupMemberGroupName);
904 }
905
906 public boolean hasPrincipal(){
907 return StringUtils.isNotEmpty(principalMemberPrincipalName);
908 }
909
910 public boolean hasAnyMember(){
911 return hasRole() || hasGroup() || hasPrincipal();
912 }
913
914 public DelegateMemberCompleteInfo getDelegationMemberOfType(String memberTypeCode){
915 if(KimConstants.KimUIConstants.MEMBER_TYPE_ROLE_CODE.equals(memberTypeCode)){
916 delegationMemberRole.setMemberId(roleMemberRoleId);
917 delegationMemberRole.setMemberName(roleMemberRoleName);
918 delegationMemberRole.setMemberNamespaceCode(roleMemberRoleNamespaceCode);
919 delegationMemberRole.setRoleMemberId(roleMemberId);
920 return delegationMemberRole;
921 } else if(KimConstants.KimUIConstants.MEMBER_TYPE_GROUP_CODE.equals(memberTypeCode)){
922 delegationMemberGroup.setMemberId(groupMemberGroupId);
923 delegationMemberGroup.setMemberName(groupMemberGroupName);
924 delegationMemberGroup.setMemberNamespaceCode(groupMemberGroupNamespaceCode);
925 delegationMemberRole.setRoleMemberId(roleMemberId);
926 return delegationMemberGroup;
927 } else if(KimConstants.KimUIConstants.MEMBER_TYPE_PRINCIPAL_CODE.equals(memberTypeCode)){
928 delegationMemberPerson.setMemberId(principalMemberPrincipalId);
929 delegationMemberPerson.setMemberName(principalMemberPrincipalName);
930 delegationMemberRole.setRoleMemberId(roleMemberId);
931 return delegationMemberPerson;
932 }
933 return null;
934 }
935
936 public RoleMemberCompleteInfo getRoleMemberOfType(String memberTypeCode){
937 if(KimConstants.KimUIConstants.MEMBER_TYPE_ROLE_CODE.equals(memberTypeCode)){
938 memberRole.setMemberId(roleMemberRoleId);
939 memberRole.setMemberName(roleMemberRoleName);
940 memberRole.setMemberNamespaceCode(roleMemberRoleNamespaceCode);
941 return memberRole;
942 } else if(KimConstants.KimUIConstants.MEMBER_TYPE_GROUP_CODE.equals(memberTypeCode)){
943 memberGroup.setMemberId(groupMemberGroupId);
944 memberGroup.setMemberName(groupMemberGroupName);
945 memberGroup.setMemberNamespaceCode(groupMemberGroupNamespaceCode);
946 return memberGroup;
947 } else if(KimConstants.KimUIConstants.MEMBER_TYPE_PRINCIPAL_CODE.equals(memberTypeCode)){
948 memberPerson.setMemberId(principalMemberPrincipalId);
949 memberPerson.setMemberName(principalMemberPrincipalName);
950 return memberPerson;
951 }
952 return null;
953 }
954
955 public String getMemberIdForDelegationMember(String memberTypeCode){
956 DelegateMemberCompleteInfo member = getDelegationMemberOfType(memberTypeCode);
957 return member!=null?member.getMemberId():null;
958 }
959
960 public String getMemberIdForRoleMember(String memberTypeCode){
961 RoleMemberCompleteInfo member = getRoleMemberOfType(memberTypeCode);
962 return member!=null?member.getMemberId():null;
963 }
964
965 public String getDelegationMemberFieldName(DelegateMemberCompleteInfo member){
966 String memberFieldName = "";
967 if(member!=null){
968 if(isRole(member.getMemberTypeCode()))
969 memberFieldName = OrgReviewRole.ROLE_NAME_FIELD_NAME;
970 else if(isGroup(member.getMemberTypeCode()))
971 memberFieldName = OrgReviewRole.GROUP_NAME_FIELD_NAME;
972 else if(isPrincipal(member.getMemberTypeCode())){
973 memberFieldName = OrgReviewRole.PRINCIPAL_NAME_FIELD_NAME;
974 }
975 }
976 return memberFieldName;
977 }
978
979 public boolean isRole(String memberTypeCode){
980 return memberTypeCode!=null && memberTypeCode.equals(KimConstants.KimUIConstants.MEMBER_TYPE_ROLE_CODE);
981 }
982
983 public boolean isGroup(String memberTypeCode){
984 return memberTypeCode!=null && memberTypeCode.equals(KimConstants.KimUIConstants.MEMBER_TYPE_GROUP_CODE);
985 }
986
987 public boolean isPrincipal(String memberTypeCode){
988 return memberTypeCode!=null && memberTypeCode.equals(KimConstants.KimUIConstants.MEMBER_TYPE_PRINCIPAL_CODE);
989 }
990
991 public String getMemberFieldName(RoleMemberCompleteInfo member){
992 String memberFieldName = "";
993 if(member!=null){
994 if(isRole(member.getMemberTypeCode()))
995 memberFieldName = OrgReviewRole.ROLE_NAME_FIELD_NAME;
996 else if(isGroup(member.getMemberTypeCode()))
997 memberFieldName = OrgReviewRole.GROUP_NAME_FIELD_NAME;
998 else if(isPrincipal(member.getMemberTypeCode())){
999 memberFieldName = OrgReviewRole.PRINCIPAL_NAME_FIELD_NAME;
1000 }
1001 }
1002 return memberFieldName;
1003 }
1004 /**
1005 * Gets the memberId attribute.
1006 * @return Returns the memberId.
1007 */
1008 public String getMemberId() {
1009 return memberId;
1010 }
1011 /**
1012 * Gets the memberTypeCode attribute.
1013 * @return Returns the memberTypeCode.
1014 */
1015 public String getMemberTypeCode() {
1016 return memberTypeCode;
1017 }
1018 /**
1019 * Gets the group attribute.
1020 * @return Returns the group.
1021 */
1022 public Group getGroup() {
1023 return group;
1024 }
1025 /**
1026 * Sets the group attribute value.
1027 * @param group The group to set.
1028 */
1029 public void setGroup(Group group) {
1030 this.group = group;
1031 }
1032 /**
1033 * Gets the person attribute.
1034 * @return Returns the person.
1035 */
1036 public Person getPerson() {
1037 if(StringUtils.isNotEmpty(principalMemberPrincipalId) &&
1038 (person==null || StringUtils.isEmpty(person.getPrincipalId()) || StringUtils.isEmpty(person.getPrincipalName()))){
1039 person = getPersonFromService(principalMemberPrincipalId);
1040 }
1041 return person;
1042 }
1043 /**
1044 * Sets the person attribute value.
1045 * @param person The person to set.
1046 */
1047 public void setPerson(Person person) {
1048 this.person = person;
1049 }
1050
1051 /**
1052 * Gets the role attribute.
1053 * @return Returns the role.
1054 */
1055 public Role getRole() {
1056 return this.role;
1057 }
1058
1059 public Role getRole(String roleId) {
1060 Map<String, Object> fieldValues = new HashMap<String, Object>();
1061 fieldValues.put(KimConstants.PrimaryKeyConstants.ROLE_ID, roleId);
1062 return (Role) SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(Role.class).getExternalizableBusinessObject(Role.class, fieldValues);
1063 }
1064
1065 public Role getRole(Map<String, Object> fieldValues) {
1066 return (Role) SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(Role.class).getExternalizableBusinessObject(Role.class, fieldValues);
1067 }
1068
1069 public Group getGroup(String groupId) {
1070 Map<String, Object> fieldValues = new HashMap<String, Object>();
1071 fieldValues.put(KimConstants.PrimaryKeyConstants.GROUP_ID, groupId);
1072 return (Group) SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(Group.class).getExternalizableBusinessObject(Group.class, fieldValues);
1073 }
1074
1075 public Group getGroup(Map<String, Object> fieldValues) {
1076 return (Group) SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(Group.class).getExternalizableBusinessObject(Group.class, fieldValues);
1077 }
1078
1079 /**
1080 * Sets the role attribute value.
1081 * @param role The role to set.
1082 */
1083 public void setRole(Role role) {
1084 this.role = role;
1085 }
1086 /**
1087 * Gets the delegationMemberGroup attribute.
1088 * @return Returns the delegationMemberGroup.
1089 */
1090 public DelegateMemberCompleteInfo getDelegationMemberGroup() {
1091 return delegationMemberGroup;
1092 }
1093 /**
1094 * Sets the delegationMemberGroup attribute value.
1095 * @param delegationMemberGroup The delegationMemberGroup to set.
1096 */
1097 public void setDelegationMemberGroup(DelegateMemberCompleteInfo delegationMemberGroup) {
1098 this.delegationMemberGroup = delegationMemberGroup;
1099 if(delegationMemberGroup!=null){
1100 Map<String, Object> fieldValues = new HashMap<String, Object>();
1101 fieldValues.put(KimConstants.PrimaryKeyConstants.GROUP_ID, memberGroup.getMemberId());
1102 Group groupInfo = getGroup(fieldValues);
1103 setGroup(groupInfo);
1104 }
1105 }
1106 /**
1107 * Gets the delegationMemberPerson attribute.
1108 * @return Returns the delegationMemberPerson.
1109 */
1110 public DelegateMemberCompleteInfo getDelegationMemberPerson() {
1111 return delegationMemberPerson;
1112 }
1113 /**
1114 * Sets the delegationMemberPerson attribute value.
1115 * @param delegationMemberPerson The delegationMemberPerson to set.
1116 */
1117 public void setDelegationMemberPerson(DelegateMemberCompleteInfo delegationMemberPerson) {
1118 this.delegationMemberPerson = delegationMemberPerson;
1119 if(delegationMemberPerson!=null){
1120 Person person = getPersonFromService(delegationMemberPerson.getMemberId());
1121 //person.setPrincipalId(delegationMemberPerson.getMemberId());
1122 //person.setPrincipalName(delegationMemberPerson.getMemberName());
1123 setPerson(person);
1124 }
1125 }
1126 /**
1127 * Gets the delegationMemberRole attribute.
1128 * @return Returns the delegationMemberRole.
1129 */
1130 public DelegateMemberCompleteInfo getDelegationMemberRole() {
1131 return delegationMemberRole;
1132 }
1133 /**
1134 * Sets the delegationMemberRole attribute value.
1135 * @param delegationMemberRole The delegationMemberRole to set.
1136 */
1137 public void setDelegationMemberRole(DelegateMemberCompleteInfo delegationMemberRole) {
1138 this.delegationMemberRole = delegationMemberRole;
1139 if(delegationMemberRole!=null){
1140 Map<String, Object> fieldValues = new HashMap<String, Object>();
1141 fieldValues.put(KimConstants.PrimaryKeyConstants.ROLE_ID, delegationMemberRole.getMemberId());
1142 Role roleInfo = getRole(fieldValues);
1143 setRole(roleInfo);
1144 }
1145 }
1146 /**
1147 * Gets the memberGroup attribute.
1148 * @return Returns the memberGroup.
1149 */
1150 public RoleMemberCompleteInfo getMemberGroup() {
1151 return memberGroup;
1152 }
1153 /**
1154 * Sets the memberGroup attribute value.
1155 * @param memberGroup The memberGroup to set.
1156 */
1157 protected void setMemberGroup(RoleMemberCompleteInfo memberGroup) {
1158 this.memberGroup = memberGroup;
1159 if(memberGroup!=null){
1160 Map<String, Object> fieldValues = new HashMap<String, Object>();
1161 fieldValues.put(KimConstants.PrimaryKeyConstants.GROUP_ID, memberGroup.getMemberId());
1162 Group groupInfo = getGroup(fieldValues);
1163 setGroup(groupInfo);
1164 }
1165 }
1166 /**
1167 * Gets the memberPerson attribute.
1168 * @return Returns the memberPerson.
1169 */
1170 public RoleMemberCompleteInfo getMemberPerson() {
1171 return memberPerson;
1172 }
1173 /**
1174 * Sets the memberPerson attribute value.
1175 * @param memberPerson The memberPerson to set.
1176 */
1177 protected void setMemberPerson(RoleMemberCompleteInfo memberPerson) {
1178 this.memberPerson = memberPerson;
1179 if(memberPerson!=null){
1180 Person personImpl = getPersonFromService(memberPerson.getMemberId());
1181 //personImpl.setPrincipalId(memberPerson.getMemberId());
1182 //personImpl.setPrincipalName(memberPerson.getMemberName());
1183 setPerson(personImpl);
1184 }
1185 }
1186 /**
1187 * Gets the memberRole attribute.
1188 * @return Returns the memberRole.
1189 */
1190 public RoleMemberCompleteInfo getMemberRole() {
1191 return memberRole;
1192 }
1193 /**
1194 * Sets the memberRole attribute value.
1195 * @param memberRole The memberRole to set.
1196 */
1197 protected void setMemberRole(RoleMemberCompleteInfo memberRole) {
1198 this.memberRole = memberRole;
1199 if(memberRole!=null){
1200 Map<String, Object> criteria = new HashMap<String, Object>();
1201 criteria.put(KimConstants.PrimaryKeyConstants.ROLE_ID, memberRole.getMemberId());
1202 Role roleInfo = getRole(criteria);
1203 setRole(roleInfo);
1204 }
1205 }
1206
1207 public void setRoleDocumentDelegationMember(DelegateMemberCompleteInfo delegationMember){
1208 if ( delegationMember != null ) {
1209 if(KimConstants.KimUIConstants.MEMBER_TYPE_ROLE_CODE.equals(delegationMember.getMemberTypeCode()))
1210 setDelegationMemberRole(delegationMember);
1211 else if(KimConstants.KimUIConstants.MEMBER_TYPE_GROUP_CODE.equals(delegationMember.getMemberTypeCode()))
1212 setDelegationMemberGroup(delegationMember);
1213 else if(KimConstants.KimUIConstants.MEMBER_TYPE_PRINCIPAL_CODE.equals(delegationMember.getMemberTypeCode()))
1214 setDelegationMemberPerson(delegationMember);
1215 setActiveFromDate(delegationMember.getActiveFromDate());
1216 setActiveToDate(delegationMember.getActiveToDate());
1217 } else {
1218 setDelegationMemberRole( new DelegateMemberCompleteInfo() );
1219 setDelegationMemberGroup( new DelegateMemberCompleteInfo() );
1220 setDelegationMemberPerson( new DelegateMemberCompleteInfo() );
1221 setActiveFromDate(null);
1222 setActiveToDate(null);
1223 }
1224 }
1225
1226 public void setKimDocumentRoleMember(RoleMemberCompleteInfo roleMember){
1227 if ( roleMember != null ) {
1228 if(KimConstants.KimUIConstants.MEMBER_TYPE_ROLE_CODE.equals(roleMember.getMemberTypeCode()))
1229 setMemberRole(roleMember);
1230 else if(KimConstants.KimUIConstants.MEMBER_TYPE_GROUP_CODE.equals(roleMember.getMemberTypeCode()))
1231 setMemberGroup(roleMember);
1232 else if(KimConstants.KimUIConstants.MEMBER_TYPE_PRINCIPAL_CODE.equals(roleMember.getMemberTypeCode()))
1233 setMemberPerson(roleMember);
1234 setActiveFromDate(roleMember.getActiveFromDate());
1235 setActiveToDate(roleMember.getActiveToDate());
1236 } else {
1237 setMemberRole( new RoleMemberCompleteInfo() );
1238 setMemberGroup( new RoleMemberCompleteInfo() );
1239 setMemberPerson( new RoleMemberCompleteInfo() );
1240 setActiveFromDate(null);
1241 setActiveToDate(null);
1242 }
1243 }
1244
1245 /**
1246 * Gets the copy attribute.
1247 * @return Returns the copy.
1248 */
1249 public boolean isCopy() {
1250 return copy || KNSConstants.MAINTENANCE_COPY_METHOD_TO_CALL.equalsIgnoreCase(methodToCall);
1251 }
1252 /**
1253 * Sets the copy attribute value.
1254 * @param copy The copy to set.
1255 */
1256 public void setCopy(boolean copy) {
1257 this.copy = copy;
1258 }
1259 /**
1260 * Gets the edit attribute.
1261 * @return Returns the edit.
1262 */
1263 public boolean isEdit() {
1264 return edit || KNSConstants.MAINTENANCE_EDIT_METHOD_TO_CALL.equalsIgnoreCase(methodToCall);
1265 }
1266 /**
1267 * Sets the edit attribute value.
1268 * @param edit The edit to set.
1269 */
1270 public void setEdit(boolean edit) {
1271 this.edit = edit;
1272 }
1273 /**
1274 * Gets the oDelMId attribute.
1275 * @return Returns the oDelMId.
1276 */
1277 public String getODelMId() {
1278 return oDelMId;
1279 }
1280 /**
1281 * Sets the oDelMId attribute value.
1282 * @param delMId The oDelMId to set.
1283 */
1284 public void setODelMId(String delMId) {
1285 oDelMId = delMId;
1286 }
1287 /**
1288 * Gets the oRMId attribute.
1289 * @return Returns the oRMId.
1290 */
1291 public String getORMId() {
1292 return oRMId;
1293 }
1294 /**
1295 * Sets the oRMId attribute value.
1296 * @param id The oRMId to set.
1297 */
1298 public void setORMId(String id) {
1299 oRMId = id;
1300 }
1301 /**
1302 * Gets the delegationMemberId attribute.
1303 * @return Returns the delegationMemberId.
1304 */
1305 public String getDelegationMemberId() {
1306 return delegationMemberId;
1307 }
1308 /**
1309 * Sets the delegationMemberId attribute value.
1310 * @param delegationMemberId The delegationMemberId to set.
1311 */
1312 public void setDelegationMemberId(String delegationMemberId) {
1313 this.delegationMemberId = delegationMemberId;
1314 }
1315 /**
1316 * Gets the roleMemberId attribute.
1317 * @return Returns the roleMemberId.
1318 */
1319 public String getRoleMemberId() {
1320 return roleMemberId;
1321 }
1322 /**
1323 * Sets the roleMemberId attribute value.
1324 * @param roleMemberId The roleMemberId to set.
1325 */
1326 public void setRoleMemberId(String roleMemberId) {
1327 this.roleMemberId = roleMemberId;
1328 }
1329 /**
1330 * Gets the methodToCall attribute.
1331 * @return Returns the methodToCall.
1332 */
1333 public String getMethodToCall() {
1334 return methodToCall;
1335 }
1336 /**
1337 * Sets the methodToCall attribute value.
1338 * @param methodToCall The methodToCall to set.
1339 */
1340 public void setMethodToCall(String methodToCall) {
1341 this.methodToCall = methodToCall;
1342 }
1343
1344 public boolean isEditDelegation(){
1345 return isEdit() && isDelegate();
1346 }
1347
1348 public boolean isEditRoleMember(){
1349 return isEdit() && !isDelegate();
1350 }
1351
1352 public boolean isCopyDelegation(){
1353 return isCopy() && isDelegate();
1354 }
1355
1356 public boolean isCopyRoleMember(){
1357 return isCopy() && !isDelegate();
1358 }
1359
1360 public boolean isCreateDelegation(){
1361 return NEW_DELEGATION_ID_KEY_VALUE.equals(getODelMId());
1362 }
1363
1364 public boolean isCreateRoleMember(){
1365 return StringUtils.isEmpty(methodToCall);
1366 }
1367
1368 /**
1369 * Gets the organizationTypeCode attribute.
1370 * @return Returns the organizationTypeCode.
1371 */
1372 public String getOrganizationTypeCode() {
1373 return "99";
1374 }
1375 /**
1376 * Sets the organizationTypeCode attribute value.
1377 * @param organizationTypeCode The organizationTypeCode to set.
1378 */
1379 public void setOrganizationTypeCode(String organizationTypeCode) {
1380 }
1381 /**
1382 * Gets the roleName attribute.
1383 * @return Returns the roleName.
1384 */
1385 public String getRoleName() {
1386 return roleName;
1387 }
1388 /**
1389 * Sets the roleName attribute value.
1390 * @param roleName The roleName to set.
1391 */
1392 public void setRoleName(String roleName) {
1393 this.roleName = roleName;
1394 setRoleNamesToConsider( Collections.singletonList(roleName) );
1395 }
1396 /**
1397 * Gets the roleNamespaceCode attribute.
1398 * @return Returns the roleNamespaceCode.
1399 */
1400 public String getNamespaceCode() {
1401 return namespaceCode;
1402 }
1403 /**
1404 * Sets the roleNamespaceCode attribute value.
1405 * @param roleNamespaceCode The roleNamespaceCode to set.
1406 */
1407 public void setNamespaceCode(String namespaceCode) {
1408 this.namespaceCode = namespaceCode;
1409 }
1410
1411 @Override
1412 public Long getVersionNumber(){
1413 return 1L;
1414 }
1415
1416 private Person getPersonFromService(String principalId){
1417 return KIMServiceLocator.getPersonService().getPerson(principalId);
1418 }
1419 /**
1420 * Gets the kimTypeId attribute.
1421 * @return Returns the kimTypeId.
1422 */
1423 public String getKimTypeId() {
1424 return kimTypeId;
1425 }
1426 /**
1427 * Sets the kimTypeId attribute value.
1428 * @param kimTypeId The kimTypeId to set.
1429 */
1430 public void setKimTypeId(String kimTypeId) {
1431 this.kimTypeId = kimTypeId;
1432 }
1433
1434 public AttributeSet getQualifierAsAttributeSet(List<KfsKimDocumentAttributeData> qualifiers) {
1435 AttributeSet m = new AttributeSet();
1436 for(KfsKimDocumentAttributeData data: qualifiers){
1437 m.put(data.getKimAttribute().getAttributeName(), data.getAttrVal());
1438 }
1439 return m;
1440 }
1441
1442 public List<KfsKimDocumentAttributeData> getAttributeSetAsQualifierList(
1443 KimTypeInfo typeInfo, AttributeSet qualifiers) {
1444 List<KfsKimDocumentAttributeData> attributesList = new ArrayList<KfsKimDocumentAttributeData>();
1445 KfsKimDocumentAttributeData attribData;
1446 KimTypeAttributeInfo attribInfo;
1447 for(String key: qualifiers.keySet()){
1448 attribInfo = typeInfo.getAttributeDefinitionByName(key);
1449 attribData = new KfsKimDocumentAttributeData();
1450 attribData.setKimAttribute(attribInfo);
1451 attribData.setKimTypId(typeInfo.getKimTypeId());
1452 attribData.setKimAttrDefnId(attribInfo.getKimAttributeId());
1453 //attribData.setAttrDataId(attrDataId) - Not Available
1454 attribData.setAttrVal(qualifiers.get(key));
1455 attributesList.add(attribData);
1456 }
1457 return attributesList;
1458 }
1459 /**
1460 * Gets the roleRspActions attribute.
1461 * @return Returns the roleRspActions.
1462 */
1463 public List<RoleResponsibilityActionInfo> getRoleRspActions() {
1464 return roleRspActions;
1465 }
1466 /**
1467 * Sets the roleRspActions attribute value.
1468 * @param roleRspActions The roleRspActions to set.
1469 */
1470 public void setRoleRspActions(List<RoleResponsibilityActionInfo> roleRspActions) {
1471 this.roleRspActions = roleRspActions;
1472 }
1473
1474 public String getOrgReviewRoleInquiryTitle() {
1475 if ( INQUIRY_TITLE_VALUE == null ) {
1476 INQUIRY_TITLE_VALUE = SpringContext.getBean(KualiConfigurationService.class).getPropertyString(ORR_INQUIRY_TITLE_PROPERTY);
1477 }
1478 return INQUIRY_TITLE_VALUE;
1479 }
1480
1481 @Override
1482 public void refreshNonUpdateableReferences() {
1483 // do nothing
1484 }
1485
1486 @Override
1487 public void refreshReferenceObject(String referenceObjectName) {
1488 // do nothing
1489 }
1490 }