Coverage Report - org.kuali.student.common.ui.client.mvc.dto.ReferenceModel
 
Classes in this File Line Coverage Branch Coverage Complexity
ReferenceModel
0%
0/25
0%
0/2
1.182
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.student.common.ui.client.mvc.dto;
 17  
 
 18  
 import java.util.HashMap;
 19  
 import java.util.Map;
 20  
 
 21  
 import org.kuali.student.common.ui.client.configurable.mvc.HasReferenceId;
 22  
 import org.kuali.student.common.ui.client.mvc.Model;
 23  
 import org.kuali.student.common.ui.client.mvc.ModelChangeEvent;
 24  
 import org.kuali.student.common.ui.client.mvc.ModelChangeHandler;
 25  
 import org.kuali.student.common.ui.client.mvc.ModelChangeEvent.Action;
 26  
 
 27  
 import com.google.gwt.event.shared.HandlerManager;
 28  
 import com.google.gwt.event.shared.HandlerRegistration;
 29  
 
 30  
 /**
 31  
  * A small model that contains id, type, and state
 32  
  * 
 33  
  * @author Kuali Student Team
 34  
  *
 35  
  */
 36  0
 public class ReferenceModel implements HasReferenceId, Model {
 37  
     String referenceId;
 38  
     String referenceTypeKey;
 39  
     String referenceType;
 40  
     String referenceState;
 41  
     Map<String, String> referenceAttributes;  // Use referenceAttributes to store misc data from the parent Model
 42  0
         private HandlerManager handlers = new HandlerManager(this);
 43  
 
 44  
         @Override
 45  
         public HandlerRegistration addModelChangeHandler(
 46  
                         ModelChangeHandler handler) {
 47  0
                 return handlers.addHandler(ModelChangeEvent.TYPE, handler);
 48  
         }
 49  
 
 50  
     /**
 51  
      * @see org.kuali.student.common.ui.client.configurable.mvc.HasReferenceId#setReferenceId(java.lang.String)
 52  
      */
 53  
     @Override
 54  
     public void setReferenceId(String id) {
 55  0
         this.referenceId = id;
 56  0
                 handlers.fireEvent(new ModelChangeEvent(Action.RELOAD, this));
 57  0
     }
 58  
 
 59  
     /**
 60  
      * @see org.kuali.student.common.ui.client.configurable.mvc.HasReferenceId#setReferenceKey(java.lang.String)
 61  
      */
 62  
     @Override
 63  
     public String getReferenceId() {
 64  0
         return referenceId;
 65  
     }
 66  
 
 67  
     @Override
 68  
         public String getReferenceTypeKey() {
 69  0
                 return referenceTypeKey;
 70  
         }
 71  
 
 72  
     @Override
 73  
         public void setReferenceTypeKey(String referenceTypeKey) {
 74  0
                 this.referenceTypeKey = referenceTypeKey;
 75  0
                 handlers.fireEvent(new ModelChangeEvent(Action.RELOAD, this));
 76  0
         }
 77  
 
 78  
     @Override
 79  
         public String getReferenceType() {
 80  0
                 return referenceType;
 81  
         }
 82  
 
 83  
     @Override
 84  
         public void setReferenceType(String referenceType) {
 85  0
                 this.referenceType = referenceType;
 86  0
                 handlers.fireEvent(new ModelChangeEvent(Action.RELOAD, this));
 87  0
         }
 88  
 
 89  
     @Override
 90  
         public String getReferenceState() {
 91  0
                 return referenceState;
 92  
         }
 93  
 
 94  
     @Override
 95  
         public void setReferenceState(String referenceState) {
 96  0
                 this.referenceState = referenceState;
 97  0
                 handlers.fireEvent(new ModelChangeEvent(Action.RELOAD, this));
 98  0
         }
 99  
     
 100  
     public Map<String, String> getReferenceAttributes(){
 101  0
             if(referenceAttributes!=null){
 102  0
                     return referenceAttributes;
 103  
             }
 104  
             else{
 105  0
                     return new HashMap<String,String>();
 106  
             }
 107  
     }
 108  
     public void setReferenceAttributes(Map<String, String> referenceAttributes){
 109  0
             this.referenceAttributes = referenceAttributes;
 110  0
             handlers.fireEvent(new ModelChangeEvent(Action.RELOAD, this));
 111  0
     }
 112  
 }