We're updating the issue view to help you get more done. 

Reject loading to CANCELLED investigations

Description

If the DocumentLoaderJob attempts to load content to a CANCELLED investigation that already has a document attached, it tries to version it, yielding:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 24 Oct 2017 10:00:00,215 INFO DocumentLoaderJob,scheduler_Worker-2:118 - - Error /var/openvpms/import/in/1935678_Sassy_2017-10-23-214258.pdf Failed to validate the object using archetype act.patientInvestigationVersion.1.0. FailedToValidObjectAgainstArchetype node:status msg:Validation failed for assertion lookup.local at org.openvpms.component.business.service.archetype.ArchetypeService.validateObject(ArchetypeService.java:214) at org.openvpms.component.business.service.archetype.ArchetypeService.save(ArchetypeService.java:525) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64) at org.openvpms.component.business.service.security.OpenVPMSMethodSecurityInterceptor.invoke(OpenVPMSMethodSecurityInterceptor.java:50) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy19.save(Unknown Source) at org.openvpms.component.business.service.archetype.rule.ArchetypeRuleService$2.run(ArchetypeRuleService.java:136) at org.openvpms.component.business.service.archetype.rule.ArchetypeRuleService$5.doInTransaction(ArchetypeRuleService.java:201) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) at org.openvpms.component.business.service.archetype.rule.ArchetypeRuleService.execute(ArchetypeRuleService.java:196) at org.openvpms.component.business.service.archetype.rule.ArchetypeRuleService.save(ArchetypeRuleService.java:134) at org.openvpms.component.business.service.archetype.DelegatingArchetypeService.save(DelegatingArchetypeService.java:223) at org.openvpms.etl.tools.doc.AbstractLoader.addDocument(AbstractLoader.java:297) at org.openvpms.etl.tools.doc.AbstractLoader$1.doInTransactionWithoutResult(AbstractLoader.java:278) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) at org.openvpms.etl.tools.doc.AbstractLoader.addDocument(AbstractLoader.java:274) at org.openvpms.etl.tools.doc.AbstractLoader.loadWithDuplicateCheck(AbstractLoader.java:252) at org.openvpms.etl.tools.doc.AbstractLoader.load(AbstractLoader.java:189) at org.openvpms.etl.tools.doc.IdLoader.load(IdLoader.java:153) at org.openvpms.etl.tools.doc.AbstractLoader.loadNext(AbstractLoader.java:156) at org.openvpms.web.jobs.docload.DocumentLoaderJob.execute(DocumentLoaderJob.java:142) at org.openvpms.component.business.service.scheduler.JobRunner$1.call(JobRunner.java:131) at org.openvpms.component.business.service.scheduler.JobRunner$1.call(JobRunner.java:127) at org.openvpms.component.business.service.security.RunAs.run(RunAs.java:41) at org.openvpms.component.business.service.scheduler.JobRunner.execute(JobRunner.java:136) at org.quartz.core.JobRunShell.run(JobRunShell.java:216) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)

This is because act.patientInvestigationVersion does not have a CANCELLED option for the status node.
If an act is CANCELLED, and loads to it should be rejected as errors.

Environment

None

Status

Assignee

Tim Anderson

Reporter

Tim Anderson

Labels

None

Components

Fix versions

Affects versions

1.9

Priority

Minor