1
|
package eu.dnetlib.msro.workflows.dedup.conf;
|
2
|
|
3
|
import java.io.IOException;
|
4
|
import java.util.Queue;
|
5
|
|
6
|
import com.google.gson.Gson;
|
7
|
import com.google.gson.GsonBuilder;
|
8
|
|
9
|
import eu.dnetlib.pace.config.DedupConfig;
|
10
|
import eu.dnetlib.pace.util.PaceException;
|
11
|
import org.codehaus.jackson.map.ObjectMapper;
|
12
|
|
13
|
/**
|
14
|
* The Class DedupConfigurationOrchestration.
|
15
|
*/
|
16
|
public class DedupConfigurationOrchestration {
|
17
|
|
18
|
/** The entity. */
|
19
|
private Entity entity;
|
20
|
|
21
|
/** The action set id. */
|
22
|
private String actionSetId;
|
23
|
|
24
|
/** The configurations. */
|
25
|
private Queue<DedupConfig> configurations;
|
26
|
|
27
|
public DedupConfigurationOrchestration() {}
|
28
|
|
29
|
/**
|
30
|
* Instantiates a new dedup configuration orchestration.
|
31
|
*
|
32
|
* @param entity
|
33
|
* the entity
|
34
|
* @param actionSetId
|
35
|
* the action set id
|
36
|
* @param configurations
|
37
|
* the configurations
|
38
|
*/
|
39
|
public DedupConfigurationOrchestration(final Entity entity, final String actionSetId, final Queue<DedupConfig> configurations) {
|
40
|
super();
|
41
|
this.setEntity(entity);
|
42
|
this.setActionSetId(actionSetId);
|
43
|
this.setConfigurations(configurations);
|
44
|
}
|
45
|
|
46
|
/**
|
47
|
* Gets the entity.
|
48
|
*
|
49
|
* @return the entity
|
50
|
*/
|
51
|
public Entity getEntity() {
|
52
|
return entity;
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* Gets the action set id.
|
57
|
*
|
58
|
* @return the action set id
|
59
|
*/
|
60
|
public String getActionSetId() {
|
61
|
return actionSetId;
|
62
|
}
|
63
|
|
64
|
/**
|
65
|
* Gets the configurations.
|
66
|
*
|
67
|
* @return the configurations
|
68
|
*/
|
69
|
public Queue<DedupConfig> getConfigurations() {
|
70
|
return configurations;
|
71
|
}
|
72
|
|
73
|
public void setEntity(final Entity entity) {
|
74
|
this.entity = entity;
|
75
|
}
|
76
|
|
77
|
public void setActionSetId(final String actionSetId) {
|
78
|
this.actionSetId = actionSetId;
|
79
|
}
|
80
|
|
81
|
public void setConfigurations(final Queue<DedupConfig> configurations) {
|
82
|
this.configurations = configurations;
|
83
|
}
|
84
|
|
85
|
/**
|
86
|
* From json.
|
87
|
*
|
88
|
* @param json
|
89
|
* the json
|
90
|
* @return the dedup configuration orchestration
|
91
|
*/
|
92
|
public static DedupConfigurationOrchestration fromJSON(final String json) {
|
93
|
try {
|
94
|
return new ObjectMapper().readValue(json, DedupConfigurationOrchestration.class);
|
95
|
} catch (IOException e) {
|
96
|
throw new PaceException("unable to deserialise configuration", e);
|
97
|
}
|
98
|
}
|
99
|
|
100
|
/*
|
101
|
* (non-Javadoc)
|
102
|
*
|
103
|
* @see java.lang.Object#toString()
|
104
|
*/
|
105
|
@Override
|
106
|
public String toString() {
|
107
|
try {
|
108
|
return new ObjectMapper().writeValueAsString(this);
|
109
|
} catch (IOException e) {
|
110
|
throw new PaceException("unable to serialise configuration", e);
|
111
|
}
|
112
|
}
|
113
|
|
114
|
}
|