Search in sources :

Example 16 with Transaction

use of com.runwaysdk.dataaccess.transaction.Transaction in project geoprism-registry by terraframe.

the class MasterList method markAllAsInvalid.

@Transaction
public static void markAllAsInvalid(ServerHierarchyType hierarchyType, ServerGeoObjectType type) {
    MasterListQuery query = new MasterListQuery(new QueryFactory());
    query.WHERE(query.getValid().EQ((Boolean) null));
    query.OR(query.getValid().EQ(true));
    try (OIterator<? extends MasterList> iterator = query.getIterator()) {
        while (iterator.hasNext()) {
            MasterList masterlist = iterator.next();
            if (hierarchyType != null && type != null) {
                masterlist.markAsInvalid(hierarchyType, type);
            } else if (hierarchyType != null) {
                masterlist.markAsInvalid(hierarchyType);
            } else if (type != null) {
                masterlist.markAsInvalid(type);
            }
        }
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 17 with Transaction

use of com.runwaysdk.dataaccess.transaction.Transaction in project geoprism-registry by terraframe.

the class MasterList method publishFrequencyVersions.

@Transaction
public void publishFrequencyVersions() {
    if (!this.isValid()) {
        throw new InvalidMasterListException();
    }
    NotificationFacade.queue(new GlobalNotificationMessage(MessageType.PUBLISH_JOB_CHANGE, null));
    try {
        Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
        final ServerGeoObjectType objectType = this.getGeoObjectType();
        Pair<Date, Date> range = this.getDateRange(objectType);
        if (range != null) {
            Date endDate = range.getSecond();
            if (endDate.after(new Date())) {
                endDate = new Date();
            }
            List<Date> dates = this.getFrequencyDates(range.getFirst(), range.getSecond());
            for (Date date : dates) {
                MasterListVersion version = this.getOrCreateVersion(date, MasterListVersion.PUBLISHED);
                ((Session) Session.getCurrentSession()).reloadPermissions();
                version.publish();
            }
        } else {
            throw new EmptyListException();
        }
    } finally {
        Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
    }
}
Also used : ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) GlobalNotificationMessage(net.geoprism.registry.ws.GlobalNotificationMessage) Date(java.util.Date) Session(com.runwaysdk.session.Session) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 18 with Transaction

use of com.runwaysdk.dataaccess.transaction.Transaction in project geoprism-registry by terraframe.

the class SynchronizationConfig method apply.

@Override
@Transaction
public void apply() {
    SessionIF session = Session.getCurrentSession();
    Organization organization = this.getOrganization();
    if (session != null && organization != null) {
        ServiceFactory.getRolePermissionService().enforceRA(organization.getCode());
    }
    super.apply();
    if (this.isNew()) {
        DataExportJob job = new DataExportJob();
        job.setConfig(this);
        job.apply();
    }
}
Also used : DataExportJob(net.geoprism.registry.etl.export.DataExportJob) SessionIF(com.runwaysdk.session.SessionIF) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 19 with Transaction

use of com.runwaysdk.dataaccess.transaction.Transaction in project geoprism-registry by terraframe.

the class SynchronizationConfig method delete.

@Override
@Transaction
public void delete() {
    List<? extends DataExportJob> jobs = getJobs();
    for (DataExportJob job : jobs) {
        job.delete();
    }
    super.delete();
}
Also used : DataExportJob(net.geoprism.registry.etl.export.DataExportJob) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 20 with Transaction

use of com.runwaysdk.dataaccess.transaction.Transaction in project geoprism-registry by terraframe.

the class UndirectedGraphType method update.

@Transaction
public void update(JsonObject object) {
    try {
        this.appLock();
        if (object.has(UndirectedGraphType.JSON_LABEL)) {
            LocalizedValue label = LocalizedValue.fromJSON(object.getAsJsonObject(UndirectedGraphType.JSON_LABEL));
            LocalizedValueConverter.populate(this.getDisplayLabel(), label);
        }
        if (object.has(UndirectedGraphType.DESCRIPTION)) {
            LocalizedValue description = LocalizedValue.fromJSON(object.getAsJsonObject(UndirectedGraphType.DESCRIPTION));
            LocalizedValueConverter.populate(this.getDescription(), description);
        }
        this.apply();
    } finally {
        this.unlock();
    }
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Aggregations

Transaction (com.runwaysdk.dataaccess.transaction.Transaction)131 QueryFactory (com.runwaysdk.query.QueryFactory)29 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)27 JsonObject (com.google.gson.JsonObject)17 Date (java.util.Date)15 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)15 MdBusinessDAO (com.runwaysdk.dataaccess.metadata.MdBusinessDAO)14 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)13 LinkedList (java.util.LinkedList)11 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)11 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)10 ProgrammingErrorException (com.runwaysdk.dataaccess.ProgrammingErrorException)10 MdBusiness (com.runwaysdk.system.metadata.MdBusiness)10 List (java.util.List)10 ChangeRequest (net.geoprism.registry.action.ChangeRequest)10 VertexObject (com.runwaysdk.business.graph.VertexObject)8 IOException (java.io.IOException)8 GeoObjectImportConfiguration (net.geoprism.registry.io.GeoObjectImportConfiguration)8 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)8 JSONObject (org.json.JSONObject)8