use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class JournaledEngine method deleteQualifier.
@Override
public void deleteQualifier(long id) {
Qualifier qualifier = getQualifier(id);
deligate.deleteQualifier(id);
synchronized (swithJournalLock) {
journal.store(new DeleteQualifierCommand(this, qualifier));
}
QualifierEvent event = new QualifierEvent(this, qualifier, null);
qualifierDeleted(event);
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class JournaledEngine method updateQualifier.
@Override
public void updateQualifier(Qualifier qualifier) {
Qualifier old = getQualifier(qualifier.getId());
QualifierEvent event = new QualifierEvent(this, old, qualifier);
beforeQualifierUpdated(event);
event = new QualifierEvent(this, old, qualifier);
UpdateQualifierCommand command = new UpdateQualifierCommand(this, old, qualifier);
deligate.updateQualifier(qualifier);
synchronized (swithJournalLock) {
journal.store(command);
}
updateElementNames(old, qualifier);
qualifierUpdated(event);
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class SetElementQualifierCommand method undo.
@Override
public void undo(IEngine iEngine) {
Element element = iEngine.getElement(elementId);
Element newElement = new Element(element.getId(), oldQualifierId, element.getName());
ElementEvent event = new ElementEvent(engine, element, newElement, newQualifierId, true);
engine.beforeElementDeleted(event);
iEngine.setElementQualifier(elementId, oldQualifierId);
engine.elementDeleted(event);
event = new ElementEvent(engine, element, newElement, oldQualifierId, true);
engine.elementCreated(event);
Qualifier oldQualifier = iEngine.getQualifier(oldQualifierId);
Qualifier newQualifier = iEngine.getQualifier(newQualifierId);
List<Attribute> attrs = new ArrayList<Attribute>();
addNotPresentAttributes(oldQualifier.getAttributes(), newQualifier.getAttributes(), attrs);
addNotPresentAttributes(oldQualifier.getSystemAttributes(), newQualifier.getSystemAttributes(), attrs);
List<Attribute> as = oldQualifier.getAttributes();
as.addAll(oldQualifier.getSystemAttributes());
int i = 0;
for (Attribute a : as) {
if (attrs.indexOf(a) >= 0) {
iEngine.setBinaryAttribute(elementId, a.getId(), data[i]);
i++;
}
Object object = engine.getAttribute(newElement, a);
if (object != null) {
AttributeEvent event2 = new AttributeEvent(engine, newElement, a, null, object, true);
engine.attributeChanged(event2);
}
}
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class TransactionStorageCommand method setAttribute.
private void setAttribute(Transaction transaction, IEngine iEngine) {
Element element = iEngine.getElement(elementId);
Attribute attribute = iEngine.getAttribute(attributeId);
Object oldValue = engine.getAttribute(element, attribute);
iEngine.setBinaryAttribute(elementId, attributeId, transaction);
Object newValue = engine.getAttribute(element, attribute);
if (element != null) {
long qId = engine.getQualifierIdForElement(elementId);
Qualifier q = engine.getQualifier(qId);
if (q.getAttributeForName() == attributeId) {
element.setName((newValue == null) ? "" : newValue.toString());
}
}
AttributeEvent event = new AttributeEvent(engine, element, attribute, oldValue, newValue, true);
engine.attributeChanged(event);
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class DeleteQualifierCommand method readBody.
@Override
public void readBody(BinaryDataInput input) throws IOException {
qualifier = new Qualifier();
loadQualifier(input, qualifier);
system = input.readBoolean();
}
Aggregations