Package org.openbp.core.model

Examples of org.openbp.core.model.ModelException


      return item;
    }
    catch (PersistenceException e)
    {
      tg.doCatch();
      throw new ModelException("DatabaseOperation", "Error loading models from the database: " + e.getMessage(), e);
    }
    finally
    {
      tg.doFinally();
    }
View Full Code Here


  {
    PersistenceQuery query = pc.createQuery(DbModel.class);
    query.eq("name", name);
    Iterator it = pc.runQuery(query);
    if (! it.hasNext())
      throw new ModelException("DatabaseOperation", "Model '" + name + "' not found. Maybe the model has been deleted from the database.");
    DbModel dbModel = (DbModel) it.next();
    return dbModel;
  }
View Full Code Here

    query.eq("modelName", modelName);
    query.eq("itemName", itemName);
    query.eq("itemType", itemType);
    Iterator it = pc.runQuery(query);
    if (! it.hasNext())
      throw new ModelException("DatabaseOperation", "Component '" + new ModelQualifier(modelName, itemName, itemType).toUntypedString()
        + "' not found. Maybe the component has been deleted from the database.");
    DbModelItem dbModelItem = (DbModelItem) it.next();
    return dbModelItem;
  }
View Full Code Here

      processModel = context.getExecutingModel();
    }
    if (processModel == null)
    {
      String msg = LogUtil.error(getClass(), "Position reference $0 requires a model specification or the executing model to be set. [{1}]", ref, context);
      throw new ModelException("NoDefaultProcess", msg);
    }

    // Absolute reference: The process specification was given in the start reference
    ProcessItem process;
    if (processName != null)
    {
      // Resolve the process reference
      process = (ProcessItem) processModel.resolveItemRef(processName, ItemTypes.PROCESS);
    }
    else
    {
      // Use the model's default process
      process = processModel.getDefaultProcess();

      if (process == null)
      {
        String msg = LogUtil.error(getClass(), "Model $0 does not have a default process (position reference: $1). [{2}]", processModel.getQualifier(), ref, context);
        throw new ModelException("NoDefaultProcess", msg);
      }
    }

    // Get the entry socket
    Node node;
    if (entryName != null)
    {
      node = process.getNodeByName(entryName);
      if (node == null)
      {
        String msg = LogUtil.error(getClass(), "Initial node $0 not found in process $1 (position reference: $2). [{3}]", entryName, process.getQualifier(), ref, context);
        throw new ModelException("NodeNotFound", msg);
      }
    }
    else
    {
      node = process.getDefaultInitialNode();
      if (node == null)
      {
        String msg = LogUtil.error(getClass(), "Process $0 does not have a default initial node (position reference: $1). [{2}]", process.getQualifier(), ref, context);
        throw new ModelException("NoDefaultNode", msg);
      }
    }

    if (! (node instanceof InitialNode))
    {
      String msg = LogUtil.error(getClass(), "Node $0 is not an initial node (position reference: $1). [{2}]", node.getQualifier(), ref, context);
      throw new ModelException("NoInitialNode", msg);
    }

    NodeSocket initialSocket = ((InitialNode) node).getSocket();

    if (! initialSocket.hasControlLinks())
View Full Code Here

        currentNode = currentSocket.getProcess().getNodeByName(nodeName);
        if (currentNode == null)
        {
          String msg = LogUtil.error(getClass(), "Initial node $0 not found (position reference: $1). [{2}]", nodeName, ref, context);
          throw new ModelException("NodeNotFound", msg);
        }
        if (! (currentNode instanceof InitialNode))
        {
          String msg = LogUtil.error(getClass(), "Node $0 is not an initial node (position reference: $1). [{2}]", currentNode.getQualifier(), ref, context);
          throw new ModelException("NoInitialNode", msg);
        }
      }
      else if (index == 0)
      {
        // ".Socket"
View Full Code Here

      ret = mgrs[i].internalGetModelByQualifier(modelQualifier);
      if (ret != null)
        break;
    }
    if (ret == null)
      throw new ModelException("ObjectNotFound", "Model '" + modelQualifier + "' does not exist");
    return ret;
  }
View Full Code Here

    for (int i = 0; i < mgrs.length; ++i)
    {
      if (mgrs[i].addModel(model))
        return true;
    }
    throw new ModelException("Operation", "Model '" + model.getName() + "' could not be created by any of the available model managers.");
  }
View Full Code Here

   * @throws OpenBPException On error
   */
  public Item getItemByQualifier(ModelQualifier qualifier, boolean required)
  {
    if (qualifier.getModel() == null)
      throw new ModelException("Operation", "Missing model name");
    if (qualifier.getItem() == null)
      throw new ModelException("Operation", "Missing component name");

    Model model = getModelByQualifier(ModelQualifier.constructModelQualifier(qualifier.getModel()));
    return model.getItem(qualifier.getItem(), qualifier.getItemType(), required);
  }
View Full Code Here

    if (errMsg != null && errMsg.equals(""))
      errMsg = null;
    getMsgContainer().clearMsgs();

    if (errMsg != null)
      throw new ModelException("ModelValidationFailedAfterreload", "Model validation failed after reload:\n" + errMsg);
  }
View Full Code Here

  private ModelMgr getModelMgr(Model model)
  {
    ModelMgr mgr = model.getModelMgr();
    if (mgr == null)
      throw new ModelException("Internal", "Model '" + model.getQualifier() + "' has not model mgr reference.");
    return mgr;
  }
View Full Code Here

TOP

Related Classes of org.openbp.core.model.ModelException

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.