com.memority.domino.shared.api.sync.SyncSituation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of domino-api Show documentation
Show all versions of domino-api Show documentation
This artifact provides the API classes that are necessary to implement synchronization configuration Rules on the Memority IM platform.
/*
* Copyright (c) 2016-2023 Memority. All Rights Reserved.
*
* This file is part of Memority Domino API , a Memority project.
*
* This file is released under the Memority Public Artifacts End-User License Agreement,
* see
* Unauthorized copying of this file, via any medium is strictly prohibited.
*/
package com.memority.domino.shared.api.sync;
import com.memority.domino.shared.api.XmlConstants;
import javax.xml.bind.annotation.XmlType;
import java.util.Arrays;
import java.util.List;
import static com.memority.domino.shared.api.sync.SyncAction.*;
/**
* When Domino detects a synchronization event it is categorized into one of those situations.
*
* The situation deals only with the existence or non-existence of an application object (e.g. a LDAP account), and
* with ownership of the account by an IDM object. In other words it deals only with "links". It does not deal with
* the legality of the account (whether the Identity should have the account). The situation also does not deal with
* changes in account attributes.
*
* The situation is evaluated by the correlation process (see {@code CorrelationService}.
*
* The following algorithm is used to determine a situation:
*
* - if the application object is deleted then the situation is "deleted"
* - the application object's owner is looked up in the Domino repository. The owner is an IDM object that has a
* database link to this application object. If an owner is found then the situation is "linked"
* - the correlation is used to determine a potential owner for the application object. If any potential owner(s)
* are found the situation is "unlinked" (single owner) or "disputed" (several owners)
* - the situation is "unmatched" (no owner found)
*
*/
@XmlType(name = XmlConstants.NAME_TYPE_SYNCSITUATION)
public enum SyncSituation {
/**
* Nominal case: an account is linked to an IDM object. They are synchronized.
*/
LINKED(
SYNCHRONIZE_IDM_OBJECT,
NO_OP
),
/**
* An account is found on the remote application, the correlation process determines exactly one IDM owner
* for that application object and that IDM owner does not have the application object linked (yet).
*/
UNLINKED(
LINK, // Legalize the account
SYNCHRONIZE_IDM_OBJECT,
DELETE_APPLICATION_OBJECT, // Illegal account which was created on the Application using native administration tools
INACTIVATE_APPLICATION_OBJECT, // Illegal account (variant)
NO_OP
),
/**
* An account does not exist on the remote application anymore; a shadow exists but no account in the remote
* application matches it, typically a line that has been removed from a CSV file.
*/
DELETED(
UNLINK,
DELETE_IDM_OBJECT,
SOFT_DELETE_IDM_OBJECT,
INACTIVATE_IDM_OBJECT,
ADD_APPLICATION_OBJECT,
NO_OP
),
/**
* An account is found on the remote application and no matching IDM owner was found for the account by the
* correlation process.
*/
UNMATCHED(
ADD_IDM_OBJECT,
DELETE_APPLICATION_OBJECT, // Non authoritative Application
INACTIVATE_APPLICATION_OBJECT, // Non authoritative Application (variant)
NO_OP
),
/**
* An account is found on the remote application and two or more potential IDM owners are found for it by the
* correlation process.
*/
DISPUTED(
DELETE_APPLICATION_OBJECT, // An ambiguous account is created manually on the Application
INACTIVATE_APPLICATION_OBJECT, // Ambiguous account (variant)
NO_OP
),
/**
* The application object is linked to two or more IDM objects. Should never happen: bug or inconsistent database.
*/
COLLISION(
NO_OP
);
/**
* The list of {@link SyncAction}s compatible with the situation.
* UPDATE March 4 2020: PSA has convoluted use cases => for now "compatible" actions are ignored
*/
private final List compatibleActions;
SyncSituation(SyncAction... compatibleActions) {
this.compatibleActions = Arrays.asList(compatibleActions);
}
public List getCompatibleActions() {
return compatibleActions;
}
/**
* Tell whether a given action is compatible with this situation
*
* @param action to be tested for compatibility
* @return true if the given action is compatible with this situation
*/
public boolean isActionCompatible(SyncAction action) {
return getCompatibleActions().contains(action);
}
}