Class RequirementRuleServiceImpl
java.lang.Object
ch.tocco.nice2.optional.educationrequirement.impl.RequirementRuleServiceImpl
- All Implemented Interfaces:
RequirementRuleService
-
Constructor Summary
ConstructorDescriptionRequirementRuleServiceImpl
(Context context, QueryBuilderFactory queryFactory, EntityDefaultValueService entityDefaultValueService, CommandExecutor executor, ClientQuestionService questionService, TextResources textResources, CascadingDeleteService cascadingDeleteService) -
Method Summary
Modifier and TypeMethodDescriptionboolean
confirmRequirementAdjustements
(EntityList requirements) send the user a confirmation question if the Requirements should actually be updatedfilterOpenRequirements
(EntityList requirements) filter out all Requirements that aren't opengetValidRegistrations
(Entity event) Return all registrations for given event entity which have status 'registered' or 'booked'getValidSchoolings
(Entity courseOfStudy) Return all schooling entites which are linked with given course of study and have an empty end date or in futurevoid
linkRequirementRules
(EntityList sourceEntities, EntityList requirementPackages) Connect all the requirement rules with given single source entity.void
linkRequirementRulesForSingleEntity
(Entity sourceEntity, EntityList requirementPackages) void
removeRequirementPackage
(EntityList sources, Entity requirementPackage) removes Requirement_packages from Requirements that were generated on sources.
-
Constructor Details
-
RequirementRuleServiceImpl
public RequirementRuleServiceImpl(Context context, QueryBuilderFactory queryFactory, EntityDefaultValueService entityDefaultValueService, CommandExecutor executor, ClientQuestionService questionService, TextResources textResources, CascadingDeleteService cascadingDeleteService)
-
-
Method Details
-
linkRequirementRules
Description copied from interface:RequirementRuleService
Connect all the requirement rules with given single source entity. A requirement entity is created for each rule in the given requirement packages. If a rule is present in multiple packages only a single requirement entity is created. Each requirement entity knows from which package it originated.- Specified by:
linkRequirementRules
in interfaceRequirementRuleService
- Parameters:
sourceEntities
- Entities of model 'Schooling' or 'Registration'requirementPackages
- the requirement packages from which to load the rules to be used
-
linkRequirementRulesForSingleEntity
public void linkRequirementRulesForSingleEntity(Entity sourceEntity, EntityList requirementPackages) Description copied from interface:RequirementRuleService
- Specified by:
linkRequirementRulesForSingleEntity
in interfaceRequirementRuleService
- Parameters:
sourceEntity
- Single entity of model 'Schooling' or 'Registration'requirementPackages
- the Requirement_packages from which to load the rules to be used
-
getValidSchoolings
Description copied from interface:RequirementRuleService
Return all schooling entites which are linked with given course of study and have an empty end date or in future- Specified by:
getValidSchoolings
in interfaceRequirementRuleService
- Parameters:
courseOfStudy
- Source course of study entity- Returns:
- EntityList with valid schooling entities
-
getValidRegistrations
Description copied from interface:RequirementRuleService
Return all registrations for given event entity which have status 'registered' or 'booked'- Specified by:
getValidRegistrations
in interfaceRequirementRuleService
- Parameters:
event
- Source event entity- Returns:
- EntityList with valid registration entities
-
removeRequirementPackage
Description copied from interface:RequirementRuleService
removes Requirement_packages from Requirements that were generated on sources. If the Requirements have any other status than 'open' a confirmation is sent to the user before anything else is done. Afterwards the Requirement_package is removed from Requirement_relRequirement_package. If that Requirement_package is the last one on the Requirement, it is deleted.- Specified by:
removeRequirementPackage
in interfaceRequirementRuleService
- Parameters:
sources
- the sources from which to load RequirementsrequirementPackage
- the Requirement to remove
-
filterOpenRequirements
Description copied from interface:RequirementRuleService
filter out all Requirements that aren't open- Specified by:
filterOpenRequirements
in interfaceRequirementRuleService
- Parameters:
requirements
- the Requirements to filter- Returns:
- a list of Requirements with any status other than 'open'
-
confirmRequirementAdjustements
Description copied from interface:RequirementRuleService
send the user a confirmation question if the Requirements should actually be updated- Specified by:
confirmRequirementAdjustements
in interfaceRequirementRuleService
- Parameters:
requirements
- the Requirements to list in the question- Returns:
- the answer from the user
-