Package org.dmlite.exception

Examples of org.dmlite.exception.SelectionException


   */
  protected Collection<T> getCollection(
      SelectionCriteria selectionCriteria) throws SelectionException {
    if (selectionCriteria == null) {
      String error = "Selection criteria cannot be null.";
      throw new SelectionException(error);
    }

    String type = selectionCriteria.getCriteriaType();
    if (type == null) {
      String error = "Selection criteria type cannot be null.";
      throw new SelectionException(error);
    }

    Collection<T> result = new ArrayList<T>();
    if (type.equals(SelectionCriteria.NONE)) {
      return result;
    }

    String propertyCode = selectionCriteria.getPropertyCode();
    if (propertyCode == null) {
      if (!type.equals(SelectionCriteria.ALL)) {
        String error = "For a selection criteria different from NONE and ALL, the criteria property code cannot be null.";
        throw new SelectionException(error);
      }
    }
    Object value = selectionCriteria.getCriteriaValue();

    synchronized (collectionOfEntities) {
View Full Code Here


        destinationEntities.add(collection);
        modelMeta.setParents(destinationEntities, this);
        destinationEntities.setSourceEntities(this);
      } else {
        String error = "There is no domain model.";
        throw new SelectionException(error);
      }
    } catch (Exception e) {
      log.error("Error in Entities.getEntities: " + e.getMessage());
      throw new SelectionException(e.getMessage());
    }
    return (IEntities<T>) destinationEntities;
  }
View Full Code Here

            .getEntitiesClass();
        String thisEntitiesClass = getConceptConfig()
            .getEntitiesClass();
        if (!entitiesArgumentClass.equals(thisEntitiesClass)) {
          String error = "Union input entities must be of the same type.";
          throw new SelectionException(error);
        }

        Collection<T> collection = getCollection();
        ModelMeta modelMeta = domainModel.getModelMeta();
        union = (Entities<T>) modelMeta.createEntities(getConceptConfig()
            .getEntitiesClass());
        union.setPropagateToSource(false);
        union.add(collection);

        for (T entity : entities) {
          if (!union.contain(entity)) {
            union.add(entity);
          }
        }

        modelMeta.setParents(union, this);
        if (getSourceEntities() != null
            && entities.getSourceEntities() != null
            && getSourceEntities() == entities.getSourceEntities()) {
          union.setSourceEntities(getSourceEntities());
          union.setPropagateToSource(true);
        }
      } else {
        String error = "There is no domain model.";
        throw new SelectionException(error);
      }
    } catch (Exception e) {
      log.error("Error in Entities.union: " + e.getMessage());
      throw new SelectionException(e.getMessage());
    }
    return (IEntities<T>) union;
  }
View Full Code Here

            .getEntitiesClass();
        String thisEntitiesClass = getConceptConfig()
            .getEntitiesClass();
        if (!entitiesArgumentClass.equals(thisEntitiesClass)) {
          String error = "Intersection input entities must be of the same type.";
          throw new SelectionException(error);
        }

        ModelMeta modelMeta = domainModel.getModelMeta();
        intersection = (Entities<T>) modelMeta
            .createEntities(getConceptConfig().getEntitiesClass());
        intersection.setPropagateToSource(false);

        for (T entity : this) {
          if (entities.contain(entity)) {
            intersection.add(entity);
          }
        }
        for (T entity : entities) {
          if (!intersection.contain(entity) && this.contain(entity)) {
            intersection.add(entity);
          }
        }

        modelMeta.setParents(intersection, this);
        if (getSourceEntities() != null
            && entities.getSourceEntities() != null
            && getSourceEntities() == entities.getSourceEntities()) {
          intersection.setSourceEntities(getSourceEntities());
          intersection.setPropagateToSource(true);
        }
      } else {
        String error = "There is no domain model.";
        throw new SelectionException(error);
      }
    } catch (Exception e) {
      log.error("Error in Entities.intersection: " + e.getMessage());
      throw new SelectionException(e.getMessage());
    }
    return (IEntities<T>) intersection;
  }
View Full Code Here

            .getEntitiesClass();
        String thisEntitiesClass = getConceptConfig()
            .getEntitiesClass();
        if (!entitiesArgumentClass.equals(thisEntitiesClass)) {
          String error = "Subset and superset entities must be of the same type.";
          throw new SelectionException(error);
        }

        for (T entity : this) {
          if (!entities.contain(entity)) {
            subsetOf = false;
            break;
          }
        }
      } else {
        String error = "There is no domain model.";
        throw new SelectionException(error);
      }
    } catch (Exception e) {
      log.error("Error in Entities.isSubsetOf: " + e.getMessage());
      throw new SelectionException(e.getMessage());
    }
    return subsetOf;
  }
View Full Code Here

TOP

Related Classes of org.dmlite.exception.SelectionException

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.