Package org.openbp.core.model

Examples of org.openbp.core.model.Model


   *
   * @param model Model to reload
   */
  protected void reloadModelAfterModelUpdate(Model model)
  {
    Model newModel = readModelDescriptor(model.getModelPath());
    try
    {
      model.copyFrom(newModel, Copyable.COPY_SHALLOW);
    }
    catch (CloneNotSupportedException e)
View Full Code Here


   * @return The new item or null (error messages go to the message container)
   */
  protected Item readItemFromStore(ModelQualifier itemQualifier)
  {
    ModelQualifier modelQualifier = ModelQualifier.constructModelQualifier(itemQualifier.getModel());
    Model model = getOptionalModelByQualifier(modelQualifier);
    if (model != null)
    {
      String itemType = itemQualifier.getItemType();
      ItemTypeDescriptor itd = getItemTypeDescriptor(itemType);
      if (itd == null)
View Full Code Here

   * @param item Item or model
   * @return The class name or null
   */
  public static String constructClassNamePrefix(Item item)
  {
    Model model = item.getOwningModel();
    if (model != null)
    {
      String pkg = model.getDefaultPackage();
      if (pkg == null)
      {
        // Use the name of the model as package suffix
        pkg = SettingUtil.getStringSetting("openbp.cockpit.defaultModelPackageBaseName");
        if (pkg == null)
          pkg = "org.openbp.model";
        pkg = pkg + "." + model.getName().toLowerCase();
      }

      return pkg;
    }

View Full Code Here

    {
      Item npItem = (Item) np;
      if (npItem.getRuntimeAttribute(Modeler.ATTRIBUTE_SKELETON) != null)
      {
        // We have a skeleton object. Use its item type to create a new item of this type.
        Model model = process.getModel();

        // Create the item using the item factory
        String processType = null;
        if (npItem instanceof ProcessItem)
        {
View Full Code Here

        msgBox.initDialog();
        SwingUtil.show(msgBox);

        int choice = msgBox.getUserChoice();

        Model model = node.getOwningModel();

        if (choice == JMsgBox.TYPE_YES)
        {
          // Yes means create a new process
          final Item item = ItemCreationUtil.createItem(model, placeholderNode.getName(), placeholderNode.getDisplayName(), ItemTypes.PROCESS, null);
          if (item != null)
          {
            assignPlaceholderReference(item);

            // Open the new process
            SwingUtilities.invokeLater(new Runnable()
            {
              public void run()
              {
                getDrawing().getEditor().fireEvent("plugin.association.open", new BasicTransferable(item));
              }
            });
          }
        }
        else if (choice == JMsgBox.TYPE_NO)
        {
          // Yes means reference an existing process
          ItemSelectionDialog dlg = new ItemSelectionDialog(ApplicationUtil.getActiveWindow(), true);

          String dlgTitle = res.getRequiredString("placeholder.referencedialog.select");
          dlg.setTitle(dlgTitle);

          // We may select a single object only
          dlg.setSelectionMode(ItemTree.SELECTION_SINGLE);
          dlg.setShowGroups(false);

          dlg.setSupportedItemTypes(new String [] { ItemTypes.MODEL, ItemTypes.PROCESS });
          dlg.setSelectableItemTypes(new String [] { ItemTypes.PROCESS });
          dlg.setSupportedObjectClasses(new Class [] { Node.class });
          dlg.setSelectableObjectClasses(new Class [] { Node.class });

          ItemTreeState state = new ItemTreeState();
          state.addExpandedQualifier(model.getQualifier());

          // Build the tree, expanding the first level and the currently selected item
          dlg.rebuildTree();
          dlg.expand(1);
          dlg.restoreState(state);
View Full Code Here

   */
  protected void assignPlaceholderReference(ModelObject mo)
  {
    String referencePath = null;

    Model model = getDrawing().getProcess().getModel();
    if (model != null)
    {
      referencePath = model.determineObjectRef(mo);
    }

    if (referencePath == null)
    {
      referencePath = mo.getQualifier().toString();
View Full Code Here

          if (!(context instanceof TokenContext))
          {
            throw newError("Expression.EvaluationContextMissing", "Invalid context for '" + ExpressionConstants.REFERENCE_KEY_OPERATOR + "' operation", sp);
          }
          Model model = ((TokenContext) context).getExecutingModel();

          if (persistenceContextProvider == null)
          {
            throw newError("Expression.EvaluationContextMissing", "Invalid context for '" + ExpressionConstants.REFERENCE_KEY_OPERATOR + "' operation", sp);
          }

          ident = collectDataTypeName(sp);

          try
          {
            DataTypeItem targetType = (DataTypeItem) model.resolveItemRef(ident, ItemTypes.TYPE);
            if (targetType.isSimpleType())
            {
              throw newError("Expression.EvaluationContextMissing", "Data type '" + ident + "' in '" + ExpressionConstants.REFERENCE_KEY_OPERATOR + "' expression may not be a primitive type.", sp);
            }
View Full Code Here

   */
  public String executeVisual(String visualType, VisualItem visual, TokenContext context, NodeSocket entrySocket)
    throws Exception
  {
    // Determine the adapter and forward the request to it
    Model model = context.getExecutingModel();

    UIAdapter adapter = lookupAdapter(model, visualType);
    if (adapter == null)
    {
      // Create an adapter.
View Full Code Here

    // Check for an object name first
    boolean success = super.validate(flag);

    if (success)
    {
      Model systemModel = getModel().getModelMgr().getModelByQualifier(CoreConstants.SYSTEM_MODEL_QUALIFIER);

      if (! getModel().getQualifier().equals(systemModel.getQualifier()))
      {
        DataTypeItem systemType = (DataTypeItem) systemModel.getItem(getName(), ItemTypes.TYPE, false);
        if (systemType != null && systemType.isSimpleType())
        {
          getModelMgr().getMsgContainer().addMsg(this, "Type name conflicts with a type name of the System model.");
          success = false;
        }

        if (baseTypeName != null)
        {
          if (baseTypeName.equals(getName()))
          {
            getModelMgr()
              .getMsgContainer()
              .addMsg(
                this,
                "A type cannot have itself as base type. If you want to refer to a type from another model, use the fully qualified notation (e. g. \"/Model/Type\").");
            success = false;
          }

          systemType = (DataTypeItem) systemModel.getItem(baseTypeName, ItemTypes.TYPE, false);
          if (systemType != null && systemType.isSimpleType())
          {
            getModelMgr().getMsgContainer().addMsg(this, "Base type name $0 conflicts with a type name of the System model.",
              new Object[]
              {
View Full Code Here

      DbModel dbModel = (DbModel) it.next();

      if (! shouldLoadModel(dbModel.getName()))
        continue;

      Model model = dbModelToModel(dbModel);

      // Register the model
      try
      {
        registerModel(model);
      }
      catch (ModelException e)
      {
        getMsgContainer().addMsg(null, "Error registering model $0 in model manager $1", new Object[]
        {
          model.getName(), getClass().getName(), e
        });
        continue;
      }

      LogUtil.info(getClass(), "Loaded model $0 from database.", model.getQualifier());
    }
  }
View Full Code Here

TOP

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

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.