Coverage Report - org.kuali.rice.kew.api.action.ActionItemCustomization
 
Classes in this File Line Coverage Branch Coverage Complexity
ActionItemCustomization
0%
0/15
N/A
1.533
ActionItemCustomization$1
N/A
N/A
1.533
ActionItemCustomization$Builder
0%
0/27
0%
0/8
1.533
ActionItemCustomization$Constants
0%
0/1
N/A
1.533
ActionItemCustomization$Elements
0%
0/1
N/A
1.533
 
 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.kew.api.action;
 17  
 
 18  
 import java.io.Serializable;
 19  
 import java.util.Collection;
 20  
 
 21  
 import javax.xml.bind.annotation.XmlAccessType;
 22  
 import javax.xml.bind.annotation.XmlAccessorType;
 23  
 import javax.xml.bind.annotation.XmlAnyElement;
 24  
 import javax.xml.bind.annotation.XmlElement;
 25  
 import javax.xml.bind.annotation.XmlRootElement;
 26  
 import javax.xml.bind.annotation.XmlType;
 27  
 
 28  
 import org.apache.commons.lang.StringUtils;
 29  
 import org.kuali.rice.core.api.CoreConstants;
 30  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 31  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 32  
 import org.kuali.rice.kew.api.action.ActionItem.Elements;
 33  
 import org.kuali.rice.kew.api.actionlist.DisplayParameters;
 34  
 import org.w3c.dom.Element;
 35  
 
 36  
 @XmlRootElement(name = ActionItemCustomization.Constants.ROOT_ELEMENT_NAME)
 37  
 @XmlAccessorType(XmlAccessType.NONE)
 38  
 @XmlType(name = ActionItemCustomization.Constants.TYPE_NAME, propOrder = {
 39  
         ActionItemCustomization.Elements.ID,
 40  
         ActionItemCustomization.Elements.ACTION_SET,
 41  
         ActionItemCustomization.Elements.DISPLAY_PARAMETERS,
 42  
         CoreConstants.CommonElements.FUTURE_ELEMENTS
 43  
 })
 44  0
 public class ActionItemCustomization extends AbstractDataTransferObject implements ActionItemCustomizationContract {
 45  
 
 46  
     @XmlElement(name = Elements.ID, required = false)
 47  
     private final String id;
 48  
     @XmlElement(name = Elements.ACTION_SET, required = true)
 49  
     private final ActionSet actionSet;
 50  
     @XmlElement(name = Elements.DISPLAY_PARAMETERS, required = true)
 51  
     private final DisplayParameters displayParameters;
 52  0
     @SuppressWarnings("unused")
 53  
     @XmlAnyElement
 54  
     private final Collection<Element> _futureElements = null;
 55  
     
 56  
     /**
 57  
      * Private constructor used only by JAXB.
 58  
      * 
 59  
      */
 60  0
     private ActionItemCustomization() {
 61  0
         this.id = null;
 62  0
         this.actionSet = null;
 63  0
         this.displayParameters = null;
 64  0
     }
 65  
     
 66  0
     private ActionItemCustomization(Builder builder) {
 67  0
         this.id = builder.getId();
 68  0
         this.actionSet = builder.getActionSet();
 69  0
         this.displayParameters = builder.getDisplayParameters();
 70  0
     }
 71  
 
 72  
     @Override
 73  
     public String getId() {
 74  0
         return this.id;
 75  
     }
 76  
     
 77  
     @Override
 78  
     public ActionSet getActionSet() {
 79  0
         return this.actionSet;
 80  
     }
 81  
 
 82  
     @Override
 83  
     public DisplayParameters getDisplayParameters() {
 84  0
         return this.displayParameters;
 85  
     }
 86  
     
 87  
     /**
 88  
      * A builder which can be used to construct {@link ActionItemCustomization} instances.  
 89  
      * Enforces the constraints of the {@link ActionItemCustomizationContract}. 
 90  
      */
 91  0
     public final static class Builder
 92  
         implements Serializable, ModelBuilder, ActionItemCustomizationContract
 93  
     {
 94  
         
 95  
         private String id;        
 96  
         private ActionSet actionSet;        
 97  
         private DisplayParameters displayParameters;
 98  
         
 99  0
         private Builder(ActionSet actionSet, DisplayParameters displayParameters) {
 100  0
             setActionSet(actionSet);
 101  0
             setDisplayParameters(displayParameters);
 102  0
         }
 103  
         
 104  
         public static Builder create(ActionSet actionSet, DisplayParameters displayParameters) {
 105  0
             return new Builder(actionSet, displayParameters);
 106  
         }
 107  
         
 108  
         public static Builder create(ActionItemCustomizationContract contract) {
 109  0
             if (contract == null) {
 110  0
                 throw new IllegalArgumentException("contract is null");
 111  
             }
 112  0
             Builder builder = create(contract.getActionSet(), contract.getDisplayParameters());
 113  0
             builder.setId(contract.getId());
 114  0
             return builder;
 115  
         }
 116  
                     
 117  
         @Override
 118  
         public ActionItemCustomization build() {
 119  0
             return new ActionItemCustomization(this);
 120  
         }
 121  
 
 122  
         @Override
 123  
         public ActionSet getActionSet() {
 124  0
             return this.actionSet;
 125  
         }
 126  
 
 127  
         public DisplayParameters getDisplayParameters() {
 128  0
             return this.displayParameters;
 129  
         }
 130  
 
 131  
         public String getId() {
 132  0
             return this.id;
 133  
         }
 134  
         
 135  
         public void setId(String id) {
 136  0
             if (StringUtils.isWhitespace(id)) {
 137  0
                 throw new IllegalArgumentException("id is blank");
 138  
             }
 139  0
             this.id = id;
 140  0
         }
 141  
         
 142  
         public void setActionSet(ActionSet actionSet) {
 143  0
             if (actionSet == null) {
 144  0
                 throw new IllegalArgumentException("actionSet is null");
 145  
             }
 146  0
             this.actionSet = actionSet;
 147  0
         }
 148  
         
 149  
         public void setDisplayParameters(DisplayParameters displayParameters) {
 150  0
             if (displayParameters == null) {
 151  0
                 throw new IllegalArgumentException("displayParameters is null");
 152  
             }
 153  0
             this.displayParameters = displayParameters;
 154  0
         }
 155  
     }    
 156  
     
 157  
     /**
 158  
      * Defines some internal constants used on this class.
 159  
      * 
 160  
      */
 161  0
     static class Constants {
 162  
         final static String ROOT_ELEMENT_NAME = "actionItemCustomization";
 163  
         final static String TYPE_NAME = "ActionItemCustomizationType";
 164  
     }
 165  
 
 166  
     /**
 167  
       * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 168  
       * 
 169  
       */
 170  0
     static class Elements {
 171  
         final static String ID = "id";
 172  
         final static String ACTION_SET = "actionSet";
 173  
         final static String DISPLAY_PARAMETERS = "displayParameters";
 174  
     }
 175  
 }