public FileImport() { setLastUpdatedUUID(" "); setErrorMessage(" "); setState(FileImport.State.CREATED); }
fileImport.setErrorMessage( message );
/** * This method is called when the job is retried maximum times by the scheduler but still fails. * Thus the scheduler marks it as DEAD. */ @Override public void dead( final JobExecution execution ) throws Exception { // Get the root entity manager EntityManager rootEm = emf.getEntityManager( emf.getManagementAppId() ); // Mark the sub-job i.e. File Import Job as Failed FileImport fileImport = null;//importService.getFileImportEntity(execution); fileImport.setErrorMessage("The Job has been tried maximum times but still failed"); fileImport.setState(FileImport.State.FAILED); rootEm.update(fileImport); // If one file Job fails, mark the main import Job also as failed Results ImportJobResults = rootEm.getSourceEntities( fileImport, "includes", null, Level.ALL_PROPERTIES); List<Entity> importEntity = ImportJobResults.getEntities(); UUID importId = importEntity.get(0).getUuid(); Import importUG = rootEm.get(importId, Import.class); importUG.setState(Import.State.FAILED); rootEm.update(importUG); } }