Interface AbstractGroupService<G extends BaseGroup,Q extends com.github.rutledgepaulv.qbuilders.builders.QBuilder<Q>>
-
- All Superinterfaces:
Queryable<G,Q>
- All Known Subinterfaces:
GroupService
,SnapshotService
,TagService
- All Known Implementing Classes:
GroupProvider
public interface AbstractGroupService<G extends BaseGroup,Q extends com.github.rutledgepaulv.qbuilders.builders.QBuilder<Q>> extends Queryable<G,Q>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addEntities(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> entityIdsPerAssociation)
Attaches the givenMap
of entities to the given group, by adding the provided entities to the corresponding association.void
addVariables(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> variableIdsPerAssociation)
Attaches the givenMap
of associations to the given group, by adding the provided variables to the corresponding association.G
create(G group)
Creates group as in the parameter NOTE: this is a mutative method.void
delete(long id)
Deletes an existing groupjava.util.Map<java.lang.String,java.util.Set<Entity>>
getEntities(long id)
Returns the complete map of entities grouped by their association to a given groupjava.util.Map<java.lang.String,java.util.Set<Variable>>
getVariables(long id)
Returns the complete map of variables grouped by their association to a given groupvoid
removeEntities(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> entityIdsPerAssociation)
Detaches the givenMap
of entities from the given group.void
removeVariables(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> variableIdsPerAssociation)
Detaches the givenMap
of variables from the given group.void
setEntities(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> entityIdsPerAssociation)
Attaches the givenMap
of entities to the given group, overwriting any existing associations.void
setVariables(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> variableIdsPerAssociation)
Attaches the givenMap
of variables to the given group, overwriting any existing associations.G
update(G group)
Updates an existing group to the new values as in the parameter NOTE: this is a mutative method.
-
-
-
Method Detail
-
create
G create(G group)
Creates group as in the parameter NOTE: this is a mutative method. It is not thread-safe or meant to be used in parallel- Parameters:
group
- to be created- Returns:
- Created group
-
update
G update(G group)
Updates an existing group to the new values as in the parameter NOTE: this is a mutative method. It is not thread-safe or meant to be used in parallel- Parameters:
group
- to be updated- Returns:
- Updated group or null if the group does not exist
-
delete
void delete(long id)
Deletes an existing group- Parameters:
id
- the id of the group to be deleted
-
getVariables
java.util.Map<java.lang.String,java.util.Set<Variable>> getVariables(long id)
Returns the complete map of variables grouped by their association to a given group- Parameters:
id
- of the group to query- Returns:
Map
of variables grouped by their association type to the group
-
setVariables
void setVariables(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> variableIdsPerAssociation)
Attaches the givenMap
of variables to the given group, overwriting any existing associations. In case the association(s) do not exist, it creates and sets the variables as described by their ids. The group and the variables must exist. The map key should represent the association type of the enclosed variableSet
. NOTE: this action replaces any existing associations. The resulted associations would reflect the provided context. NOTE: this is a mutative method. It is not thread-safe or meant to be used in parallel- Parameters:
id
- group to attach variables tovariableIdsPerAssociation
-Map
of variable ids to attach, grouped by the association type
-
addVariables
void addVariables(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> variableIdsPerAssociation)
Attaches the givenMap
of associations to the given group, by adding the provided variables to the corresponding association. In case the association(s) do not exist, it creates and adds the variables as described by their ids. The group and the variables to add must exist. The map key should represent the association type of the enclosed variableSet
. NOTE: this action only adds to any existing attachedSet
. Does not fail if variable already present. The resulted associations would reflect the merged product of the existing associations and the provided ones. NOTE: this is a mutative method. It is not thread-safe or meant to be used in parallel- Parameters:
id
- group to attach variables tovariableIdsPerAssociation
-Map
of variable ids to attach, grouped by the association type
-
removeVariables
void removeVariables(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> variableIdsPerAssociation)
Detaches the givenMap
of variables from the given group. The map key should represent the association type of the enclosed variableSet
. The group and the variables must exist. NOTE: it removes from any existing attachedSet
. Does not fail if variable already absent. NOTE: this is a mutative method. It is not thread-safe or meant to be used in parallel- Parameters:
id
- group to attach variables tovariableIdsPerAssociation
-Map
of variable ids to detach, grouped by the association type
-
getEntities
java.util.Map<java.lang.String,java.util.Set<Entity>> getEntities(long id)
Returns the complete map of entities grouped by their association to a given group- Parameters:
id
- of the group to query- Returns:
Map
of entities grouped by their association type to the group
-
setEntities
void setEntities(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> entityIdsPerAssociation)
Attaches the givenMap
of entities to the given group, overwriting any existing associations. In case the association(s) do not exist, it creates and sets the entities as described by their ids. The group and the entities must exist. The map key should represent the association type of the enclosed entitySet
. NOTE: this action replaces any existing associations. The resulted associations would reflect the provided context. NOTE: this is a mutative method. It is not thread-safe or meant to be used in parallel- Parameters:
id
- id of the group to attach entities toentityIdsPerAssociation
-Map
of entity ids to attach, grouped by the association type
-
addEntities
void addEntities(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> entityIdsPerAssociation)
Attaches the givenMap
of entities to the given group, by adding the provided entities to the corresponding association. In case the association(s) do not exist, it creates and adds the entities as described by their ids. The group and the entities to add must exist. The map key should represent the association type of the enclosed entitySet
. NOTE: this action only adds to any existing attachedSet
. Does not fail if entity already present. The resulted associations would reflect the merged product of the existing associations and the provided ones. NOTE: this is a mutative method. It is not thread-safe or meant to be used in parallel- Parameters:
id
- group to attach entities toentityIdsPerAssociation
-Map
of entity ids to attach, grouped by the association type
-
removeEntities
void removeEntities(long id, java.util.Map<java.lang.String,java.util.Set<java.lang.Long>> entityIdsPerAssociation)
Detaches the givenMap
of entities from the given group. The map key should represent the association type of the enclosed entitySet
. The group and the entities must exist. NOTE: it removes from any existing attachedSet
. Does not fail if entity already absent. NOTE: this is a mutative method. It is not thread-safe or meant to be used in parallel- Parameters:
id
- group to attach entities toentityIdsPerAssociation
-Map
of entity ids to detach, grouped by the association type
-
-