当前位置: 首页>>代码示例>>Java>>正文


Java RemovedObjectEntry类代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:23,代码来源:WabitSessionPersister.java

示例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);
    }
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:12,代码来源:AbstractNetworkConflictResolver.java

示例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));
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:14,代码来源:WorkspacePersisterListener.java

示例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);
	}
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:12,代码来源:WorkspacePersisterListener.java

示例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();
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:36,代码来源:WabitSessionPersister.java

示例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);
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:22,代码来源:WabitSessionPersister.java

示例7: setObjectsToRemoveRollbackList

import ca.sqlpower.dao.RemovedObjectEntry; //导入依赖的package包/类
private void setObjectsToRemoveRollbackList(
		List<RemovedObjectEntry> objectsToRemoveRollbackList) {
	this.objectsToRemoveRollbackList = objectsToRemoveRollbackList;
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:5,代码来源:WabitSessionPersister.java


注:本文中的ca.sqlpower.dao.RemovedObjectEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。