Search in sources :

Example 1 with PropertyEntity

use of org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity in project camunda-bpm-platform by camunda.

the class GetPropertiesCmd method execute.

@SuppressWarnings("unchecked")
public Map<String, String> execute(CommandContext commandContext) {
    List<PropertyEntity> propertyEntities = commandContext.getDbEntityManager().selectList("selectProperties");
    Map<String, String> properties = new HashMap<String, String>();
    for (PropertyEntity propertyEntity : propertyEntities) {
        properties.put(propertyEntity.getName(), propertyEntity.getValue());
    }
    return properties;
}
Also used : PropertyEntity(org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity) HashMap(java.util.HashMap)

Example 2 with PropertyEntity

use of org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity in project camunda-bpm-platform by camunda.

the class DeletePropertyCmd method execute.

public Object execute(CommandContext commandContext) {
    final PropertyManager propertyManager = commandContext.getPropertyManager();
    PropertyEntity propertyEntity = propertyManager.findPropertyById(name);
    if (propertyEntity != null) {
        propertyManager.delete(propertyEntity);
    }
    return null;
}
Also used : PropertyEntity(org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity) PropertyManager(org.camunda.bpm.engine.impl.persistence.entity.PropertyManager)

Example 3 with PropertyEntity

use of org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity in project camunda-bpm-platform by camunda.

the class SetPropertyCmd method execute.

public Object execute(CommandContext commandContext) {
    final PropertyManager propertyManager = commandContext.getPropertyManager();
    PropertyEntity property = propertyManager.findPropertyById(name);
    if (property != null) {
        // update
        property.setValue(value);
    } else {
        // create
        property = new PropertyEntity(name, value);
        propertyManager.insert(property);
    }
    return null;
}
Also used : PropertyEntity(org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity) PropertyManager(org.camunda.bpm.engine.impl.persistence.entity.PropertyManager)

Example 4 with PropertyEntity

use of org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity in project camunda-bpm-platform by camunda.

the class HistoryLevelSetupCommand method dbCreateHistoryLevel.

public static void dbCreateHistoryLevel(CommandContext commandContext) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    HistoryLevel configuredHistoryLevel = processEngineConfiguration.getHistoryLevel();
    PropertyEntity property = new PropertyEntity("historyLevel", Integer.toString(configuredHistoryLevel.getId()));
    commandContext.getSession(DbEntityManager.class).insert(property);
    LOG.creatingHistoryLevelPropertyInDatabase(configuredHistoryLevel);
}
Also used : HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) PropertyEntity(org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity) DbEntityManager(org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 5 with PropertyEntity

use of org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity in project camunda-bpm-platform by camunda.

the class GetNextIdBlockCmd method execute.

public IdBlock execute(CommandContext commandContext) {
    PropertyEntity property = commandContext.getPropertyManager().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.camunda.bpm.engine.impl.db.IdBlock) PropertyEntity(org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity)

Aggregations

PropertyEntity (org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity)5 PropertyManager (org.camunda.bpm.engine.impl.persistence.entity.PropertyManager)2 HashMap (java.util.HashMap)1 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 IdBlock (org.camunda.bpm.engine.impl.db.IdBlock)1 DbEntityManager (org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager)1 HistoryLevel (org.camunda.bpm.engine.impl.history.HistoryLevel)1