org.apereo.portal.xml.XmlUtilitiesImpl.toString()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.apereo.portal.xml.XmlUtilitiesImpl.toString()方法的一些代码示例,展示了XmlUtilitiesImpl.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlUtilitiesImpl.toString()方法的具体详情如下:
包路径:org.apereo.portal.xml.XmlUtilitiesImpl
类名称:XmlUtilitiesImpl
方法名:toString

XmlUtilitiesImpl.toString介绍

暂无

代码示例

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

public void track(List<NodeInfo> order, Element compViewParent, Element positionSet) {
    ++count;
    if (count > MAX_NUMBER) {
      final String msg = "Maximum number of NodeInfo objects for this layout exceeded";
      logger.error(msg);
      logger.error("count=" + count);
      logger.error("order=" + order);
      logger.error("compViewParent=" + XmlUtilitiesImpl.toString(compViewParent));
      logger.error("positionSet=" + XmlUtilitiesImpl.toString(positionSet));
      throw new RuntimeException(msg);
    }
  }
}

代码示例来源:origin: Jasig/uPortal

private String loadAttribute(String name, NamedNodeMap atts, boolean required, Element e) {
  Node att = atts.getNamedItem(name);
  if (required && (att == null || att.getNodeValue().equals("")))
    throw new RuntimeException(
        "Missing or empty attribute '"
            + name
            + "' required by <fragment> in\n'"
            + XmlUtilitiesImpl.toString(e)
            + "'");
  if (att == null) return null;
  return att.getNodeValue();
}

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

private Evaluator createProfileEvaluator(Node n) {
  NamedNodeMap attribs = n.getAttributes();
  Node attribNode = attribs.getNamedItem("fname");
  if (attribNode == null || attribNode.getNodeValue().equals(""))
    throw new RuntimeException(
        "Missing or empty value attribute in '" + XmlUtilitiesImpl.toString(n) + "'");
  String value = attribNode.getNodeValue();
  Evaluator eval = null;
  try {
    eval = getProfileEvaluator(value);
  } catch (Exception e) {
    throw new RuntimeException(e.getMessage() + " in '" + XmlUtilitiesImpl.toString(n), e);
  }
  return eval;
}

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

private Evaluator getGroupEvaluator(int type, Node node) {
  NodeList nodes = node.getChildNodes();
  Evaluator container = null;
  if (nodes == null
      || nodes.getLength() == 0
      || (container = createGroupEvaluator(type, nodes)) == null) {
    throw new RuntimeException(
        "Invalid content. Expected one to many "
            + "<paren>, <NOT>, or <attribute> in '"
            + XmlUtilitiesImpl.toString(node)
            + "'");
  }
  return container;
}

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

private Evaluator getGroupEvaluator(int type, Node node) {
  NodeList nodes = node.getChildNodes();
  Evaluator container = null;
  if (nodes == null
      || nodes.getLength() == 0
      || (container = createGroupEvaluator(type, nodes)) == null) {
    throw new RuntimeException(
        "Invalid content. Expected one to many "
            + "<paren>, <NOT>, or <attribute> in '"
            + XmlUtilitiesImpl.toString(node)
            + "'");
  }
  return container;
}

代码示例来源:origin: Jasig/uPortal

private void addEvaluator(EvaluatorFactory factory, Node audience) {
  Evaluator evaluator = factory.getEvaluator(audience);
  if (evaluator == null)
    throw new RuntimeException(
        "Evaluator factory '"
            + factory.getClass().getName()
            + "' failed to "
            + "return an evaluator for 'audience' element"
            + " in\n'"
            + XmlUtilitiesImpl.toString(audience)
            + "'");
  if (evaluators == null) {
    evaluators = new LinkedList<Evaluator>();
  }
  evaluators.add(evaluator);
}

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

private Evaluator createAttributeEvaluator(Node n) {
  NamedNodeMap attribs = n.getAttributes();
  Node attribNode = attribs.getNamedItem("name");
  if (attribNode == null || attribNode.getNodeValue().equals(""))
    throw new RuntimeException(
        "Missing or empty name attribute in '" + XmlUtilitiesImpl.toString(n) + "'");
  String name = attribNode.getNodeValue();
  String value = null;
  attribNode = attribs.getNamedItem("value");
  if (attribNode != null) value = attribNode.getNodeValue();
  attribNode = attribs.getNamedItem("mode");
  if (attribNode == null || attribNode.getNodeValue().equals(""))
    throw new RuntimeException(
        "Missing or empty mode attribute in '" + XmlUtilitiesImpl.toString(n) + "'");
  String mode = attribNode.getNodeValue();
  Evaluator eval = null;
  try {
    eval = getAttributeEvaluator(name, mode, value);
  } catch (Exception e) {
    throw new RuntimeException(e.getMessage() + " in '" + XmlUtilitiesImpl.toString(n), e);
  }
  return eval;
}

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

private Evaluator createEvaluator(Node node) {
  String nodeName = node.getNodeName();
  if (nodeName.equals("paren")) return createParen(node);
  else if (nodeName.equals("profile")) return createProfileEvaluator(node);
  throw new RuntimeException(
      "Unrecognized element '"
          + nodeName
          + "' in '"
          + XmlUtilitiesImpl.toString(node)
          + "'");
}

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

private Evaluator createEvaluator(Node node) {
  String nodeName = node.getNodeName();
  if (nodeName.equals("paren")) return createParen(node);
  else if (nodeName.equals("attribute")) return createAttributeEvaluator(node);
  throw new RuntimeException(
      "Unrecognized element '"
          + nodeName
          + "' in '"
          + XmlUtilitiesImpl.toString(node)
          + "'");
}

代码示例来源:origin: org.jasig.portal/uPortal-rendering

@Override
protected XMLEvent filterEvent(XMLEvent event, boolean peek) {
  if (logEvents && logger.isDebugEnabled()) {
    if (peek) {
      logger.debug("Peek: " + XmlUtilitiesImpl.toString(event));
    } else {
      logger.debug("Read: " + XmlUtilitiesImpl.toString(event));
    }
  }
  if (logFullDocument && logger.isDebugEnabled()) {
    eventBuffer.add(event);
    if (event.isEndDocument()) {
      final String xmlOutput =
          xmlUtilities.serializeXMLEvents(eventBuffer, logFullDocumentAsHtml);
      logger.debug(stepIdentifier + "\n" + xmlOutput);
    }
  }
  return event;
}

代码示例来源:origin: Jasig/uPortal

@Override
protected XMLEvent filterEvent(XMLEvent event, boolean peek) {
  if (logEvents && logger.isDebugEnabled()) {
    if (peek) {
      logger.debug("Peek: " + XmlUtilitiesImpl.toString(event));
    } else {
      logger.debug("Read: " + XmlUtilitiesImpl.toString(event));
    }
  }
  if (logFullDocument && logger.isDebugEnabled()) {
    eventBuffer.add(event);
    if (event.isEndDocument()) {
      final String xmlOutput =
          xmlUtilities.serializeXMLEvents(eventBuffer, logFullDocumentAsHtml);
      logger.debug(stepIdentifier + "\n" + xmlOutput);
    }
  }
  return event;
}

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

private Evaluator createParen(Node n) {
  NamedNodeMap attribs = n.getAttributes();
  Node opNode = attribs.getNamedItem("mode");
  if (opNode == null)
    throw new RuntimeException(
        "Invalid mode. Expected 'AND','OR', or 'NOT'"
            + " in '"
            + XmlUtilitiesImpl.toString(n)
            + "'");
  else if (opNode.getNodeValue().equals("OR")) return getGroupEvaluator(OR, n);
  else if (opNode.getNodeValue().equals("NOT")) return getGroupEvaluator(NOT, n);
  else if (opNode.getNodeValue().equals("AND")) return getGroupEvaluator(AND, n);
  else
    throw new RuntimeException(
        "Invalid mode. Expected 'AND','OR', or 'NOT'"
            + " in '"
            + XmlUtilitiesImpl.toString(n)
            + "'");
}

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

private Evaluator createParen(Node n) {
  NamedNodeMap attribs = n.getAttributes();
  Node opNode = attribs.getNamedItem("mode");
  if (opNode == null)
    throw new RuntimeException(
        "Invalid mode. Expected 'AND','OR', or 'NOT'"
            + " in '"
            + XmlUtilitiesImpl.toString(n)
            + "'");
  else if (opNode.getNodeValue().equals("OR")) return getGroupEvaluator(OR, n);
  else if (opNode.getNodeValue().equals("NOT")) return getGroupEvaluator(NOT, n);
  else if (opNode.getNodeValue().equals("AND")) return getGroupEvaluator(AND, n);
  else
    throw new RuntimeException(
        "Invalid mode. Expected 'AND','OR', or 'NOT'"
            + " in '"
            + XmlUtilitiesImpl.toString(n)
            + "'");
}

代码示例来源:origin: Jasig/uPortal

private void loadAudienceEvaluators(NodeList nodes) {
  final String evaluatorFactoryAtt = "evaluatorFactory";
  for (int i = 0; i < nodes.getLength(); i++) {
    Node audience = nodes.item(i);
    NamedNodeMap atts = audience.getAttributes();
    Node att = atts.getNamedItem(evaluatorFactoryAtt);
    if (att == null || att.getNodeValue().equals(""))
      throw new RuntimeException(
          "Required attibute '"
              + evaluatorFactoryAtt
              + "' "
              + "is missing or empty on 'audience' "
              + " element in\n'"
              + XmlUtilitiesImpl.toString(audience)
              + "'");
    String className = att.getNodeValue();
    /*
     * For version 5.0, all uPortal sources were repackaged from 'org.jasig.portal'
     * to 'org.apereo.portal'.  *.fragment-definition.xml files exported from earlier
     * versions of uPortal will contain the old evaluatorFactory name.  We can detect
     * that and intervene here.
     */
    className = className.replace("org.jasig.portal", "org.apereo.portal");
    EvaluatorFactory factory = loadEvaluatorFactory(className, audience);
    addEvaluator(factory, audience);
  }
}

代码示例来源:origin: org.jasig.portal/uPortal-rendering

new Object[] {
  beanName,
  XmlUtilitiesImpl.toString(attribute),
  XmlUtilitiesImpl.toString(event)
});

代码示例来源:origin: Jasig/uPortal

new Object[] {
  beanName,
  XmlUtilitiesImpl.toString(attribute),
  XmlUtilitiesImpl.toString(event)
});

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

/**
 * Creates a composite ILF (incorporated layouts fragment) by first using the applicable
 * fragment layouts, then merging in the PLF (personal layout fragment).
 */
private Document createCompositeILF(
    final IPerson person,
    final Document PLF,
    final List<Document> applicableLayouts,
    final IntegrationResult integrationResult) {
  final Document ILF = ILFBuilder.constructILF(PLF, applicableLayouts, person);
  PLFIntegrator.mergePLFintoILF(PLF, ILF, integrationResult);
  if (logger.isDebugEnabled()) {
    logger.debug(
        "PLF for {} after MERGING\n{}",
        person.getAttribute(IPerson.USERNAME),
        XmlUtilitiesImpl.toString(PLF));
    logger.debug(
        "ILF for {} after MERGING\n{}",
        person.getAttribute(IPerson.USERNAME),
        XmlUtilitiesImpl.toString(ILF));
  }
  return ILF;
}

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

private Document getPLF(final IPerson person, final IUserProfile profile) {
  Document PLF = (Document) person.getAttribute(Constants.PLF);
  if (null == PLF) {
    PLF = this._safeGetUserLayout(person, profile);
    person.setAttribute(Constants.PLF, PLF);
  }
  if (logger.isDebugEnabled()) {
    logger.debug(
        "PLF for {} immediately after loading\n{}",
        person.getAttribute(IPerson.USERNAME),
        XmlUtilitiesImpl.toString(PLF));
  }
  return PLF;
}

代码示例来源:origin: Jasig/uPortal

public void loadFromEelement(Element e) {
  final boolean REQUIRED = true;
  final boolean NOT_REQUIRED = false;
  NamedNodeMap atts = e.getAttributes();
  this.ownerID = loadAttribute("ownerID", atts, REQUIRED, e);
  this.defaultLayoutOwnerID = loadAttribute("defaultLayoutOwnerID", atts, NOT_REQUIRED, e);
  this.description = loadAttribute("description", atts, NOT_REQUIRED, e);
  String precedence = loadAttribute("precedence", atts, REQUIRED, e);
  try {
    this.precedence = Double.valueOf(precedence).doubleValue();
  } catch (NumberFormatException nfe) {
    throw new RuntimeException(
        "Invalid format for precedence attribute "
            + "of <fragment> in\n'"
            + XmlUtilitiesImpl.toString(e),
        nfe);
  }
  // Audience Evaluators.
  // NB:  We're about to re-parse the complete set of evaluators,
  // so we need to remove any that are already present.
  if (this.evaluators != null) {
    this.evaluators.clear();
  }
  loadAudienceEvaluators(e.getElementsByTagName("dlm:audience"));
}

代码示例来源:origin: org.jasig.portal/uPortal-layout-impl

/**
 * This method overrides the same method in the super class to persist only layout information
 * stored in the user's person layout fragment or PLF. If fragment cache update is requested
 * then it checks to see if this person is a layout owner and if so then their changes are
 * pushed into the appropriate layout fragment.
 */
@Override
public void setUserLayout(
    IPerson person,
    IUserProfile profile,
    Document layoutXML,
    boolean channelsAdded,
    boolean updateFragmentCache) {
  final Document plf = (Document) person.getAttribute(Constants.PLF);
  if (logger.isDebugEnabled()) {
    logger.debug(
        "PLF for {}\n{}",
        person.getAttribute(IPerson.USERNAME),
        XmlUtilitiesImpl.toString(plf));
  }
  super.setUserLayout(person, profile, plf, channelsAdded);
  if (updateFragmentCache) {
    final FragmentDefinition fragment =
        this.fragmentUtils.getFragmentDefinitionByOwner(person);
    if (fragment != null) {
      this.updateCachedLayout(plf, profile, fragment);
    }
  }
}

相关文章