Esempio n. 1
1
 public char[] getTextCharacters() {
   if (charArray != null) {
     return charArray;
   } else if (value != null) {
     return value.toCharArray();
   } else {
     try {
       return Base64Utils.encodeToCharArray((DataHandler) getDataHandler());
     } catch (IOException ex) {
       throw new OMException(ex);
     }
   }
 }
Esempio n. 2
0
 /** Returns the value. */
 public String getText() throws OMException {
   if (charArray != null || this.value != null) {
     return getTextFromProperPlace();
   } else {
     try {
       return Base64Utils.encode((DataHandler) getDataHandler());
     } catch (Exception e) {
       throw new OMException(e);
     }
   }
 }
Esempio n. 3
0
  private Object readObject(ParameterType paramType, OMElement node, boolean client)
      throws Exception {
    switch (paramType.getType()) {
      case BOOLEAN:
      case DOUBLE:
      case FLOAT:
      case INT:
      case LONG:
      case STRING:
      case ENUM:
      case DATE:
      case BYTE:
        return node == null
            ? null
            : readSimpleObject(paramType, node.getLocalName(), node.getText(), client);
      case OBJECT:
        // descend - note possibly two levels if inside a collection recursion
        OMElement _copy = this.currentNode;
        currentNode = node;

        Transcribable t = (Transcribable) paramType.getImplementationClass().newInstance();
        t.transcribe(this, TranscribableParams.getAll(), client);

        // ascend
        this.currentNode = _copy;
        return t;
      case MAP:
        Map map = new HashMap();
        for (Iterator i = node.getChildElements(); i.hasNext(); ) {
          OMElement element = (OMElement) i.next();
          Object key =
              readSimpleObject(
                  paramType.getComponentTypes()[0],
                  node.getLocalName(),
                  element.getAttributeValue(keyAttName),
                  client);
          map.put(
              key,
              readObject(
                  paramType.getComponentTypes()[1],
                  (OMElement) element.getChildElements().next(),
                  client));
        }
        return map;
      case LIST:
        if (paramType.getComponentTypes()[0].getType() == ParameterType.Type.BYTE) {
          try {
            return Base64Utils.decode(node.getText());
          } catch (Exception e) {
            String message = "Unable to parse " + node.getText() + " as type " + paramType;
            logger.log(Level.FINER, message, e);
            throw CougarMarshallingException.unmarshallingException("soap", message, e, client);
          }
        } else {
          List list = new ArrayList();
          for (Iterator i = node.getChildElements(); i.hasNext(); ) {
            list.add(readObject(paramType.getComponentTypes()[0], (OMElement) i.next(), client));
          }
          return list;
        }
      case SET:
        Set set = new HashSet();
        for (Iterator i = node.getChildElements(); i.hasNext(); ) {
          set.add(readObject(paramType.getComponentTypes()[0], (OMElement) i.next(), client));
        }
        return set;
    }
    return null;
  }