Search in sources :

Example 1 with LongPersistent

use of com.ramussoft.core.attribute.simple.LongPersistent in project ramus by Vitaliy-Yakovchuk.

the class StandardAttributesPlugin method canDeleteElements.

@Override
public boolean canDeleteElements(long[] elementIds, IEngine engine) {
    Vector<Long> vector = new Vector<Long>();
    for (long elementId : elementIds) {
        long qualifierId = engine.getQualifierIdForElement(elementId);
        Long l = new Long(qualifierId);
        if (vector.indexOf(l) < 0) {
            vector.add(l);
            if (qualifierId == qualifiers.getId()) {
                List<Persistent>[] lists = engine.getBinaryAttribute(elementId, aQualifierId.getId());
                Long long1;
                if (lists[0].size() == 0)
                    long1 = null;
                else
                    long1 = ((LongPersistent) lists[0].get(0)).getValue();
                if (long1 == null)
                    continue;
                if (!rules.canDeleteQualifier(long1)) {
                    DeleteStatus status = new DeleteStatus();
                    status.setDelete(Delete.CAN_NOT);
                    return false;
                }
                continue;
            }
        }
    }
    return true;
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) DeleteStatus(com.ramussoft.common.DeleteStatus) Vector(java.util.Vector) LongPersistent(com.ramussoft.core.attribute.simple.LongPersistent)

Aggregations

DeleteStatus (com.ramussoft.common.DeleteStatus)1 LongPersistent (com.ramussoft.core.attribute.simple.LongPersistent)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Vector (java.util.Vector)1