Search in sources :

Example 1 with Record

use of com.ramussoft.core.history.Record in project ramus by Vitaliy-Yakovchuk.

the class StandardAttributesPlugin method getHistory.

public static List<Record> getHistory(Engine engine, Element element, Attribute attribute) {
    StandardAttributesPlugin plugin = getStandardPlugin(engine);
    List<Element> elements = engine.findElements(plugin.historyQualifier.getId(), plugin.historyElement, element.getId());
    List<Record> res = new ArrayList<Record>();
    for (Element element2 : elements) {
        Long id = (Long) engine.getAttribute(element2, plugin.historyAttribute);
        if (id.longValue() == attribute.getId()) {
            Record record = new Record();
            record.setDate((Date) engine.getAttribute(element2, plugin.historyTime));
            record.setValue(engine.getAttribute(element2, attribute));
            record.setElement(element2);
            res.add(record);
        }
    }
    Collections.sort(res);
    return res;
}
Also used : Element(com.ramussoft.common.Element) ArrayList(java.util.ArrayList) Record(com.ramussoft.core.history.Record)

Aggregations

Element (com.ramussoft.common.Element)1 Record (com.ramussoft.core.history.Record)1 ArrayList (java.util.ArrayList)1