Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2013 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.opensource.org/licenses/ecl2.php Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.kuali.rice.kew.xml.export;
 
 
 
 import static org.kuali.rice.core.api.impex.xml.XmlConstants.*;

This is a description of what this class does - jjhanso don't forget to fill this in.

Author(s):
Kuali Rice Team (rice.collab@kuali.org)
 
 public class GroupXmlExporter implements XmlExporter {
     protected final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(getClass());
 
     private XmlRenderer renderer = new XmlRenderer();
 
 	public boolean supportPrettyPrint() {
 		return true;
 	}
    
    
 
     public Element export(ExportDataSet exportDataSet) {
     	KewExportDataSet dataSet = KewExportDataSet.fromExportDataSet(exportDataSet);
         if (!dataSet.getGroups().isEmpty()) {
             Element rootElement = .renderElement(null);
             for (Iterator iterator = dataSet.getGroups().iterator(); iterator.hasNext();) {
                 Group group = (Groupiterator.next();
                 exportGroup(rootElementgroup);
             }
             return rootElement;
         }
         // TODO jjhanso - THIS METHOD NEEDS JAVADOCS
         return null;
     }

    
This method ...

Parameters:
rootElement
group
object
 
     private void exportGroup(Element parentGroup group) {
         Element groupElement = .renderElement(parent);
         if (group.getName() != null) {
             .renderTextElement(groupElementgroup.getName());
         }
         if (group.getNamespaceCode() != null) {
             .renderTextElement(groupElementgroup.getNamespaceCode());
         }
 
         if (group.getDescription() != null && !group.getDescription().trim().equals("")) {
             .renderTextElement(groupElementgroup.getDescription());
         }
 
         .renderTextElement(groupElementnew Boolean(group.isActive()).toString());
 
         if (group.getKimTypeId() != null) {
             Element typeElement = .renderElement(groupElement);
             KimType kimType = KimApiServiceLocator.getKimTypeInfoService().getKimType(group.getKimTypeId());
             .renderTextElement(typeElementkimType.getNamespaceCode());
             .renderTextElement(typeElementkimType.getName());
         }
 
         if (group.getAttributes().size() > 0) {
             Element attributesElement = .renderElement(groupElement);
             for (String key : group.getAttributes().keySet()) {
                 Element attributeElement = .renderElement(attributesElement);
                attributeElement.setAttribute(key);
                attributeElement.setAttribute(group.getAttributes().get(key));
            }
        }
        java.util.List<StringmemberGroupIds = KimApiServiceLocator.getGroupService().getDirectMemberGroupIds(group.getId());
        java.util.List<StringmemberPrincipalIds = KimApiServiceLocator.getGroupService().getDirectMemberPrincipalIds(
                group.getId());
        if (memberGroupIds.size() > 0 || memberPrincipalIds.size() > 0) {
            Element membersElement = .renderElement(groupElement);
            for (String memberGroupId : memberGroupIds) {
                Group memberGroup = KimApiServiceLocator.getGroupService().getGroup(memberGroupId);
                Element groupNameElement = .renderElement(membersElement);
                .renderTextElement(groupNameElementmemberGroup.getName());
                .renderTextElement(groupNameElementmemberGroup.getNamespaceCode());
            }
            for (String memberPrincipalId : memberPrincipalIds) {
                .renderTextElement(membersElement, KimApiServiceLocator.getIdentityService().getPrincipal(memberPrincipalId).getPrincipalName());
            }
        }
    }
New to GrepCode? Check out our FAQ X