Package org.openmhealth.reference.exception

Examples of org.openmhealth.reference.exception.OmhException


    final JsonNode data)
    throws OmhException {

    // Ensure the data is not null.
    if(data == null) {
      throw new OmhException("The data field is null.");
    }
   
    // Validate the data.
    try {
      schema.validateData(data);
    }
    catch(ConcordiaException e) {
      throw new OmhException("The data is invalid.", e);
    }
   
    // Return the result.
    return new Data(owner, this, metaData, data);
  }
View Full Code Here


   *         The ID is invalid.
   */
  public static String validateId(final String id) throws OmhException {
    // Validate that the ID is not null.
    if(id == null) {
      throw new OmhException("The ID is null.");
    }
   
    // Remove surrounding whitespace.
    String idTrimmed = id.trim();
   
    // Validate that the ID is not empty or only whitespace.
    if(idTrimmed.length() == 0) {
      throw new OmhException("The ID is empty or only whitespace.");
    }
   
    // Validate that the trimmed ID matches the pattern.
    if(! PATTERN_ID.matcher(idTrimmed).matches()) {
      throw
        new OmhException(
          "The schema ID is invalid. It must be colon " +
            "deliminated, alphanumeric sections, with or " +
            "without underscores, where the first section is " +
            "\"omh\": " +
            idTrimmed);
View Full Code Here

    final long version)
    throws OmhException {

    // The version must be positive.
    if(version <= 0) {
      throw new OmhException("The version must be positive.");
    }

    return version;
  }
View Full Code Here

    final long chunkSize)
    throws OmhException {

    // The chunk size must be positive.
    if(chunkSize <= 0) {
      throw new OmhException("The chunk size must be positive.");
    }

    return chunkSize;
  }
View Full Code Here

          .getAttribute(
            AuthFilter
              .ATTRIBUTE_AUTHENTICATION_TOKEN_IS_PARAM)) {
     
      throw
        new OmhException(
          "To register a third-party, the authentication token is " +
            "required as a parameter.");
    }
   
    return
View Full Code Here

    AuthorizationCode authCode =
      AuthorizationCodeBin.getInstance().getCode(code);
    // If the code is unknown, we cannot redirect back to the third-party
    // because we don't know who they are.
    if(authCode == null) {
      throw new OmhException("The authorization code is unknown.");
    }
   
    // Verify that the code has not yet expired.
    if(System.currentTimeMillis() > authCode.getExpirationTime()) {
      response
View Full Code Here

    if(
      (authenticationTokenIsParam == null) ||
      (! ((Boolean) authenticationTokenIsParam))) {
     
      throw
        new OmhException(
          "To upload data, the authentication token is required " +
            "as a parameter.");
    }
   
    // Get the authentication token.
View Full Code Here

  public UserActivationRequest(
    final String registrationId)
    throws OmhException {
   
    if(registrationId == null) {
      throw new OmhException("The registration ID is null.");
    }
    if(registrationId.trim().length() == 0) {
      throw new OmhException("The registration ID is empty.");
    }
   
    this.registrationId = registrationId;
  }
View Full Code Here

    User user =
      UserBin.getInstance().getUserFromRegistrationId(registrationId);
   
    // Verify that the registration ID returned an actual user.
    if(user == null) {
      throw new OmhException("The registration ID is unknown.");
    }
   
    // Activate the account.
    user.activate();
   
View Full Code Here

   * @throws OmhException
   *         There was an error executing the request.
   */
  protected void setData(final T data) throws OmhException {
    if(data == null) {
      throw new OmhException("The data is null.");
    }

    this.data = data;
  }
View Full Code Here

TOP

Related Classes of org.openmhealth.reference.exception.OmhException

Copyright © 2018 www.massapicom. 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.