com.memority.domino.shared.api.context.ProvisioningContext 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.context;
import com.memority.domino.shared.api.sync.ActivationSituation;
import com.memority.toolkit.rule.api.context.ContextConfigurer;
/**
* Provide information about the current provisioning state
*
* @author Pierre Sion <[email protected]>
* Date: 2021/09/02
*/
public class ProvisioningContext {
/**
* The id of the provisioned application
*/
private String application;
/**
* Set when a custom "activation" action is executed.
*/
private ActivationSituation activationSituation;
public String application() {
return application;
}
@SuppressWarnings("unused") // Invoked by Groovy scripts
public ActivationSituation activationSituation() {
return activationSituation;
}
public ProvisioningContextConfigurer configureFrom(C returningContext) {
return new ProvisioningContextConfigurerImpl<>(returningContext);
}
public interface ProvisioningContextConfigurer extends ContextConfigurer {
ProvisioningContextConfigurer targeting(String applicationId);
ProvisioningContextConfigurer withActivationSituation(ActivationSituation activationSituation);
default C end() {
return and();
}
}
class ProvisioningContextConfigurerImpl implements ProvisioningContextConfigurer {
private final C returningContext;
ProvisioningContextConfigurerImpl(C returningContext) {
this.returningContext = returningContext;
}
@Override
public ProvisioningContextConfigurer targeting(String applicationId) {
ProvisioningContext.this.application = applicationId;
return this;
}
@Override
public ProvisioningContextConfigurer withActivationSituation(ActivationSituation activationSituation) {
ProvisioningContext.this.activationSituation = activationSituation;
return this;
}
@Override
public C and() {
return this.returningContext;
}
}
}