diff --git a/src/main/java/org/opensearch/flowframework/FlowFrameworkPlugin.java b/src/main/java/org/opensearch/flowframework/FlowFrameworkPlugin.java index 67334c3fc..c52bd2fef 100644 --- a/src/main/java/org/opensearch/flowframework/FlowFrameworkPlugin.java +++ b/src/main/java/org/opensearch/flowframework/FlowFrameworkPlugin.java @@ -30,7 +30,12 @@ import org.opensearch.flowframework.rest.RestCreateWorkflowAction; import org.opensearch.flowframework.rest.RestProvisionWorkflowAction; import org.opensearch.flowframework.rest.RestSearchWorkflowAction; -import org.opensearch.flowframework.transport.*; +import org.opensearch.flowframework.transport.CreateWorkflowAction; +import org.opensearch.flowframework.transport.CreateWorkflowTransportAction; +import org.opensearch.flowframework.transport.ProvisionWorkflowAction; +import org.opensearch.flowframework.transport.ProvisionWorkflowTransportAction; +import org.opensearch.flowframework.transport.SearchWorkflowAction; +import org.opensearch.flowframework.transport.SearchWorkflowTransportAction; import org.opensearch.flowframework.workflow.WorkflowProcessSorter; import org.opensearch.flowframework.workflow.WorkflowStepFactory; import org.opensearch.ml.client.MachineLearningNodeClient; diff --git a/src/main/java/org/opensearch/flowframework/rest/AbstractSearchWorkflowAction.java b/src/main/java/org/opensearch/flowframework/rest/AbstractSearchWorkflowAction.java index 86f3c3096..47f5aa40a 100644 --- a/src/main/java/org/opensearch/flowframework/rest/AbstractSearchWorkflowAction.java +++ b/src/main/java/org/opensearch/flowframework/rest/AbstractSearchWorkflowAction.java @@ -32,6 +32,9 @@ import static org.opensearch.core.xcontent.ToXContent.EMPTY_PARAMS; import static org.opensearch.flowframework.util.RestHandlerUtils.getSourceContext; +/** + * Abstract class to handle search request. + */ public class AbstractSearchWorkflowAction extends BaseRestHandler { protected final List urlPaths; @@ -40,6 +43,13 @@ public class AbstractSearchWorkflowAction extends Ba protected final ActionType actionType; protected final FlowFrameworkFeatureEnabledSetting flowFrameworkFeatureEnabledSetting; + /** + * Instantiates a new AbstractSearchWorkflowAction + * @param urlPaths urlPaths to create routes + * @param index index the search should be done on + * @param clazz model class + * @param actionType from which action abstract class is called + */ public AbstractSearchWorkflowAction(List urlPaths, String index, Class clazz, ActionType actionType, FlowFrameworkFeatureEnabledSetting flowFrameworkFeatureEnabledSetting) { this.urlPaths = urlPaths; this.index = index; @@ -69,6 +79,12 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli return channel -> client.execute(actionType, searchRequest, search(channel)); } + /** + * Builds the action response for the Search Request + * + * @param channel the REST channel + * @return the action response + */ protected RestResponseListener search(RestChannel channel) { return new RestResponseListener(channel) { @Override diff --git a/src/main/java/org/opensearch/flowframework/rest/RestSearchWorkflowAction.java b/src/main/java/org/opensearch/flowframework/rest/RestSearchWorkflowAction.java index 2a095c6c6..a7334a61a 100644 --- a/src/main/java/org/opensearch/flowframework/rest/RestSearchWorkflowAction.java +++ b/src/main/java/org/opensearch/flowframework/rest/RestSearchWorkflowAction.java @@ -16,6 +16,9 @@ import static org.opensearch.flowframework.common.CommonValue.GLOBAL_CONTEXT_INDEX; import static org.opensearch.flowframework.common.CommonValue.WORKFLOW_URI; +/** + * Rest Action to facilitate requests to search workflows + */ public class RestSearchWorkflowAction extends AbstractSearchWorkflowAction