Klasse RegionGroupRepository
java.lang.Object
de.delinkedde.areashopreborn.persistence.RegionGroupRepository
Persists named region groups and their many-to-many region assignments.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic enumResult of one atomic membership mutation. -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungbooleanAssigns a region to a group idempotently.booleanAssigns a region only while its direct assignment ceiling has not been reached.changeAssignmentAudited(RegionGroup group, EstateRegion region, UUID actorId, boolean assigning, int maximumAssignments) Atomically changes one assignment and appends its audit record.booleanDeletes a group and its assignments.booleandeleteAudited(RegionGroup group, UUID actorId) Atomically deletes a group, cascades assignments, and records the deletion.Finds a group by command name.findAll()Lists all groups by stable name.findAll(int limit) Lists a bounded prefix of groups by stable name.findNames(int limit) Loads only the lightweight names required by command completion.findNamesForRegion(UUID regionId) Lists normalized group names assigned directly to a region.findNamesForRegionHierarchy(UUID regionId) Lists group names assigned to a region or its direct parent city.findNamesForRegionHierarchy(UUID regionId, int limit) Lists a bounded prefix of direct and parent group names.findRegions(UUID groupId) Lists regions directly assigned to a group.findRegions(UUID groupId, int limit) Lists a bounded prefix of regions directly assigned to a group.voidinsert(RegionGroup group) Inserts a new named group.booleaninsert(RegionGroup group, int maximumGroups) Inserts a group only while the global group ceiling has not been reached.booleaninsertAudited(RegionGroup group, int maximumGroups) Atomically creates a group and its immutable audit entry.booleanisAssigned(UUID groupId, UUID regionId) Tests an exact assignment without loading group rows.booleanRemoves one region assignment.
-
Konstruktordetails
-
RegionGroupRepository
Creates the group repository.- Parameter:
database- SQLite connection provider
-
-
Methodendetails
-
insert
Inserts a new named group.- Parameter:
group- group to create- Löst aus:
SQLException- when the name already exists or insertion fails
-
insert
Inserts a group only while the global group ceiling has not been reached.- Parameter:
group- group to createmaximumGroups- maximum persistent groups- Gibt zurück:
- whether the group was inserted
- Löst aus:
SQLException- when insertion fails
-
insertAudited
Atomically creates a group and its immutable audit entry.- Parameter:
group- group to createmaximumGroups- maximum persistent groups- Gibt zurück:
- whether both records were committed
- Löst aus:
SQLException- when either write fails
-
find
Finds a group by command name.- Parameter:
name- case-insensitive group name- Gibt zurück:
- matching group when present
- Löst aus:
SQLException- when the query fails
-
findAll
Lists all groups by stable name.- Gibt zurück:
- immutable group list
- Löst aus:
SQLException- when the query fails
-
findAll
Lists a bounded prefix of groups by stable name.- Parameter:
limit- maximum groups returned- Gibt zurück:
- immutable group list
- Löst aus:
SQLException- when the query fails
-
findNames
Loads only the lightweight names required by command completion.- Parameter:
limit- maximum number of names to return- Gibt zurück:
- immutable names ordered case-insensitively
- Löst aus:
SQLException- when the query fails
-
delete
Deletes a group and its assignments.- Parameter:
groupId- group identifier- Gibt zurück:
- whether a group was removed
- Löst aus:
SQLException- when deletion fails
-
deleteAudited
Atomically deletes a group, cascades assignments, and records the deletion.- Parameter:
group- group snapshot to deleteactorId- administrator performing the deletion- Gibt zurück:
- whether both deletion and audit were committed
- Löst aus:
SQLException- when either write fails
-
assign
Assigns a region to a group idempotently.- Parameter:
groupId- group identifierregionId- region identifieractorId- assigning administrator- Gibt zurück:
- whether a new assignment was created
- Löst aus:
SQLException- when insertion fails
-
assign
public boolean assign(UUID groupId, UUID regionId, UUID actorId, int maximumAssignments) throws SQLException Assigns a region only while its direct assignment ceiling has not been reached.The count predicate and insert are one SQLite statement, so concurrent callers cannot both pass a separate preflight count and exceed the limit.
- Parameter:
groupId- group identifierregionId- region identifieractorId- assigning administratormaximumAssignments- maximum direct groups on one region- Gibt zurück:
- whether a new assignment was created
- Löst aus:
SQLException- when insertion fails
-
isAssigned
Tests an exact assignment without loading group rows.- Parameter:
groupId- group identifierregionId- region identifier- Gibt zurück:
- whether the assignment exists
- Löst aus:
SQLException- when the query fails
-
changeAssignmentAudited
public RegionGroupRepository.AssignmentResult changeAssignmentAudited(RegionGroup group, EstateRegion region, UUID actorId, boolean assigning, int maximumAssignments) throws SQLException Atomically changes one assignment and appends its audit record.- Parameter:
group- group snapshotregion- region snapshotactorId- administrator performing the changeassigning- whether to assign rather than unassignmaximumAssignments- maximum direct groups on one region- Gibt zurück:
- precise mutation outcome
- Löst aus:
SQLException- when mutation or audit persistence fails
-
unassign
Removes one region assignment.- Parameter:
groupId- group identifierregionId- region identifier- Gibt zurück:
- whether an assignment was removed
- Löst aus:
SQLException- when deletion fails
-
findRegions
Lists regions directly assigned to a group.- Parameter:
groupId- group identifier- Gibt zurück:
- immutable region list
- Löst aus:
SQLException- when the query fails
-
findRegions
Lists a bounded prefix of regions directly assigned to a group.- Parameter:
groupId- group identifierlimit- maximum regions returned- Gibt zurück:
- immutable region list
- Löst aus:
SQLException- when the query fails
-
findNamesForRegion
Lists normalized group names assigned directly to a region.- Parameter:
regionId- region identifier- Gibt zurück:
- immutable names ordered deterministically
- Löst aus:
SQLException- when the query fails
-
findNamesForRegionHierarchy
Lists group names assigned to a region or its direct parent city. Direct and inherited duplicate names are collapsed deterministically.- Parameter:
regionId- region identifier- Gibt zurück:
- immutable direct and parent group names
- Löst aus:
SQLException- when the query fails
-
findNamesForRegionHierarchy
Lists a bounded prefix of direct and parent group names.- Parameter:
regionId- region identifierlimit- maximum distinct names returned- Gibt zurück:
- immutable deterministic group names
- Löst aus:
SQLException- when the query fails
-