Examples of ModelObject


Examples of org.gatein.management.api.model.ModelObject

            return;

        ModelList list = model.get(fieldName, ModelList.class);
        if (string.isLocalized()) {
            for (Localized.Value<String> value : string.getLocalizedValues()) {
                ModelObject localizedModel = list.add().asValue(ModelObject.class);
                localizedModel.set("value", value.getValue());
                populate("lang", value.getLocale(), localizedModel);
            }
        } else {
            list.add().asValue(ModelObject.class).set("value", string.getValue());
        }
View Full Code Here

Examples of org.gatein.management.api.model.ModelObject

        } else {
            node = node.filter().showDefault();
        }

        // Populate the model
        ModelObject model = modelProvider.newModel(ModelObject.class);
        populateNode(node, scope, model, context.getAddress());

        return model;
    }
View Full Code Here

Examples of org.gatein.management.api.model.ModelObject

        // Add child and save
        Node child = parent.addChild(name);
        navigation.saveNode(parent);

        // Populate model
        ModelObject model = modelProvider.newModel(ModelObject.class);
        populateNode(child, 0, model, address);

        return model;
    }
View Full Code Here

Examples of org.gatein.management.api.model.ModelObject

        // Save node
        navigation.saveNode(node);

        // Populate model for update node
        ModelObject updateNodeModel = modelProvider.newModel(ModelObject.class);
        populateNode(node, 0, updateNodeModel, address);

        return updateNodeModel;
    }
View Full Code Here

Examples of org.gatein.management.api.model.ModelObject

        return node;
    }

    private ModelObject populateNavigationModel(Node rootNode, int scope, OperationContext context) {
        ModelObject model = modelProvider.newModel(ModelObject.class);

        PathAddress address = context.getAddress();

        // Populate navigation fields
        model.set("priority", navigation.getPriority());
        model.set("siteType", navigation.getSiteId().getType().getName());
        model.set("siteName", navigation.getSiteId().getName());
        ModelList nodesModel = model.get("nodes").setEmptyList();
        if (rootNode.isChildrenLoaded()) {
            for (Node child : rootNode) {
                Model childModel = nodesModel.add();
                PathAddress childAddress = address.append(child.getName());
                if (scope > 0 || scope < 0) // Continue populating nodes in response
View Full Code Here

Examples of org.gatein.management.api.model.ModelObject

    private void populateVisibility(Visibility visibility, ModelObject model) {
        if (visibility != null) {
            set("status", visibility.getStatus(), model);
            if (visibility.getPublicationDate() != null) {
                ModelObject pubDateModel = model.get("publication-date", ModelObject.class);
                Date start = visibility.getPublicationDate().getStart();
                Date end = visibility.getPublicationDate().getEnd();
                set("start", start, pubDateModel);
                set("end", end, pubDateModel);
            }
View Full Code Here

Examples of org.gatein.management.api.model.ModelObject

            throw invalidValue(null, "displayNames");
        }
        LocalizedString displayName = null;
        int i=0;
        for (ModelValue mv : list) {
            ModelObject displayNameModel = mv.asValue(ModelObject.class);

            // Parse value (required && non-null)
            if (!displayNameModel.has("value")) {
                throw requiredField("displayNames["+i+"].value");
            }
            String value = get(displayNameModel, ModelString.class, "value").getValue();
            if (value == null) {
                throw invalidValue(value, "displayNames[" + i + "].value");
            }

            // Parse lang (not-required but if defined must be non-null)
            if (displayNameModel.has("lang")) {
                ModelString langModel = get(displayNameModel, ModelString.class, "lang");
                String lang = langModel.getValue();
                if (lang == null) {
                    throw invalidValue(lang, "displayNames[" + i + "].lang");
                }
View Full Code Here

Examples of org.gatein.management.api.model.ModelObject

        return displayName;
    }

    private static PageId getPageId(ModelObject nodeModel) {
        ModelObject pageModel = get(nodeModel, ModelObject.class, "page");
        if (pageModel.isDefined()) {
            String pageName = nonNullString(nodeModel, "page", "pageName");
            String siteName = nonNullString(nodeModel, "page", "siteName");
            String siteTypeString = nonNullString(nodeModel, "page", "siteType");
            SiteType siteType = SiteType.forName(siteTypeString);
            if (siteType == null) {
View Full Code Here

Examples of org.gatein.management.api.model.ModelObject

    }

    private static Visibility getVisibility(ModelObject nodeModel, Visibility original) {
        Visibility.Status status = getStatus(nodeModel);
        if (status == Visibility.Status.PUBLICATION) {
            ModelObject pubDateModel = get(nodeModel, ModelObject.class, "visibility", "publication-date");
            // If status was set to PUBLICATION however no publication date was specified then throw exception
            if (!pubDateModel.isDefined()) {
                throw requiredFieldWhen("visibility status is " + status, "visibility", "publication-date");
            }
            PublicationDate publicationDate = getPublicationDate(nodeModel, original.getPublicationDate());
            return new Visibility(publicationDate);
        } else {
View Full Code Here

Examples of org.openbp.core.model.ModelObject

      // Single element selected, show it in the property browser.
      Figure figure = (Figure) selection.get(0);

      if (figure instanceof ProcessElementContainer)
      {
        ModelObject mo = ((ProcessElementContainer) figure).getReferredProcessElement();
        Object originalObject = null;

        // Determine the item the figure element references to
        Item referencedItem = null;
        if (mo instanceof SubprocessNode)
        {
          referencedItem = ((SubprocessNode) mo).getSubprocess();
        }

        if (editor() instanceof NodeItemEditorPlugin)
        {
          // We are in the nodeeditor, we need not the process object,
          // but the item behind it
          if (referencedItem != null)
          {
            // Get the reference object for name uniqueness checks
            originalObject = ModelConnector.getInstance().getItemByQualifier(referencedItem.getQualifier(), false);

            // We will edit the referenced item directly
            mo = referencedItem;
          }
        }
        else
        {
          if (mo instanceof MultiSocketNode)
          {
            MultiSocketNode node = (MultiSocketNode) mo;

            // If we edit an activity node, create a configuration bean if not already there
            // in order to be able to edit the settings in the property browser.
            // The bean will be removed if it contains the default values only when saving the activity node again
            // (see plugin_propertybrowser_executesave () in the ModelerEventModule)
            if (node.getConfigurationBean() == null)
            {
              // We create a new configuration bean (if defined by the underlying activity)
              if (referencedItem != null)
              {
                node.setConfigurationBean(referencedItem.createConfigurationBean());
              }
            }
          }
        }

        // Make sure the global reference names are up to date or else we may have trouble
        // saving the object (the ModelObjectValidator will try to rebuild the references from the names)
        mo.maintainReferences(ModelObject.SYNC_GLOBAL_REFNAMES | ModelObject.SYNC_LOCAL_REFNAMES);

        String title = mo.getName();
        String modelObjectTypeName = mo.getModelObjectTypeName();
        if (modelObjectTypeName != null)
        {
          title = title + " (" + modelObjectTypeName + ")";
        }

        // Send the object to the OE
        modeler.fireEvent(new PropertyBrowserSetEvent(modeler, mo, originalObject, false, mo.getDescription(), title, null, false, true));

        // Show object description in info panel
        modeler.fireEvent(new JaspiraEvent(modeler, "plugin.infopanel.setinfotext", mo));
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.