use of org.commongeoregistry.adapter.dataaccess.LocalizedValue in project geoprism-registry by terraframe.
the class XMLImporter method createTermOptions.
private void createTermOptions(Element attributeNode, Term root) {
NodeList attributeList = attributeNode.getElementsByTagName("option");
for (int i = 0; i < attributeList.getLength(); i++) {
Node nNode = attributeList.item(i);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element) nNode;
String code = elem.getAttribute("code");
LocalizedValue label = this.getLabel(elem);
LocalizedValue description = this.getDescription(elem);
Term term = new Term(code, label, description);
Classifier classifier = TermConverter.createClassifierFromTerm(root.getCode(), term);
TermConverter termBuilder = new TermConverter(classifier.getKeyName());
termBuilder.build();
}
}
}
use of org.commongeoregistry.adapter.dataaccess.LocalizedValue in project geoprism-registry by terraframe.
the class TestHierarchyTypeInfo method toDTO.
public HierarchyType toDTO() {
LocalizedValue displayLabel = new LocalizedValue(this.displayLabel);
LocalizedValue description = new LocalizedValue(this.displayLabel);
HierarchyType ht = new HierarchyType(this.code, displayLabel, description, this.getOrganization().getCode());
return ht;
}
use of org.commongeoregistry.adapter.dataaccess.LocalizedValue in project geoprism-registry by terraframe.
the class ConversionTest method testAttributeTypeDateTree.
@Test
public void testAttributeTypeDateTree() {
String sessionId = testData.clientRequest.getSessionId();
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(2019, Calendar.JANUARY, 12, 20, 21, 32);
// Add a new custom attribute
AttributeType testDate = AttributeType.factory("testDate", new LocalizedValue("testDateLocalName"), new LocalizedValue("testDateLocalDescrip"), AttributeDateType.TYPE, false, false, false);
testDate = ServiceFactory.getRegistryService().createAttributeType(sessionId, USATestData.STATE.getCode(), testDate.toJSON().toString());
// Create a new GeoObject with the custom attribute
GeoObject geoObj = ServiceFactory.getRegistryService().newGeoObjectInstance(sessionId, USATestData.STATE.getCode());
geoObj.setCode(testGo.getCode());
geoObj.setDisplayLabel(LocalizedValue.DEFAULT_LOCALE, "Test Label");
geoObj.setUid(ServiceFactory.getRegistryService().getUIDS(sessionId, 1)[0]);
geoObj.setValue(testDate.getName(), calendar.getTime());
ServiceFactory.getRegistryService().createGeoObject(sessionId, geoObj.toJSON().toString(), TestDataSet.DEFAULT_OVER_TIME_DATE, TestDataSet.DEFAULT_END_TIME_DATE);
// Get the object with the custom attribute
GeoObject result = ServiceFactory.getRegistryService().getGeoObjectByCode(sessionId, testGo.getCode(), USATestData.STATE.getCode(), TestDataSet.DEFAULT_OVER_TIME_DATE);
Assert.assertNotNull(result);
Assert.assertEquals(geoObj.getValue(testDate.getName()), result.getValue(testDate.getName()));
}
use of org.commongeoregistry.adapter.dataaccess.LocalizedValue in project geoprism-registry by terraframe.
the class BusinessTypeTest method testGetAttribute.
@Test
@Request
public void testGetAttribute() {
String code = "TEST_PROG";
String orgCode = FastTestDataset.ORG_CGOV.getCode();
String label = "Test Prog";
JsonObject object = new JsonObject();
object.addProperty(BusinessType.CODE, code);
object.addProperty(BusinessType.ORGANIZATION, orgCode);
object.add(BusinessType.DISPLAYLABEL, new LocalizedValue(label).toJSON());
BusinessType type = BusinessType.apply(object);
try {
AttributeCharacterType expected = new AttributeCharacterType("testCharacter", new LocalizedValue("Test Character"), new LocalizedValue("Test True"), false, false, false);
type.createAttributeType(expected);
AttributeType actual = type.getAttribute(expected.getName());
Assert.assertTrue(actual instanceof AttributeCharacterType);
Assert.assertEquals(expected.getName(), actual.getName());
Assert.assertEquals(expected.getLabel().getValue(), actual.getLabel().getValue());
Assert.assertEquals(expected.getIsDefault(), actual.getIsDefault());
} finally {
type.delete();
}
}
use of org.commongeoregistry.adapter.dataaccess.LocalizedValue 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());
}
Aggregations