Search in sources :

Example 21 with ListType

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);
}
Also used : ListType(net.geoprism.registry.ListType) ListTypeVersion(net.geoprism.registry.ListTypeVersion) InvalidMasterListException(net.geoprism.registry.InvalidMasterListException) Request(com.runwaysdk.session.Request)

Example 22 with ListType

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();
        }
    });
}
Also used : MdBusinessDAOIF(com.runwaysdk.dataaccess.MdBusinessDAOIF) ListTypeEntry(net.geoprism.registry.ListTypeEntry) ListType(net.geoprism.registry.ListType) JsonObject(com.google.gson.JsonObject) ListTypeVersion(net.geoprism.registry.ListTypeVersion) Date(java.util.Date) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 23 with ListType

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();
    }
}
Also used : SingleListType(net.geoprism.registry.SingleListType) IntervalListType(net.geoprism.registry.IntervalListType) ListType(net.geoprism.registry.ListType) IncrementalListType(net.geoprism.registry.IncrementalListType) JsonObject(com.google.gson.JsonObject) DuplicateDataDatabaseException(com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException) ClassificationTypeTest(net.geoprism.registry.classification.ClassificationTypeTest) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 24 with ListType

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();
    }
}
Also used : SingleListType(net.geoprism.registry.SingleListType) IntervalListType(net.geoprism.registry.IntervalListType) ListType(net.geoprism.registry.ListType) IncrementalListType(net.geoprism.registry.IncrementalListType) JsonObject(com.google.gson.JsonObject) DuplicateDataDatabaseException(com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException) ClassificationTypeTest(net.geoprism.registry.classification.ClassificationTypeTest) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 25 with ListType

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();
    }
}
Also used : SingleListType(net.geoprism.registry.SingleListType) IntervalListType(net.geoprism.registry.IntervalListType) ListType(net.geoprism.registry.ListType) IncrementalListType(net.geoprism.registry.IncrementalListType) JsonObject(com.google.gson.JsonObject) DuplicateDataDatabaseException(com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException) ClassificationTypeTest(net.geoprism.registry.classification.ClassificationTypeTest) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

ListType (net.geoprism.registry.ListType)28 Request (com.runwaysdk.session.Request)21 JsonObject (com.google.gson.JsonObject)19 ListTypeVersion (net.geoprism.registry.ListTypeVersion)11 Test (org.junit.Test)10 IncrementalListType (net.geoprism.registry.IncrementalListType)9 IntervalListType (net.geoprism.registry.IntervalListType)9 SingleListType (net.geoprism.registry.SingleListType)9 DuplicateDataDatabaseException (com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException)8 ClassificationTypeTest (net.geoprism.registry.classification.ClassificationTypeTest)8 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)8 JsonArray (com.google.gson.JsonArray)5 ListTypeEntry (net.geoprism.registry.ListTypeEntry)5 QueryFactory (com.runwaysdk.query.QueryFactory)4 Session (com.runwaysdk.session.Session)4 MdBusinessDAOIF (com.runwaysdk.dataaccess.MdBusinessDAOIF)3 InvalidMasterListException (net.geoprism.registry.InvalidMasterListException)3 ListTypeVersionQuery (net.geoprism.registry.ListTypeVersionQuery)3 Geometry (com.vividsolutions.jts.geom.Geometry)2 Organization (net.geoprism.registry.Organization)2