Package org.dmlite.model.config

Examples of org.dmlite.model.config.IdConfig


   *            entity
   */
  public void addUniqueEntityError(IEntities entities, IEntity entity) {
    String errorKey = entity.getConceptConfig().getCode() + "."
        + "id.unique";
    IdConfig idConfig = entity.getConceptConfig().getIdConfig();
    String error = entity.getConceptConfig().getCode() + ".id "
        + idConfig.getCodes() + " must be unique.";
    entities.getErrors().add(errorKey, error);
  }
View Full Code Here


   * @return <code>true</code> if the entity identifier is unique
   */
  public boolean uniqueId(IEntities<?> entities, IEntity entity) {
    boolean uniqueId = true;
    try {
      IdConfig idConfig = entity.getConceptConfig().getIdConfig();
      if (!idConfig.isEmpty()) {
        for (IEntity currentEntity : entities) {
          if (!currentEntity.equals(entity)) {
            if (currentEntity.equalIds(entity)) {
              uniqueId = false;
              addUniqueEntityError(entities, entity);
View Full Code Here

   */
  public boolean uniqueId(IEntities<?> entities, IEntity entity,
      IEntity updateEntity) {
    boolean uniqueId = true;
    try {
      IdConfig idConfig = entity.getConceptConfig().getIdConfig();
      if (!idConfig.isEmpty()) {
        for (IEntity currentEntity : entities) {
          if (!currentEntity.equals(updateEntity)) {
            if (currentEntity.equalIds(updateEntity)) {
              uniqueId = false;
              addUniqueEntityError(entities, updateEntity);
View Full Code Here

   * Derives the entity id using the concept id configuration.
   *
   * @return entity id
   */
  public Id getId() {
    IdConfig idConfig = getConceptConfig().getIdConfig();
    id = new Id(this);

    if (!idConfig.isPropertyEmpty()) {
      for (String propertyCode : idConfig.getPropertyCodeList()) {
        Object property = getProperty(propertyCode);
        id.add(propertyCode, property);
      }
    }

    if (!idConfig.isNeighborEmpty()) {
      for (String neighborCode : idConfig.getNeighborCodeList()) {
        IEntity neighbor = (IEntity) getNeighborEntity(neighborCode);
        id.add(neighborCode, neighbor);
      }
    }
    return id;
View Full Code Here

TOP

Related Classes of org.dmlite.model.config.IdConfig

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.