Search in sources :

Example 11 with SynchronizationSituationType

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

the class AbstractInitializedModelIntegrationTest method assertShadowOperationalData.

protected void assertShadowOperationalData(PrismObject<ShadowType> shadow, SynchronizationSituationType expectedSituation, Long timeBeforeSync) {
    ShadowType shadowType = shadow.asObjectable();
    SynchronizationSituationType actualSituation = shadowType.getSynchronizationSituation();
    assertEquals("Wrong situation in shadow " + shadow, expectedSituation, actualSituation);
    XMLGregorianCalendar actualTimestampCal = shadowType.getSynchronizationTimestamp();
    assert actualTimestampCal != null : "No synchronization timestamp in shadow " + shadow;
    if (timeBeforeSync != null) {
        long actualTimestamp = XmlTypeConverter.toMillis(actualTimestampCal);
        assert actualTimestamp >= timeBeforeSync : "Synchronization timestamp was not updated in shadow " + shadow;
    }
// TODO: assert sync description
}
Also used : SynchronizationSituationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationSituationType) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)

Example 12 with SynchronizationSituationType

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

the class PageAccounts method createTotalsModel.

private LoadableModel<Integer> createTotalsModel(final SynchronizationSituationType situation) {
    return new LoadableModel<Integer>(false) {

        @Override
        protected Integer load() {
            ObjectFilter resourceFilter = createResourceQueryFilter();
            if (resourceFilter == null) {
                return 0;
            }
            ObjectFilter filter = createObjectQuery().getFilter();
            Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createRaw());
            Task task = createSimpleTask(OPERATION_GET_TOTALS);
            OperationResult result = new OperationResult(OPERATION_GET_TOTALS);
            try {
                ObjectFilter situationFilter = QueryBuilder.queryFor(ShadowType.class, getPrismContext()).item(ShadowType.F_SYNCHRONIZATION_SITUATION).eq(situation).buildFilter();
                ObjectQuery query = ObjectQuery.createObjectQuery(AndFilter.createAnd(filter, situationFilter));
                return getModelService().countObjects(ShadowType.class, query, options, task, result);
            } catch (CommonException | RuntimeException ex) {
                LoggingUtils.logUnexpectedException(LOGGER, "Couldn't count shadows", ex);
            }
            return 0;
        }
    };
}
Also used : Task(com.evolveum.midpoint.task.api.Task) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CommonException(com.evolveum.midpoint.util.exception.CommonException) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery)

Aggregations

SynchronizationSituationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationSituationType)9 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)7 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)4 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)4 PrismObject (com.evolveum.midpoint.prism.PrismObject)3 PropertyDelta (com.evolveum.midpoint.prism.delta.PropertyDelta)3 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)3 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)3 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)3 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)3 PolicyViolationException (com.evolveum.midpoint.util.exception.PolicyViolationException)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)3 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)2 ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)2 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)2 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)2 Task (com.evolveum.midpoint.task.api.Task)2