Search in sources :

Example 1 with DeleteElementCommand

use of com.ramussoft.common.journal.command.DeleteElementCommand in project ramus by Vitaliy-Yakovchuk.

the class JournaledEngine method deleteElement.

@Override
public void deleteElement(long id) {
    qualifirsForElements.remove(id);
    Element element = getElement(id);
    long qualifierId = getQualifierIdForElement(id);
    Transaction[] data = getAttributeWhatWillBeDeleted(id);
    ElementEvent event = new ElementEvent(this, element, null, qualifierId);
    try {
        beforeElementDeleted(event);
    } catch (Exception e) {
        e.printStackTrace();
    }
    deligate.deleteElement(id);
    synchronized (swithJournalLock) {
        journal.store(new DeleteElementCommand(this, qualifierId, id, data));
    }
    elementDeleted(event);
}
Also used : DeleteElementCommand(com.ramussoft.common.journal.command.DeleteElementCommand) Transaction(com.ramussoft.common.persistent.Transaction) Element(com.ramussoft.common.Element) ElementEvent(com.ramussoft.common.event.ElementEvent)

Aggregations

Element (com.ramussoft.common.Element)1 ElementEvent (com.ramussoft.common.event.ElementEvent)1 DeleteElementCommand (com.ramussoft.common.journal.command.DeleteElementCommand)1 Transaction (com.ramussoft.common.persistent.Transaction)1