package eu.reply.lea.services.yms.task.locationaware.application; import…
- User
package eu.reply.lea.services.yms.task.locationaware.application;
import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Default; import javax.inject.Inject; import javax.inject.Named; import javax.persistence.EntityManager;
import eu.reply.lea.services.yms.ModuleConfiguration; import eu.reply.lea.services.yms.task.TaskReference; import eu.reply.lea.services.yms.task.locationaware.domain.LocationAwareTask; import eu.reply.lea.services.yms.task.locationaware.integration.yms.queue.TaskDequeueAdapter; import eu.reply.lea.services.yms.task.sequence.LocationAwareTasksSequence; import eu.reply.sce.backend.core.jee.configuration.entity.EntityReferenceHandler; import eu.reply.sce.backend.core.jee.log.Logged;
@Logged @ApplicationScoped @Named("LocationAwareTaskApplicationService") public class LocationAwareTaskApplicationService {
@Inject private TaskDequeueAdapter taskDequeueAdapter; @Inject @ModuleConfiguration.Module(ModuleConfiguration.Module.CURRENT) private EntityManager em; @Inject private EntityReferenceHandler entityReferenceHandler; @TransactionAttribute(TransactionAttributeType.REQUIRED) public void handleTaskClosure(final TaskReference taskReference) { final LocationAwareTask<?,?,?> task = entityReferenceHandler.getEntity(taskReference.toEntityReference(), em); LocationAwareTasksSequence<LocationAwareTask<?, ?, ?>> sequence = task.getSequence(); if (sequence != null && sequence.areAllTasksContiguousInTheLocationClosed(task)) { // Delegate external service call to adapter taskDequeueAdapter.notifyDequeueForTask(sequence.getAllTasksContiguousInTheLocationClosed(task, true)); } }} Use the policy pattern, so far i had only thasks which were enqueued (therefore they had to be dequeued) Now i have another tasks (we can see by task.isEnableQUeue()==false) that does not queue Therefore instead of dequeueing at the closure, we unlock the next task in the sequence. Propose other alternative insted of the policy, maybe you come up with something better Work using DDD principles, this is an application service
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.