@Test public void generateProperGraphQLQueryForTrajectory() throws Exception { String queryXML = TestUtilities.getResourceAsString("trajectoryGraphql/trajectoryGraphqlQuery1411.xml"); ObjTrajectory obj = ((ObjTrajectorys) WitsmlMarshal.deserialize(queryXML, ObjTrajectorys.class)).getTrajectory().get(0); GraphQLQueryConverter converter = new GraphQLQueryConverter(); String graphQLQuery = converter.getQuery(obj, "test"); assertNotNull(graphQLQuery); assertTrue(graphQLQuery.contains("title")); }
public static String getQuery(AbstractWitsmlObject wmlObject) throws IOException { switch (wmlObject.getObjectType()){ case "well": return getWellQuery(wmlObject); case "wellbore": return createWellboreQuery(wmlObject.getJSONString("1.4.1.1")); default: return null; } }
GraphQLQueryConverter { public static String getQuery(AbstractWitsmlObject wmlObject) throws IOException { switch (wmlObject.getObjectType()){ case "well": return getWellQuery(wmlObject); case "wellbore": return createWellboreQuery(wmlObject.getJSONString("1.4.1.1")); default: return null; } } }
GraphQLQueryConverter { public static String getQuery(AbstractWitsmlObject wmlObject) throws IOException { switch (wmlObject.getObjectType()){ case "well": return getWellQuery(wmlObject); case "wellbore": return createWellboreQuery(wmlObject.getJSONString("1.4.1.1")); default: return null; } }  }
GraphQLQueryConverter { public static String getQuery(AbstractWitsmlObject wmlObject) throws IOException { switch (wmlObject.getObjectType()){ case "well": return getWellQuery(wmlObject); case "wellbore": return createWellboreQuery(wmlObject.getJSONString("1.4.1.1")); default: return null; } }  static String getQuery(AbstractWitsmlObject wmlObject); static String getQuery(AbstractWitsmlObject wmlObject, String wellboreUuid); static String getWellboreAndWellUuidQuery(AbstractWitsmlObject wmlObject); static String getWellboreNameQuery(AbstractWitsmlObject wmlObject); static String getWellNameQuery(AbstractWitsmlObject wmlObject); }
GraphQLQueryConverter { public static String getQuery(AbstractWitsmlObject wmlObject) throws IOException { switch (wmlObject.getObjectType()){ case "well": return getWellQuery(wmlObject); case "wellbore": return createWellboreQuery(wmlObject.getJSONString("1.4.1.1")); default: return null; } }  static String getQuery(AbstractWitsmlObject wmlObject); static String getQuery(AbstractWitsmlObject wmlObject, String wellboreUuid); static String getWellboreAndWellUuidQuery(AbstractWitsmlObject wmlObject); static String getWellboreNameQuery(AbstractWitsmlObject wmlObject); static String getWellNameQuery(AbstractWitsmlObject wmlObject);  }