1 package org.kuali.student.enrollment.class2.examoffering.batch;
2
3 import org.kuali.student.enrollment.batch.util.BatchSchedulerConstants;
4 import org.kuali.student.enrollment.class2.courseofferingset.model.SocAttributeEntity;
5 import org.kuali.student.enrollment.courseofferingset.dto.SocInfo;
6 import org.kuali.student.enrollment.courseofferingset.service.CourseOfferingSetService;
7 import org.kuali.student.r2.common.dto.AttributeInfo;
8 import org.kuali.student.r2.common.dto.ContextInfo;
9 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
10 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
11 import org.kuali.student.r2.common.exceptions.MissingParameterException;
12 import org.kuali.student.r2.common.exceptions.OperationFailedException;
13 import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
14 import org.kuali.student.r2.common.util.date.DateFormatters;
15 import org.springframework.batch.core.StepContribution;
16 import org.springframework.batch.core.scope.context.ChunkContext;
17 import org.springframework.batch.core.step.tasklet.Tasklet;
18 import org.springframework.batch.repeat.RepeatStatus;
19
20 import java.util.Date;
21 import java.util.List;
22
23
24
25
26 public class ExamOfferingSlottingStateTasklet implements Tasklet {
27
28 private ContextInfo context;
29
30 private String socId;
31 private String stateKey;
32 private CourseOfferingSetService socService;
33
34 public RepeatStatus execute(StepContribution arg0, ChunkContext chunkContext) {
35 try {
36 SocInfo soc = this.getSocService().getSoc(socId, context);
37 AttributeInfo attr = new AttributeInfo(stateKey, DateFormatters.SERVER_DATE_PARSER_FORMATTER.format(new Date()));
38 soc.getAttributes().add(attr);
39 this.getSocService().updateSoc(socId, soc, context);
40
41 } catch (Exception e) {
42
43 }
44
45
46 return RepeatStatus.FINISHED;
47 }
48
49 public ContextInfo getContext() {
50 return context;
51 }
52
53 public void setContext(ContextInfo context) {
54 this.context = context;
55 }
56
57 public String getSocId() {
58 return socId;
59 }
60
61 public void setSocId(String socId) {
62 this.socId = socId;
63 }
64
65 public String getStateKey() {
66 return stateKey;
67 }
68
69 public void setStateKey(String stateKey) {
70 this.stateKey = stateKey;
71 }
72
73 public CourseOfferingSetService getSocService() {
74 return socService;
75 }
76
77 public void setSocService(CourseOfferingSetService socService) {
78 this.socService = socService;
79 }
80 }