Package org.openmhealth.reference.exception

Examples of org.openmhealth.reference.exception.OmhException


      dateRegistered,
      dateActivated);
   
    // Store the MongoDB ID.
    if(dbId == null) {
      throw new OmhException("The MongoDB ID is missing.");
    }
    else {
      this.dbId = dbId;
    }
  }
View Full Code Here


   *
   * @throws OmhException The column is null or an empty string.
   */
  private void addChild(final String column) throws OmhException {
    if(column == null) {
      throw new OmhException("The column is null.");
    }
    if(column.trim().length() == 0) {
      throw new OmhException("The column is empty.");
    }
   
    String[] parts = column.split("\\" + COLUMN_SEPARATOR, 2);
    String childName = parts[0];
   
View Full Code Here

   * @throws OmhException
   *         The user is null.
   */
  public AuthenticationToken(final User user) throws OmhException {
    if(user == null) {
      throw new OmhException("The user is null.");
    }
   
    token = UUID.randomUUID().toString();
    username = user.getUsername();
    granted = System.currentTimeMillis();
View Full Code Here

    @JsonProperty(JSON_KEY_GRANTED) final long granted,
    @JsonProperty(JSON_KEY_EXPIRES) final long expires)
    throws OmhException {
   
    if(token == null) {
      throw new OmhException("The authentication token is null.");
    }
    if(username == null) {
      throw new OmhException("The user-name is null.");
    }
    if(granted > System.currentTimeMillis()) {
      throw
        new OmhException(
          "An authentication token cannot be granted in the " +
            "future.");
    }
    if(granted > expires) {
      throw
        new OmhException(
          "A token cannot expire before it was granted.");
    }
   
    this.token = token;
    this.username = username;
View Full Code Here

    User user = UserBin.getInstance().getUser(username);
   
    // If the user no longer exists, throw an exception.
    if(user == null) {
      throw
        new OmhException(
          "The user that is associated with this token no longer " +
            "exists.");
    }
   
    // Return the user.
View Full Code Here

      throw
        new InvalidAuthenticationException(
          "No authentication token was provided.");
    }
    if(schemaId == null) {
      throw new OmhException("The schema ID is missing.");
    }

    this.authenticationToken = authenticationToken;
    this.authorizationToken = authorizationToken;
    this.schemaId = schemaId;
View Full Code Here

   
    super(token, username, granted, expires);
   
    // Store the MongoDB ID.
    if(dbId == null) {
      throw new OmhException("The MongoDB ID is missing.");
    }
    else {
      this.dbId = dbId;
    }
  }
View Full Code Here

    final MetaData metaData,
    final JsonNode data)
    throws OmhException {

    if(owner == null) {
      throw new OmhException("The owner is null.");
    }
    if(schema == null) {
      throw new OmhException("The schema is null.");
    }
    if(data == null) {
      throw new OmhException("The data is null.");
    }

    this.owner = owner;
   
    this.schema = schema;
View Full Code Here

    @JsonProperty(JSON_KEY_METADATA) final MetaData metaData,
    @JsonProperty(JSON_KEY_DATA) final JsonNode data)
    throws OmhException {
   
    if(owner == null) {
      throw new OmhException("The owner is null.");
    }
    if(schemaId == null) {
      throw new OmhException("The schema ID is null.");
    }
    if(data == null) {
      throw new OmhException("The data is null.");
    }
   
    this.owner = owner;
    this.schema = null;
    this.schemaId = schemaId;
View Full Code Here

   */
  @Override
  public void storeCode(final AuthorizationCode code) throws OmhException {
    // Validate the parameter.
    if(code == null) {
      throw new OmhException("The code is null.");
    }
   
    // Get the authorization code collection.
    JacksonDBCollection<AuthorizationCode, Object> collection =
      JacksonDBCollection
        .wrap(
          MongoDao
            .getInstance()
            .getDb()
            .getCollection(DB_NAME),
          AuthorizationCode.class);
   
    // Make sure the token doesn't already exist.
    if(collection
      .count(
        new BasicDBObject(
          AuthorizationCode.JSON_KEY_CODE,
          code.getCode())) > 0) {
     
      throw new OmhException("The token already exists.");
    }
   
    // Save it.
    collection.insert(code);
  }
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.