Package com.dbxml.labrador.types

Examples of com.dbxml.labrador.types.Variant


      if ( res != null )
         res = Context.toString(res);
      Context.exit();

    if ( res != null )
      return new Variant(res);
    else
      return null;
   }
View Full Code Here


      pi.exec(script);

      // Return any possible result
      Object res = pi.get("result");
    if ( res != null )
      return new Variant(res);
    else
      return null;
   }
View Full Code Here

      Element tagsElem = DOMUtils.addElement(contentElem, Constants.TAGS);
      Element notesElem = DOMUtils.addElement(contentElem, Constants.NOTES);

      DOMUtils.setText(pathElem, path);
      DOMUtils.setText(ownerElem, owner);
      DOMUtils.setText(modifiedElem, new Variant(modified).toString());
      DOMUtils.setText(createdElem, new Variant(created).toString());
      DOMUtils.setText(sizeElem, Long.toString(size));
      DOMUtils.setText(versionElem, Double.toString(version));

      DOMUtils.setToElements(groupsElem, Constants.GROUP, groups);
      DOMUtils.setToElements(tagsElem, Constants.TAG, tags);
View Full Code Here

   public void streamFromXML(Element element) throws DOMException {
      status = Constants.getStatusValue(element.getAttribute(Constants.STATUS));

      path = DOMUtils.getElementText(element, Constants.PATH);
      owner = DOMUtils.getElementText(element, owner);
      modified = new Variant(DOMUtils.getElementText(element, Constants.MODIFIED)).getDate();
      created = new Variant(DOMUtils.getElementText(element, Constants.CREATED)).getDate();
      size = Long.parseLong(DOMUtils.getElementText(element, Constants.SIZE));
      version = Double.parseDouble(DOMUtils.getElementText(element, Constants.VERSION));

      DOMUtils.elementsToSet(element, Constants.GROUP, groups);
      DOMUtils.elementsToSet(element, Constants.TAG, tags);
View Full Code Here

                  if ( n2.getNodeType() == Node.TEXT_NODE )
                     sb.append(((Text)n2).getData());
               }
  
               String str = Base64.decode(sb.toString().trim());
               Variant v = new Variant(str);
               Object value = TypeConversions.toTypedValue(typeNum, v);
              
               super._put(key, value);
            }
         }
View Full Code Here

            int typeNum = Types.typeOf(value);
            if ( typeNum == Types.UNKNOWN )
               continue;
                       
            String type = Types.typeName(typeNum);
            Variant v = new Variant(value);
            String str = v.getString();
            if ( str == null )
               continue;
           
            Element resource = doc.createElement(RESOURCE);
            rootElem.appendChild(resource);
View Full Code Here

   public Manifest(Document doc) {
      this(doc.getDocumentElement());
   }

   public Manifest(Element elem) {
      date = new Variant(elem.getAttribute(Constants.DATE)).getDate();

      NodeList nl = elem.getChildNodes();
      for ( int i = 0; i < nl.getLength(); i++ ) {
         Node n = nl.item(i);
         if ( n.getNodeType() == Node.ELEMENT_NODE ) {
View Full Code Here

   public JAXBElementAdapter(Collection col) {
      super(col);
   }

   private void putObject(Transaction tx, Object key, Element obj) throws DBException {
      Node node = new Variant(obj).getNode();
      DocumentTable dt;

      try {
         dt = DTSMHelper.nodeToTable(node, col.getSymbols());
      }
View Full Code Here

      catch ( DTSMException e ) {
         throw new DBException(FaultCodes.COL_CANNOT_RETRIEVE, "Error retrieving object '" + key + "'", e);
      }

      if ( doc != null ) {
         Variant v = new Variant(doc);
         return v.getJAXBElement();
      }

      return null;
   }
View Full Code Here

         Set grpSet = new HashSet();
         for ( int i = 0; groups != null && i < groups.length; i++ )
            grpSet.add(groups[i]);

         String d = new Variant(date).getString();
         StringBuffer sb = new StringBuffer(64);
         sb.append("/" + Constants.CONTENT + "[" + Constants.MODIFIED + " > '" + d + "'");
         if ( groups != null ) {
            sb.append(" and " + Constants.GROUPS + "/" + Constants.GROUP + "[");
            for ( int i = 0; i < groups.length; i++ ) {
               if ( i > 0 )
                  sb.append(" or ");
               sb.append(".='" + groups[i] + "'");
            }
            sb.append("]");
         }
         sb.append("]");

         XMLSerializableAdapter col = getContentCollection();
         ResultSet rs = col.queryCollection(tx, XPathQueryResolver.STYLE_XPATH, sb.toString(), null);
         Map grpMap = new HashMap(); // of String to List of Element

         while ( rs.next() ) {
            try {
               DocumentTable dt = rs.getResult();
               Element elem = (Element)DTSMHelper.tableToNode(dt);
               NodeList nl = elem.getElementsByTagName(Constants.GROUP);
               for ( int i = 0; i < nl.getLength(); i++ ) {
                  Element e = (Element)nl.item(i);
                  String grpName = DOMUtils.getText(e);
                  if ( groups != null && !grpSet.contains(grpName) )
                     continue;
                  List l = (List)grpMap.get(grpName);
                  if ( l == null ) {
                     l = new ArrayList();
                     grpMap.put(grpName, l);
                  }
                  l.add(elem);
               }
            }
            catch ( DTSMException e ) {
               throw new DBException(FaultCodes.GEN_GENERAL_ERROR, "Can't convert DocumentTable", e);
            }
         }

         Document doc = DOMHelper.newDocument();
         Element rootElem = doc.createElement(Constants.MANIFEST);
         rootElem.setAttribute(Constants.DATE, new Variant(start).getString());
         doc.appendChild(rootElem);

         Iterator iter = grpMap.keySet().iterator();
         while ( iter.hasNext() ) {
            String key = (String)iter.next();
View Full Code Here

TOP

Related Classes of com.dbxml.labrador.types.Variant

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.