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);
}
}
}
}
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);
}
}
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();
}
}
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();
}
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();
}
}
Aggregations