Package org.apache.slide.projector.descriptor

Examples of org.apache.slide.projector.descriptor.ValueDescriptor


        } else {
          parameterDescriptor = new ParameterDescriptor(name, new ParameterMessage(ParameterMessage.NO_MESSAGE_AVAILABLE, new String[] {name}), null);
        }
        parameterDescriptors.add(parameterDescriptor);
        Element valueDescriptorElement = (Element)inputParameter.getChildren().iterator().next();
        ValueDescriptor valueDescriptor = ValueFactoryManager.getInstance().loadValueDescriptor(valueDescriptorElement);
        parameterDescriptor.setValueDescriptor(valueDescriptor);
      }
      this.parameterDescriptors = (ParameterDescriptor [])parameterDescriptors.toArray(new ParameterDescriptor[parameterDescriptors.size()]);
      List outputResults = XPath.newInstance("/process/description/output/result").selectNodes(rootElement);
      List resultEntryDescriptors = new ArrayList();
      for ( Iterator i = outputResults.iterator(); i.hasNext(); ) {
        Element outputResult = (Element)i.next();
        String name = outputResult.getAttributeValue("name");
        String description = outputResult.getAttributeValue("description");
        String contentType = outputResult.getAttributeValue("content-type");
        boolean presentable = ConversionHelpers.getBoolean(outputResult.getAttributeValue("presentable"), false);
        resultEntryDescriptors.add(new ResultEntryDescriptor(name, new DefaultMessage(description), contentType, presentable));
      }
      List stateElements = XPath.newInstance("/process/description/output/state").selectNodes(rootElement);
      List states = new ArrayList();
      for ( Iterator i = stateElements.iterator(); i.hasNext(); ) {
        Element stateElement = (Element)i.next();
        String description = stateElement.getAttributeValue("description");
        states.add(new StateDescriptor(stateElement.getTextTrim(), new DefaultMessage(description)));
      }
      resultDescriptor = new ResultDescriptor((StateDescriptor [])states.toArray(new StateDescriptor[states.size()]), (ResultEntryDescriptor[])resultEntryDescriptors.toArray(new ResultEntryDescriptor[resultEntryDescriptors.size()]));
      List providedEnvironmentElements = XPath.newInstance("/process/description/output/environment").selectNodes(rootElement);
      List providedEnvironment = new ArrayList();
      for ( Iterator i = providedEnvironmentElements.iterator(); i.hasNext(); ) {
        Element environmentElement = (Element)i.next();
        String key = environmentElement.getAttributeValue("key");
        String storeName = environmentElement.getAttributeValue("store");
        String description = environmentElement.getAttributeValue("description");
        String contentType = environmentElement.getAttributeValue("content-type");
        boolean presentable = ConversionHelpers.getBoolean(environmentElement.getAttributeValue("presentable"), false);
        int store = StoreHelper.getStoreByName(storeName);
        ProvidedEnvironmentDescriptor environmentDescriptor = new ProvidedEnvironmentDescriptor(key, new DefaultMessage(description), contentType, presentable);
        environmentDescriptor.setStore(store);
        providedEnvironment.add(environmentDescriptor);
      }
      providedEnvironmentDescriptors = (ProvidedEnvironmentDescriptor [])providedEnvironment.toArray(new ProvidedEnvironmentDescriptor[providedEnvironment.size()]);
      List requiredEnvironmentElements = XPath.newInstance("/process/description/input/environment").selectNodes(rootElement);
      List requiredEnvironment = new ArrayList();
      for ( Iterator i = requiredEnvironmentElements.iterator(); i.hasNext(); ) {
        Element requiredEnvironmentElement = (Element)i.next();
        String name = requiredEnvironmentElement.getAttributeValue("name");
        String storeName = requiredEnvironmentElement.getAttributeValue("store");
        int store = StoreHelper.getStoreByName(storeName);
        String description = requiredEnvironmentElement.getAttributeValue("description");
        RequiredEnvironmentDescriptor environmentDescriptor;
        if ( description != null ) {
          environmentDescriptor = new RequiredEnvironmentDescriptor(name, store, new ParameterMessage(description), null);
        } else {
          environmentDescriptor = new RequiredEnvironmentDescriptor(name, store, new ParameterMessage(ParameterMessage.NO_MESSAGE_AVAILABLE, new String[] {name}), null);
        }
        requiredEnvironment.add(environmentDescriptor);
        Element valueDescriptorElement = (Element)requiredEnvironmentElement.getChildren().iterator().next();
        ValueDescriptor valueDescriptor = ValueFactoryManager.getInstance().loadValueDescriptor(valueDescriptorElement);
        environmentDescriptor.setValueDescriptor(valueDescriptor);
      }
      requiredEnvironmentDescriptors = (RequiredEnvironmentDescriptor [])requiredEnvironment.toArray(new RequiredEnvironmentDescriptor[requiredEnvironment.size()]);
      List stepElements = XPath.newInstance("/process/step").selectNodes(rootElement);
      for ( Iterator i = stepElements.iterator(); i.hasNext(); ) {
View Full Code Here

TOP

Related Classes of org.apache.slide.projector.descriptor.ValueDescriptor

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.