Subversion Repositories SmartDukaan

Rev

Rev 36337 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36337 Rev 36357
Line 33... Line 33...
33
    private CronBatchItemRepository cronBatchItemRepository;
33
    private CronBatchItemRepository cronBatchItemRepository;
34
 
34
 
35
    @Autowired
35
    @Autowired
36
    private MailOutboxService mailOutboxService;
36
    private MailOutboxService mailOutboxService;
37
 
37
 
-
 
38
    /**
-
 
39
     * Read-only guard used by OfferBatchService before creating a new batch.
-
 
40
     * Returns any RUNNING batch for this offer (sellin or activation job name),
-
 
41
     * or null if none. Wrapped in a read-only tx so callers running outside an
-
 
42
     * existing transaction (e.g. background worker thread) can query safely.
-
 
43
     */
-
 
44
    @Transactional(readOnly = true)
-
 
45
    public CronBatch findRunningForOffer(int offerId) {
-
 
46
        List<CronBatch> running = cronBatchRepository.selectRunningForOffer(offerId);
-
 
47
        return running.isEmpty() ? null : running.get(0);
-
 
48
    }
-
 
49
 
38
    @Transactional(propagation = Propagation.REQUIRES_NEW)
50
    @Transactional(propagation = Propagation.REQUIRES_NEW)
39
    public CronBatch createBatch(String jobName, Map<Integer, String> fofoIdPartnerNameMap) {
51
    public CronBatch createBatch(String jobName, Map<Integer, String> fofoIdPartnerNameMap) {
40
        CronBatch batch = new CronBatch(jobName);
52
        CronBatch batch = new CronBatch(jobName);
41
        batch.setTotalCount(fofoIdPartnerNameMap.size());
53
        batch.setTotalCount(fofoIdPartnerNameMap.size());
42
        cronBatchRepository.persist(batch);
54
        cronBatchRepository.persist(batch);