use of com.ramussoft.common.journal.command.SetElementQualifierCommand 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);
}
Aggregations