Search in sources :

Example 1 with IdBlock

use of org.activiti.engine.impl.db.IdBlock in project Activiti by Activiti.

the class GetNextIdBlockCmd method execute.

public IdBlock execute(CommandContext commandContext) {
    PropertyEntity property = (PropertyEntity) commandContext.getPropertyEntityManager().findPropertyById("next.dbid");
    long oldValue = Long.parseLong(property.getValue());
    long newValue = oldValue + idBlockSize;
    property.setValue(Long.toString(newValue));
    return new IdBlock(oldValue, newValue - 1);
}
Also used : IdBlock(org.activiti.engine.impl.db.IdBlock) PropertyEntity(org.activiti.engine.impl.persistence.entity.PropertyEntity)

Aggregations

IdBlock (org.activiti.engine.impl.db.IdBlock)1 PropertyEntity (org.activiti.engine.impl.persistence.entity.PropertyEntity)1