Class UpdateClassroomUserBatchJob
java.lang.Object
ch.tocco.nice2.tasks.api.quartz.AbstractJob
ch.tocco.nice2.optional.classroom.spi.UpdateClassroomUserBatchJob
- All Implemented Interfaces:
org.quartz.Job
Updates the classroom for each contributed base entity name (e.g. Registration or Lecturer_booking) that is
connected to one
* if
relevant_for_classoom
is set to true on the status of the entity, it is added to the classroom
* otherwise, it is removed
* users that are connected to a classroom, but do not have a corresponding base entity (e.g. Registration or
Lecturer_booking) are left untouched
If updateClassroomOfModule
is set to true, the classroom of the "parent event" is updated as well.
This batch job is not contributed in this module. If this batch job should be activated for a certain customer,
please do so in the hivemodule.xml of that customer.
Also don't forget to add the boolean field `relevant_for_classroom` on the status entity of the contributed
base entity.
Example configuration for a customer where users should be updated from Registrations and moderators from
Lecturer bookings. If the "parent event" of the event has a classroom, the classroom of the parent should be
updated as well:
@Bean
public UpdateClassroomUserBatchJob.UpdateClassroomEntitiesContribution registrationUpdateClassroomEntitiesRegistrationContribution() {
UpdateClassroomUserBatchJob.UpdateClassroomEntitiesContribution bean = new UpdateClassroomUserBatchJob.UpdateClassroomEntitiesContribution();
bean.setBaseEntity("Registration");
bean.setRelationFromBaseEntityToStatus("relRegistration_status");
bean.setRelationFromClassroomToUser("relUser");
return bean;
}
@Bean
public UpdateClassroomUserBatchJob.UpdateClassroomEntitiesContribution lecturerBookingUpdateClassroomEntitiesRegistrationContribution() {
UpdateClassroomUserBatchJob.UpdateClassroomEntitiesContribution bean = new UpdateClassroomUserBatchJob.UpdateClassroomEntitiesContribution();
bean.setBaseEntity("Lecturer_booking");
bean.setRelationFromBaseEntityToStatus("relLecturer_status");
bean.setRelationFromClassroomToUser("relModerator");
return bean;
}
@Bean
public BatchJobContribution repairBinaryReferenceCountBatchJobContribution() {
return new BatchJobContribution("UpdateClassroomUserBatchJob",
"adds and removes Registration and Lecturer_booking entities on the connected Classroom based on the 'relevant_for_classroom' field of their status",
"0 2 * * ?",
UpdateClassroomUserBatchJob.class);
}
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
-
Field Summary
Fields inherited from class ch.tocco.nice2.tasks.api.quartz.AbstractJob
businessUnitManager, l10N, logger, principalManager, securityManager
-
Constructor Summary
ConstructorDescriptionUpdateClassroomUserBatchJob
(CommandExecutor executor, QueryBuilderFactory queryBuilderFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doExecute
(org.quartz.JobExecutionContext context, JobDataMapReader jobDataMapReader) void
setEntitiesContributions
(List<UpdateClassroomUserBatchJob.UpdateClassroomEntitiesContribution> entitiesContributions) void
setUpdateClassroomOfModule
(boolean updateClassroomOfModule) Methods inherited from class ch.tocco.nice2.tasks.api.quartz.AbstractJob
execute, getProgress, getProgressLog, setBusinessUnitManager, setConverters, setL10N, setLogger, setPrincipalManager, setProgressPersistenceManager, setRuleProviderService, setSecurityManager
-
Constructor Details
-
UpdateClassroomUserBatchJob
public UpdateClassroomUserBatchJob(CommandExecutor executor, QueryBuilderFactory queryBuilderFactory)
-
-
Method Details
-
setEntitiesContributions
@Autowired(required=false) public void setEntitiesContributions(List<UpdateClassroomUserBatchJob.UpdateClassroomEntitiesContribution> entitiesContributions) -
setUpdateClassroomOfModule
@Value("${nice2.classroom.UpdateClassroomUserBatchJob.updateClassroomOfModule}") public void setUpdateClassroomOfModule(boolean updateClassroomOfModule) -
doExecute
- Specified by:
doExecute
in classAbstractJob
-