Search code examples
javatimefold

ScoreDirector problem change entity lookup


I can investigate this myself, but figured i'd put the question out there in case anyone else stumbles across this.

I would like to be able to "remove" a planning entity via a ProblemChange. I was hoping to be able to do this by planning ID. Does ProblemChangeDirector.lookUpWorkingObject support lookup by ID, or must the entire entity be passed?


Solution

  • Currently, ProblemChangeDirector does not support lookup by id. What you can do is create an "empty" entity that only has its planning id set and use that to lookup the entity:

    MyEntity lookupEntity = new MyEntity(id);
    problemChangeDirector.removeEntity(lookupEntity, workingSolution.getMyEntityList()::remove);