Return this Tenant definition as a UNode tree, which can be serialized into text
via {@link UNode#toJSON()} or {@link UNode#toXML()}.

@return  This Tenant definition serialized as a UNode tree.
961689
public UNode toDoc() {
        UNode tenantNode = UNode.createMapNode(m_name, "tenant");
        if (m_options.size() > 0) {
            UNode optsNode = tenantNode.addMapNode("options");
            for (Map.Entry<String, Object> mapEntry : m_options.entrySet()) {
                optsNode.addChildNode(optionValueToUNode(mapEntry.getKey(), mapEntry.getValue()));
            }
        }
        if (m_properties.size() > 0) {
            UNode propsNode = tenantNode.addMapNode("properties");
            for (Map.Entry<String, String> mapEntry : m_properties.entrySet()) {
                propsNode.addValueNode(mapEntry.getKey(), mapEntry.getValue(), "property");
            }
        }
        if (m_users.size() > 0) {
            UNode usersNode = tenantNode.addMapNode("users");
            for (UserDefinition userDef : m_users.values()) {
                usersNode.addChildNode(userDef.toDoc());
            }
        }
        return tenantNode;
    }
852502
public Unmarshaller getUnmarshaller() throws JAXBException {
    JAXBContext context = JAXBContext.newInstance(classOfT);
    Unmarshaller u = context.createUnmarshaller();
    u.setEventHandler(new ValidationEventHandler() {
      @Override
      public boolean handleEvent(ValidationEvent event) {
        return true;
      }
    });
    return u;
  }
779479
public static Document getOwnerDocument(Node n) {
    return n == null || !isElement(n) ? null : n.getNodeType() == Node.DOCUMENT_NODE
        ? n.<Document> cast() : n.getOwnerDocument();
  }
642375
private Map<String, TenantDefinition> getAllTenantDefs() {
        Map<String, TenantDefinition> tenantMap = new HashMap<>();
        Iterable<DRow> rowIter = DBService.instance().getAllRows(TENANTS_STORE_NAME);
        for (DRow row : rowIter) {
            TenantDefinition tenantDef = loadTenantDefinition(row);
            if (tenantDef != null) {
                tenantMap.put(tenantDef.getName(), tenantDef);
            }
        }
        return tenantMap;
    }
816787
public CodeBlock getInstance() {
        return CodeBlock.builder()
                .add( "new $T() {\n", ClassName.get( getMainClass() ) )
                .indent()
                .add( buildCreateMethod( getKeyClass(), key.getInstance() ) )
                .add( "\n" )
                .add( buildCreateMethod( getJsonClass(), json.getInstance() ) )
                .unindent()
                .add( "}" )
                .build();

    }
1294546
public JsonNode toJson() {
		ObjectMapper mapper = new ObjectMapper();
		ObjectNode node = mapper.createObjectNode();

		ArrayNode columnsNode = mapper.createArrayNode();
		for (DataColumn column : columns) {
			columnsNode.add(column.toJson());
		}
		ArrayNode dataNode = mapper.createArrayNode();
		for (DataRow row : rows) {
			dataNode.add(row.toJson());
		}

		node.put("columns", columnsNode);
		node.put("data", dataNode);
		node.put("overwrite", overwritePolicy.toJson());
		if (templateId != null) {
			node.put("templateId", templateId);
		}
		if (splitByColumn != null) {
			node.put("splitByColumn", splitByColumn);
		}
		return node;
	}
760913
public UNode toDoc() {
        // Root object is a MAP called "batch".
        UNode batchNode = UNode.createMapNode("batch");
        
        // Add a "docs" node as an array.
        UNode docsNode = batchNode.addArrayNode("docs");
        for (DBObject dbObj : m_dbObjList) {
            docsNode.addChildNode(dbObj.toDoc());
        }
        return batchNode;
    }
743534
public Object createMarshallableObject()
    {
        wsdlFactory = new org.xmlsoap.schemas.wsdl.ObjectFactory();
        
        // create a wsdl object
        TDefinitions TDefinitions = wsdlFactory.createTDefinitions();
        JAXBElement<TDefinitions> root = wsdlFactory.createDefinitions(TDefinitions);
        String targetNamespace = this.getNamespace();  // Location of this document
        TDefinitions.setTargetNamespace(targetNamespace);
        
        // Create the service type
            this.addService(TDefinitions);
            
          // Create the bindings type
        this.addBindingsType(TDefinitions);
        
        // Create the service type
        this.addPort(TDefinitions);
        
        // Create the service type
        this.addMessageTypes(TDefinitions);
        
        // Create the interface type
        this.addTypeTypes(TDefinitions);
        
        return root;
    }
1247162
public Object unmarshalRootElement(Node node, BaseXmlTrxMessageIn soapTrxMessage) throws Exception
    {
            // Override this! (If you can!)
        TransformerFactory tFact = TransformerFactory.newInstance();

        Source source = new DOMSource(node);
        Writer writer = new StringWriter();
        Result result = new StreamResult(writer);

        Transformer transformer = tFact.newTransformer();
        transformer.transform(source, result);

        writer.flush();
        writer.close();
        String strXMLBody = writer.toString();
        
        Reader inStream = new StringReader(strXMLBody);

        Object msg = this.unmarshalRootElement(inStream, soapTrxMessage);

        inStream.close();
        
        return msg;        
    }
693063
public JSONObject asJSONObject()
    {
        if ( entity == null ) {
            return null;
        }
        String str = asString();
        try {
            return new JSONObject( str );
        } catch ( JSONException ex ) {
            throw new CStorageException( "Error parsing the JSON response: " + str, ex );
        }
    }
202680
public Tree tree() throws ScanException, ParseException {
		consumeToken();
		AstNode t = text();
		if (token.getSymbol() == EOF) {
			if (t == null) {
				t = new AstText("");
			}
			return new Tree(t, functions, identifiers, false);
		}
		AstEval e = eval();
		if (token.getSymbol() == EOF && t == null) {
			return new Tree(e, functions, identifiers, e.isDeferred());
		}
		ArrayList<AstNode> list = new ArrayList<AstNode>();
		if (t != null) {
			list.add(t);
		}
		list.add(e);
		t = text();
		if (t != null) {
			list.add(t);
		}
		while (token.getSymbol() != EOF) {
			if (e.isDeferred()) {
				list.add(eval(true, true));
			} else {
				list.add(eval(true, false));
			}
			t = text();
			if (t != null) {
				list.add(t);
			}
		}
		return new Tree(createAstComposite(list), functions, identifiers, e.isDeferred());
	}
357276
public Tree<T> build() {
        Tree<T> result = base;
        if (null == base && treeStack.size() == 1) {
            result = treeStack.get(0);
        } else if (treeStack.size() > 0) {
            result = new TreeStack<T>(treeStack, base);
        }else if(null==base) {
            throw new IllegalArgumentException("base tree was not set");
        }

        return result;
    }
1158387
public int subtreeDepth() throws UnsupportedOperationException {
        String subtree=name;
        int i=1;

        /* strip off name@ portion */
        int atNdx = subtree.lastIndexOf('@');
        if (atNdx >= 0) {
            i++;
            subtree=subtree.substring(atNdx+1);
        }

        /* count dots in dnsname, adding one if dnsname preceded by @ */
        for (; subtree.lastIndexOf('.') >= 0; i++) {
            subtree=subtree.substring(0,subtree.lastIndexOf('.'));
        }

        return i;
    }
442210
public UNode toDoc() {
        UNode paramNode = UNode.createMapNode(m_name);
        if (!Utils.isEmpty(m_type)) {
            paramNode.addValueNode("_type", m_type);
        }
        if (m_isRequired) {
            paramNode.addValueNode("_required", Boolean.toString(m_isRequired));
        }
        if (m_parameters.size() > 0) {
            for (RESTParameter param : m_parameters) {
                paramNode.addChildNode(param.toDoc());
            }
        }
        return paramNode;
    }
699620
public Content getSerializedContent(Content serializedTreeContent) {
        HtmlTree divContent = HtmlTree.DIV(HtmlStyle.serializedFormContainer,
                serializedTreeContent);
        if (configuration.allowTag(HtmlTag.MAIN)) {
            mainTree.addContent(divContent);
            return mainTree;
        } else {
            return divContent;
        }
    }
985264
private TenantDefinition getTenantDef(String tenantName) {
        DRow tenantDefRow = DBService.instance().getRow(TENANTS_STORE_NAME, tenantName);
        if (tenantDefRow == null) {
            return null;
        }
        return loadTenantDefinition(tenantDefRow);
    }
1283790
OrderedProperty<S>[] asArray() {
        if (mOrderings == null) {
            OrderedProperty<S>[] orderings = new OrderedProperty[mSize];
            OrderingList<S> node = this;
            for (int i=mSize; --i>=0; ) {
                orderings[i] = node.mProperty;
                node = node.mParent;
            }
            mOrderings = orderings;
        }
        return mOrderings;
    }