Project

General

Profile

« Previous | Next » 

Revision 57006

Cleaning up and adding the OR clause (job.isRegistration || job.isUpdate)

View differences:

modules/uoa-validator-service/trunk/src/main/java/eu/dnetlib/validator/service/impl/ValidatorManagerImpl.java
218 218
		try {
219 219
			logger.info("Submiting validation job requested by user: " + job.getUserEmail());
220 220

  
221
			if (job.isRegistration()) {
221

  
222
			if (job.isRegistration() || job.isUpdateExisting()) {
222 223
				logger.debug("initiating preregistration validations on repo " + job.getBaseUrl() + " for user " + job.getUserEmail() + "and desired compatibility: " + job.getDesiredCompatibilityLevel());
223
				for (RuleSet ruleset : rulesetsDao.getRuleSets()) {
224
					if (ruleset.getGuidelinesAcronym().equals(job.getDesiredCompatibilityLevel())) {
225
						job.setSelectedContentRules(ruleset.getContentRulesIds());
226
						job.setSelectedUsageRules(ruleset.getUsageRulesIds());
227
					}	
228
				}	
224

  
225
				for (RuleSet ruleset : rulesetsDao.getRuleSets(job.getDesiredCompatibilityLevel())) {
226
					job.setSelectedContentRules(ruleset.getContentRulesIds());
227
					job.setSelectedUsageRules(ruleset.getUsageRulesIds());
228
				}
229 229
			}
230 230
			
231 231
			if ( job.getDesiredCompatibilityLevel().toLowerCase().matches("^openaire4.0$") ) {
......
251 251
				logger.debug("Chosen set: OpenAIRE For Cris");
252 252
				logger.debug("Setting METADATA_PREFIX to: oai_CERIF_openaire");
253 253
				job.setMetadataPrefix("oai_CERIF_openaire");			
254
			} else {
255
				logger.error("Cannot set metadata prefx for " + job.getDesiredCompatibilityLevel() + " guidelines");
254 256
			}
255 257
			
256 258
			
......
264 266
			
265 267
			if (job.getSelectedContentRules() != null) {
266 268
				contentJobs = 1;
267
				validationType +="C";
269
				validationType += "C";
268 270
				totalRules.addAll(job.getSelectedContentRules());
269 271
				newJob.setContentJobStatus("ongoing");
270 272
			} else {
271 273
				newJob.setContentJobStatus("none");
272 274
			}
275

  
273 276
			if (job.getSelectedUsageRules() != null) {
274 277
				logger.debug("Creating map for provider information");
275 278
				verbRuleMap= new HashMap<String,Set<Integer>>();
276 279
				Set<Integer> old,temp = null;
280

  
277 281
				for (Integer id : job.getSelectedUsageRules()){
278 282
					eu.dnetlib.domain.functionality.validator.Rule ruleStored = rulesDao.get(id);
279 283
					logger.debug("Checking for verb : "+ruleStored.getProvider_information());
......
310 314
				newJob.setSelectedCrisEntities(job.getSelectedCrisEntities());
311 315
				newJob.setCrisReferentialChecks(job.isCrisReferentialChecks());
312 316
			}
317

  
313 318
			newJob.setValidationType(validationType);
314
			if (job.isRegistration()) {
319

  
320
			if (job.isRegistration() || job.isUpdateExisting()) {
315 321
				newJob.setJobType("Registration Request");
316 322
				//TODO move in uoa-domain
317 323
				newJob.setActivationId(job.getActivationId());
......
332 338
	
333 339
			int jobIdStored = jobsDao.save(newJob);
334 340
			
335

  
336 341
			RegistrationListener regListener = null;
337
			if (job.isRegistration()) {
342
			if (job.isRegistration() || job.isUpdateExisting()) {
338 343
				regListener = listenersManager.createRegListener();
339
//				regListener.setActivationId(job.getActivationId());
340
//				regListener.setBaseUrl(job.getBaseUrl());
341
//				regListener.setActivationId(job.getActivationId());
342
//				regListener.setAdminEmails(job.getAdminEmails());
343
//				regListener.setOfficialName(job.getOfficialName());
344 344
				regListener.setUserMail(job.getUserEmail());
345 345
				regListener.setDatasourceId(job.getDatasourceId());
346 346
				regListener.setInterfaceId(job.getInterfaceId());
347
//				regListener.setValidationSet(job.getValidationSet());
348
//				regListener.setDesiredCompLevel(job.getDesiredCompatibilityLevel());
349
//				regListener.setRepoType(job.getRepoType());
350
//				regListener.setInterfaceIdOld(job.getInterfaceIdOld());
351
				regListener.setUpdateExisting(job.isUpdateExisting());	
347
				regListener.setUpdateExisting(job.isUpdateExisting());
352 348
				regListener.setTotalJobs(usageJobs + contentJobs);
353 349
			}
354 350
			
......
356 352
			compTestListener.setValidationSet(job.getValidationSet());
357 353
			compTestListener.setGuidelines(job.getDesiredCompatibilityLevel());
358 354
			compTestListener.setTotalJobs(usageJobs + contentJobs);
359

  
360 355
			
361
//CONTENT
356
			//CONTENT
362 357
			if (job.getSelectedContentRules() != null) {
363
			
364 358
				Set<Rule> rulesContent = new HashSet<Rule>();
365
				
366 359
				Properties props = new Properties();
360

  
367 361
				props.setProperty(OAIPMHRecordProvider.BASEURL, job.getBaseUrl());
368 362
				props.setProperty(OAIPMHRecordProvider.METADATA_PREFIX, newJob.getMetadataPrefix());
369 363
				props.setProperty(OAIPMHRecordProvider.RECORDS,Integer.toString(job.getRecords()));
370 364
				props.setProperty(OAIPMHRecordProvider.SET,job.getValidationSet());
371 365
				
372
		
373 366
				Job jobContent = null;
374 367
				
375 368
				ValidatorJobListener listenerContent = listenersManager.createListener();
369

  
376 370
				listenerContent.setJobSubmittedId(jobIdStored);
377 371
				listenerContent.setJobSubmittedUser(job.getUserEmail());
378 372
				listenerContent.setGroupBy_xpath(newJob.getGroupByXpath());
379 373
				listenerContent.setValidationType("content");
380 374
				listenerContent.setInternalJobsSum(contentJobs);
381
				
382 375

  
383 376
				if (job.isCris()) {
384 377
					logger.debug("Submiting job for cris.");
385 378
					logger.debug("Total content jobs: " + contentJobs);
386
//					logger.debug("Selected content rules number: " + job.getSelectedContentRules().size());
387 379
					jobContent = new Job(jobIdStored, 4, rulesContent, props);
388
// acz					validator.submitJobForCris(jobContent, entityChosenRulesMap, entityChosenRulesMapReferential, listenerContent, compTestListener);
389
// send cris validation to Guideline team member. Could be moved into MemoryThreadValidator.submitJobForCris method
390
                                        List<String> recipientsMailAddr = new ArrayList<String>();
391
                                        recipientsMailAddr.add("andreas.czerniak@uni-bielefeld.de");
392
                                        emailer.sendMail( recipientsMailAddr, "CrisJob submitting", "baseUrl: " + job.getBaseUrl() , false, recipientsMailAddr);
393
                                } else {
394
					
380
					// acz
381
					// validator.submitJobForCris(jobContent, entityChosenRulesMap, entityChosenRulesMapReferential, listenerContent, compTestListener);
382
					// send cris validation to Guideline team member. Could be moved into MemoryThreadValidator.submitJobForCris method
383
					List<String> recipientsMailAddr = new ArrayList<String>();
384
					recipientsMailAddr.add("andreas.czerniak@uni-bielefeld.de");
385
					emailer.sendMail( recipientsMailAddr, "CrisJob submitting", "baseUrl: " + job.getBaseUrl() , false, recipientsMailAddr);
386
				} else {
395 387
					logger.debug("Selected content rules number: " + job.getSelectedContentRules().size());
396 388
					for (Integer ruleId : job.getSelectedContentRules()){
389
						eu.dnetlib.domain.functionality.validator.Rule tempRule= rulesDao.get(ruleId);
397 390
						
398
						eu.dnetlib.domain.functionality.validator.Rule tempRule=rulesDao.get(ruleId);
399
						
400 391
						//special behaviour type of rule is chain
401
						if(tempRule.getType().equals("ChainRule")) {
392
						if (tempRule.getType().equals("ChainRule")) {
402 393
							ChainRule<Rule> chainRule = this.handleChain(tempRule);
403 394
							rulesContent.add(chainRule);
404
						}
405
						else {
395
						} else
406 396
							rulesContent.add((Rule) this.getRuleClassInstanceByType(tempRule.getType(), tempRule.getConfiguration(), tempRule.getId()));
407
						}
408 397
					}
409 398
					
410 399
					jobContent = new Job(jobIdStored, 1, rulesContent, props);
411 400
					
412
					if (job.isRegistration()) {
401
					if (job.isRegistration() || job.isUpdateExisting()) {
413 402
						validator.submitJob(jobContent, 1, listenerContent, regListener);
414 403
					} else {
415 404
						validator.submitJob(jobContent, 1, listenerContent, compTestListener);
......
439 428
					jobsUsage.add(new Job(jobIdStored, 2, rulesUsage, pros));
440 429
				}
441 430
				for (Job jobUsage : jobsUsage ) {
442
					if (job.isRegistration()) {
431
					if (job.isRegistration() || job.isUpdateExisting()) {
443 432
						validator.submitJob(jobUsage, 1, listenerUsage, regListener);
444 433
					} else {
445 434
						validator.submitJob(jobUsage, 1, listenerUsage, compTestListener);
modules/uoa-validator-service/trunk/src/main/resources/eu/dnetlib/validator/service/listeners/springContext-validator-listeners.xml
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<beans xmlns="http://www.springframework.org/schema/beans"
3 3
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xmlns:context="http://www.springframework.org/schema/context"
5
	xmlns:cxf="http://cxf.apache.org/core"
6
	xmlns:jaxws="http://cxf.apache.org/jaxws"
7 4
	xmlns:p="http://http://www.springframework.org/schema/p"
8
	xmlns:template="http://dnetlib.eu/springbeans/template"
9 5
	xmlns:t="http://dnetlib.eu/springbeans/t"
10
	xmlns:tx="http://www.springframework.org/schema/tx"
11
	
6

  
12 7
	xsi:schemaLocation="
13
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
14
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
15
        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
16
        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
17
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
18
        http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd"
8
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"
19 9
	default-autowire="no">
20 10
	
21 11
	<bean id="listenersManager" class="eu.dnetlib.validator.service.impls.listeners.ListenersManager">
......
27 17
	</bean>
28 18
	
29 19
	<bean id ="openaireValRegListener" class="eu.dnetlib.validator.service.impls.listeners.RegistrationListener" scope="prototype">
30
<!--		<property name="valBaseUrl" value="${services.validator.webBaseUrl}" />-->
31 20
		<property name="providerUrl" value="${provider.endpoint}"/>
32 21
		<property name="jobsDao" ref="jobsDao" />
33 22
	</bean>	
modules/uoa-validator-service/trunk/src/main/resources/eu/dnetlib/validator/service/springContext-validator-blackboard.xml
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<beans xmlns="http://www.springframework.org/schema/beans"
3
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
4
	xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxws="http://cxf.apache.org/jaxws"
5
	xmlns:p="http://http://www.springframework.org/schema/p"
6
	xmlns:template="http://dnetlib.eu/springbeans/template" xmlns:t="http://dnetlib.eu/springbeans/t"
7
	xmlns:tx="http://www.springframework.org/schema/tx"
8

  
3
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9 4
	xsi:schemaLocation="
10
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
11
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
12
        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
13
        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
14
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
15
        http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd"
5
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"
16 6
	default-autowire="no">
17 7

  
18 8
	<bean id="blackboardHandler"
......
26 16
		</property>
27 17
	</bean>
28 18

  
29
	<bean id="notificationListener" class="eu.dnetlib.validator.service.impl.NotificationListener"
30
		scope="singleton">
19
	<bean id="notificationListener" class="eu.dnetlib.validator.service.impl.NotificationListener">
31 20
		<property name="valManager" ref="validatorManager" />
32 21
		<property name="blackboardHandler" ref="blackboardHandler" />
33 22
	</bean>
modules/uoa-validator-service/trunk/src/main/resources/eu/dnetlib/validator/service/providers/springContext-validator-providers.xml
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<beans xmlns="http://www.springframework.org/schema/beans"
3 3
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xmlns:context="http://www.springframework.org/schema/context"
5
	xmlns:cxf="http://cxf.apache.org/core"
6
	xmlns:jaxws="http://cxf.apache.org/jaxws"
7 4
	xmlns:p="http://http://www.springframework.org/schema/p"
8
	xmlns:template="http://dnetlib.eu/springbeans/template"
9 5
	xmlns:t="http://dnetlib.eu/springbeans/t"
10
	xmlns:tx="http://www.springframework.org/schema/tx"
11
	
12 6
	xsi:schemaLocation="
13
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
14
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
15
        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
16
        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
17
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
18
        http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd"
7
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"
19 8
	default-autowire="no">
20 9
	
21 10
	<bean id="providersManager" class="eu.dnetlib.validator.service.impls.providers.ProvidersManager">
......
40 29
	</bean>	
41 30
	
42 31
	<bean id ="dnetProvider" class="eu.dnetlib.validator.service.impls.providers.DnetProviderNew" scope="prototype">
43
	
44 32
		<property name="mdStoreServiceLocator" ref="mdStoreServiceLocator" />
45 33
		<property name="rsFactory" ref="resultSetFactory" />
46 34
		<property name="harvesterExecutor" ref="jobExecutor" />

Also available in: Unified diff