Revision 29454
Added by Nikon Gasparis almost 10 years ago
PrepareEditRule.java | ||
---|---|---|
16 | 16 |
private static final long serialVersionUID = 8825889540939707747L; |
17 | 17 |
private String ruleId; |
18 | 18 |
|
19 |
private String type, jobType; |
|
19 |
private String type, jobType, entityType;
|
|
20 | 20 |
private List<RulePair> rules; |
21 | 21 |
private List<FieldPair> ruleValues; |
22 | 22 |
private String mandatory; |
23 | 23 |
private static final Logger logger = Logger |
24 | 24 |
.getLogger(PrepareEditRule.class); |
25 | 25 |
|
26 |
|
|
27 |
public String execute() { |
|
28 |
this.clearErrorsAndMessages(); |
|
29 |
try { |
|
30 |
logger.debug("preparing edit of rule"); |
|
31 |
|
|
32 |
logger.debug("preparing edit of rule " + ruleId); |
|
33 |
RuleStored rule = this.getOpenAIREValidator().getRule(ruleId); |
|
34 |
|
|
35 |
this.ruleValues = this.getOpenAIREValidator().getRuleValuePairs( |
|
36 |
ruleId); |
|
37 |
this.type = rule.getType(); |
|
38 |
if (type.equals("ChainRule")) { |
|
39 |
try { |
|
40 |
rules = this.getOpenAIREValidator().getAllRulesToRulePair(); |
|
41 |
} catch (OpenAIREValidatorException e) { |
|
42 |
return Action.ERROR; |
|
43 |
} |
|
44 |
} |
|
45 |
this.jobType = rule.getJob_type(); |
|
46 |
this.entityType = rule.getEntity_type(); |
|
47 |
if (this.jobType.equals("content")) |
|
48 |
this.jobType = "OAI Content Validation"; |
|
49 |
else |
|
50 |
this.jobType = "OAI Usage Validation"; |
|
51 |
this.mandatory = rule.getMandatory(); |
|
52 |
return Action.SUCCESS; |
|
53 |
} catch (Exception e) { |
|
54 |
logger.error("preparing edit of rule " + ruleId, e); |
|
55 |
this.addActionError(this.getText("generic.error")); |
|
56 |
reportException(e); |
|
57 |
return "exception"; |
|
58 |
} |
|
59 |
} |
|
26 | 60 |
public List<RulePair> getRules() { |
27 | 61 |
return rules; |
28 | 62 |
} |
... | ... | |
39 | 73 |
this.jobType = jobType; |
40 | 74 |
} |
41 | 75 |
|
76 |
public String getEntityType() { |
|
77 |
return entityType; |
|
78 |
} |
|
79 |
|
|
80 |
public void setEntityType(String entityType) { |
|
81 |
this.entityType = entityType; |
|
82 |
} |
|
83 |
|
|
42 | 84 |
public List<FieldPair> getRuleValues() { |
43 | 85 |
return ruleValues; |
44 | 86 |
} |
... | ... | |
62 | 104 |
public void setRuleId(String ruleId) { |
63 | 105 |
this.ruleId = ruleId; |
64 | 106 |
} |
65 |
|
|
66 |
public String execute() { |
|
67 |
this.clearErrorsAndMessages(); |
|
68 |
try { |
|
69 |
logger.debug("preparing edit of rule"); |
|
70 |
|
|
71 |
logger.debug("preparing edit of rule " + ruleId); |
|
72 |
RuleStored rule = this.getOpenAIREValidator().getRule(ruleId); |
|
73 |
|
|
74 |
this.ruleValues = this.getOpenAIREValidator().getRuleValuePairs( |
|
75 |
ruleId); |
|
76 |
this.type = rule.getType(); |
|
77 |
if (type.equals("ChainRule")) { |
|
78 |
try { |
|
79 |
rules = this.getOpenAIREValidator().getAllRulesToRulePair(); |
|
80 |
} catch (OpenAIREValidatorException e) { |
|
81 |
return Action.ERROR; |
|
82 |
} |
|
83 |
} |
|
84 |
this.jobType = rule.getJob_type(); |
|
85 |
if (this.jobType.equals("content")) |
|
86 |
this.jobType = "OAI Content Validation"; |
|
87 |
else |
|
88 |
this.jobType = "OAI Usage Validation"; |
|
89 |
this.mandatory = rule.getMandatory(); |
|
90 |
return Action.SUCCESS; |
|
91 |
} catch (Exception e) { |
|
92 |
logger.error("preparing edit of rule " + ruleId, e); |
|
93 |
this.addActionError(this.getText("generic.error")); |
|
94 |
reportException(e); |
|
95 |
return "exception"; |
|
96 |
} |
|
97 |
} |
|
98 |
|
|
107 |
|
|
99 | 108 |
public void setMandatory(String mandatory) { |
100 | 109 |
this.mandatory = mandatory; |
101 | 110 |
} |
Also available in: Unified diff
*extended information on registration mails
*fixed a bug where namespace prefix for aggregator was 11 rather than 12 characters
*new properties to enable/disable registration of publication files
*new property to set deploy environment
*guidelines are displaying according to the chosen deploy environment
*support for CRIS rules
*support for CRIS compatibility tests