use of net.geoprism.registry.model.Classification in project geoprism-registry by terraframe.
the class ClassificationService method removeChild.
@Request(RequestType.SESSION)
public void removeChild(String sessionId, String classificationCode, String parentCode, String childCode) {
ClassificationType type = ClassificationType.getByCode(classificationCode);
Classification parent = Classification.get(type, parentCode);
Classification child = Classification.get(type, childCode);
parent.removeChild(child);
}
use of net.geoprism.registry.model.Classification in project geoprism-registry by terraframe.
the class ClassificationService method remove.
@Request(RequestType.SESSION)
public void remove(String sessionId, String classificationCode, String code) {
ClassificationType type = ClassificationType.getByCode(classificationCode);
Classification classification = Classification.get(type, code);
classification.delete();
}
use of net.geoprism.registry.model.Classification in project geoprism-registry by terraframe.
the class ExcelServiceTest method classSetUp.
@BeforeClass
@Request
public static void classSetUp() {
type = ClassificationType.apply(ClassificationTypeTest.createMock());
Classification root = Classification.newInstance(type);
root.setCode(CODE);
root.setDisplayLabel(new LocalizedValue("Test Classification"));
root.apply(null);
TestDataSet.deleteAllSchedulerData();
testData = USATestData.newTestData();
testData.setUpMetadata();
testTerm = (AttributeTermType) TestDataSet.createTermAttribute("testTerm", "testTermLocalName", USATestData.DISTRICT, null).fetchDTO();
testBoolean = (AttributeBooleanType) TestDataSet.createAttribute("testBoolean", "testBooleanLocalName", USATestData.DISTRICT, AttributeBooleanType.TYPE).fetchDTO();
testDate = (AttributeDateType) TestDataSet.createAttribute("testDate", "testDateLocalName", USATestData.DISTRICT, AttributeDateType.TYPE).fetchDTO();
testInteger = (AttributeIntegerType) TestDataSet.createAttribute("testInteger", "testIntegerLocalName", USATestData.DISTRICT, AttributeIntegerType.TYPE).fetchDTO();
if (!SchedulerManager.initialized()) {
SchedulerManager.start();
}
testClassification = (AttributeClassificationType) AttributeType.factory("testClassification", new LocalizedValue("testClassificationLocalName"), new LocalizedValue("testClassificationLocalDescrip"), AttributeClassificationType.TYPE, false, false, false);
testClassification.setClassificationType(type.getCode());
testClassification.setRootTerm(root.toTerm());
ServerGeoObjectType got = ServerGeoObjectType.get(USATestData.DISTRICT.getCode());
testClassification = (AttributeClassificationType) got.createAttributeType(testClassification.toJSON().toString());
}
use of net.geoprism.registry.model.Classification in project geoprism-registry by terraframe.
the class AttributeTypeServiceTest method createMdClassification.
@Request
private void createMdClassification() {
type = ClassificationType.apply(ClassificationTypeTest.createMock());
Classification root = Classification.newInstance(type);
root.setCode(CODE);
root.setDisplayLabel(new LocalizedValue("Test Classification"));
root.apply(null);
TYPE_CODE = type.getCode();
}
use of net.geoprism.registry.model.Classification in project geoprism-registry by terraframe.
the class ClassificationTest method testRemoveChild.
@Test
@Request
public void testRemoveChild() {
Classification parent = Classification.newInstance(type);
parent.setCode(PARENT_CODE);
parent.apply(null);
try {
Classification child = Classification.newInstance(type);
child.setCode(CHILD_CODE);
child.apply(null);
try {
parent.addChild(child);
Assert.assertEquals(Long.valueOf(1), parent.getChildren().getCount());
parent.removeChild(child);
Assert.assertEquals(Long.valueOf(0), parent.getChildren().getCount());
} finally {
child.delete();
}
} finally {
parent.delete();
}
}
Aggregations