Coverage Report - org.kuali.rice.kew.xml.GroupNamespaceURIFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
GroupNamespaceURIFilter
0%
0/26
0%
0/2
1.25
 
 1  
 /*
 2  
  * Copyright 2007-2010 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.kew.xml;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.List;
 20  
 
 21  
 import org.kuali.rice.core.util.KeyValue;
 22  
 import org.kuali.rice.core.xml.CoreNamespaceConstants;
 23  
 
 24  
 
 25  
 /**
 26  
  * This class transforms all the URIs for the group object
 27  
  * 
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  * 
 30  
  */
 31  0
 public class GroupNamespaceURIFilter extends AbstractTransformationFilter {
 32  
 
 33  
         public static final String GROUP_URI_OLD = "ns:workflow/Group";
 34  
         public static final String GROUP_URI_NEW = "http://rice.kuali.org/xsd/kim/group";
 35  
 
 36  
         /**
 37  
          * This overridden method returns a list of KeyValue objects. the key is the
 38  
          * element name and the value
 39  
          * 
 40  
          * @see org.kuali.rice.kew.xml.AbstractTransformationFilter#getElementTransformationList()
 41  
          */
 42  
         public List<KeyValue> getElementTransformationList() {
 43  0
                 List<KeyValue> rList = new ArrayList<KeyValue>();
 44  
 
 45  0
                 rList.add(new KeyValue("groups", GROUP_URI_OLD));
 46  0
                 rList.add(new KeyValue("groups.group", GROUP_URI_OLD));
 47  0
                 rList.add(new KeyValue("groups.group.groupName", GROUP_URI_OLD));
 48  0
                 rList.add(new KeyValue("groups.group.namespaceCode", GROUP_URI_OLD));
 49  0
                 rList.add(new KeyValue("groups.group.groupDescription", GROUP_URI_OLD));
 50  0
                 rList.add(new KeyValue("groups.group.active", GROUP_URI_OLD));
 51  0
                 rList.add(new KeyValue("groups.group.type", GROUP_URI_OLD));
 52  0
                 rList.add(new KeyValue("groups.group.type.namespace", GROUP_URI_OLD));
 53  0
                 rList.add(new KeyValue("groups.group.type.name", GROUP_URI_OLD));
 54  0
                 rList.add(new KeyValue("groups.group.attributes", GROUP_URI_OLD));
 55  0
                 rList.add(new KeyValue("groups.group.members", GROUP_URI_OLD));
 56  0
                 rList.add(new KeyValue("groups.group.members.principalName",GROUP_URI_OLD));
 57  0
                 rList.add(new KeyValue("groups.group.members.principalId", GROUP_URI_OLD));
 58  0
                 rList.add(new KeyValue("groups.group.members.groupName", GROUP_URI_OLD));
 59  0
                 rList.add(new KeyValue("groups.group.members.groupName.name",GROUP_URI_OLD));
 60  0
                 rList.add(new KeyValue("groups.group.members.groupName.namespace", GROUP_URI_OLD));
 61  
 
 62  0
                 return rList;
 63  
         }
 64  
 
 65  
         /**
 66  
          * This overridden method sets the groups starting element.
 67  
          * 
 68  
          * @see org.kuali.rice.kew.xml.AbstractTransformationFilter#getStartingElement()
 69  
          */
 70  
         public String getStartingElementPath() {
 71  0
                 return "data";
 72  
         }
 73  
 
 74  
         /**
 75  
          * This method sets the URI
 76  
          * 
 77  
          * @see org.kuali.rice.kew.xml.AbstractTransformationFilter#transformEndElement(org.kuali.rice.kew.xml.AbstractTransformationFilter.CurrentElement)
 78  
          */
 79  
         public CurrentElement transformEndElement(CurrentElement currentElement) {
 80  0
                 if("groups.group.attributes".equals(this.getTrimmedCurrentElementKey(currentElement.getNameKey()))){
 81  0
                         currentElement.setUri(CoreNamespaceConstants.CORE);
 82  
                 }else{
 83  0
                         currentElement.setUri(GROUP_URI_NEW);
 84  
                 }
 85  0
                 return currentElement;
 86  
         }
 87  
 
 88  
         /**
 89  
          * This method sets the URI of the element
 90  
          * 
 91  
          * @see org.kuali.rice.kew.xml.AbstractTransformationFilter#transformStartElement(org.kuali.rice.kew.xml.AbstractTransformationFilter.CurrentElement)
 92  
          */
 93  
         public CurrentElement transformStartElement(CurrentElement currentElement) {
 94  0
                 currentElement.setUri(GROUP_URI_NEW);
 95  0
                 return currentElement;
 96  
         }
 97  
 }