Module org.unidata.mdm.bulk.core¶
General Info¶
The module contains a service for launching and obtaining information about bulk operations that implement the BulkOperation interface, as well as interfaces and classes necessary in the implementation of the operations themselves to use the functionality of the module.
Dependencies¶
org.unidata.mdm.core
org.unidata.mdm.search
org.unidata.mdm.draft
Configuration Options¶
No external parameters
Pipeline Points¶
None
Classes and Interfaces of Module¶
BulkOperationService - Service for working with bulk operations.
Contains the entity of Bulk Operations (BulkOperation), in which it is necessary to register the created operations;
Contains the entity of selection criteria (BulkOperationState), where new criteria should be registered;
Allows to get descriptions (BulkOperationDescriptor) of all operations from the entity;
Allows to get all selection criteria from the entity;
Allows to get description by operation ID;
Allows to get a selection criterion by criterion name;
Allows to get descriptions of all operations that have the specified combination of namespaces and selection criteria;
Allows to start an operation;
BulkOperation - Interface through which bulk operations are realized. Allows to get the ID of the operation and start its execution.
BulkOperationDescriptor - Represents the operation descriptor.
BulkOperationState - Represents the sampling criterion.
Services¶
Bulk Operation Service (org.unidata.mdm.bulk.core.service.BulkOperationService)
The current standard implementation searches Collection<BulkOperationDescriptor> descriptors(Collection<String> nameSpaces, Collection<String> states)
operations for supported namespaces and sampling criteria so that all operations that support at least one of the namespaces and all of the specified sampling criteria are returned.
/**
* @author Mikhail Mikhailov on Mar 25, 2022
*/
public interface BulkOperationService {
/**
* Registers a bulk operation at system.
* @param operation the operation
*/
void register(BulkOperation operation);
/**
* Registers BOp states.
* @param states the states
*/
void register(Collection<BulkOperationState> states);
/**
* Gets all registered descriptors.
* @return all registered descriptors
*/
@Nonnull
Collection<BulkOperationDescriptor> descriptors();
/**
* Returns all registered states.
* @return all registered states
*/
@Nonnull
Collection<BulkOperationState> states();
/**
* Gets a specific descriptor by BOp ID.
* @param id the id
* @return descriptor or null, if not found
*/
@Nullable
BulkOperationDescriptor descriptor(String id);
/**
* Gets registerd state by state name
* @param name the state name
* @return state or null, if not found
*/
@Nullable
BulkOperationState state(String name);
/**
* Filter only those descriptors, which support given combination of namespaces and states.
* @param nameSpaces namespaces
* @param states states
* @return collection of descriptors
*/
@Nonnull
Collection<BulkOperationDescriptor> descriptors(Collection<String> nameSpaces, Collection<String> states);
/**
* Runs a bulk operation.
* @param ctx the context
* @return result
*/
AbstractBulkOperationResult execute(AbstractBulkOperationContext ctx);
}
Classes and Interfaces Required for Implementation¶
Bulk Operation Interface¶
org.unidata.mdm.bulk.core.type.BulkOperation
/**
* @author Mikhail Mikhailov on Mar 25, 2022
*/
public interface BulkOperation {
/**
* Gets the ID of this BOp.
* @return ID of this BOp
*/
BulkOperationDescriptor descriptor();
/**
* Executes this bulk operation.
* @param input the BOp input
*/
AbstractBulkOperationResult execute(AbstractBulkOperationContext input);
}
Operation Descriptor¶
org.unidata.mdm.bulk.core.type.BulkOperationDescriptor
Only the fields are specified:
/**
* @author Mikhail Mikhailov on Mar 26, 2022
*/
public class BulkOperationDescriptor {
/**
* This BOp ID.
*/
private final String id;
/**
* This BOp module ID.
*/
private final String moduleId;
/**
* Display name.
*/
private final Supplier<String> displayName;
/**
* Description.
*/
private final Supplier<String> description;
/**
* The exact input type class.
*/
private final Class<? extends AbstractBulkOperationContext> inputType;
/**
* Supported namespaces.
*/
private final Set<NameSpace> nameSpaces = new HashSet<>();
/**
* Supported operation states.
* Collection of states is understood as AND condition
* (if this descriptor defines two states, those two states must also be defined during filtering to select this op/descriptor).
*/
private final Set<BulkOperationState> states = new HashSet<>();
private final Set<BulkOperationOption> options = new HashSet(); //Parameters for starting the operation
}
Selection Criterion¶
org.unidata.mdm.bulk.core.type.BulkOperationState
Only the fields are specified:
/**
* @author Mikhail Mikhailov on Mar 25, 2022
*/
public final class BulkOperationState {
/**
* NS.
*/
private final String name;
/**
* Exporting module ID.
*/
private final String moduleId;
/**
* A possibly localized display name.
*/
private final Supplier<String> displayName;
/**
* A possibly localized description.
*/
private final Supplier<String> description;
/**
* Hash.
*/
private final int h;
}