| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AgendaBo |
|
| 0.0;0 |
| 1 | /** | |
| 2 | * Copyright 2005-2011 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl2.php | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package org.kuali.rice.krms.impl.repository | |
| 17 | ||
| 18 | import org.kuali.rice.krad.bo.PersistableBusinessObjectBase | |
| 19 | import org.kuali.rice.krms.api.repository.agenda.AgendaDefinitionContract | |
| 20 | ||
| 21 | ||
| 22 | public class AgendaBo extends PersistableBusinessObjectBase implements AgendaDefinitionContract { | |
| 23 | ||
| 24 | def String id | |
| 25 | def String name | |
| 26 | def String typeId | |
| 27 | def String contextId | |
| 28 | def boolean active = true | |
| 29 | ||
| 30 | def String firstItemId | |
| 31 | def Set<AgendaAttributeBo> attributeBos | |
| 32 | ||
| 33 | def List<AgendaItemBo> items | |
| 34 | ||
| 35 | def ContextBo context | |
| 36 | ||
| 37 | public AgendaBo() { | |
| 38 | 31 | active = true; |
| 39 | 31 | items = new ArrayList<AgendaItemBo>(); |
| 40 | } | |
| 41 | ||
| 42 | public Map<String, String> getAttributes() { | |
| 43 | 16 | HashMap<String, String> attributes = new HashMap<String, String>(); |
| 44 | 16 | for (attr in attributeBos) { |
| 45 | 32 | attributes.put( attr.attributeDefinition.name, attr.value ) |
| 46 | } | |
| 47 | 16 | return attributes; |
| 48 | } | |
| 49 | ||
| 50 | ||
| 51 | ||
| 52 | // /** | |
| 53 | // * Converts a mutable bo to it's immutable counterpart | |
| 54 | // * @param bo the mutable business object | |
| 55 | // * @return the immutable object | |
| 56 | // */ | |
| 57 | // static AgendaDefinition to(AgendaBo bo) { | |
| 58 | // if (bo == null) { return null } | |
| 59 | // return org.kuali.rice.krms.api.repository.agenda.AgendaDefinition.Builder.create(bo).build() | |
| 60 | // } | |
| 61 | // | |
| 62 | // | |
| 63 | // /** | |
| 64 | // * Converts a immutable object to it's mutable bo counterpart | |
| 65 | // * TODO: move to() and from() to impl service | |
| 66 | // * @param im immutable object | |
| 67 | // * @return the mutable bo | |
| 68 | // */ | |
| 69 | // static public AgendaBo from(AgendaDefinition im) { | |
| 70 | // if (im == null) { return null } | |
| 71 | // | |
| 72 | // AgendaBo bo = new AgendaBo() | |
| 73 | // bo.setId( im.getId() ) | |
| 74 | // bo.setNamespace( im.getNamespace() ) | |
| 75 | // bo.setName( im.getName() ) | |
| 76 | // bo.setTypeId( im.getTypeId() ) | |
| 77 | // bo.setContextId( im.getContextId() ) | |
| 78 | // bo.setFirstItemId( im.getFirstItemId() ) | |
| 79 | // | |
| 80 | // Map<String,String> attrList = convertAttributeKeys | |
| 81 | // Set<AgendaAttributeBo> attrList = new HashSet<AgendaAttributeBo>() | |
| 82 | // for (attr in im.getAttributes()){ | |
| 83 | // | |
| 84 | // attrList.add ( AgendaAttributeBo.from() ) | |
| 85 | // } | |
| 86 | // bo.setAttributes(attrList) | |
| 87 | // return bo | |
| 88 | // } | |
| 89 | ||
| 90 | @SuppressWarnings("unchecked") | |
| 91 | @Override | |
| 92 | List buildListOfDeletionAwareLists() { | |
| 93 | 0 | List managedLists = super.buildListOfDeletionAwareLists(); |
| 94 | 0 | managedLists.add(this.attributeBos); |
| 95 | 0 | managedLists.add(this.items) |
| 96 | 0 | for (AgendaItemBo agendaItemBo : items) { |
| 97 | 0 | managedLists.add(agendaItemBo.getRule().getActions()); |
| 98 | 0 | managedLists.add(agendaItemBo.getRule().getAttributeBos()); |
| 99 | } | |
| 100 | 0 | return managedLists; |
| 101 | } | |
| 102 | } |