Examples of ApitraryOrmException


Examples of com.apitrary.orm.core.exception.ApitraryOrmException

   * @return a T object.
   */
  @SuppressWarnings("unchecked")
  public <T> T save(T entity) {
    if (entity == null) {
      throw new ApitraryOrmException("Cannot persist null entity");
    }
    log.debug("Saving " + entity.getClass());

    PostRequest request = new PostRequest();
    request.setEntity(resolveApitraryEntity(entity));

    String payload = marshall(entity);

    request.setRequestPayload(payload);

    PostResponse response = resolveApitraryClient().send(request);

    if (HttpStatus.Created.ordinal() == response.getStatusCode()) {
      return (T) new PostResponseUnmarshaller().unMarshall(response, entity);
    } else {
      throw new ApitraryOrmException(response.getResult());
    }
  }
View Full Code Here

Examples of com.apitrary.orm.core.exception.ApitraryOrmException

   *            a T object.
   * @return a T object.
   */
  public <T> T update(T entity) {
    if (entity == null) {
      throw new ApitraryOrmException("Cannot update null entity");
    }

    log.debug("Updating " + entity.getClass());

    PutRequest request = new PutRequest();
View Full Code Here

Examples of com.apitrary.orm.core.exception.ApitraryOrmException

   * @param <T>
   *            a T object.
   */
  public <T> void delete(T entity) {
    if (entity == null) {
      throw new ApitraryOrmException("Cannot delete null entity");
    }

    log.debug("Deleting " + entity.getClass());

    DeleteRequest request = new DeleteRequest();
View Full Code Here

Examples of com.apitrary.orm.core.exception.ApitraryOrmException

   * @return a T object.
   */
  @SuppressWarnings("unchecked")
  public <T> T findById(String id, Class<T> entity) {
    if (entity == null) {
      throw new ApitraryOrmException("Cannot access null entity");
    }
    if (id == null || id.isEmpty()) {
      return null;
    }

View Full Code Here

Examples of com.apitrary.orm.core.exception.ApitraryOrmException

   * @return a {@link java.util.List} object.
   */
  @SuppressWarnings("unchecked")
  public <T> List<T> find(String riakQuery, Class<T> entity) {
    if (entity == null) {
      throw new ApitraryOrmException("Cannot access null entity");
    }
    log.debug("Searching " + entity + " " + riakQuery);

    QueriedGetRequest request = new QueriedGetRequest();
    request.setEntity(resolveApitraryEntity(entity));
View Full Code Here

Examples of com.apitrary.orm.core.exception.ApitraryOrmException

   * @return a {@link java.util.List} object.
   */
  @SuppressWarnings("unchecked")
  public <T> List<T> findAll(Class<T> entity) {
    if (entity == null) {
      throw new ApitraryOrmException("Cannot access null entity");
    }

    log.debug("Loading all " + entity);

    QueriedGetRequest request = new QueriedGetRequest();
View Full Code Here

Examples of com.apitrary.orm.core.exception.ApitraryOrmException

   * @return a T object.
   */
  @SuppressWarnings("unchecked")
  public <T> T save(T entity) {
    if (entity == null) {
      throw new ApitraryOrmException("Cannot persist null entity");
    }
    log.debug("Saving " + entity.getClass());

    PostRequest request = new PostRequest();
    request.setEntity(resolveApitraryEntity(entity));

    String payload = marshall(entity);

    request.setRequestPayload(payload);

    PostResponse response = resolveApitraryClient().send(request);

    if (HttpStatus.Created.ordinal() == response.getStatusCode()) {
      return (T) new PostResponseUnmarshaller().unMarshall(response, entity);
    } else {
      throw new ApitraryOrmException(response.getResult());
    }
  }
View Full Code Here

Examples of com.apitrary.orm.core.exception.ApitraryOrmException

   *            a T object.
   * @return a T object.
   */
  public <T> T update(T entity) {
    if (entity == null) {
      throw new ApitraryOrmException("Cannot update null entity");
    }

    log.debug("Updating " + entity.getClass());

    PutRequest request = new PutRequest();
View Full Code Here

Examples of com.apitrary.orm.core.exception.ApitraryOrmException

   * @param <T>
   *            a T object.
   */
  public <T> void delete(T entity) {
    if (entity == null) {
      throw new ApitraryOrmException("Cannot delete null entity");
    }

    log.debug("Deleting " + entity.getClass());

    DeleteRequest request = new DeleteRequest();
View Full Code Here

Examples of com.apitrary.orm.core.exception.ApitraryOrmException

   * @return a T object.
   */
  @SuppressWarnings("unchecked")
  public <T> T findById(String id, Class<T> entity) {
    if (entity == null) {
      throw new ApitraryOrmException("Cannot access null entity");
    }
    if (id == null || id.isEmpty()) {
      return null;
    }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.