cancel
Showing results for 
Search instead for 
Did you mean: 

Add a variable to ended process instance ?

christophe_carv
Champ in-the-making
Champ in-the-making
Hi,

Is there a way of adding a variable to an ended process instance ? Our database is growing and we want to filter all historic process instance with more values using HistoryService…

I tried with a sql query but i can't find the value for the primary key.


Best regards.
5 REPLIES 5

trademak
Star Contributor
Star Contributor
It's not supported via the Activiti API. But you can add new entries to the historic variable table for example. You can query for historic process instances to retrieve the database id (primary key).

Best regards,

Thanks.

But my query would be like this : "INSERT INTO ACT_HI_VARINST VALUES (?, ?, ?…" and the primary key seems to be calculated with a specific algorithm (IdGenerator)…

How can i find the next id to insert ?


Regards.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

call
org.activiti.engine.impl.cfg.IdGenerator#getNextId

You obtain free id, you can use it for your HI row.

Regards
Martin

christophe_carv
Champ in-the-making
Champ in-the-making
Hi,

Thanks for you support.

Just one last question : the getNextId() method of the IdGenerator class uses a property "idBlockSize", how can i find its default value ?

Best regards.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Christophe,


  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);
  }

Regards
Martin