4 changed files with 90 additions and 0 deletions
@ -0,0 +1,27 @@
|
||||
package org.leolo.nrdatad.model; |
||||
|
||||
public enum AssociationCategory { |
||||
JOIN("JJ"), |
||||
DIVIDE("VV"), |
||||
NEXT("NP"); |
||||
|
||||
private String code; |
||||
|
||||
private AssociationCategory(String code){ |
||||
this.code = code; |
||||
} |
||||
|
||||
public String getCode() { |
||||
return code; |
||||
} |
||||
|
||||
public static AssociationCategory parseCode(String code){ |
||||
if(code==null) |
||||
return null; |
||||
for(AssociationCategory ac: AssociationCategory.values()){ |
||||
if(code.equalsIgnoreCase(ac.code)) |
||||
return ac; |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
@ -0,0 +1,2 @@
|
||||
package org.leolo.nrdatad.model;public class ScheduleAssociation { |
||||
} |
||||
@ -0,0 +1,30 @@
|
||||
package org.leolo.nrdatad.model; |
||||
|
||||
public enum ShortTermPlanningIndicator { |
||||
|
||||
CANCELLATION("C"), |
||||
NEW("N"), |
||||
OVERLAY("O"), |
||||
PERMANENT("P"); |
||||
|
||||
private String code; |
||||
|
||||
private ShortTermPlanningIndicator(String code){ |
||||
this.code = code; |
||||
} |
||||
|
||||
public String getCode() { |
||||
return code; |
||||
} |
||||
|
||||
|
||||
public static ShortTermPlanningIndicator parseCode(String code){ |
||||
if(code==null) |
||||
return null; |
||||
for(ShortTermPlanningIndicator stpi: ShortTermPlanningIndicator.values()){ |
||||
if(code.equalsIgnoreCase(stpi.code)) |
||||
return stpi; |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
@ -0,0 +1,31 @@
|
||||
package org.leolo.nrdatad; |
||||
|
||||
import org.junit.Test; |
||||
import org.leolo.nrdatad.model.AssociationCategory; |
||||
import org.leolo.nrdatad.model.ShortTermPlanningIndicator; |
||||
|
||||
import static org.junit.Assert.*; |
||||
|
||||
public class ScheduleEnumTest { |
||||
|
||||
@Test |
||||
public void testAssociationCategory(){ |
||||
assertEquals(AssociationCategory.DIVIDE, AssociationCategory.parseCode("VV")); |
||||
assertEquals(AssociationCategory.JOIN, AssociationCategory.parseCode("JJ")); |
||||
assertEquals(AssociationCategory.NEXT, AssociationCategory.parseCode("NP")); |
||||
assertNull(AssociationCategory.parseCode("XX")); |
||||
assertNull(AssociationCategory.parseCode(null)); |
||||
assertNull(AssociationCategory.parseCode("")); |
||||
} |
||||
|
||||
@Test public void testShortTermPlanningIndicator(){ |
||||
assertEquals(ShortTermPlanningIndicator.CANCELLATION, ShortTermPlanningIndicator.parseCode("C")); |
||||
assertEquals(ShortTermPlanningIndicator.NEW, ShortTermPlanningIndicator.parseCode("N")); |
||||
assertEquals(ShortTermPlanningIndicator.PERMANENT, ShortTermPlanningIndicator.parseCode("P")); |
||||
assertEquals(ShortTermPlanningIndicator.OVERLAY, ShortTermPlanningIndicator.parseCode("O")); |
||||
assertNull(ShortTermPlanningIndicator.parseCode("X")); |
||||
assertNull(ShortTermPlanningIndicator.parseCode(null)); |
||||
assertNull(ShortTermPlanningIndicator.parseCode("")); |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue