public void deleteJobPlanAssociatedEntities ( JobInstance job ) { JobPlan jobPlan = loadPlan ( job . getId ( ) ) ; environmentVariableDao . deleteAll ( jobPlan . getVariables ( ) ) ; artifactPlanRepository . deleteAll ( jobPlan . getArtifactPlansOfType ( ArtifactPlanType . file ) ) ; artifactPropertiesGeneratorRepository . deleteAll ( jobPlan . getPropertyGenerators ( ) ) ; resourceRepository . deleteAll ( jobPlan . getResources ( ) ) ; if ( jobPlan . requiresElasticAgent ( ) ) { jobAgentMetadataDao . delete ( jobAgentMetadataDao . load ( jobPlan . getJobId ( ) ) ) ; } }
this will be called from Job Status Listener when Job is completed .