1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
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 |
|
|
22 |
|
|
23 |
|
@author |
24 |
|
|
|
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 9 |
Complexity Density: 0.64 |
|
25 |
|
public class ProgramMetadataServiceImpl extends MetadataServiceImpl { |
26 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
27 |
0
|
public ProgramMetadataServiceImpl(DictionaryService... dictionaryServices) {... |
28 |
0
|
super(dictionaryServices); |
29 |
|
} |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
31 |
0
|
@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 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
43 |
0
|
private String getNonNullState(String state) {... |
44 |
0
|
return (null == state ? DtoState.DRAFT.toString() : state); |
45 |
|
} |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 5 |
Complexity Density: 0.71 |
|
47 |
0
|
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 |
|
} |