use of com.runwaysdk.dataaccess.transaction.Transaction in project geoprism-registry by terraframe.
the class SearchService method deleteSearchTable.
@Transaction
public void deleteSearchTable() {
String suffix = this.getSuffix();
MdEdgeDAOIF mdEdge = MdEdgeDAO.getMdEdgeDAO(PACKAGE + "." + EDGE_PREFIX + suffix);
mdEdge.getBusinessDAO().delete();
MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(PACKAGE + "." + VERTEX_PREFIX + suffix);
mdVertex.getBusinessDAO().delete();
}
use of com.runwaysdk.dataaccess.transaction.Transaction in project geoprism-registry by terraframe.
the class XMLImporter method importXMLDefinitions.
@Transaction
public List<ServerElement> importXMLDefinitions(Organization organization, InputStream istream) {
TransactionState state = TransactionState.getCurrentTransactionState();
state.putTransactionObject("transaction-state", this.cache);
LinkedList<ServerElement> list = new LinkedList<ServerElement>();
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = factory.newDocumentBuilder();
Document doc = dBuilder.parse(istream);
list.addAll(this.createTypes(organization, doc));
list.addAll(this.createHierarchies(organization, doc));
list.addAll(this.createDirectedAcyclicGraphTypes(doc));
list.addAll(this.createUndirectedGraphTypes(doc));
} catch (ParserConfigurationException | IOException | SAXException e) {
throw new ProgrammingErrorException(e);
}
return list;
}
use of com.runwaysdk.dataaccess.transaction.Transaction in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method createCRTrans.
@Transaction
private String createCRTrans(String actionType) {
ChangeRequest cr = new ChangeRequest();
cr.addApprovalStatus(AllGovernanceStatus.PENDING);
cr.setOrganizationCode(FastTestDataset.ORG_CGOV.getCode());
if (actionType.equals(UpdateAttributeViewJsonAdapters.PARENT_ATTR_NAME)) {
cr.setGeoObjectCode(FastTestDataset.PROV_CENTRAL.getCode());
cr.setGeoObjectTypeCode(FastTestDataset.PROV_CENTRAL.getGeoObjectType().getCode());
} else {
cr.setGeoObjectCode(FastTestDataset.CAMBODIA.getCode());
cr.setGeoObjectTypeCode(FastTestDataset.CAMBODIA.getGeoObjectType().getCode());
}
cr.apply();
AbstractAction action = null;
if (actionType.equals(CreateGeoObjectAction.CLASS)) {
action = new CreateGeoObjectAction();
action.setApiVersion("1.0");
((CreateGeoObjectActionBase) action).setGeoObjectJson(FastTestDataset.CAMBODIA.fetchGeoObjectOverTime().toJSON().toString());
action.addApprovalStatus(AllGovernanceStatus.PENDING);
action.setCreateActionDate(new Date());
action.apply();
} else if (actionType.equals(UpdateAttributeAction.CLASS)) {
action = new UpdateAttributeAction();
action.setApiVersion("1.0");
((UpdateAttributeActionBase) action).setAttributeName(FastTestDataset.AT_National_Anthem.getAttributeName());
((UpdateAttributeActionBase) action).setJson(UPDATE_ATTR_JSON);
action.addApprovalStatus(AllGovernanceStatus.PENDING);
action.setCreateActionDate(new Date());
action.apply();
} else if (actionType.equals(UpdateAttributeViewJsonAdapters.PARENT_ATTR_NAME)) {
action = new UpdateAttributeAction();
action.setApiVersion("1.0");
((UpdateAttributeActionBase) action).setAttributeName(UpdateAttributeViewJsonAdapters.PARENT_ATTR_NAME);
((UpdateAttributeActionBase) action).setJson(UPDATE_PARENT_ATTR_JSON);
action.addApprovalStatus(AllGovernanceStatus.PENDING);
action.setCreateActionDate(new Date());
action.apply();
} else {
throw new UnsupportedOperationException();
}
cr.addAction(action).apply();
return cr.toJSON().toString();
}
use of com.runwaysdk.dataaccess.transaction.Transaction in project geoprism-registry by terraframe.
the class TaskTest method deleteAllTasksInTrans.
@Transaction
private static void deleteAllTasksInTrans() {
LocalizedValueStoreQuery lvsq = new LocalizedValueStoreQuery(new QueryFactory());
lvsq.WHERE(lvsq.getStoreKey().EQ(TestTaskType.TestGeoObjectSplitOrphanedChildren.getTemplateKey()).OR(lvsq.getStoreKey().EQ(TestTaskType.TestGeoObjectSplitOrphanedChildren.getTitleKey())));
OIterator<? extends LocalizedValueStore> lvsit = lvsq.getIterator();
while (lvsit.hasNext()) {
LocalizedValueStore template = lvsit.next();
TaskQuery tq = new TaskQuery(new QueryFactory());
tq.WHERE(tq.getTemplate().EQ(template));
tq.OR(tq.getTitle().EQ(template));
OIterator<? extends Task> it2 = tq.getIterator();
while (it2.hasNext()) {
it2.next().delete();
}
template.delete();
}
}
use of com.runwaysdk.dataaccess.transaction.Transaction in project geoprism-registry by terraframe.
the class DirectedAcyclicGraphType method update.
@Transaction
public void update(JsonObject object) {
try {
this.appLock();
if (object.has(DirectedAcyclicGraphType.DISPLAYLABEL)) {
LocalizedValue label = LocalizedValue.fromJSON(object.getAsJsonObject(DirectedAcyclicGraphType.DISPLAYLABEL));
LocalizedValueConverter.populate(this.getDisplayLabel(), label);
}
if (object.has(DirectedAcyclicGraphType.DESCRIPTION)) {
LocalizedValue description = LocalizedValue.fromJSON(object.getAsJsonObject(DirectedAcyclicGraphType.DESCRIPTION));
LocalizedValueConverter.populate(this.getDescription(), description);
}
this.apply();
} finally {
this.unlock();
}
}
Aggregations