Revision 29454
Added by Nikon Gasparis almost 10 years ago
OpenAIREValidatorImpl.java | ||
---|---|---|
93 | 93 |
|
94 | 94 |
|
95 | 95 |
@Override |
96 |
public void createRuleSet(String name, String description, String[] ruleIdsContent,String[] ruleIdsUsage) throws OpenAIREValidatorException { |
|
96 |
public void createRuleSet(String name, String description,String guidelinesAcronym, String visibility, String[] ruleIdsContent,String[] ruleIdsUsage) throws OpenAIREValidatorException {
|
|
97 | 97 |
|
98 | 98 |
try { |
99 | 99 |
logger.debug("creating rule set " + name); |
... | ... | |
105 | 105 |
logger.debug("creating rule set : usage : " + newRuleSet.getRuleIdsUsage()); |
106 | 106 |
newRuleSet.setName(name); |
107 | 107 |
newRuleSet.setDescription(description); |
108 |
newRuleSet.setGuidelinesAcronym(guidelinesAcronym); |
|
109 |
newRuleSet.setVisibility(Utilities.convertStringToList(visibility)); |
|
108 | 110 |
newRuleSet.setId(-1); |
109 | 111 |
ruleSetDao.save(newRuleSet); |
110 | 112 |
} catch (Exception e) { |
... | ... | |
116 | 118 |
} |
117 | 119 |
|
118 | 120 |
@Override |
119 |
public void editRuleSet(int setId, String name, String description, String[] ruleIdsContent, String[] ruleIdsUsage) throws OpenAIREValidatorException { |
|
121 |
public void editRuleSet(int setId, String name, String description,String guidelinesAcronym, String visibility, String[] ruleIdsContent, String[] ruleIdsUsage) throws OpenAIREValidatorException {
|
|
120 | 122 |
try { |
121 | 123 |
logger.debug("editing rule set " + setId); |
122 | 124 |
RuleSet newRuleSet = new RuleSet(); |
... | ... | |
124 | 126 |
newRuleSet.setRuleIdsUsage(Utilities.convertArrayToList(ruleIdsUsage)); |
125 | 127 |
newRuleSet.setName(name); |
126 | 128 |
newRuleSet.setDescription(description); |
129 |
newRuleSet.setGuidelinesAcronym(guidelinesAcronym); |
|
130 |
newRuleSet.setVisibility(Utilities.convertStringToList(visibility)); |
|
127 | 131 |
newRuleSet.setId(setId); |
128 | 132 |
ruleSetDao.save(newRuleSet); |
129 | 133 |
} catch (Exception e) { |
... | ... | |
418 | 422 |
|
419 | 423 |
|
420 | 424 |
} |
425 |
|
|
426 |
public Map<String, Set<Integer>> prepareCrisJobs(Set<Integer> chosenContentRules) throws OpenAIREValidatorException { |
|
427 |
Map<String, Set<Integer>> entityChosenRulesMap = new HashMap<String, Set<Integer>>(); |
|
428 |
|
|
429 |
//getting rules per entity and leave only chosen ones |
|
430 |
for (String entity : RuleTypes.getEntities().keySet()) { |
|
431 |
Set<Integer> tempSet = new HashSet<Integer>(); |
|
432 |
for (RuleStored rule : ruleStoredDao.getAllRulesByJobTypeEntityType("content", entity)) { |
|
433 |
if (chosenContentRules.contains(Integer.parseInt(rule.getId()))) |
|
434 |
tempSet.add(Integer.parseInt(rule.getId())); |
|
435 |
} |
|
436 |
entityChosenRulesMap.put(RuleTypes.getSetOfEntity(entity), tempSet); |
|
437 |
} |
|
438 |
|
|
439 |
return entityChosenRulesMap; |
|
440 |
} |
|
421 | 441 |
|
422 |
|
|
423 | 442 |
@Override |
424 | 443 |
@Transactional(propagation = Propagation.REQUIRED) |
425 | 444 |
public JobSubmitted submitContentJob(Properties pros, Set<Integer> crules, String user, String groupBy_xpath, OpenAIREValidatorRegistrationListener regListener) throws OpenAIREValidatorException { |
... | ... | |
629 | 648 |
|
630 | 649 |
@Override |
631 | 650 |
@Transactional(propagation = Propagation.REQUIRED) |
632 |
public String addNewRule(String type, String jobType, String[] inputs) throws OpenAIREValidatorException{ |
|
651 |
public String addNewRule(String type, String jobType, String entityType, String[] inputs) throws OpenAIREValidatorException{
|
|
633 | 652 |
try { |
634 | 653 |
logger.debug("adding new rule using the inputs of the user"); |
635 | 654 |
RuleStored newRule = new RuleStored(); |
... | ... | |
692 | 711 |
} |
693 | 712 |
newRule.setId("-1"); |
694 | 713 |
newRule.setJob_type(JobTypes.getClassOfType(jobType)); |
714 |
newRule.setEntity_type(entityType); |
|
695 | 715 |
newRule.setType(type); |
696 | 716 |
newRule.setConfiguration(pros); |
697 | 717 |
|
... | ... | |
706 | 726 |
|
707 | 727 |
@Override |
708 | 728 |
@Transactional(propagation = Propagation.REQUIRED) |
709 |
public String editRule(String ruleId, String type, String jobType, String[] inputs) throws OpenAIREValidatorException { |
|
729 |
public String editRule(String ruleId, String type, String jobType, String entityType, String[] inputs) throws OpenAIREValidatorException {
|
|
710 | 730 |
try { |
711 | 731 |
logger.debug("edit rule using the inputs of the user"); |
712 | 732 |
RuleStored newRule = new RuleStored(); |
... | ... | |
773 | 793 |
} |
774 | 794 |
newRule.setId(ruleId); |
775 | 795 |
newRule.setJob_type(JobTypes.getClassOfType(jobType)); |
796 |
newRule.setEntity_type(entityType); |
|
776 | 797 |
newRule.setType(type); |
777 | 798 |
newRule.setConfiguration(pros); |
778 | 799 |
|
... | ... | |
1101 | 1122 |
return map; |
1102 | 1123 |
} |
1103 | 1124 |
|
1125 |
@Override |
|
1126 |
public Map<String, String> getRuleSetsMap(String deployEnvironment) throws OpenAIREValidatorException { |
|
1127 |
Map<String, String> map = new HashMap<String, String>(); |
|
1128 |
List<RuleSet> ruleSets = ruleSetDao.getRuleSetIdNames(); |
|
1129 |
for(RuleSet ruleSet : ruleSets) |
|
1130 |
{ |
|
1131 |
if (ruleSet.getVisibility().contains(deployEnvironment)) |
|
1132 |
map.put(ruleSet.getId().toString(), ruleSet.getName()); |
|
1133 |
} |
|
1134 |
return map; |
|
1135 |
} |
|
1136 |
|
|
1104 | 1137 |
private ChainRule<Rule> handleChain(RuleStored tempRule) throws OpenAIREValidatorException { |
1105 | 1138 |
logger.debug("chain rule found"); |
1106 | 1139 |
List<Rule> rules_chain = new ArrayList<Rule>(); |
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