/**
   * get all OpenSearch configuration
   *
   * @param variant client preferred media type
   * @return Representation
   */
  @Get
  public Representation retrieve(Variant variant) {
    try {

      if (getDatasetId() != null) {
        Response response = null;
        Opensearch osearch = getStore().retrieve(getDatasetId());
        if ((getDatasetId() != null) && (!getDatasetId().equals(osearch.getParent()))) {
          response = new Response(false, "OPENSEARCH_NOT_BELONGS_TO_DATASET");
        } else {
          response = new Response(true, osearch, Opensearch.class, "opensearch");
        }

        return getRepresentation(response, variant);

      } else {
        ResourceCollectionFilter filter = new ResourceCollectionFilter(this.getRequest());
        if (getDatasetId() != null) {
          filter.setParent(getDatasetId());
        }
        Opensearch[] osearchs = getStore().getArray(filter);
        Response response = new Response(true, osearchs);
        return getRepresentation(response, variant);
      }
    } catch (ResourceException e) {
      getLogger().log(Level.INFO, null, e);
      throw e;
    } catch (Exception e) {
      getLogger().log(Level.SEVERE, null, e);
      throw new ResourceException(Status.SERVER_ERROR_INTERNAL, e);
    }
  }
  /**
   * Update / Validate existing OpenSearch
   *
   * @param representation OpenSearch configuration
   * @param variant client preferred media type
   * @return Representation
   */
  @Post
  public Representation newOpensearch(Representation representation, Variant variant) {
    if (representation == null) {
      throw new ResourceException(
          Status.CLIENT_ERROR_BAD_REQUEST, "OPENSEARCH_REPRESENTATION_REQUIRED");
    }
    try {
      Opensearch osearchInput = null;
      if (MediaType.APPLICATION_XML.isCompatible(representation.getMediaType())) {
        // Parse the XML representation to get the bean
        osearchInput = new XstreamRepresentation<Opensearch>(representation).getObject();

      } else if (MediaType.APPLICATION_JSON.isCompatible(representation.getMediaType())) {
        // Parse the JSON representation to get the bean
        osearchInput =
            new JacksonRepresentation<Opensearch>(representation, Opensearch.class).getObject();
      }

      // Business service
      osearchInput.setStatus("INACTIVE");
      Opensearch osearchOutput = getStore().create(osearchInput);

      // Response
      Response response = new Response(true, osearchOutput, Opensearch.class, "opensearch");
      return getRepresentation(response, variant);

    } catch (ResourceException e) {
      getLogger().log(Level.INFO, null, e);
      throw e;
    } catch (Exception e) {
      getLogger().log(Level.SEVERE, null, e);
      throw new ResourceException(Status.SERVER_ERROR_INTERNAL, e);
    }
  }