1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.ext.scimv2.api.data;
20
21 import com.fasterxml.jackson.annotation.JsonCreator;
22 import com.fasterxml.jackson.annotation.JsonIgnore;
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import java.time.OffsetDateTime;
25 import java.util.Optional;
26 import javax.ws.rs.core.EntityTag;
27 import org.apache.syncope.ext.scimv2.api.type.Resource;
28
29 public class Meta extends SCIMBean {
30
31 private static final long serialVersionUID = 8976451652101091915L;
32
33 private final Resource resourceType;
34
35 private final OffsetDateTime created;
36
37 private final OffsetDateTime lastModified;
38
39 @JsonIgnore
40 private final EntityTag version;
41
42 private final String location;
43
44 @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
45 public Meta(
46 @JsonProperty("resourceType") final Resource resourceType,
47 @JsonProperty("created") final OffsetDateTime created,
48 @JsonProperty("lastModified") final OffsetDateTime lastModified,
49 @JsonProperty("version") final String version,
50 @JsonProperty("location") final String location) {
51
52 this.resourceType = resourceType;
53 this.created = created;
54 this.lastModified = lastModified;
55 this.version = Optional.ofNullable(version).map(s -> new EntityTag(s, true)).orElse(null);
56 this.location = location;
57 }
58
59 public Resource getResourceType() {
60 return resourceType;
61 }
62
63 public OffsetDateTime getCreated() {
64 return created;
65 }
66
67 public OffsetDateTime getLastModified() {
68 return lastModified;
69 }
70
71 @JsonProperty
72 public String getVersion() {
73 return Optional.ofNullable(version).map(EntityTag::toString).orElse(null);
74 }
75
76 public String getLocation() {
77 return location;
78 }
79 }