org.apache.neethi.Assertion.isOptional()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(118)

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

Assertion.isOptional介绍

[英]Returns true if this Assertion is optional. Returns false otherwise.
[中]如果此断言是可选的,则返回true。否则返回false。

代码示例

代码示例来源:origin: apache/cxf

public List<Interceptor<? extends Message>>
getInterceptorsForAlternative(Collection<? extends Assertion> alternative,
               boolean out, boolean fault) {
  List<Interceptor<? extends Message>> interceptors = new ArrayList<>();
  for (Assertion a : alternative) {
    if (a.isOptional()) {
      continue;
    }
    QName qn = a.getName();
    interceptors.addAll(getInterceptorsForAssertion(qn, out, fault));
  }
  return interceptors;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-policy

public List<Interceptor<? extends Message>>
getInterceptorsForAlternative(Collection<? extends Assertion> alternative,
               boolean out, boolean fault) {
  List<Interceptor<? extends Message>> interceptors = new ArrayList<>();
  for (Assertion a : alternative) {
    if (a.isOptional()) {
      continue;
    }
    QName qn = a.getName();
    interceptors.addAll(getInterceptorsForAssertion(qn, out, fault));
  }
  return interceptors;
}

代码示例来源:origin: apache/cxf

/**
 * Return a collection of all assertions used in the given policy component,
 * optionally including optional assertions.
 * The policy need not be normalised, so any policy references will have to be resolved.
 * @param pc the policy component
 * @param includeOptional flag indicating if optional assertions should be included
 * @return the assertions
 */
Collection<Assertion> getAssertions(PolicyComponent pc, boolean includeOptional) {
  Collection<Assertion> assertions = new ArrayList<>();
  if (Constants.TYPE_ASSERTION == pc.getType()) {
    Assertion a = (Assertion)pc;
    if (includeOptional || !a.isOptional()) {
      assertions.add(a);
    }
  } else {
    addAssertions(pc, includeOptional, assertions);
  }
  return assertions;
}
Collection<Assertion> getAssertions(EffectivePolicy pc, boolean includeOptional) {

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-policy

/**
 * Return a collection of all assertions used in the given policy component,
 * optionally including optional assertions.
 * The policy need not be normalised, so any policy references will have to be resolved.
 * @param pc the policy component
 * @param includeOptional flag indicating if optional assertions should be included
 * @return the assertions
 */
Collection<Assertion> getAssertions(PolicyComponent pc, boolean includeOptional) {
  Collection<Assertion> assertions = new ArrayList<>();
  if (Constants.TYPE_ASSERTION == pc.getType()) {
    Assertion a = (Assertion)pc;
    if (includeOptional || !a.isOptional()) {
      assertions.add(a);
    }
  } else {
    addAssertions(pc, includeOptional, assertions);
  }
  return assertions;
}
Collection<Assertion> getAssertions(EffectivePolicy pc, boolean includeOptional) {

代码示例来源:origin: org.apache.rampart/rampart-policy

supportingToken
    .setSignedParts((SignedEncryptedParts) primitive);
supportingToken.setSignedPartsOptional(primitive.isOptional());
supportingToken.setSignedElementsOptional(primitive.isOptional());
supportingToken.setEncryptedPartsOptional(primitive.isOptional());
supportingToken.setEncryptedElementsOptional(primitive.isOptional());

代码示例来源:origin: apache/cxf

Collection<Assertion> getAssertions(EffectivePolicy pc, boolean includeOptional) {
  if (pc == null || pc.getChosenAlternative() == null) {
    return null;
  }
  Collection<Assertion> assertions = new ArrayList<>();
  for (Assertion assertion : pc.getChosenAlternative()) {
    if (Constants.TYPE_ASSERTION == assertion.getType()) {
      if (includeOptional || !assertion.isOptional()) {
        assertions.add(assertion);
      }
    } else {
      addAssertions(assertion, includeOptional, assertions);
    }
  }
  return assertions;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-policy

Collection<Assertion> getAssertions(EffectivePolicy pc, boolean includeOptional) {
  if (pc == null || pc.getChosenAlternative() == null) {
    return null;
  }
  Collection<Assertion> assertions = new ArrayList<>();
  for (Assertion assertion : pc.getChosenAlternative()) {
    if (Constants.TYPE_ASSERTION == assertion.getType()) {
      if (includeOptional || !assertion.isOptional()) {
        assertions.add(assertion);
      }
    } else {
      addAssertions(assertion, includeOptional, assertions);
    }
  }
  return assertions;
}

代码示例来源:origin: org.apache.rampart/rampart-policy

asymmetricBinding.setIncludeTimestampOptional(assertion.isOptional());

代码示例来源:origin: org.apache.rampart/rampart-policy

asymmetricBinding.setIncludeTimestampOptional(assertion.isOptional());

代码示例来源:origin: apache/cxf

protected void unassertPolicy(Assertion assertion, Exception reason) {
  if (assertion == null) {
    return;
  }
  if (LOG.isLoggable(Level.FINE)) {
    LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " + reason);
  }
  AssertionInfoMap aim = message.get(AssertionInfoMap.class);
  Collection<AssertionInfo> ais = aim.get(assertion.getName());
  if (ais != null) {
    for (AssertionInfo ai : ais) {
      if (ai.getAssertion() == assertion) {
        ai.setNotAsserted(reason.getMessage());
      }
    }
  }
  if (!assertion.isOptional()) {
    throw new PolicyException(new Message(reason.getMessage(), LOG), reason);
  }
}

代码示例来源:origin: apache/cxf

buf.append(" ");
buf.append(((Assertion)pc).getName());
if (((Assertion)pc).isOptional()) {
  buf.append(" (optional)");

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-security

protected void unassertPolicy(Assertion assertion, Exception reason) {
  if (assertion == null) {
    return;
  }
  if (LOG.isLoggable(Level.FINE)) {
    LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " + reason);
  }
  AssertionInfoMap aim = message.get(AssertionInfoMap.class);
  Collection<AssertionInfo> ais = aim.get(assertion.getName());
  if (ais != null) {
    for (AssertionInfo ai : ais) {
      if (ai.getAssertion() == assertion) {
        ai.setNotAsserted(reason.getMessage());
      }
    }
  }
  if (!assertion.isOptional()) {
    throw new PolicyException(new Message(reason.getMessage(), LOG), reason);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-policy

buf.append(" ");
buf.append(((Assertion)pc).getName());
if (((Assertion)pc).isOptional()) {
  buf.append(" (optional)");

代码示例来源:origin: apache/cxf

void addAssertions(PolicyComponent pc, boolean includeOptional,
          Collection<Assertion> assertions) {
  if (Constants.TYPE_ASSERTION == pc.getType()) {
    Assertion a = (Assertion)pc;
    if (includeOptional || !a.isOptional()) {
      assertions.add((Assertion)pc);
    }
    return;
  }
  if (Constants.TYPE_POLICY_REF == pc.getType()) {
    PolicyReference pr = (PolicyReference)pc;
    pc = pr.normalize(registry, false);
  }
  PolicyOperator po = (PolicyOperator)pc;
  List<PolicyComponent> pcs = CastUtils.cast(po.getPolicyComponents(), PolicyComponent.class);
  for (PolicyComponent child : pcs) {
    addAssertions(child, includeOptional, assertions);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-policy

void addAssertions(PolicyComponent pc, boolean includeOptional,
          Collection<Assertion> assertions) {
  if (Constants.TYPE_ASSERTION == pc.getType()) {
    Assertion a = (Assertion)pc;
    if (includeOptional || !a.isOptional()) {
      assertions.add((Assertion)pc);
    }
    return;
  }
  if (Constants.TYPE_POLICY_REF == pc.getType()) {
    PolicyReference pr = (PolicyReference)pc;
    pc = pr.normalize(registry, false);
  }
  PolicyOperator po = (PolicyOperator)pc;
  List<PolicyComponent> pcs = CastUtils.cast(po.getPolicyComponents(), PolicyComponent.class);
  for (PolicyComponent child : pcs) {
    addAssertions(child, includeOptional, assertions);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-policy

if (pc instanceof Assertion) {
  Assertion a = (Assertion)pc;
  if (!a.isOptional()) {
    if (null != assertor && assertor.canAssert(a.getName())) {
      continue;

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-security

protected void unassertPolicy(Assertion assertion, String reason) {
  if (assertion == null) {
    return;
  }
  if (LOG.isLoggable(Level.FINE)) {
    LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " + reason);
  }
  AssertionInfoMap aim = message.get(AssertionInfoMap.class);
  Collection<AssertionInfo> ais = aim.get(assertion.getName());
  if (ais != null) {
    for (AssertionInfo ai : ais) {
      if (ai.getAssertion() == assertion) {
        ai.setNotAsserted(reason);
      }
    }
  }
  if (!assertion.isOptional()) {
    throw new PolicyException(new Message(reason, LOG));
  }
}

代码示例来源:origin: apache/cxf

protected void unassertPolicy(Assertion assertion, String reason) {
  if (assertion == null) {
    return;
  }
  if (LOG.isLoggable(Level.FINE)) {
    LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " + reason);
  }
  AssertionInfoMap aim = message.get(AssertionInfoMap.class);
  Collection<AssertionInfo> ais = aim.get(assertion.getName());
  if (ais != null) {
    for (AssertionInfo ai : ais) {
      if (ai.getAssertion() == assertion) {
        ai.setNotAsserted(reason);
      }
    }
  }
  if (!assertion.isOptional()) {
    throw new PolicyException(new Message(reason, LOG));
  }
}

代码示例来源:origin: apache/cxf

if (ai.getAssertion().equal(ass) || ai.getAssertion().equals(ass)) {
  found = true;
  if (!ai.isAsserted() && !ass.isOptional()) {
    errors.add(ass.getName());
    pass = false;

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-policy

if (ai.getAssertion().equal(ass) || ai.getAssertion().equals(ass)) {
  found = true;
  if (!ai.isAsserted() && !ass.isOptional()) {
    errors.add(ass.getName());
    pass = false;

相关文章