本文整理汇总了Java中javax.jdo.listener.InstanceLifecycleEvent类的典型用法代码示例。如果您正苦于以下问题:Java InstanceLifecycleEvent类的具体用法?Java InstanceLifecycleEvent怎么用?Java InstanceLifecycleEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InstanceLifecycleEvent类属于javax.jdo.listener包,在下文中一共展示了InstanceLifecycleEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: preDelete
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void preDelete(InstanceLifecycleEvent event) {
Object instance = event.getSource();
String className = instance.getClass().getName();
getLogger().trace("Received pre-delete for: {}", instance);
// omit events for trash and history instances
// get the schema version from the data service
MotechDataService dataService = ServiceUtil.getServiceFromAppContext(getApplicationContext(), className);
Long schemaVersion = dataService.getSchemaVersion();
if (getService().isTrashMode()) {
getLogger().debug("Moving to trash {}, schema version {}", new Object[]{instance, schemaVersion});
getService().moveToTrash(instance, schemaVersion);
}
}
开发者ID:motech,项目名称:motech,代码行数:18,代码来源:TrashListener.java
示例2: preDelete
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void preDelete(final InstanceLifecycleEvent event) {
final TempFileChunk tempFileChunk = (TempFileChunk) event.getPersistentInstance();
final LocalRepoTransaction tx = getTransactionOrFail();
final FileChunkPayloadDao fileChunkPayloadDao = tx.getDao(FileChunkPayloadDao.class);
final FileChunkPayload fileChunkPayload = fileChunkPayloadDao.getFileChunkPayload(tempFileChunk);
if (fileChunkPayload != null) {
// check, if it's still referenced by a HistoFileChunk!
final long histoFileChunkCount = tx.getDao(HistoFileChunkDao.class).getHistoFileChunkCount(fileChunkPayload);
if (histoFileChunkCount == 0)
fileChunkPayloadDao.deletePersistent(fileChunkPayload);
else
fileChunkPayload.setTempFileChunk(null);
}
tx.flush();
}
开发者ID:subshare,项目名称:subshare,代码行数:19,代码来源:DeleteTempFileChunkListener.java
示例3: preDelete
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void preDelete(final InstanceLifecycleEvent event) {
final FileChunk fileChunk = (FileChunk) event.getPersistentInstance();
final LocalRepoTransaction tx = getTransactionOrFail();
final FileChunkPayloadDao fileChunkPayloadDao = tx.getDao(FileChunkPayloadDao.class);
final FileChunkPayload fileChunkPayload = fileChunkPayloadDao.getFileChunkPayload(fileChunk);
if (fileChunkPayload != null) {
// check, if it's still referenced by a HistoFileChunk!
final long histoFileChunkCount = tx.getDao(HistoFileChunkDao.class).getHistoFileChunkCount(fileChunkPayload);
if (histoFileChunkCount == 0)
fileChunkPayloadDao.deletePersistent(fileChunkPayload);
else
fileChunkPayload.setFileChunk(null);
}
tx.flush();
}
开发者ID:subshare,项目名称:subshare,代码行数:19,代码来源:DeleteFileChunkListener.java
示例4: preDelete
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void preDelete(final InstanceLifecycleEvent event) {
final RepoFile repoFile = (RepoFile) event.getPersistentInstance();
final LocalRepoTransaction tx = getTransactionOrFail();
if (repoFile instanceof NormalFile) {
final NormalFile normalFile = (NormalFile) repoFile;
final TempFileChunkDao tempFileChunkDao = tx.getDao(TempFileChunkDao.class);
final Collection<TempFileChunk> tempFileChunks = tempFileChunkDao.getTempFileChunks(normalFile);
tempFileChunkDao.deletePersistentAll(tempFileChunks);
tx.flush();
}
final CryptoRepoFileDao cryptoRepoFileDao = tx.getDao(CryptoRepoFileDao.class);
final CryptoRepoFile cryptoRepoFile = cryptoRepoFileDao.getCryptoRepoFile(repoFile);
if (cryptoRepoFile != null) {
// PreliminaryDeletion preliminaryDeletion = tx.getDao(PreliminaryDeletionDao.class).getPreliminaryDeletion(cryptoRepoFile);
// if (preliminaryDeletion == null && cryptoRepoFile.getDeleted() == null)
// throw new IllegalStateException(String.format("%s not marked as deleted!", cryptoRepoFile));
// The above is a legal state when switching from one type of RepoFile to another (e.g. from NormalFile to Directory).
cryptoRepoFile.setRepoFile(null); // this must be done, now, because we cannot delete the RepoFile otherwise due to a constraint-violation
}
}
开发者ID:subshare,项目名称:subshare,代码行数:26,代码来源:DeleteRepoFileListener.java
示例5: postStore
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void postStore(InstanceLifecycleEvent event) {
xLogger.fine("Lifecycle : create for " +
((Persistable) event.getSource()).dnGetObjectId());
IEvent eventEntity = (IEvent) event.getPersistentInstance();
xLogger.fine("Entered PostPutCallbacks.notify");
Boolean isRealTime = eventEntity.isRealTime();
//Getting estimated time of action for scheduled tasks.
long etaMillis = -1l;
Object etaObject = eventEntity.getEtaMillis();
if (etaObject != null) {
etaMillis = (Long) etaObject;
}
try {
if (isRealTime) {
Map<String, String> params = new HashMap<String, String>();
params.put("action", "notify");
params.put("eventkey", String.valueOf(eventEntity.getKey()));
params.put("frequency", String.valueOf(EventSpec.NotifyOptions.IMMEDIATE));
params.put("method", MessageService.SMS);
if (etaMillis == -1) {
etaMillis = System.currentTimeMillis() + 10_000;
}
taskService.schedule(ITaskService.QUEUE_MESSAGE, NOTIFIER_URL, params, null,
ITaskService.METHOD_POST, etaMillis, eventEntity.getDomainId(), null,
"EVENT_NOTIFICATION");
}
} catch (Exception e) {
xLogger.warn("{0} during PostPut notify for event key {1}: {2}", e.getClass().getName(),
eventEntity.getKey(), e.getMessage());
}
xLogger.fine("Exiting PostPutCallbacks.notify");
}
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:34,代码来源:PostPutCallbacks.java
示例6: postDirty
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
public void postDirty(javax.jdo.listener.InstanceLifecycleEvent event)
{
final String message = "Post dirty event for " + event.getSource().getClass().getName();
//logger.error(message, new Exception(message));
if (get() == null)
set(new Boolean(true));
}
开发者ID:SeldonIO,项目名称:seldon-server,代码行数:8,代码来源:JDOLifecycleListener.java
示例7: postStore
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void postStore(InstanceLifecycleEvent event) {
Object instance = event.getSource();
getLogger().trace("Post-store event received for {}", instance);
getLogger().debug("Recording history for {}", instance);
getService().record(instance);
}
开发者ID:motech,项目名称:motech,代码行数:9,代码来源:HistoryListener.java
示例8: postStore
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void postStore(final InstanceLifecycleEvent event) {
final Object persistable = assertNotNull(event.getPersistentInstance(), "event.persistentInstance");
if (persistable instanceof RepoFile) {
final RepoFile repoFile = (RepoFile) persistable;
repoFileName2RepoFile.put(assertNotNull(repoFile.getName(), "repoFile.name"), repoFile);
}
else if (persistable instanceof CryptoRepoFile)
cryptoRepoFilePersisted = true;
else if (persistable instanceof HistoCryptoRepoFile)
histoCryptoRepoFilePersisted = true;
}
开发者ID:subshare,项目名称:subshare,代码行数:13,代码来源:AssignCryptoRepoFileRepoFileListener.java
示例9: postDelete
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void postDelete(InstanceLifecycleEvent event) {
final Object entity = assertNotNull(event.getPersistentInstance(), "event.persistentInstance");
final EntityId entityId = getEntityId(entity);
if (entityId != null)
enlist(new EntityModification(entityId, EntityModificationType.DELETE));
}
开发者ID:subshare,项目名称:subshare,代码行数:8,代码来源:LocalRepoCommitEventManagerNotifyingListener.java
示例10: postStore
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void postStore(InstanceLifecycleEvent event) {
final Object entity = assertNotNull(event.getPersistentInstance(), "event.persistentInstance");
final EntityId entityId = getEntityId(entity);
if (entityId != null)
enlist(new EntityModification(entityId, EntityModificationType.CHANGE));
}
开发者ID:subshare,项目名称:subshare,代码行数:8,代码来源:LocalRepoCommitEventManagerNotifyingListener.java
示例11: postCreate
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void postCreate(InstanceLifecycleEvent event) {
final Object entity = assertNotNull(event.getPersistentInstance(), "event.persistentInstance");
final EntityId entityId = getEntityId(entity);
if (entityId != null)
enlist(new EntityModification(entityId, EntityModificationType.CREATE));
}
开发者ID:subshare,项目名称:subshare,代码行数:8,代码来源:LocalRepoCommitEventManagerNotifyingListener.java
示例12: preStore
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void preStore(final InstanceLifecycleEvent event) {
// It seems, this method is always invoked whenever something is about to be written
// into the database - no matter, if it's a new object being persisted, a detached
// object being attached or a persistent object having been modified and being flushed.
// Therefore, we do not need AttachLifecycleListener and DirtyLifecycleListener.
// Marco :-)
onWrite(event.getPersistentInstance());
}
开发者ID:cloudstore,项目名称:cloudstore,代码行数:10,代码来源:AutoTrackLifecycleListener.java
示例13: preDelete
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void preDelete(final InstanceLifecycleEvent event) {
// We want to ensure that the revision is incremented, even if we do not have any remote repository connected
// (and thus no DeleteModification being created).
getTransactionOrFail().getLocalRevision();
final Object oid = JDOHelper.getObjectId(event.getPersistentInstance());
oid2LastChanged.remove(oid);
}
开发者ID:cloudstore,项目名称:cloudstore,代码行数:10,代码来源:AutoTrackLifecycleListener.java
示例14: preStore
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void preStore(InstanceLifecycleEvent event) {
// TODO Auto-generated method stub
}
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:6,代码来源:PostPutCallbacks.java
示例15: preDirty
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
public void preDirty(InstanceLifecycleEvent arg0)
{
}
开发者ID:SeldonIO,项目名称:seldon-server,代码行数:4,代码来源:JDOLifecycleListener.java
示例16: postCreate
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void postCreate(InstanceLifecycleEvent event) {
invokeMethods(event.getPersistentInstance(), InstanceLifecycleListenerType.POST_CREATE);
}
开发者ID:motech,项目名称:motech,代码行数:5,代码来源:ProxyJdoListener.java
示例17: preStore
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void preStore(InstanceLifecycleEvent event) {
invokeMethods(event.getPersistentInstance(), InstanceLifecycleListenerType.PRE_STORE);
}
开发者ID:motech,项目名称:motech,代码行数:5,代码来源:ProxyJdoListener.java
示例18: postStore
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void postStore(InstanceLifecycleEvent event) {
invokeMethods(event.getPersistentInstance(), InstanceLifecycleListenerType.POST_STORE);
}
开发者ID:motech,项目名称:motech,代码行数:5,代码来源:ProxyJdoListener.java
示例19: preDelete
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void preDelete(InstanceLifecycleEvent event) {
invokeMethods(event.getPersistentInstance(), InstanceLifecycleListenerType.PRE_DELETE);
}
开发者ID:motech,项目名称:motech,代码行数:5,代码来源:ProxyJdoListener.java
示例20: postDelete
import javax.jdo.listener.InstanceLifecycleEvent; //导入依赖的package包/类
@Override
public void postDelete(InstanceLifecycleEvent event) {
invokeMethods(event.getPersistentInstance(), InstanceLifecycleListenerType.POST_DELETE);
}
开发者ID:motech,项目名称:motech,代码行数:5,代码来源:ProxyJdoListener.java
注:本文中的javax.jdo.listener.InstanceLifecycleEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论