use of org.structr.net.data.RemoteTransaction in project structr by structr.
the class PeerToPeerService method setProperty.
public void setProperty(final String uuid, final String key, final Object value) throws FrameworkException {
logger.info("Attempting to modify shared node with UUID {}: {} = {} in Structr", new Object[] { uuid, key, value });
final RepositoryObject sharedObject = repository.getObject(uuid);
if (sharedObject != null) {
try (final RemoteTransaction tx = peer.beginTx(sharedObject)) {
tx.setProperty(sharedObject, key, value);
tx.commit();
} catch (Exception ex) {
System.out.println("timeout");
throw new FrameworkException(500, ex.getMessage());
}
} else {
System.out.println("No such object " + uuid);
}
}
use of org.structr.net.data.RemoteTransaction in project structr by structr.
the class Peer method set.
public void set(final String objectId, final String key, final Object value) {
final RepositoryObject sharedObject = repository.getObject(objectId);
if (sharedObject != null) {
try (final RemoteTransaction tx = beginTx(sharedObject)) {
tx.setProperty(sharedObject, key, value);
tx.commit();
} catch (Exception tex) {
System.out.println("Failed");
}
} else {
System.out.println("No such object " + objectId);
}
}
use of org.structr.net.data.RemoteTransaction in project structr by structr.
the class Peer method beginTx.
public RemoteTransaction beginTx(final RepositoryObject sharedObject) throws TimeoutException {
final RemoteTransaction tx = new RemoteTransaction(this);
tx.begin(sharedObject);
return tx;
}
Aggregations