use of com.servoy.j2db.persistence.SimplePersistFactory in project servoy-client by Servoy.
the class FlattenedSolution method getSolutionCopy.
public Solution getSolutionCopy(boolean create) {
if (mainSolution == null) {
if (loginFlattenedSolution != null) {
return loginFlattenedSolution.getSolutionCopy(create);
}
return null;
}
if (copySolution != null || !create)
return copySolution;
try {
SimplePersistFactory factory = getPersistFactory();
copySolution = SimplePersistFactory.createDummyCopy(mainSolution);
copySolution.setChangeHandler(new ChangeHandler(factory) {
// overwrite this new Object to skip the call to rootObject.registerNewObject(object); which shouldn't be needed for solution model solutions.
@Override
public IPersist createNewObject(ISupportChilds parent, int object_type_id, int element_id, UUID uuid) throws RepositoryException {
return factory.createObject(parent, object_type_id, element_id, uuid);
}
});
copySolution.getChangeHandler().addIPersistListener(this);
getIndex().setSolutionModelSolution(copySolution);
} catch (Exception e) {
Debug.error(e);
}
return copySolution;
}
Aggregations