1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.core.workflow.java;
20
21 import java.time.OffsetDateTime;
22 import org.apache.syncope.core.persistence.api.dao.GroupDAO;
23 import org.apache.syncope.core.persistence.api.entity.Any;
24 import org.apache.syncope.core.persistence.api.entity.EntityFactory;
25 import org.springframework.context.ApplicationEventPublisher;
26
27 public abstract class AbstractWorkflowAdapter {
28
29 protected final GroupDAO groupDAO;
30
31 protected final EntityFactory entityFactory;
32
33 protected final ApplicationEventPublisher publisher;
34
35 protected AbstractWorkflowAdapter(
36 final GroupDAO groupDAO,
37 final EntityFactory entityFactory,
38 final ApplicationEventPublisher publisher) {
39
40 this.groupDAO = groupDAO;
41 this.entityFactory = entityFactory;
42 this.publisher = publisher;
43 }
44
45 protected void metadata(final Any<?> any, final String who, final String context) {
46 OffsetDateTime now = OffsetDateTime.now();
47
48 if (any.getCreationDate() == null) {
49 any.setCreationDate(now);
50 any.setCreator(who);
51 any.setCreationContext(context);
52 }
53
54 any.setLastModifier(who);
55 any.setLastChangeDate(now);
56 any.setLastChangeContext(context);
57 }
58 }