View Javadoc
1   /**
2    * Copyright 2004-2014 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.kpme.pm.classification.duty;
17  
18  import java.math.BigDecimal;
19  
20  import org.kuali.kpme.pm.api.classification.duty.ClassificationDuty;
21  import org.kuali.kpme.pm.api.classification.duty.ClassificationDutyContract;
22  import org.kuali.kpme.pm.classification.ClassificationBo;
23  import org.kuali.kpme.pm.classification.ClassificationDerived;
24  import org.kuali.rice.core.api.mo.ModelObjectUtils;
25  
26  public class ClassificationDutyBo extends ClassificationDerived implements ClassificationDutyContract {
27  	
28  	private static final long serialVersionUID = -3553603419139534148L;
29  	
30  	private String pmDutyId;
31  	private String name;
32  	private String description;
33  	private BigDecimal percentage;
34  	
35  	
36  	public String getPmDutyId() {
37  		return pmDutyId;
38  	}
39  	public void setPmDutyId(String pmDutyId) {
40  		this.pmDutyId = pmDutyId;
41  	}
42  	public String getName() {
43  		return name;
44  	}
45  	public void setName(String name) {
46  		this.name = name;
47  	}
48  	public String getDescription() {
49  		return description;
50  	}
51  	public void setDescription(String description) {
52  		this.description = description;
53  	}
54  	public BigDecimal getPercentage() {
55  		return percentage;
56  	}
57  	public void setPercentage(BigDecimal percentage) {
58  		this.percentage = percentage;
59  	}
60  	@Override
61  	public String getId() {
62  		return this.getPmDutyId();
63  	}
64  	@Override
65  	public void setId(String id) {
66  		this.setPmDutyId(id);
67  	}
68  	
69  		public static ClassificationDutyBo from(ClassificationDuty im) {
70  				if (im == null) {
71  					return null;
72  				}
73  				ClassificationDutyBo classificationDutyBo = new ClassificationDutyBo();
74  		
75  				
76  				classificationDutyBo.setPmDutyId(im.getPmDutyId());
77  				classificationDutyBo.setName(im.getName());
78  				classificationDutyBo.setDescription(im.getDescription());
79  				classificationDutyBo.setPercentage(im.getPercentage());
80  				
81  				classificationDutyBo.setPmPositionClassId(im.getPmPositionClassId());
82  		        classificationDutyBo.setVersionNumber(im.getVersionNumber());
83  		        classificationDutyBo.setObjectId(im.getObjectId());
84  				
85  				return classificationDutyBo;
86  			}
87  		
88  			public static ClassificationDuty to(ClassificationDutyBo bo) {
89  				if (bo == null) {
90  					return null;
91  				}
92  				return ClassificationDuty.Builder.create(bo).build();
93  			}
94  		
95  			public static final ModelObjectUtils.Transformer<ClassificationDutyBo, ClassificationDuty> toImmutable = new ModelObjectUtils.Transformer<ClassificationDutyBo, ClassificationDuty>() {
96  				public ClassificationDuty transform(ClassificationDutyBo input) {
97  					return ClassificationDutyBo.to(input);
98  				};
99  			};
100 		
101 			public static final ModelObjectUtils.Transformer<ClassificationDuty, ClassificationDutyBo> toBo = new ModelObjectUtils.Transformer<ClassificationDuty, ClassificationDutyBo>() {
102 				public ClassificationDutyBo transform(ClassificationDuty input) {
103 					return ClassificationDutyBo.from(input);
104 				};
105 			};
106 			
107 }