コード例 #1
0
  @Override
  public PagedConnObjectTOResult listConnObjects(
      final String key, final String anyTypeKey, final ConnObjectTOListQuery listQuery) {

    Pair<SearchResult, List<ConnObjectTO>> list =
        logic.listConnObjects(
            key,
            anyTypeKey,
            listQuery.getSize(),
            listQuery.getPagedResultsCookie(),
            getOrderByClauses(listQuery.getOrderBy()));

    PagedConnObjectTOResult result = new PagedConnObjectTOResult();
    if (list.getLeft() != null) {
      result.setAllResultsReturned(list.getLeft().isAllResultsReturned());
      result.setPagedResultsCookie(list.getLeft().getPagedResultsCookie());
      result.setRemainingPagedResults(list.getLeft().getRemainingPagedResults());
    }
    result.getResult().addAll(list.getRight());

    UriBuilder builder = uriInfo.getAbsolutePathBuilder();
    MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
    for (Map.Entry<String, List<String>> queryParam : queryParams.entrySet()) {
      builder = builder.queryParam(queryParam.getKey(), queryParam.getValue().toArray());
    }

    if (StringUtils.isNotBlank(result.getPagedResultsCookie())) {
      result.setNext(
          builder
              .replaceQueryParam(PARAM_CONNID_PAGED_RESULTS_COOKIE, result.getPagedResultsCookie())
              .build());
    }

    return result;
  }
コード例 #2
0
  @Override
  public BulkActionResult bulk(final BulkAction bulkAction) {
    BulkActionResult result = new BulkActionResult();

    if (bulkAction.getType() == BulkAction.Type.DELETE) {
      for (String name : bulkAction.getTargets()) {
        try {
          result.getResults().put(logic.delete(name).getKey(), BulkActionResult.Status.SUCCESS);
        } catch (Exception e) {
          LOG.error("Error performing delete for resource {}", name, e);
          result.getResults().put(name, BulkActionResult.Status.FAILURE);
        }
      }
    }

    return result;
  }
コード例 #3
0
 @Override
 public ConnObjectTO readConnObject(final String key, final String anyTypeKey, final Long anyKey) {
   return logic.readConnObject(key, anyTypeKey, anyKey);
 }
コード例 #4
0
 @Override
 public List<ResourceTO> list() {
   return logic.list();
 }
コード例 #5
0
 @Override
 public ResourceTO read(final String key) {
   return logic.read(key);
 }
コード例 #6
0
 @Override
 public void delete(final String key) {
   logic.delete(key);
 }
コード例 #7
0
 @Override
 public void update(final ResourceTO resourceTO) {
   logic.update(resourceTO);
 }
コード例 #8
0
 @Override
 public Response create(final ResourceTO resourceTO) {
   ResourceTO created = logic.create(resourceTO);
   URI location = uriInfo.getAbsolutePathBuilder().path(created.getKey()).build();
   return Response.created(location).header(RESTHeaders.RESOURCE_KEY, created.getKey()).build();
 }
コード例 #9
0
 @Override
 public void check(final ResourceTO resourceTO) {
   logic.check(resourceTO);
 }