Tabnine Logo
UNode.addMapNode
Code IndexAdd Tabnine to your IDE (free)

How to use
addMapNode
method
in
com.dell.doradus.common.UNode

Best Java code snippets using com.dell.doradus.common.UNode.addMapNode (Showing top 20 results out of 315)

origin: com.dell.doradus/doradus-common

/**
 * Serialize this RESTCatalog into a UNode tree and return the root node. The UNode
 * tree can be serialized into into JSON or XML using {@link UNode#toJSON()} or
 * {@link UNode#toXML()}.
 * 
 * @return  Root node of the serialized {@link UNode} tree.
 */
public UNode toUNode() {
  UNode rootNode = UNode.createMapNode("commands");
  for (String ownerName : m_cmdsByOwnerMap.keySet()) {
    Map<String, RESTCommand> ownerMap = m_cmdsByOwnerMap.get(ownerName);
    UNode ownerNode = rootNode.addMapNode(ownerName);
    for (String cmdName : ownerMap.keySet()) {
      RESTCommand cmd = ownerMap.get(cmdName);
      ownerNode.addChildNode(cmd.toDoc());
    }
  }
  return rootNode;
}

origin: QSFT/Doradus

/**
 * 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.
 */
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;
}   // toDoc

origin: QSFT/Doradus

/**
 * Serialize this RESTCatalog into a UNode tree and return the root node. The UNode
 * tree can be serialized into into JSON or XML using {@link UNode#toJSON()} or
 * {@link UNode#toXML()}.
 * 
 * @return  Root node of the serialized {@link UNode} tree.
 */
public UNode toUNode() {
  UNode rootNode = UNode.createMapNode("commands");
  for (String ownerName : m_cmdsByOwnerMap.keySet()) {
    Map<String, RESTCommand> ownerMap = m_cmdsByOwnerMap.get(ownerName);
    UNode ownerNode = rootNode.addMapNode(ownerName, "owner");
    for (String cmdName : ownerMap.keySet()) {
      RESTCommand cmd = ownerMap.get(cmdName);
      ownerNode.addChildNode(cmd.toDoc());
    }
  }
  return rootNode;
}

origin: QSFT/Doradus

@Override
public UNode invokeUNodeOut() {
  UNode rootNode = UNode.createMapNode("active-tenants");
  SortedMap<String, SortedMap<String, Object>> tenantInfoMap = DBManagerService.instance().getActiveTenantInfo();
  for (String tenantName : tenantInfoMap.keySet()) {
    UNode tenantNode = rootNode.addMapNode(tenantName, "tenant");
    SortedMap<String, Object> tenantParamMap = tenantInfoMap.get(tenantName);
    for (String paramName : tenantParamMap.keySet()) {
      Object paramValue = tenantParamMap.get(paramName);
      if (paramName.contains("password") || paramName.contains("secret")) {
        paramValue = "*****";
      } else if (paramValue == null) {
        paramValue = "";
      }
      tenantNode.addValueNode(paramName, paramValue.toString(), "param");
    }
  }
  return rootNode;
}
origin: com.dell.doradus/doradus-common

/**
 * 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.
 */
public UNode toDoc() {
  UNode tenantNode = UNode.createMapNode(m_name, "tenant");
  if (m_options.size() > 0) {
    UNode optsNode = tenantNode.addMapNode("options");
    for (Map.Entry<String, String> mapEntry : m_options.entrySet()) {
      optsNode.addValueNode(mapEntry.getKey(), mapEntry.getValue(), "option");
    }
  }
  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;
}   // toDoc

origin: QSFT/Doradus

private void leafFieldtoDoc(UNode parentNode, String fieldName) {
  assert parentNode != null;
  
  Set<String> addSet = null;
  if (m_valueMap.containsKey(fieldName)) {
    addSet = new TreeSet<String>(m_valueMap.get(fieldName));
  }
  List<String> removeSet = m_valueRemoveMap.get(fieldName);
  if (addSet != null && addSet.size() == 1 && removeSet == null) {
    parentNode.addValueNode(fieldName, addSet.iterator().next(), "field");
  } else {
    UNode fieldNode = parentNode.addMapNode(fieldName, "field");
    if (addSet != null && addSet.size() > 0) {
      UNode addNode = fieldNode.addArrayNode("add");
      for (String value : addSet) {
        addNode.addValueNode("value", value);
      }
    }
    if (removeSet != null && removeSet.size() > 0) {
      UNode addNode = fieldNode.addArrayNode("remove");
      for (String value : removeSet) {
        addNode.addValueNode("value", value);
      }
    }
  }
}   // leafFieldtoDoc
 
origin: com.dell.doradus/doradus-common

private void leafFieldtoDoc(UNode parentNode, String fieldName) {
  assert parentNode != null;
  
  Set<String> addSet = null;
  if (m_valueMap.containsKey(fieldName)) {
    addSet = new TreeSet<String>(m_valueMap.get(fieldName));
  }
  List<String> removeSet = m_valueRemoveMap.get(fieldName);
  if (addSet != null && addSet.size() == 1 && removeSet == null) {
    parentNode.addValueNode(fieldName, addSet.iterator().next(), "field");
  } else {
    UNode fieldNode = parentNode.addMapNode(fieldName, "field");
    if (addSet != null && addSet.size() > 0) {
      UNode addNode = fieldNode.addArrayNode("add");
      for (String value : addSet) {
        addNode.addValueNode("value", value);
      }
    }
    if (removeSet != null && removeSet.size() > 0) {
      UNode addNode = fieldNode.addArrayNode("remove");
      for (String value : removeSet) {
        addNode.addValueNode("value", value);
      }
    }
  }
}   // leafFieldtoDoc
 
origin: com.dell.doradus/doradus-common

UNode optsNode = appNode.addMapNode("options");
for (String optName : m_optionMap.keySet()) {
  if (!optName.equals(CommonDefs.OPT_TENANT)) {    // don't include for now
UNode tablesNode = appNode.addMapNode("tables");
for (TableDefinition tableDef : m_tableMap.values()) {
  tablesNode.addChildNode(tableDef.toDoc());
origin: com.dell.doradus/doradus-server

@Override
public UNode invokeUNodeOut() {
  UNode rootNode = UNode.createMapNode("configuration");
  String version = DoradusServer.getDoradusVersion();
  if (!Utils.isEmpty(version)) {
    rootNode.addValueNode("version", version);
  }
  String[] args = ServerConfig.commandLineArgs;
  if (args != null) { 
    UNode cmdlineArgsNode = rootNode.addMapNode("command-line-args");
    for (int inx = 0; inx < args.length; inx++) {
      String name = args[inx].substring(1);
      String value = args[++inx];
      cmdlineArgsNode.addValueNode(name, value, "arg");
    }
  }
  Map<String, Object> serverConfigMap = new TreeMap<>(ServerConfig.getInstance().toMap());
  if (serverConfigMap != null) { 
    UNode propsNode = rootNode.addMapNode("server-params");
    for (String key : serverConfigMap.keySet()) {
      String value = key.contains("password") ? "*****": "" + serverConfigMap.get(key);
      if (value != null) {
        propsNode.addValueNode(key, value, "param");
      }
    }
  }
    return rootNode;
}   // invokeUNodeOut	
origin: QSFT/Doradus

private void groupFieldtoDoc(UNode                parentNode,
               FieldDefinition      groupFieldDef,
               Set<FieldDefinition> deferredFields) {
  // Prerequisities:
  assert parentNode != null;
  assert groupFieldDef != null && groupFieldDef.isGroupField();
  assert deferredFields != null && deferredFields.size() > 0;
  
  UNode groupNode = parentNode.addMapNode(groupFieldDef.getName(), "field");
  for (FieldDefinition nestedFieldDef : groupFieldDef.getNestedFields()) {
    if (!deferredFields.contains(nestedFieldDef)) {
      continue;
    }
    if (nestedFieldDef.isGroupField()) {
      groupFieldtoDoc(groupNode, nestedFieldDef, deferredFields);
    } else {
      leafFieldtoDoc(groupNode, nestedFieldDef.getName());
    }
  }
}   // groupFieldtoDoc
origin: com.dell.doradus/doradus-common

private void groupFieldtoDoc(UNode                parentNode,
               FieldDefinition      groupFieldDef,
               Set<FieldDefinition> deferredFields) {
  // Prerequisities:
  assert parentNode != null;
  assert groupFieldDef != null && groupFieldDef.isGroupField();
  assert deferredFields != null && deferredFields.size() > 0;
  
  UNode groupNode = parentNode.addMapNode(groupFieldDef.getName(), "field");
  for (FieldDefinition nestedFieldDef : groupFieldDef.getNestedFields()) {
    if (!deferredFields.contains(nestedFieldDef)) {
      continue;
    }
    if (nestedFieldDef.isGroupField()) {
      groupFieldtoDoc(groupNode, nestedFieldDef, deferredFields);
    } else {
      leafFieldtoDoc(groupNode, nestedFieldDef.getName());
    }
  }
}   // groupFieldtoDoc
origin: QSFT/Doradus

public UNode toUNode() {
  UNode result = UNode.createMapNode("results");
  result.addValueNode("total", "" + totalCount);
  result.addValueNode("groupsCount", "" + groupsCount);
  UNode groupsNode = result.addArrayNode("groups");
  for (GroupCount group : groups) {
    UNode groupNode = groupsNode.addMapNode("group");
    groupNode.addValueNode("name", group.name);
    groupNode.addValueNode("count", "" + group.count);
  }
  return result;
}
 
origin: com.dell.doradus/doradus-server

public UNode toUNode() {
  UNode result = UNode.createMapNode("results");
  result.addValueNode("total", "" + totalCount);
  result.addValueNode("groupsCount", "" + groupsCount);
  UNode groupsNode = result.addArrayNode("groups");
  for (GroupCount group : groups) {
    UNode groupNode = groupsNode.addMapNode("group");
    groupNode.addValueNode("name", group.name);
    groupNode.addValueNode("count", "" + group.count);
  }
  return result;
}
 
origin: QSFT/Doradus

@Override
public UNode invokeUNodeOut() {
  ApplicationDefinition appDef = m_request.getAppDef();
  
  // "result": {"<app name>": {"shards": [*<shard name>]}}
  UNode resultNode = UNode.createMapNode("result");
  UNode appNode = resultNode.addMapNode(appDef.getAppName(), "application");
  UNode shardsNode = appNode.addArrayNode("shards");
  for (String shard : OLAPService.instance().listShards(appDef)) {
    shardsNode.addValueNode("value", shard);
  }
  return resultNode;
}   // invokeUNodeOut
origin: com.dell.doradus/doradus-server

@Override
public UNode invokeUNodeOut() {
  ApplicationDefinition appDef = m_request.getAppDef();
  
  // "result": {"<app name>": {"shards": [*<shard name>]}}
  UNode resultNode = UNode.createMapNode("result");
  UNode appNode = resultNode.addMapNode(appDef.getAppName(), "application");
  UNode shardsNode = appNode.addArrayNode("shards");
  for (String shard : OLAPService.instance().listShards(appDef)) {
    shardsNode.addValueNode("value", shard);
  }
  return resultNode;
}   // invokeUNodeOut
origin: QSFT/Doradus

@Override
public UNode invokeUNodeOut() {
  UNode rootNode = UNode.createMapNode("tenants");
  for (Tenant tenant : TenantService.instance().getTenants()) {
    UNode tenantNode = rootNode.addMapNode(tenant.getName(), "tenant");
    UNode appNode = tenantNode.addArrayNode("applications");
    try {
      for (ApplicationDefinition appDef : SchemaService.instance().getAllApplications(tenant)) {
        appNode.addValueNode("value", appDef.getAppName());
      }
    } catch (Throwable e) {
      appNode.addValueNode("value", ">>>Error: Unable to list applications: " + e.toString());
    }
  }
  return rootNode;
}
origin: QSFT/Doradus

private void addDoc(UNode parentNode) {
  UNode groupNode = parentNode.addMapNode("group");
origin: com.dell.doradus/doradus-server

@Override
public UNode invokeUNodeOut() {
  UNode rootNode = UNode.createMapNode("tenants");
  for (Tenant tenant : TenantService.instance().getTenants()) {
    UNode tenantNode = rootNode.addMapNode(stripQuotes(tenant.getKeyspace()), "tenant");
    UNode appNode = tenantNode.addArrayNode("applications");
    for (ApplicationDefinition appDef : SchemaService.instance().getAllApplications(tenant)) {
      appNode.addValueNode("value", appDef.getAppName());
    }
  }
  return rootNode;
}
origin: com.dell.doradus/doradus-common

UNode paramsNode = rootNode.addMapNode("parameters");
for (RESTParameter param : m_parameters) {
  paramsNode.addChildNode(param.toDoc());
origin: QSFT/Doradus

UNode paramsNode = rootNode.addMapNode("parameters");
for (RESTParameter param : m_parameters) {
  paramsNode.addChildNode(param.toDoc());
com.dell.doradus.commonUNodeaddMapNode

Javadoc

Create a new MAP node with the given name and add it as a child of this node. This node must be a MAP or ARRAY. This is a convenience method that calls UNode#createMapNode(String) and then #addChildNode(UNode).

Popular methods of UNode

  • getMember
    Get the child node (member) of this UNode with the given name. If this UNode isn't a MAP or there is
  • getMemberList
    Get the list of child nodes of this collection UNode as an Iterable UNode object. The UNode must be
  • getName
    Get this node's name. All nodes have a name.
  • getValue
    Get this node's value. Only UNode.NodeType#VALUE nodes have a value.
  • isCollection
    Return true if this UNode's type is UNode.NodeType#ARRAY or UNode.NodeType#MAP.
  • isValue
    Return true if this UNode's type is UNode.NodeType#VALUE.
  • parseJSON
    Parse the given JSON text and return the appropriate UNode object. The only JSON documents we allow
  • parseXML
    Parse the given XML text and return the appropriate UNode object. The UNode returned is a MAP whose
  • toJSON
    Convert the DOM tree rooted at this UNode into a JSON document. Optionally format the text with inde
  • toXML
    Convert the DOM tree rooted at this UNode into an XML document, optionally indenting each XML level
  • addArrayNode
    Create a new ARRAY node with the given name and tag name and add it as a child of this node. This no
  • addChildNode
    Add the given child node to this node, which must be a MAP or ARRAY. If this node is a MAP, the name
  • addArrayNode,
  • addChildNode,
  • addValueNode,
  • createArrayNode,
  • createMapNode,
  • getMemberNames,
  • isArray,
  • isMap,
  • parse

Popular in Java

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • getResourceAsStream (ClassLoader)
  • getSharedPreferences (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • JList (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now