You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/03/10 22:22:40 UTC

[11/50] [abbrv] git commit: Fixed error in Job class where I added an emf for testing purposes.

Fixed error in Job class where I added an emf for testing purposes.


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/1a2028da
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/1a2028da
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/1a2028da

Branch: refs/pull/70/head
Commit: 1a2028daa314cc3bf5f841600a6280d4d90d2484
Parents: 41caff7
Author: grey <gr...@apigee.com>
Authored: Tue Feb 25 14:57:01 2014 -0800
Committer: grey <gr...@apigee.com>
Committed: Tue Feb 25 14:57:01 2014 -0800

----------------------------------------------------------------------
 .../usergrid/management/export/ExportJob.java   | 29 +++++++-------------
 1 file changed, 10 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1a2028da/stack/services/src/main/java/org/apache/usergrid/management/export/ExportJob.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/export/ExportJob.java b/stack/services/src/main/java/org/apache/usergrid/management/export/ExportJob.java
index 83cda0a..c89be43 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/export/ExportJob.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/export/ExportJob.java
@@ -11,9 +11,6 @@ import org.springframework.stereotype.Component;
 import org.apache.usergrid.batch.JobExecution;
 import org.apache.usergrid.batch.job.OnlyOnceJob;
 import org.apache.usergrid.management.ExportInfo;
-import org.apache.usergrid.persistence.EntityManager;
-import org.apache.usergrid.persistence.EntityManagerFactory;
-import org.apache.usergrid.persistence.entities.Export;
 import org.apache.usergrid.persistence.entities.JobData;
 
 
@@ -29,15 +26,11 @@ public class ExportJob extends OnlyOnceJob {
     @Autowired
     ExportService exportService;
 
-    @Autowired
-    private EntityManagerFactory emf;
-
-
     public ExportJob() {
         logger.info( "ExportJob created " + this );
     }
 
-//need to add in checking the export state and what happens if it fails. This should then update the export entity with failed state.
+
     @Override
     public void doJob( JobExecution jobExecution ) throws Exception {
         logger.info( "execute ExportJob {}", jobExecution );
@@ -57,17 +50,15 @@ public class ExportJob extends OnlyOnceJob {
             logger.error( "Export information cannot be null" );
             return;
         }
-        EntityManager em = emf.getEntityManager( config.getApplicationId() );
-        Export export = em.get( exportId, Export.class );
-
-            jobExecution.heartbeat();
-            try {
-                exportService.doExport( config, jobExecution );
-            }catch (Exception e) {
-                logger.error( "Export Service failed to complete job" );
-                export.setState( Export.State.FAILED );
-                em.update( export );
-            }
+
+        jobExecution.heartbeat();
+        try {
+            exportService.doExport( config, jobExecution );
+        }
+        catch ( Exception e ) {
+            logger.error( "Export Service failed to complete job" );
+            return;
+        }
 
         logger.info( "executed ExportJob process completed" );
     }