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


Java DbEntity类代码示例

本文整理汇总了Java中org.camunda.bpm.engine.impl.db.DbEntity的典型用法代码示例。如果您正苦于以下问题:Java DbEntity类的具体用法?Java DbEntity怎么用?Java DbEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DbEntity类属于org.camunda.bpm.engine.impl.db包,在下文中一共展示了DbEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectOne

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
public Object selectOne(String statement, Object parameter) {
  LOG.log(Level.FINE, "selectOne for statement '"+statement+"' parameter: "+parameter.toString());

  SingleResultQueryHandler<?> queryHandler = singleResultQueryHandlers.get(statement);
  if(queryHandler != null) {
    DbEntity result = queryHandler.executeQuery(this, parameter);
    fireEntityLoaded(result);
    return result;
  }
  else if ("selectTableCount".equals(statement)) {
    @SuppressWarnings("unchecked")
    String tableName = ((Map<String, String>) parameter).get("tableName");
    return cassandraSession.execute(QueryBuilder.select().countAll().from(tableName)).one().getLong(0);
  }
  else {
    LOG.warning("unknown query "+statement);
    return null;
  }

}
 
开发者ID:camunda,项目名称:camunda-engine-cassandra,代码行数:21,代码来源:CassandraPersistenceSession.java

示例2: getTableName

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
public String getTableName(Class<?> entityClass, boolean withPrefix) {
  String databaseTablePrefix = getDbSqlSession().getDbSqlSessionFactory().getDatabaseTablePrefix();
  String tableName = null;

  if (DbEntity.class.isAssignableFrom(entityClass)) {
    tableName = persistentObjectToTableNameMap.get(entityClass);
  }
  else {
    tableName = apiTypeToTableNameMap.get(entityClass);
  }
  if (withPrefix) {
    return databaseTablePrefix + tableName;
  }
  else {
    return tableName;
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:TableDataManager.java

示例3: get

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
/**
 * get an object from the cache
 *
 * @param type the type of the object
 * @param id the id of the object
 * @return the object or 'null' if the object is not in the cache
 * @throws ProcessEngineException if an object for the given id can be found but is of the wrong type.
 */
@SuppressWarnings("unchecked")
public <T extends DbEntity> T get(Class<T> type, String id) {
  Class<?> cacheKey = cacheKeyMapping.getEntityCacheKey(type);
  CachedDbEntity cachedDbEntity = getCachedEntity(cacheKey, id);
  if(cachedDbEntity != null) {
    DbEntity dbEntity = cachedDbEntity.getEntity();
    try {
      return (T) dbEntity;
    } catch(ClassCastException e) {
      throw LOG.entityCacheLookupException(type, id, dbEntity.getClass(), e);
    }
  } else {
    return null;
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:DbEntityCache.java

示例4: getEntitiesByType

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends DbEntity> List<T> getEntitiesByType(Class<T> type) {
  Class<?> cacheKey = cacheKeyMapping.getEntityCacheKey(type);
  Map<String, CachedDbEntity> entities = cachedEntites.get(cacheKey);
  List<T> result = new ArrayList<T>();
  if(entities == null) {
    return Collections.emptyList();
  } else {
    for (CachedDbEntity cachedEntity : entities.values()) {
      if (type != cacheKey) {
        // if the cacheKey of this type differs from the actual type,
        // not all cached entites with the key should be returned.
        // Then we only add those entities whose type matches the argument type.
        if (type.isAssignableFrom(cachedEntity.getClass())) {
          result.add((T) cachedEntity.getEntity());
        }
      } else {
        result.add((T) cachedEntity.getEntity());
      }

    }
    return result;
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:DbEntityCache.java

示例5: setDeleted

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
/**
 * Sets an object to a deleted state. It will not be removed from the cache but
 * transition to one of the DELETED states, depending on it's current state.
 *
 * @param dbEntity the object to mark deleted.
 */
public void setDeleted(DbEntity dbEntity) {
  CachedDbEntity cachedEntity = getCachedEntity(dbEntity);
  if(cachedEntity != null) {
    if(cachedEntity.getEntityState() == TRANSIENT) {
      cachedEntity.setEntityState(DELETED_TRANSIENT);

    } else if(cachedEntity.getEntityState() == PERSISTENT){
      cachedEntity.setEntityState(DELETED_PERSISTENT);

    } else if(cachedEntity.getEntityState() == MERGED){
      cachedEntity.setEntityState(DELETED_MERGED);
    }
  } else {
    // put a deleted merged into the cache
    CachedDbEntity cachedDbEntity = new CachedDbEntity();
    cachedDbEntity.setEntity(dbEntity);
    cachedDbEntity.setEntityState(DELETED_MERGED);
    putInternal(cachedDbEntity);

  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:28,代码来源:DbEntityCache.java

示例6: insertEntity

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
@Override
protected void insertEntity(DbEntityOperation operation) {

  final DbEntity dbEntity = operation.getEntity();

  // get statement
  String insertStatement = dbSqlSessionFactory.getInsertStatement(dbEntity);
  insertStatement = dbSqlSessionFactory.mapStatement(insertStatement);
  ensureNotNull("no insert statement for " + dbEntity.getClass() + " in the ibatis mapping files", "insertStatement", insertStatement);

  // execute the insert
  executeInsertEntity(insertStatement, dbEntity);

  // perform post insert actions on entity
  entityInserted(dbEntity);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:DbSqlSession.java

示例7: deleteEntity

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
@Override
protected void deleteEntity(DbEntityOperation operation) {

  final DbEntity dbEntity = operation.getEntity();

  // get statement
  String deleteStatement = dbSqlSessionFactory.getDeleteStatement(dbEntity.getClass());
  ensureNotNull("no delete statement for " + dbEntity.getClass() + " in the ibatis mapping files", "deleteStatement", deleteStatement);

  LOG.executeDatabaseOperation("DELETE", dbEntity);

  // execute the delete
  int nrOfRowsDeleted = executeDelete(deleteStatement, dbEntity);

  // It only makes sense to check for optimistic locking exceptions for objects that actually have a revision
  if (dbEntity instanceof HasDbRevision && nrOfRowsDeleted == 0) {
    operation.setFailed(true);
    return;
  }

  // perform post delete action
  entityDeleted(dbEntity);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:DbSqlSession.java

示例8: deleteJobInDatabase

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
private void deleteJobInDatabase() {
    CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
    commandExecutor.execute(new Command<Void>() {
      public Void execute(CommandContext commandContext) {

        timerEntity.delete();

        commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(timerEntity.getId());

        List<HistoricIncident> historicIncidents = Context
            .getProcessEngineConfiguration()
            .getHistoryService()
            .createHistoricIncidentQuery()
            .list();

        for (HistoricIncident historicIncident : historicIncidents) {
          commandContext
            .getDbEntityManager()
            .delete((DbEntity) historicIncident);
        }

        return null;
      }
    });
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:JobQueryTest.java

示例9: onEntityLoaded

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
@Override
public void onEntityLoaded(DbEntity entity) {
  if(entity instanceof JobEntity){
    CassandraSerializer<JobEntity> serializer = CassandraPersistenceSession.getSerializer(JobEntity.class);
    JobEntity copy= serializer.copy((JobEntity) entity);
    entityCache.put(entity.getId(), copy);
  }
}
 
开发者ID:camunda,项目名称:camunda-engine-cassandra,代码行数:9,代码来源:JobOperations.java

示例10: selectById

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends DbEntity> T selectById(Class<T> type, String id) {
  LOG.log(Level.FINE, "selectById for type '"+type.getSimpleName()+"' id '" +id+"'");

  EntityOperationHandler<?> entityOperations = operations.get(type);
  if(entityOperations != null) {
    DbEntity loadedEntity = entityOperations.getEntityById(this, id);
    fireEntityLoaded(loadedEntity);
    return (T) loadedEntity;
  }

  LOG.warning("Unhandled select by id "+type +" "+id);
  return null;
}
 
开发者ID:camunda,项目名称:camunda-engine-cassandra,代码行数:15,代码来源:CassandraPersistenceSession.java

示例11: processLoadedComposite

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
protected void processLoadedComposite(LoadedCompositeEntity composite) {
  DbEntity mainEntity = composite.getPrimaryEntity();
  boolean isMainEntityEventFired = false;
  for (Map<String, ? extends DbEntity> entities : composite.getEmbeddedEntities().values()) {
    for (DbEntity entity : entities.values()) {
      fireEntityLoaded(entity);
      if(entity == mainEntity) {
        isMainEntityEventFired = true;
      }
    }
  }
  if(!isMainEntityEventFired) {
    fireEntityLoaded(mainEntity);
  }
}
 
开发者ID:camunda,项目名称:camunda-engine-cassandra,代码行数:16,代码来源:CassandraPersistenceSession.java

示例12: getEntities

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
public List<Class<? extends DbEntity>> getEntities(String tableName) {
  String databaseTablePrefix = getDbSqlSession().getDbSqlSessionFactory().getDatabaseTablePrefix();
  List<Class<? extends DbEntity>> entities = new ArrayList<Class<? extends DbEntity>>();

  Set<Class<? extends DbEntity>> entityClasses = persistentObjectToTableNameMap.keySet();
  for (Class<? extends DbEntity> entityClass : entityClasses) {
    String entityTableName = persistentObjectToTableNameMap.get(entityClass);
    if ((databaseTablePrefix + entityTableName).equals(tableName)) {
      entities.add(entityClass);
    }
  }
  return entities;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:14,代码来源:TableDataManager.java

示例13: compare

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
public int compare(DbEntityOperation firstOperation, DbEntityOperation secondOperation) {

    if(firstOperation.equals(secondOperation)) {
      return 0;
    }

    DbEntity firstEntity = firstOperation.getEntity();
    DbEntity secondEntity = secondOperation.getEntity();

    return firstEntity.getId().compareTo(secondEntity.getId());
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:12,代码来源:DbEntityOperationComparator.java

示例14: getDeletesByType

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
protected SortedSet<DbEntityOperation> getDeletesByType(Class<? extends DbEntity> type, boolean create) {
  SortedSet<DbEntityOperation> deletesByType = deletes.get(type);
  if(deletesByType == null && create) {
    deletesByType = new TreeSet<DbEntityOperation>(MODIFICATION_OPERATION_COMPARATOR);
    deletes.put(type, deletesByType);
  }
  return deletesByType;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:9,代码来源:DbOperationManager.java

示例15: getUpdatesByType

import org.camunda.bpm.engine.impl.db.DbEntity; //导入依赖的package包/类
protected SortedSet<DbEntityOperation> getUpdatesByType(Class<? extends DbEntity> type, boolean create) {
  SortedSet<DbEntityOperation> updatesByType = updates.get(type);
  if(updatesByType == null && create) {
    updatesByType = new TreeSet<DbEntityOperation>(MODIFICATION_OPERATION_COMPARATOR);
    updates.put(type, updatesByType);
  }
  return updatesByType;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:9,代码来源:DbOperationManager.java


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