jack-moseley commented on a change in pull request #3042:
URL: https://github.com/apache/incubator-gobblin/pull/3042#discussion_r440511681
##########
File path:
gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-client/src/main/java/org/apache/gobblin/service/FlowConfigV2Client.java
##########
@@ -180,17 +184,48 @@ public void partialUpdateFlowConfig(FlowId flowId,
PatchRequest<FlowConfig> flow
*/
public FlowConfig getFlowConfig(FlowId flowId)
throws RemoteInvocationException {
- LOG.debug("getFlowConfig with groupName " + flowId.getFlowGroup() + "
flowName " +
- flowId.getFlowName());
+ LOG.debug("getFlowConfig with groupName " + flowId.getFlowGroup() + "
flowName " + flowId.getFlowName());
GetRequest<FlowConfig> getRequest = _flowconfigsV2RequestBuilders.get()
.id(new ComplexResourceKey<>(flowId, new FlowStatusId())).build();
- Response<FlowConfig> response =
- _restClient.get().sendRequest(getRequest).getResponse();
+ Response<FlowConfig> response =
_restClient.get().sendRequest(getRequest).getResponse();
return response.getEntity();
}
+ /**
+ * Get all {@link FlowConfig}s
+ * @return all {@link FlowConfig}s
+ * @throws RemoteInvocationException
+ */
+ public Collection<FlowConfig> getAllFlowConfigs() throws
RemoteInvocationException {
+ LOG.debug("getAllFlowConfigs called");
+
+ GetAllRequest<FlowConfig> getRequest =
_flowconfigsV2RequestBuilders.getAll().build();
+ Response<CollectionResponse<FlowConfig>> response =
_restClient.get().sendRequest(getRequest).getResponse();
+ return response.getEntity().getElements();
+ }
+
+ /**
+ * Get all {@link FlowConfig}s
Review comment:
Can you make this comment more descriptive, it's get all flow configs
but with a filter right?
##########
File path:
gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-client/src/main/java/org/apache/gobblin/service/FlowConfigV2Client.java
##########
@@ -180,17 +184,48 @@ public void partialUpdateFlowConfig(FlowId flowId,
PatchRequest<FlowConfig> flow
*/
public FlowConfig getFlowConfig(FlowId flowId)
throws RemoteInvocationException {
- LOG.debug("getFlowConfig with groupName " + flowId.getFlowGroup() + "
flowName " +
- flowId.getFlowName());
+ LOG.debug("getFlowConfig with groupName " + flowId.getFlowGroup() + "
flowName " + flowId.getFlowName());
GetRequest<FlowConfig> getRequest = _flowconfigsV2RequestBuilders.get()
.id(new ComplexResourceKey<>(flowId, new FlowStatusId())).build();
- Response<FlowConfig> response =
- _restClient.get().sendRequest(getRequest).getResponse();
+ Response<FlowConfig> response =
_restClient.get().sendRequest(getRequest).getResponse();
return response.getEntity();
}
+ /**
+ * Get all {@link FlowConfig}s
+ * @return all {@link FlowConfig}s
+ * @throws RemoteInvocationException
+ */
+ public Collection<FlowConfig> getAllFlowConfigs() throws
RemoteInvocationException {
+ LOG.debug("getAllFlowConfigs called");
+
+ GetAllRequest<FlowConfig> getRequest =
_flowconfigsV2RequestBuilders.getAll().build();
+ Response<CollectionResponse<FlowConfig>> response =
_restClient.get().sendRequest(getRequest).getResponse();
+ return response.getEntity().getElements();
+ }
+
+ /**
+ * Get all {@link FlowConfig}s
+ * @return all {@link FlowConfig}s
+ * @throws RemoteInvocationException
+ */
+ public Collection<FlowConfig> getFlowConfigs(String flowGroup, String
flowName, String templateUri, String userToProxy,
+ String sourceIdentifier, String destinationIdentifier, String schedule,
Boolean isRunImmediately, String owningGroup,
+ String propertyFilter) throws RemoteInvocationException {
+ LOG.debug("getAllFlowConfigs called");
+
+ FindRequest<FlowConfig> getRequest =
_flowconfigsV2RequestBuilders.findByFilterFlows()
Review comment:
Is `propertyFilter` meant to be passed here as well?
##########
File path:
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/spec_store/MysqlSpecStore.java
##########
@@ -267,7 +276,128 @@ public Spec getSpec(URI specUri, String version) throws
IOException, SpecNotFoun
return Optional.of(this.specStoreURI);
}
- protected void setPreparedStatement(PreparedStatement statement, Spec spec,
String tagValue) throws SQLException {
+ static String createGetPreparedStatement(FlowSpecSearchObject
flowSpecSearchObject, String tableName)
+ throws IOException {
+ String baseStatement = String.format(GET_STATEMENT, tableName);
+ List<String> conditions = new ArrayList<>();
+
+ if (flowSpecSearchObject.getFlowSpecUri() != null) {
+ conditions.add("spec_uri = ?");
+ }
+
+ if (flowSpecSearchObject.getFlowGroup() != null) {
+ conditions.add("flow_group = ?");
+ }
+
+ if (flowSpecSearchObject.getFlowName() != null) {
+ conditions.add("flow_name = ?");
+ }
+
+ if (flowSpecSearchObject.getTemplateURI() != null) {
+ conditions.add("template_uri = ?");
+ }
+
+ if (flowSpecSearchObject.getUserToProxy() != null) {
+ conditions.add("user_to_proxy = ?");
+ }
+
+ if (flowSpecSearchObject.getSourceIdentifier() != null) {
+ conditions.add("source_identifier = ?");
+ }
+
+ if (flowSpecSearchObject.getDestinationIdentifier() != null) {
+ conditions.add("destination_identifier = ?");
+ }
+
+ if (flowSpecSearchObject.getSchedule() != null) {
+ conditions.add("schedule = ?");
+ }
+
+ if (flowSpecSearchObject.getSchedule() != null) {
+ conditions.add("modified_time = ?");
+ }
Review comment:
There's two conditions added here for schedule and only one gets set in
`setGetPreparedStatement`, is this a mistake?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]