本文整理汇总了Java中ca.sqlpower.dao.RemovedObjectEntry类的典型用法代码示例。如果您正苦于以下问题:Java RemovedObjectEntry类的具体用法?Java RemovedObjectEntry怎么用?Java RemovedObjectEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RemovedObjectEntry类属于ca.sqlpower.dao包,在下文中一共展示了RemovedObjectEntry类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rollbackRemovals
import ca.sqlpower.dao.RemovedObjectEntry; //导入依赖的package包/类
/**
* Rolls back the removal of persisted {@link WabitObject}s
*
* @throws SPPersistenceException
* Thrown if a WabitObject could not be rolled back from its parent.
*/
private void rollbackRemovals() throws IllegalStateException {
// We must rollback in the inverse order the operations were performed.
Collections.reverse(this.objectsToRemoveRollbackList);
for (RemovedObjectEntry entry : this.objectsToRemoveRollbackList) {
final String parentUuid = entry.getParentUUID();
final SPObject objectToRestore = entry.getRemovedChild();
final int index = entry.getIndex();
final SPObject parent = SQLPowerUtils.findByUuid(root, parentUuid, SPObject.class);
try {
parent.addChild(objectToRestore, index);
} catch (Throwable t) {
// Keep going. We need to rollback as much as we can.
logger.error("Cannot rollback " + entry.getRemovedChild() + " child removal", t);
}
}
}
示例2: fillOutboundPersistedLists
import ca.sqlpower.dao.RemovedObjectEntry; //导入依赖的package包/类
protected void fillOutboundPersistedLists() {
for (PersistedSPObject obj : listener.getPersistedObjects()) {
outboundObjectsToAdd.put(obj.getUUID(), obj);
}
for (PersistedSPOProperty prop : listener.getPersistedProperties()) {
outboundPropertiesToChange.put(prop.getUUID(), prop);
}
for (RemovedObjectEntry rem : listener.getObjectsToRemove().values()) {
outboundObjectsToRemove.put(rem.getRemovedChild().getUUID(), rem);
}
}
示例3: childRemoved
import ca.sqlpower.dao.RemovedObjectEntry; //导入依赖的package包/类
public void childRemoved(SPChildEvent e) {
logger.debug("wabitChildRemoved(" + e.getChildType() + ")");
e.getChild().removeSPListener(this);
if (wouldEcho()) return;
this.transactionStarted(TransactionEvent.createStartTransactionEvent(this,
"Start of transaction triggered by wabitChildRemoved event"));
this.objectsToRemove.add(
new RemovedObjectEntry(
e.getSource().getUUID(),
e.getChild(),
e.getIndex()));
this.transactionEnded(TransactionEvent.createEndTransactionEvent(this));
}
示例4: commitRemovals
import ca.sqlpower.dao.RemovedObjectEntry; //导入依赖的package包/类
private void commitRemovals() throws SPPersistenceException {
logger.debug("commitRemovals()");
for (RemovedObjectEntry entry: this.objectsToRemove) {
logger.debug("target.removeObject(" + entry.getParentUUID() + ", " +
entry.getRemovedChild().getUUID() + ")");
target.removeObject(
entry.getParentUUID(),
entry.getRemovedChild().getUUID());
this.objectsToRemoveRollbackList.add(entry);
}
}
示例5: commitObjects
import ca.sqlpower.dao.RemovedObjectEntry; //导入依赖的package包/类
/**
* Commits the persisted {@link WabitObject}s
*
* @throws SPPersistenceException
*/
private void commitObjects() throws SPPersistenceException {
List<PersistedSPObject> orderedPersistedObjects = new ArrayList<PersistedSPObject>(persistedObjects.size());
orderedPersistedObjects.addAll(persistedObjects.values());
Collections.sort(orderedPersistedObjects, persistedObjectComparator);
for (PersistedSPObject pwo : orderedPersistedObjects) {
if (pwo.isLoaded())
continue;
SPObject parent = SQLPowerUtils.findByUuid(root, pwo
.getParentUUID(), SPObject.class);
SPObject spo = loadWabitObject(pwo);
if (spo != null) {
SPListener removeChildOnAddListener = new AbstractSPListener() {
public void childRemoved(SPChildEvent e) {
objectsToRemoveRollbackList.add(
new RemovedObjectEntry(e.getSource().getUUID(), e.getChild(), e.getIndex()));
}
};
parent.addSPListener(removeChildOnAddListener);
// FIXME Terrible hack, see bug 2326
parent.addChild(spo, Math.min(pwo.getIndex(), parent.getChildren(spo.getClass()).size()));
parent.removeSPListener(removeChildOnAddListener);
this.persistedObjectsRollbackList.add(
new PersistedObjectEntry(
parent.getUUID(),
spo.getUUID()));
}
}
persistedObjects.clear();
}
示例6: undoForSession
import ca.sqlpower.dao.RemovedObjectEntry; //导入依赖的package包/类
/**
* This static accessible method allows
* @param session
* @param creations
* @param properties
* @param removals
* @throws SPPersistenceException
*/
public static void undoForSession(
WabitSession session,
List<PersistedObjectEntry> creations,
List<PersistedPropertiesEntry> properties,
List<RemovedObjectEntry> removals) throws SPPersistenceException
{
WabitSessionPersister persister = new WabitSessionPersister("undoer", session, false);
persister.setGodMode(true);
persister.setObjectsToRemoveRollbackList(removals);
persister.setPersistedObjectsRollbackList(creations);
persister.setPersistedPropertiesRollbackList(properties);
persister.rollback(true);
}
示例7: setObjectsToRemoveRollbackList
import ca.sqlpower.dao.RemovedObjectEntry; //导入依赖的package包/类
private void setObjectsToRemoveRollbackList(
List<RemovedObjectEntry> objectsToRemoveRollbackList) {
this.objectsToRemoveRollbackList = objectsToRemoveRollbackList;
}