Package org.jboss.metatype.api.values

Examples of org.jboss.metatype.api.values.CollectionValueSupport


      throw new AdminProcessingException(IntegrationPlugin.Util.getString("policy_not_found", policyName, vdbName, vdbVersion)); //$NON-NLS-1$
    }
   
    if (role != null) {
          ManagedProperty mappedRoleNames = managedPolicy.getProperty("mappedRoleNames");//$NON-NLS-1$
          CollectionValueSupport roleCollection = (CollectionValueSupport)mappedRoleNames.getValue();
          ArrayList<MetaValue> modifiedRoleNames = new ArrayList<MetaValue>();
          if (roleCollection != null) {
            MetaValue[] roleNames = roleCollection.getElements();
            for (MetaValue mv:roleNames) {
              String existing = (String)((SimpleValueSupport)mv).getValue();
              if (!existing.equals(role)) {
                modifiedRoleNames.add(mv);
              }
            }
          }
          else {
            roleCollection = new CollectionValueSupport(new CollectionMetaType("java.util.List", SimpleMetaType.STRING)); //$NON-NLS-1$
            mappedRoleNames.setValue(roleCollection);
          }
         
          if (add) {
            modifiedRoleNames.add(ManagedUtil.wrap(SimpleMetaType.STRING, role));
          }
         
          roleCollection.setElements(modifiedRoleNames.toArray(new MetaValue[modifiedRoleNames.size()]));
    } else {
      ManagedProperty anyAuthenticated = managedPolicy.getProperty("anyAuthenticated");//$NON-NLS-1$
      anyAuthenticated.setValue(SimpleValueSupport.wrap(add));
    }
   
View Full Code Here


    }

    // Get models from VDB
    int count = 0;
    ManagedProperty property = mcVdb.getProperty("models"); //$NON-NLS-1$
    CollectionValueSupport valueSupport = (CollectionValueSupport) property.getValue();
    MetaValue[] metaValues = valueSupport.getElements();

    for (MetaValue value : metaValues) {
      GenericValueSupport genValueSupport = (GenericValueSupport) value;
      ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport.getValue();

      // Get any model errors/warnings
      MetaValue errors = managedObject.getProperty("errors").getValue(); //$NON-NLS-1$
      if (errors != null) {
        CollectionValueSupport errorValueSupport = (CollectionValueSupport) errors;
        MetaValue[] errorArray = errorValueSupport.getElements();
        count += errorArray.length;
      }
    }
    return count;
  }
View Full Code Here

    public void populateMetaValueFromProperty(PropertyList property, MetaValue metaValue, PropertyDefinitionList propertyDefinition)
    {
        PropertyDefinition listMemberPropDef = propertyDefinition.getMemberDefinition();
        List<Property> listMemberProps = property.getList();
        CollectionValueSupport collectionValue = (CollectionValueSupport)metaValue;
        MetaType listMemberMetaType = collectionValue.getMetaType().getElementType();
        MetaValue[] listMemberValues = new MetaValue[listMemberProps.size()];
        PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(listMemberMetaType);
        int memberIndex = 0;
        for (Property listMemberProp : listMemberProps)
        {
            MetaValue listMemberValue = propertyAdapter.convertToMetaValue(listMemberProp, listMemberPropDef, listMemberMetaType);
            listMemberValues[memberIndex++] = listMemberValue;
        }
        // Replace the existing elements with the new ones.
        collectionValue.setElements(listMemberValues);
    }
View Full Code Here

    {
        LOG.debug("GetMetaValue for property: " + propertyList.getName() + " values: " + propertyList.getList().toString());
        CollectionMetaType collectionMetaType = (CollectionMetaType)metaType;
        MetaType memberMetaType = collectionMetaType.getElementType();
        CollectionMetaType collectionType = new CollectionMetaType(propertyListDefinition.getName(), memberMetaType);
        CollectionValue collectionValue = new CollectionValueSupport(collectionType);
        populateMetaValueFromProperty(propertyList, collectionValue, propertyListDefinition);
        return collectionValue;
    }
View Full Code Here

    ComponentType componentType = new ComponentType(
        PluginConstants.ComponentType.VDB.TYPE,
        PluginConstants.ComponentType.VDB.SUBTYPE);

    ManagedComponent managedComponent = null;
    CollectionValueSupport modelsMetaValue = null;
    report.setStatus(ConfigurationUpdateStatus.SUCCESS);
    try {

      managementView = getConnection().getManagementView();
      managedComponent = managementView.getComponent(this.name,
          componentType);
      modelsMetaValue = (CollectionValueSupport) managedComponent
          .getProperty("models").getValue();
      GenericValue[] models = (GenericValue[]) modelsMetaValue
          .getElements();
      List<Property> multiSourceModelsPropertyList = resourceConfiguration
          .getList("multiSourceModels").getList();
      List<Property> singleSourceModelsPropertyList = resourceConfiguration
          .getList("singleSourceModels").getList();
      ArrayList<List<Property>> sourceMappingList = new ArrayList<List<Property>>();
      sourceMappingList.add(singleSourceModelsPropertyList);
      sourceMappingList.add(multiSourceModelsPropertyList);
      PropertyMap model = null;
      Iterator<List<Property>> sourceMappingListIterator = sourceMappingList
          .iterator();
      while (sourceMappingListIterator.hasNext()) {
        List<Property> sourceList = sourceMappingListIterator.next();
        for (int i = 0; i < sourceList.size(); i++) {
          model = (PropertyMap) sourceList.get(i);
          String sourceName = ((PropertySimple) model
              .get("sourceName")).getStringValue(); //$NON-NLS-1$
          if (sourceName.equals("See below"))
            continue; // This is a multisource model which we will
                  // handle separately
          String modelName = ((PropertySimple) model.get("name")) //$NON-NLS-1$
              .getStringValue();
          String dsName = ((PropertySimple) model.get("jndiName")) //$NON-NLS-1$
              .getStringValue();

          ManagedObject managedModel = null;
          if (models != null && models.length != 0) {
            for (GenericValue genValue : models) {
              ManagedObject mo = (ManagedObject) ((GenericValueSupport) genValue)
                  .getValue();
              String name = ProfileServiceUtil.getSimpleValue(mo,
                  "name", String.class); //$NON-NLS-1$
              if (modelName.equals(name)) {
                managedModel = mo;
                break;
              }
            }
          }

          ManagedProperty sourceMappings = null;
          if (managedModel != null) {

            sourceMappings = managedModel
                .getProperty("sourceMappings");//$NON-NLS-1$

            if (sourceMappings != null) {
              CollectionValueSupport mappings = (CollectionValueSupport) sourceMappings
                  .getValue();
              GenericValue[] mappingsArray = (GenericValue[]) mappings
                  .getElements();
              for (GenericValue sourceGenValue : mappingsArray) {
                ManagedObject sourceMo = (ManagedObject) ((GenericValueSupport) sourceGenValue)
                    .getValue();
                String sName = ProfileServiceUtil
View Full Code Here

   * @throws Exception
   */
  private void getModels(ManagedComponent mcVdb, Configuration configuration) {
    // Get models from VDB
    ManagedProperty property = mcVdb.getProperty("models");
    CollectionValueSupport valueSupport = (CollectionValueSupport) property
        .getValue();
    MetaValue[] metaValues = valueSupport.getElements();

    PropertyList sourceModelsList = new PropertyList("singleSourceModels");
    configuration.put(sourceModelsList);

    PropertyList multiSourceModelsList = new PropertyList(
        "multiSourceModels");
    configuration.put(multiSourceModelsList);

    PropertyList logicalModelsList = new PropertyList("logicalModels");
    configuration.put(logicalModelsList);

    PropertyList errorList = new PropertyList("errorList");
    configuration.put(errorList);

    for (MetaValue value : metaValues) {
      GenericValueSupport genValueSupport = (GenericValueSupport) value;
      ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport
          .getValue();

      Boolean isSource = Boolean.TRUE;
      try {
        isSource = ProfileServiceUtil.booleanValue(managedObject
            .getProperty("source").getValue());
      } catch (Exception e) {
        LOG.error(e.getMessage());
      }

      Boolean supportMultiSource = Boolean.TRUE;
      try {
        supportMultiSource = ProfileServiceUtil
            .booleanValue(managedObject.getProperty(
                "supportsMultiSourceBindings").getValue());
      } catch (Exception e) {
        LOG.error(e.getMessage());
      }

      String modelName = managedObject.getName();
      ManagedProperty connectorBinding = managedObject
          .getProperty("sourceMappings");
      Collection<Map<String, String>> sourceList = new ArrayList<Map<String, String>>();

      getSourceMappingValue(connectorBinding.getValue(), sourceList);

      String visibility = ((SimpleValueSupport) managedObject
          .getProperty("visible").getValue()).getValue().toString();
      String type = ((EnumValueSupport) managedObject.getProperty(
          "modelType").getValue()).getValue().toString();

      // Get any model errors/warnings
      MetaValue errors = managedObject.getProperty("errors").getValue();
      if (errors != null) {
        CollectionValueSupport errorValueSupport = (CollectionValueSupport) errors;
        MetaValue[] errorArray = errorValueSupport.getElements();

        for (MetaValue error : errorArray) {
          GenericValueSupport errorGenValueSupport = (GenericValueSupport) error;

          ManagedObject errorMo = (ManagedObject) errorGenValueSupport
View Full Code Here

    // Get models from VDB
    ManagedProperty property = mcVdb.getProperty("overrideTranslators");
    if (property == null) {
      return;
    }
    CollectionValueSupport valueSupport = (CollectionValueSupport) property
        .getValue();
    MetaValue[] metaValues = valueSupport.getElements();

    PropertyList translatorsList = new PropertyList("translators");
    configuration.put(translatorsList);

    for (MetaValue value : metaValues) {
      GenericValueSupport genValueSupport = (GenericValueSupport) value;
      ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport
          .getValue();

      String translatorName = ProfileServiceUtil.getSimpleValue(
          managedObject, "name", String.class);
      String translatorType = ProfileServiceUtil.getSimpleValue(
          managedObject, "type", String.class);
      ManagedProperty properties = managedObject.getProperty("property");

      if (properties != null) {
        CollectionValueSupport props = (CollectionValueSupport) properties
            .getValue();
        for (MetaValue propertyMetaData : props) {
          String propertyName = ProfileServiceUtil
              .stringValue(((CompositeValueSupport) propertyMetaData)
                  .get("name"));
View Full Code Here

      managementView = getConnection().getManagementView();
      managedComponent = managementView.getComponent(
          ((VDBComponent) this.resourceContext
              .getParentResourceComponent()).name, componentType);
      ManagedProperty mp = managedComponent.getProperty("dataPolicies");//$NON-NLS-1$
      CollectionValueSupport dataRolesListMp = (CollectionValueSupport) mp
          .getValue();
      String name = resourceConfiguration.getSimpleValue("name", null); //$NON-NLS-1$
      String anyAuthenticated = resourceConfiguration.getSimpleValue(
          "anyAuthenticated", null); //$NON-NLS-1$

      for (MetaValue val : dataRolesListMp.getElements()) {
        GenericValueSupport genValueSupport = (GenericValueSupport) val;
        ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport
            .getValue();

        for (String dataRolesProp : managedObject.getPropertyNames()) {
View Full Code Here

     for (String mappedRoleName : mappedRoleNameList)
       {
        MetaValue mappedRoleNameValue = SimpleValueSupport.wrap(mappedRoleName);
        listMemberValues[memberIndex++] = mappedRoleNameValue;
       }
       return new CollectionValueSupport( new CollectionMetaType("java.util.List", SimpleMetaType.STRING), //$NON-NLS-1$
                                      listMemberValues);
      
  }
View Full Code Here

    }

    // Get data roles from VDB
    ManagedProperty property = mcVdb.getProperty("dataPolicies"); //$NON-NLS-1$
    if (property != null) {
      CollectionValueSupport valueSupport = (CollectionValueSupport) property
          .getValue();
      MetaValue[] metaValues = valueSupport.getElements();

      for (MetaValue value : metaValues) {
        GenericValueSupport genValueSupport = (GenericValueSupport) value;
        ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport
            .getValue();

        String dataRoleName = ProfileServiceUtil.getSimpleValue(
            managedObject, "name", String.class); //$NON-NLS-1$
        Boolean anyAuthenticated = ProfileServiceUtil.getSimpleValue(
            managedObject, "anyAuthenticated", Boolean.class); //$NON-NLS-1$
        String description = ProfileServiceUtil.getSimpleValue(
            managedObject, "description", String.class); //$NON-NLS-1$

        configuration.put(new PropertySimple("name", dataRoleName)); //$NON-NLS-1$
        configuration.put(new PropertySimple("anyAuthenticated", //$NON-NLS-1$
            anyAuthenticated));
        configuration
            .put(new PropertySimple("description", description)); //$NON-NLS-1$

        PropertyList mappedRoleNameList = new PropertyList(
            "mappedRoleNameList"); //$NON-NLS-1$
        configuration.put(mappedRoleNameList);
        ManagedProperty mappedRoleNames = managedObject
            .getProperty("mappedRoleNames"); //$NON-NLS-1$
        if (mappedRoleNames != null) {
          CollectionValueSupport props = (CollectionValueSupport) mappedRoleNames
              .getValue();
          for (MetaValue mappedRoleName : props.getElements()) {
            PropertyMap mappedRoleNameMap = null;

            try {
              mappedRoleNameMap = new PropertyMap(
                  "map", //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.values.CollectionValueSupport

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.