public ForeignKeyManager(Class<? extends ContentItem> child) {
   mChild = child;
   final UriPath path = mChild.getAnnotation(UriPath.class);
   mPath = path != null ? path.value() : null;
   if (mPath == null) {
     throw new SQLGenerationException("ForeignKeyManager: missing @UriPath on " + child);
   }
   final DBSortOrder sortOrder = mChild.getAnnotation(DBSortOrder.class);
   mSortOrder = sortOrder != null ? sortOrder.value() : null;
 }
  protected List<BaseSpaceEntity> getList(
      BaseSpaceEntity containingObject,
      Class<? extends BaseSpaceEntity> clazz,
      String targetPath,
      FetchParams params) {
    try {
      // /v1pre1/users/{Id}/projects
      List<BaseSpaceEntity> rtn = new ArrayList<BaseSpaceEntity>();
      UriPath containerUri =
          BaseSpaceUtilities.getAnnotation(UriPath.class, containingObject.getClass());
      UriPath targetUri = BaseSpaceUtilities.getAnnotation(UriPath.class, clazz);

      MultivaluedMap<String, String> queryParams =
          params == null ? new MultivaluedMapImpl() : params.toMap();
      String response =
          getRootApiWebResource()
              .path(containerUri.value())
              .path(String.valueOf(containingObject.getId()))
              .path(targetPath != null ? targetPath : targetUri.value())
              .queryParams(queryParams)
              .accept(MediaType.APPLICATION_XHTML_XML, MediaType.APPLICATION_JSON)
              .get(String.class);
      logger.info(response);

      ItemListMetaData itemMetaData =
          (ItemListMetaData)
              mapper.readValue(
                  mapper.readValue(response, JsonNode.class).findPath(RESPONSE).toString(),
                  ItemListMetaData.class);
      JsonNode responseNode = mapper.readValue(response, JsonNode.class).findPath(ITEMS);
      for (int i = 0; i < responseNode.size(); i++) {
        BaseSpaceEntity obj = mapper.readValue(responseNode.get(i).toString(), clazz);
        obj.setListMetaData(itemMetaData);
        rtn.add(obj);
      }
      return rtn;
    } catch (BaseSpaceException bs) {
      throw bs;
    } catch (Throwable t) {
      t.printStackTrace();
      throw new RuntimeException(t.getMessage());
    }
  }
 protected <T extends BaseSpaceEntity> T getSingle(
     Class<? extends BaseSpaceEntity> clazz, String id) {
   try {
     UriPath path = BaseSpaceUtilities.getAnnotation(UriPath.class, clazz);
     ClientResponse response =
         getClient()
             .resource(configuration.getApiRootUri())
             .path(configuration.getVersion())
             .path(path.value())
             .path(id)
             .accept(MediaType.APPLICATION_XHTML_XML, MediaType.APPLICATION_JSON)
             .get(ClientResponse.class);
     String rtn = response.getEntity(String.class);
     logger.info(rtn);
     checkUnauthorized(rtn);
     return (T)
         mapper.readValue(
             mapper.readValue(rtn, JsonNode.class).findPath(RESPONSE).toString(), clazz);
   } catch (BaseSpaceException bs) {
     throw bs;
   } catch (Throwable t) {
     throw new RuntimeException(t);
   }
 }