@Test public void testPullErrorJsonFromDMZ() { testData = new StandardizedPatient(); testData.setName("patient"); testData.persist(); testData.merge(); dataFromDMZ = "abc"; try { instance.pullFromDMZ(testData.getId()); Assert.fail("Pull StandardizedPatient from DMZ by error json data without throws Exception!"); } catch (Exception e) { } }
@Override public void pullFromDMZ(Long standardizedPatientId) throws DMZSyncException { String url = getHostAddress() + "/DataImportExport/exportSP?id=" + standardizedPatientId; String data = getDMZData(url); data =preProcessData(data); JSONDeserializer deserializer = new JSONDeserializer() .use("anamnesisForm.createDate", new DateTransformer("yyyy-MM-dd'T'HH:mm:ss'Z'")) .use("birthday", new DateTransformer("yyyy-MM-dd")) .use("gender", new GenderTransformer()) .use("maritalStatus", new MaritalStatusTransformer()) .use("status",new SPStatusTransformer()) .use("workPermission", new WorkPermissionTransformer()) .use("anamnesisForm.anamnesischecksvalues.values.anamnesischeck.title.type", new AnamnesisChecksTypeTransformet()) .use("anamnesisForm.scars.values.traitType", new TraitTypeTransformet()) .use("anamnesisForm.anamnesischecksvalues.values.anamnesischeck.type", new AnamnesisChecksTypeTransformet()); String unExpectedData=standardizedPatientId+"not found"; StandardizedPatient newPatient = null; if(!data.equals(unExpectedData)){ try{ newPatient = (StandardizedPatient) (deserializer .use(null, StandardizedPatient.class).deserialize(data)); }catch(flexjson.JSONException e){ Log.error("Error deserialize json data: "+e.getMessage()); throw new DMZSyncException(DMZSyncExceptionType.SYNC_PATIENT_EXCEPTION,"Error json data."); } }else{ throw new DMZSyncException(DMZSyncExceptionType.PATIENT_EXIST_EXCEPTION,""); } StandardizedPatient patient = StandardizedPatient.findStandardizedPatient(standardizedPatientId); if( patient != null){ if(newPatient!=null){ updatePatient(patient,newPatient); } }else{ } }
DMZSyncServiceImpl extends RemoteServiceServlet implements
		DMZSyncService { @Override public void pullFromDMZ(Long standardizedPatientId) throws DMZSyncException { String url = getHostAddress() + "/DataImportExport/exportSP?id=" + standardizedPatientId; String data = getDMZData(url); data =preProcessData(data); JSONDeserializer deserializer = new JSONDeserializer() .use("anamnesisForm.createDate", new DateTransformer("yyyy-MM-dd'T'HH:mm:ss'Z'")) .use("birthday", new DateTransformer("yyyy-MM-dd")) .use("gender", new GenderTransformer()) .use("maritalStatus", new MaritalStatusTransformer()) .use("status",new SPStatusTransformer()) .use("workPermission", new WorkPermissionTransformer()) .use("anamnesisForm.anamnesischecksvalues.values.anamnesischeck.title.type", new AnamnesisChecksTypeTransformet()) .use("anamnesisForm.scars.values.traitType", new TraitTypeTransformet()) .use("anamnesisForm.anamnesischecksvalues.values.anamnesischeck.type", new AnamnesisChecksTypeTransformet()); String unExpectedData=standardizedPatientId+"not found"; StandardizedPatient newPatient = null; if(!data.equals(unExpectedData)){ try{ newPatient = (StandardizedPatient) (deserializer .use(null, StandardizedPatient.class).deserialize(data)); }catch(flexjson.JSONException e){ Log.error("Error deserialize json data: "+e.getMessage()); throw new DMZSyncException(DMZSyncExceptionType.SYNC_PATIENT_EXCEPTION,"Error json data."); } }else{ throw new DMZSyncException(DMZSyncExceptionType.PATIENT_EXIST_EXCEPTION,""); } StandardizedPatient patient = StandardizedPatient.findStandardizedPatient(standardizedPatientId); if( patient != null){ if(newPatient!=null){ updatePatient(patient,newPatient); } }else{ } } }
DMZSyncServiceImpl extends RemoteServiceServlet implements
		DMZSyncService { @Override public void pullFromDMZ(Long standardizedPatientId) throws DMZSyncException { String url = getHostAddress() + "/DataImportExport/exportSP?id=" + standardizedPatientId; String data = getDMZData(url); data =preProcessData(data); JSONDeserializer deserializer = new JSONDeserializer() .use("anamnesisForm.createDate", new DateTransformer("yyyy-MM-dd'T'HH:mm:ss'Z'")) .use("birthday", new DateTransformer("yyyy-MM-dd")) .use("gender", new GenderTransformer()) .use("maritalStatus", new MaritalStatusTransformer()) .use("status",new SPStatusTransformer()) .use("workPermission", new WorkPermissionTransformer()) .use("anamnesisForm.anamnesischecksvalues.values.anamnesischeck.title.type", new AnamnesisChecksTypeTransformet()) .use("anamnesisForm.scars.values.traitType", new TraitTypeTransformet()) .use("anamnesisForm.anamnesischecksvalues.values.anamnesischeck.type", new AnamnesisChecksTypeTransformet()); String unExpectedData=standardizedPatientId+"not found"; StandardizedPatient newPatient = null; if(!data.equals(unExpectedData)){ try{ newPatient = (StandardizedPatient) (deserializer .use(null, StandardizedPatient.class).deserialize(data)); }catch(flexjson.JSONException e){ Log.error("Error deserialize json data: "+e.getMessage()); throw new DMZSyncException(DMZSyncExceptionType.SYNC_PATIENT_EXCEPTION,"Error json data."); } }else{ throw new DMZSyncException(DMZSyncExceptionType.PATIENT_EXIST_EXCEPTION,""); } StandardizedPatient patient = StandardizedPatient.findStandardizedPatient(standardizedPatientId); if( patient != null){ if(newPatient!=null){ updatePatient(patient,newPatient); } }else{ } }  }
DMZSyncServiceImpl extends RemoteServiceServlet implements
		DMZSyncService { @Override public void pullFromDMZ(Long standardizedPatientId) throws DMZSyncException { String url = getHostAddress() + "/DataImportExport/exportSP?id=" + standardizedPatientId; String data = getDMZData(url); data =preProcessData(data); JSONDeserializer deserializer = new JSONDeserializer() .use("anamnesisForm.createDate", new DateTransformer("yyyy-MM-dd'T'HH:mm:ss'Z'")) .use("birthday", new DateTransformer("yyyy-MM-dd")) .use("gender", new GenderTransformer()) .use("maritalStatus", new MaritalStatusTransformer()) .use("status",new SPStatusTransformer()) .use("workPermission", new WorkPermissionTransformer()) .use("anamnesisForm.anamnesischecksvalues.values.anamnesischeck.title.type", new AnamnesisChecksTypeTransformet()) .use("anamnesisForm.scars.values.traitType", new TraitTypeTransformet()) .use("anamnesisForm.anamnesischecksvalues.values.anamnesischeck.type", new AnamnesisChecksTypeTransformet()); String unExpectedData=standardizedPatientId+"not found"; StandardizedPatient newPatient = null; if(!data.equals(unExpectedData)){ try{ newPatient = (StandardizedPatient) (deserializer .use(null, StandardizedPatient.class).deserialize(data)); }catch(flexjson.JSONException e){ Log.error("Error deserialize json data: "+e.getMessage()); throw new DMZSyncException(DMZSyncExceptionType.SYNC_PATIENT_EXCEPTION,"Error json data."); } }else{ throw new DMZSyncException(DMZSyncExceptionType.PATIENT_EXIST_EXCEPTION,""); } StandardizedPatient patient = StandardizedPatient.findStandardizedPatient(standardizedPatientId); if( patient != null){ if(newPatient!=null){ updatePatient(patient,newPatient); } }else{ } }  @Override List<String> pushToDMZ(Long standardizedPatientId,String locale); @Override void pullFromDMZ(Long standardizedPatientId); @Override String sendSync(String locale); @Override void getSync(String locale); String preProcessData(String data); }
DMZSyncServiceImpl extends RemoteServiceServlet implements
		DMZSyncService { @Override public void pullFromDMZ(Long standardizedPatientId) throws DMZSyncException { String url = getHostAddress() + "/DataImportExport/exportSP?id=" + standardizedPatientId; String data = getDMZData(url); data =preProcessData(data); JSONDeserializer deserializer = new JSONDeserializer() .use("anamnesisForm.createDate", new DateTransformer("yyyy-MM-dd'T'HH:mm:ss'Z'")) .use("birthday", new DateTransformer("yyyy-MM-dd")) .use("gender", new GenderTransformer()) .use("maritalStatus", new MaritalStatusTransformer()) .use("status",new SPStatusTransformer()) .use("workPermission", new WorkPermissionTransformer()) .use("anamnesisForm.anamnesischecksvalues.values.anamnesischeck.title.type", new AnamnesisChecksTypeTransformet()) .use("anamnesisForm.scars.values.traitType", new TraitTypeTransformet()) .use("anamnesisForm.anamnesischecksvalues.values.anamnesischeck.type", new AnamnesisChecksTypeTransformet()); String unExpectedData=standardizedPatientId+"not found"; StandardizedPatient newPatient = null; if(!data.equals(unExpectedData)){ try{ newPatient = (StandardizedPatient) (deserializer .use(null, StandardizedPatient.class).deserialize(data)); }catch(flexjson.JSONException e){ Log.error("Error deserialize json data: "+e.getMessage()); throw new DMZSyncException(DMZSyncExceptionType.SYNC_PATIENT_EXCEPTION,"Error json data."); } }else{ throw new DMZSyncException(DMZSyncExceptionType.PATIENT_EXIST_EXCEPTION,""); } StandardizedPatient patient = StandardizedPatient.findStandardizedPatient(standardizedPatientId); if( patient != null){ if(newPatient!=null){ updatePatient(patient,newPatient); } }else{ } }  @Override List<String> pushToDMZ(Long standardizedPatientId,String locale); @Override void pullFromDMZ(Long standardizedPatientId); @Override String sendSync(String locale); @Override void getSync(String locale); String preProcessData(String data);  }