Search in sources :

Example 1 with ObjectActionsExecutedEntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectActionsExecutedEntryType in project midpoint by Evolveum.

the class ActionsExecutedInformationDto method getObjectsTableLines.

public List<ActionsExecutedObjectsTableLineDto> getObjectsTableLines() {
    List<ActionsExecutedObjectsTableLineDto> rv = new ArrayList<>();
    for (ObjectActionsExecutedEntryType entry : actionsExecutedInformationType.getObjectActionsEntry()) {
        rv.add(new ActionsExecutedObjectsTableLineDto(entry));
    }
    Collections.sort(rv);
    return rv;
}
Also used : ArrayList(java.util.ArrayList) ObjectActionsExecutedEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectActionsExecutedEntryType)

Example 2 with ObjectActionsExecutedEntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectActionsExecutedEntryType in project midpoint by Evolveum.

the class ActionsExecutedInformationDto method getUniqueObjectsTableLines.

public List<ActionsExecutedObjectsTableLineDto> getUniqueObjectsTableLines() {
    List<ActionsExecutedObjectsTableLineDto> rv = new ArrayList<>();
    for (ObjectActionsExecutedEntryType entry : actionsExecutedInformationType.getResultingObjectActionsEntry()) {
        rv.add(new ActionsExecutedObjectsTableLineDto(entry));
    }
    Collections.sort(rv);
    return rv;
}
Also used : ArrayList(java.util.ArrayList) ObjectActionsExecutedEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectActionsExecutedEntryType)

Example 3 with ObjectActionsExecutedEntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectActionsExecutedEntryType in project midpoint by Evolveum.

the class ActionsExecutedInformation method addEntry.

protected void addEntry(Map<ActionsExecutedObjectsKey, ObjectActionsExecutedEntryType> target, ObjectActionExecuted a) {
    ActionsExecutedObjectsKey key = new ActionsExecutedObjectsKey(a.objectType, a.changeType, a.channel);
    ObjectActionsExecutedEntryType entry = target.get(key);
    if (entry == null) {
        entry = new ObjectActionsExecutedEntryType();
        target.put(key, entry);
    }
    if (a.exception == null) {
        entry.setTotalSuccessCount(entry.getTotalSuccessCount() + 1);
        entry.setLastSuccessObjectName(a.objectName);
        entry.setLastSuccessObjectDisplayName(a.objectDisplayName);
        entry.setLastSuccessObjectOid(a.objectOid);
        entry.setLastSuccessTimestamp(a.timestamp);
    } else {
        entry.setTotalFailureCount(entry.getTotalFailureCount() + 1);
        entry.setLastFailureObjectName(a.objectName);
        entry.setLastFailureObjectDisplayName(a.objectDisplayName);
        entry.setLastFailureObjectOid(a.objectOid);
        entry.setLastFailureTimestamp(a.timestamp);
        entry.setLastFailureExceptionMessage(a.exception.getMessage());
    }
}
Also used : ObjectActionsExecutedEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectActionsExecutedEntryType)

Example 4 with ObjectActionsExecutedEntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectActionsExecutedEntryType in project midpoint by Evolveum.

the class ActionsExecutedInformation method mapToJaxb.

private void mapToJaxb(Map<ActionsExecutedObjectsKey, ObjectActionsExecutedEntryType> map, List<ObjectActionsExecutedEntryType> list) {
    for (Map.Entry<ActionsExecutedObjectsKey, ObjectActionsExecutedEntryType> entry : map.entrySet()) {
        ObjectActionsExecutedEntryType e = entry.getValue().clone();
        e.setObjectType(entry.getKey().getObjectType());
        e.setOperation(ChangeType.toChangeTypeType(entry.getKey().getOperation()));
        e.setChannel(entry.getKey().getChannel());
        list.add(e);
    }
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) ObjectActionsExecutedEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectActionsExecutedEntryType)

Example 5 with ObjectActionsExecutedEntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectActionsExecutedEntryType in project midpoint by Evolveum.

the class ActionsExecutedSummarizer method summarize.

public ActivityActionsExecutedType summarize() {
    // Note: key-related fields in value objects i.e. in ObjectActionsExecutedEntryType instances (objectType, channel, ...)
    // are ignored in the following two maps.
    Map<ActionsExecutedObjectsKey, ObjectActionsExecutedEntryType> allObjectActions = new HashMap<>();
    Map<ActionsExecutedObjectsKey, ObjectActionsExecutedEntryType> resultingObjectActions = new HashMap<>();
    allActions.forEach(action -> addAction(allObjectActions, action));
    for (Map.Entry<String, List<ActionExecuted>> entry : actionsByOid.entrySet()) {
        // Last non-modify operation determines the result
        List<ActionExecuted> actions = entry.getValue();
        assert actions.size() > 0;
        int relevant;
        for (relevant = actions.size() - 1; relevant >= 0; relevant--) {
            if (actions.get(relevant).changeType != ChangeType.MODIFY) {
                break;
            }
        }
        if (relevant < 0) {
            // all are "modify" -> take any (we currently don't care whether successful or not; TODO fix this)
            ActionExecuted actionExecuted = actions.get(actions.size() - 1);
            addAction(resultingObjectActions, actionExecuted);
        } else {
            addAction(resultingObjectActions, actions.get(relevant));
        }
    }
    ActivityActionsExecutedType rv = new ActivityActionsExecutedType();
    mapToBean(allObjectActions, rv.getObjectActionsEntry());
    mapToBean(resultingObjectActions, rv.getResultingObjectActionsEntry());
    return rv;
}
Also used : ActivityActionsExecutedType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivityActionsExecutedType) HashMap(java.util.HashMap) List(java.util.List) ObjectActionsExecutedEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectActionsExecutedEntryType) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

ObjectActionsExecutedEntryType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectActionsExecutedEntryType)7 HashMap (java.util.HashMap)3 Map (java.util.Map)3 ArrayList (java.util.ArrayList)2 ActivityActionsExecutedType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivityActionsExecutedType)1 List (java.util.List)1