6 Replies Latest reply on Apr 20, 2007 9:13 AM by Charles Souillard

    ListDescriptor wiring

    Charles Souillard Newbie

      I have troubles with ListDescriptor wiring in ActivityBinding.

      Here is the code I use :
      in ActivityBinding.parseSatndardElements :

      protected void parseStandardElements(Element activityElement, ObjectDescriptor objectDescriptor, Parse parse) {
      ....
      Element targetsElement = XmlUtil.element(activityElement, "targets");
      if (targetsElement != null) {
      List targetElements = XmlUtil.elements(targetsElement, "target");
      addDescriptor(objectDescriptor, parseTargets(targetElements), "targets");
      }
      ....
      }

      private ListDescriptor parseTargets(List targetElements) {
      ListDescriptor descriptor = new ListDescriptor();
      List targetsValueDescriptor = null;
      if (targetElements!=null) {
      targetsValueDescriptor = new ArrayList();
      for (Element targetElement: targetElements) {
      String linkName = XmlUtil.attribute(targetElement, "linkName");
      ObjectDescriptor targetDescriptor = new ObjectDescriptor();
      targetDescriptor.setAutoWireEnabled(false);
      targetDescriptor.setClassName(Target.class.getName());
      FieldOperation fieldOperation = new FieldOperation("linkName", new StringDescriptor(linkName));
      targetDescriptor.addOperation(fieldOperation);
      targetsValueDescriptor.add(targetDescriptor);
      }
      descriptor.setValueDescriptors(targetsValueDescriptor);
      }

      return descriptor;
      }

      protected void addDescriptor(ObjectDescriptor objectDescriptor, Descriptor addedDescriptor, String fieldName) {
      FieldOperation fieldInjection = new FieldOperation();
      objectDescriptor.getOperations().add(fieldInjection);
      fieldInjection.setFieldName(fieldName);
      fieldInjection.setDescriptor(addedDescriptor);
      }

      At runTime, when I use the targets field of an activity having targets, the field is null..
      The message I get from the wiring :
      11:24:55,117 FNR [10|FieldOperation] injecting [] into targets

      Thanks for your help !
      Charles

      Then in runTime, I get null for the