use of org.structr.net.repository.Repository in project structr by structr.
the class Committed method onMessage.
@Override
public void onMessage(Peer peer, PeerInfo sender) {
final Repository repository = peer.getRepository();
repository.complete(transactionId);
}
use of org.structr.net.repository.Repository in project structr by structr.
the class Update method onMessage.
@Override
public void onMessage(final Peer peer, final PeerInfo sender) {
final Repository repository = peer.getRepository();
final RepositoryObject obj = repository.getObject(objectId);
if (obj != null) {
repository.update(obj, type, objectId, userId, lastModified, data);
} else {
repository.objectCreated(objectId, type, getSender(), userId, created, lastModified, data);
}
}
use of org.structr.net.repository.Repository in project structr by structr.
the class History method onMessage.
@Override
public void onMessage(Peer peer, PeerInfo sender) {
if (peer.getUuid().equals(recipient)) {
final Repository repository = peer.getRepository();
if (!repository.contains(objectId)) {
repository.objectCreated(objectId, type, getSender(), userId, creationTime, lastModified, data);
} else {
// store history
final RepositoryObject obj = repository.getObject(objectId);
if (obj != null) {
final String transactionId = UUID.randomUUID().toString().replaceAll("\\-", "");
for (final Entry<String, Object> entry : data.entrySet()) {
obj.setProperty(lastModified, transactionId, entry.getKey(), entry.getValue());
}
repository.complete(transactionId);
}
}
}
}
Aggregations