Clover Coverage Report - KS LUM Program 1.2-M2-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
../../../../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
14   57   9   3.5
8   34   0.64   4
4     2.25  
1    
 
  ProgramMetadataServiceImpl       Line # 25 14 0% 9 26 0% 0.0
 
No Tests
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may
3    * not use this file except in compliance with the License. You may obtain a copy of the License at
4    * http://www.osedu.org/licenses/ECL-2.0 Unless required by applicable law or agreed to in writing, software distributed
5    * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
6    * implied. See the License for the specific language governing permissions and limitations under the License.
7    */
8   
9    package org.kuali.student.lum.program.server.metadata;
10   
11    import java.util.ArrayList;
12    import java.util.List;
13   
14    import org.kuali.student.common.assembly.data.ConstraintMetadata;
15    import org.kuali.student.common.assembly.dictionary.MetadataServiceImpl;
16    import org.kuali.student.common.dictionary.dto.FieldDefinition;
17    import org.kuali.student.common.dictionary.service.DictionaryService;
18    import org.kuali.student.common.dto.DtoConstants.DtoState;
19   
20    /**
21    * This class provides metadata lookup for service dto objects.
22    *
23    * @author Kuali Student Team
24    */
 
25    public class ProgramMetadataServiceImpl extends MetadataServiceImpl {
26   
 
27  0 toggle public ProgramMetadataServiceImpl(DictionaryService... dictionaryServices) {
28  0 super(dictionaryServices);
29    }
30   
 
31  0 toggle @Override
32    protected List<ConstraintMetadata> getConstraints(FieldDefinition fd, String type, String state, String nextState) {
33  0 List<ConstraintMetadata> constraints = new ArrayList<ConstraintMetadata>();
34   
35  0 ConstraintMetadata constraintMetadata = new ConstraintMetadata();
36   
37  0 updateConstraintMetadata(constraintMetadata, fd, type, getNonNullState(state), getNextState(state));
38  0 constraints.add(constraintMetadata);
39   
40  0 return constraints;
41    }
42   
 
43  0 toggle private String getNonNullState(String state) {
44  0 return (null == state ? DtoState.DRAFT.toString() : state);
45    }
46   
 
47  0 toggle private String getNextState(String state) {
48  0 if (null == state || DtoState.DRAFT.toString().equalsIgnoreCase(state)) {
49  0 return DtoState.APPROVED.toString();
50  0 } else if (DtoState.APPROVED.toString().equalsIgnoreCase(state)) {
51  0 return DtoState.ACTIVE.toString();
52  0 } else if (DtoState.ACTIVE.toString().equalsIgnoreCase(state)) {
53  0 return DtoState.SUPERSEDED.toString();
54    }
55  0 return null;
56    }
57    }