use of com.ramussoft.common.persistent.Transaction in project ramus by Vitaliy-Yakovchuk.
the class DeleteAttributeCommand method readBody.
@Override
public void readBody(BinaryDataInput input) throws IOException {
attribute = new Attribute();
properties = new Transaction();
int c = input.readInt();
for (int i = 0; i < c; i++) try {
properties.getSave().add(TransactionStorageCommand.loadPersistent(engine, input));
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
loadAttribute(input, attribute);
}
use of com.ramussoft.common.persistent.Transaction in project ramus by Vitaliy-Yakovchuk.
the class JournaledEngine method setElementQualifier.
@Override
public void setElementQualifier(long elementId, long qualifierId) {
qualifirsForElements.remove(elementId);
Element element = getElement(elementId);
Qualifier current = getQualifier(element.getQualifierId());
Qualifier newQualifier = getQualifier(qualifierId);
final List<Attribute> attrs = new ArrayList<Attribute>();
addNotPresentAttributes(current.getAttributes(), newQualifier.getAttributes(), attrs);
addNotPresentAttributes(current.getSystemAttributes(), newQualifier.getSystemAttributes(), attrs);
Transaction[] data = getAttributesWhatWillBeDeleted(elementId, attrs);
ElementEvent event = new ElementEvent(this, element, new Element(element.getId(), qualifierId, element.getName()), element.getQualifierId());
beforeElementDeleted(event);
deligate.setElementQualifier(elementId, qualifierId);
synchronized (swithJournalLock) {
journal.store(new SetElementQualifierCommand(this, element.getQualifierId(), qualifierId, elementId, data));
}
elementDeleted(event);
event = new ElementEvent(this, element, new Element(element.getId(), qualifierId, element.getName()), qualifierId);
qualifirsForElements.remove(element.getId());
elementCreated(event);
}
use of com.ramussoft.common.persistent.Transaction in project ramus by Vitaliy-Yakovchuk.
the class DeleteElementCommand method readBody.
@Override
public void readBody(BinaryDataInput input) throws IOException {
qualifierId = input.readLong();
elementId = input.readLong();
int size = input.readInt();
data = new Transaction[size];
for (int i = 0; i < size; i++) {
Transaction transaction = new Transaction();
transaction.setRemoveBranchInfo(input.readBoolean());
data[i] = transaction;
int size2 = input.readInt();
for (int j = 0; j < size2; j++) {
try {
transaction.getSave().add(TransactionStorageCommand.loadPersistent(engine, input));
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
}
use of com.ramussoft.common.persistent.Transaction in project ramus by Vitaliy-Yakovchuk.
the class TransactionStorageCommand method undo.
@Override
public void undo(IEngine iEngine) {
Transaction transaction = new Transaction();
copy(delete, transaction.getSave());
copy(save, transaction.getDelete());
copy(updateOld, transaction.getUpdate());
transaction.setRemoveBranchInfo(removeBranchInfo);
setAttribute(transaction, iEngine);
}
use of com.ramussoft.common.persistent.Transaction in project ramus by Vitaliy-Yakovchuk.
the class UpdateQualifierCommand method readBody.
@Override
public void readBody(BinaryDataInput input) throws IOException {
oldQualifier = new Qualifier();
newQualifier = new Qualifier();
loadQualifier(input, oldQualifier);
loadQualifier(input, newQualifier);
initDeletedAttributes();
for (Attribute attribute : deletedAttributes) {
Hashtable<Long, Transaction> hash = new Hashtable<Long, Transaction>();
hashtable.put(attribute.getId(), hash);
int size1 = input.readInt();
for (int i = 0; i < size1; i++) {
Transaction transaction = new Transaction();
Long key = input.readLong();
int size2 = input.readInt();
for (int j = 0; j < size2; j++) {
try {
transaction.getSave().add(TransactionStorageCommand.loadPersistent(engine, input));
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
hash.put(key, transaction);
}
}
}
Aggregations