當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。