import org.simantics.db.RequestProcessor;
import org.simantics.db.Resource;
import org.simantics.db.Session;
-import org.simantics.db.VirtualGraph;
import org.simantics.db.WriteGraph;
import org.simantics.db.common.procedure.adapter.AsyncMultiProcedureAdapter;
import org.simantics.db.common.procedure.adapter.ProcedureAdapter;
import org.simantics.db.request.MultiRead;
import org.simantics.db.request.Read;
import org.simantics.db.request.ReadInterface;
-import org.simantics.db.request.UndoTraits;
import org.simantics.db.request.Write;
import org.simantics.db.request.WriteInterface;
import org.simantics.db.request.WriteOnly;
throw new RuntimeException("See cause for the real exception.", exception);
}
- @Override
- public VirtualGraph getProvider() {
- return null;
- }
-
-// @Override
-// public void fillMetadata(Map<String, String> metadata) {
-// }
-
public void acquire() {
try {
semaphore.acquire();
semaphore.release();
}
- @Override
- public UndoTraits getUndoTraits() {
- return null;
- }
-
@Override
public String toString() {
return "SyncWriteRequestAdapter " + request;
import org.simantics.db.ChangeSetIdentifier;
import org.simantics.db.Operation;
import org.simantics.db.RequestProcessor;
-import org.simantics.db.VirtualGraph;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.procedure.Procedure;
import org.simantics.db.request.DelayedWrite;
*/
public abstract class DelayedWriteRequest implements DelayedWrite, UndoTraits, WriteInterface<Object> {
- @Override
- public VirtualGraph getProvider() {
- return null;
- }
-
- @Override
- public UndoTraits getUndoTraits() {
- return this;
- }
-
@Override
public ChangeSetIdentifier getIdentifier() {
return null;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.procedure.Procedure;
import org.simantics.db.request.DelayedWriteResult;
-import org.simantics.db.request.UndoTraits;
import org.simantics.db.request.WriteInterface;
import org.simantics.db.request.WriteTraits;
final public VirtualGraph getProvider() {
return provider;
}
-
- @Override
- public UndoTraits getUndoTraits() {
- return null;
- }
@Override
public void request(AsyncRequestProcessor processor, final Procedure<T> procedure) {
import org.simantics.db.VirtualGraph;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.procedure.Procedure;
-import org.simantics.db.request.UndoTraits;
import org.simantics.db.request.WriteInterface;
import org.simantics.db.request.WriteOnly;
import org.simantics.utils.datastructures.Callback;
return provider;
}
- @Override
- public UndoTraits getUndoTraits() {
- return null;
- }
-
@Override
public void request(AsyncRequestProcessor processor, final Procedure<Object> procedure) {
processor.asyncRequest(this, new Callback<DatabaseException>() {
import org.simantics.db.VirtualGraph;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.procedure.Procedure;
-import org.simantics.db.request.UndoTraits;
import org.simantics.db.request.WriteInterface;
import org.simantics.db.request.WriteOnlyResult;
final public VirtualGraph getProvider() {
return provider;
}
-
- @Override
- public UndoTraits getUndoTraits() {
- return null;
- }
@Override
public void request(AsyncRequestProcessor processor, final Procedure<T> procedure) {
return provider;
}
- @Override
- public UndoTraits getUndoTraits() {
- return this;
- }
-
-
@Override
public void request(AsyncRequestProcessor processor, final Procedure<Object> procedure) {
processor.asyncRequest(this, new Callback<DatabaseException>() {
import org.simantics.db.VirtualGraph;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.procedure.Procedure;
-import org.simantics.db.request.UndoTraits;
import org.simantics.db.request.WriteInterface;
import org.simantics.db.request.WriteResult;
final public VirtualGraph getProvider() {
return provider;
}
-
- @Override
- public UndoTraits getUndoTraits() {
- return null;
- }
@Override
public void request(AsyncRequestProcessor processor, final Procedure<T> procedure) {
import org.simantics.db.RequestProcessor;
import org.simantics.db.Resource;
import org.simantics.db.Statement;
-import org.simantics.db.VirtualGraph;
import org.simantics.db.WriteGraph;
import org.simantics.db.WriteOnlyGraph;
import org.simantics.db.common.request.DelayedWriteRequest;
import org.simantics.db.procedure.Procedure;
import org.simantics.db.request.DelayedWrite;
import org.simantics.db.request.Read;
-import org.simantics.db.request.UndoTraits;
import org.simantics.db.request.Write;
import org.simantics.utils.datastructures.Callback;
}
if (!t.commit) throw new CancelTransactionException();
}
- @Override
- public UndoTraits getUndoTraits() {
- return null;
- }
- @Override
- public VirtualGraph getProvider() {
- return null;
- }
};
processor.asyncRequest( request, callback );
import java.util.Map;
import org.simantics.db.Resource;
-import org.simantics.db.VirtualGraph;
import org.simantics.db.WriteGraph;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.layer0.adapter.Template;
-import org.simantics.db.request.UndoTraits;
import org.simantics.db.request.WriteResult;
import org.simantics.layer0.Layer0;
return parameters;
}
-
- @Override
- public UndoTraits getUndoTraits() {
- return null;
- }
-
- @Override
- public VirtualGraph getProvider() {
- return null;
- }
}
import org.simantics.db.request.MultiRead;
import org.simantics.db.request.Read;
import org.simantics.db.request.ReadInterface;
-import org.simantics.db.request.UndoTraits;
import org.simantics.db.request.Write;
import org.simantics.db.request.WriteInterface;
import org.simantics.db.request.WriteOnly;
callback.run(new DatabaseException("" + name + "operation failed.", t));
}
};
- final WriteTraits writeTraits = new WriteTraits() {
- @Override
- public UndoTraits getUndoTraits() {
- return null;
- }
- @Override
- public VirtualGraph getProvider() {
- return null;
- }
- };
+ final WriteTraits writeTraits = new WriteTraits() {};
TaskHelper(String name) {
this.name = name;
}
import org.simantics.db.ChangeSetIdentifier;
import org.simantics.db.Session;
-import org.simantics.db.VirtualGraph;
import org.simantics.db.WriteGraph;
import org.simantics.db.exception.CancelTransactionException;
import org.simantics.db.exception.DatabaseException;
ChangeSetIdentifier getIdentifier();
- VirtualGraph getProvider();
-
void fillMetadata(Map<String, String> metadata);
}
* @see WriteResult
* @see Session
*/
+@FunctionalInterface
public interface Write extends WriteTraits {
/**
* @see Session
* @see SimpleGraphRequest
*/
+@FunctionalInterface
public interface WriteOnly extends WriteTraits {
/**
* @see Session
* @see SimpleGraphRequest
*/
+@FunctionalInterface
public interface WriteOnlyResult<T> extends WriteTraits {
/**
* @see Session
* @see SimpleGraphRequest
*/
+@FunctionalInterface
public interface WriteResult<T> extends WriteTraits {
/**
* be cancelled and any changes rolled back
*/
T perform(WriteGraph graph) throws DatabaseException;
-
+
}
public interface WriteTraits {
- /**
- * If this request is undoable it should return UndoTraits interface.
- *
- * @return null or UndoTraits interface.
- */
- UndoTraits getUndoTraits();
-
- VirtualGraph getProvider();
+ default VirtualGraph getProvider() {
+ return null;
+ }
}