use of net.geoprism.registry.ListType in project geoprism-registry by terraframe.
the class ListTypeService method applyVersion.
@Request(RequestType.SESSION)
public JsonObject applyVersion(String sessionId, String oid, String metadata) {
ListTypeVersion version = ListTypeVersion.get(oid);
ListType listType = version.getListType();
if (!listType.isValid()) {
throw new InvalidMasterListException();
}
this.enforceWritePermissions(listType);
version.appLock();
try {
version.parse(JsonParser.parseString(metadata).getAsJsonObject());
} finally {
version.apply();
}
return version.toJSON(false);
}
use of net.geoprism.registry.ListType in project geoprism-registry by terraframe.
the class ListTypeInheritedHierarchyTest method testPublishVersion.
@Test
@Request
public void testPublishVersion() {
TestDataSet.runAsUser(USATestData.USER_ADMIN, (request, adapter) -> {
JsonObject json = ListTypeTest.getJson(USATestData.ORG_NPS.getServerObject(), USATestData.HIER_SCHOOL, USATestData.SCHOOL_ZONE, USATestData.COUNTRY, USATestData.STATE, USATestData.DISTRICT);
ListType test = ListType.apply(json);
try {
ListTypeEntry entry = test.getOrCreateEntry(new Date(), null);
ListTypeVersion version = entry.getWorking();
try {
MdBusinessDAOIF mdTable = MdBusinessDAO.get(version.getMdBusinessOid());
Assert.assertNotNull(mdTable);
version.publish();
} finally {
entry.delete();
}
} finally {
test.delete();
}
});
}
use of net.geoprism.registry.ListType in project geoprism-registry by terraframe.
the class ListTypeTest method testMarkAsInvalidByParent.
@Test
@Request
public void testMarkAsInvalidByParent() {
JsonObject json = getJson(USATestData.ORG_NPS.getServerObject(), USATestData.HIER_ADMIN, USATestData.DISTRICT, USATestData.COUNTRY, USATestData.STATE);
ListType masterlist = ListType.apply(json);
try {
masterlist.markAsInvalid(USATestData.HIER_ADMIN.getServerObject(), USATestData.STATE.getServerObject());
Assert.assertFalse(masterlist.getValid());
} catch (DuplicateDataDatabaseException e) {
masterlist.delete();
}
}
use of net.geoprism.registry.ListType in project geoprism-registry by terraframe.
the class ListTypeTest method testMarkAsInvalidByDirectType.
@Test
@Request
public void testMarkAsInvalidByDirectType() {
JsonObject json = getJson(USATestData.ORG_NPS.getServerObject(), USATestData.HIER_ADMIN, USATestData.DISTRICT, USATestData.COUNTRY, USATestData.STATE);
ListType masterlist = ListType.apply(json);
try {
masterlist.markAsInvalid(USATestData.HIER_ADMIN.getServerObject(), USATestData.DISTRICT.getServerObject());
Assert.assertFalse(masterlist.getValid());
} catch (DuplicateDataDatabaseException e) {
masterlist.delete();
}
}
use of net.geoprism.registry.ListType in project geoprism-registry by terraframe.
the class ListTypeTest method testMarkAllAsInvalid.
@Test
@Request
public void testMarkAllAsInvalid() {
JsonObject json = getJson(USATestData.ORG_NPS.getServerObject(), USATestData.HIER_ADMIN, USATestData.STATE);
ListType masterlist = ListType.apply(json);
try {
ListType.markAllAsInvalid(USATestData.HIER_ADMIN.getServerObject(), USATestData.STATE.getServerObject());
ListType test = ListType.get(masterlist.getOid());
Assert.assertFalse(test.getValid());
} catch (DuplicateDataDatabaseException e) {
masterlist.delete();
}
}
Aggregations