Search in sources :

Example 1 with SimplePersistFactory

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;
}
Also used : ISupportChilds(com.servoy.j2db.persistence.ISupportChilds) ChangeHandler(com.servoy.j2db.persistence.ChangeHandler) IPersist(com.servoy.j2db.persistence.IPersist) RepositoryException(com.servoy.j2db.persistence.RepositoryException) UUID(com.servoy.j2db.util.UUID) SimplePersistFactory(com.servoy.j2db.persistence.SimplePersistFactory) RemoteException(java.rmi.RemoteException) RepositoryException(com.servoy.j2db.persistence.RepositoryException)

Aggregations

ChangeHandler (com.servoy.j2db.persistence.ChangeHandler)1 IPersist (com.servoy.j2db.persistence.IPersist)1 ISupportChilds (com.servoy.j2db.persistence.ISupportChilds)1 RepositoryException (com.servoy.j2db.persistence.RepositoryException)1 SimplePersistFactory (com.servoy.j2db.persistence.SimplePersistFactory)1 UUID (com.servoy.j2db.util.UUID)1 RemoteException (java.rmi.RemoteException)1