eu.europa.esig.dss.utils.Utils.isCollectionNotEmpty()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(158)

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

Utils.isCollectionNotEmpty介绍

暂无

代码示例

代码示例来源:origin: esig/dss

@Override
protected boolean process() {
  return Utils.isCollectionNotEmpty(trustServicesAtTime);
}

代码示例来源:origin: esig/dss

private List<String> getOidValues(List<? extends XmlOID> xmlOids) {
  List<String> result = new ArrayList<String>();
  if (Utils.isCollectionNotEmpty(xmlOids)) {
    for (XmlOID xmlOID : xmlOids) {
      result.add(xmlOID.getValue());
    }
  }
  return result;
}

代码示例来源:origin: esig/dss

public boolean hasTrustedServices() {
  List<XmlTrustedServiceProvider> tsps = certificate.getTrustedServiceProviders();
  return Utils.isCollectionNotEmpty(tsps);
}

代码示例来源:origin: esig/dss

public List<String> getCommitmentTypeIdentifiers() {
  List<String> commitmentTypeIndications = signature.getCommitmentTypeIndication();
  if (Utils.isCollectionNotEmpty(commitmentTypeIndications)) {
    return commitmentTypeIndications;
  }
  return Collections.emptyList();
}

代码示例来源:origin: esig/dss

public XmlChainItem getLastChainCertificate() {
  List<XmlChainItem> certificateChain = getCurrentCertificateChain();
  if (Utils.isCollectionNotEmpty(certificateChain)) {
    XmlChainItem lastItem = certificateChain.get(certificateChain.size() - 1);
    return lastItem;
  }
  return null;
}

代码示例来源:origin: esig/dss

public XmlChainItem getFirstChainCertificate() {
  List<XmlChainItem> certificateChain = getCurrentCertificateChain();
  if (Utils.isCollectionNotEmpty(certificateChain)) {
    return certificateChain.get(0);
  }
  return null;
}

代码示例来源:origin: esig/dss

public List<TimestampWrapper> getTimestampList() {
  List<TimestampWrapper> tsps = new ArrayList<TimestampWrapper>();
  List<XmlTimestamp> timestamps = signature.getTimestamps();
  if (Utils.isCollectionNotEmpty(timestamps)) {
    for (XmlTimestamp timestamp : timestamps) {
      tsps.add(new TimestampWrapper(timestamp));
    }
  }
  return tsps;
}

代码示例来源:origin: esig/dss

protected boolean processValueCheck(String value) {
  List<String> expecteds = constraint.getId();
  if (Utils.isStringNotEmpty(value) && Utils.isCollectionNotEmpty(expecteds)) {
    if (expecteds.contains(ALL_VALUE)) {
      return true;
    } else if (expecteds.contains(value)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: esig/dss

public List<String> getCertifiedRoles() {
  List<String> result = new ArrayList<String>();
  List<XmlCertifiedRole> certifiedRoles = signature.getCertifiedRoles();
  if (Utils.isCollectionNotEmpty(certifiedRoles)) {
    for (XmlCertifiedRole certifiedRole : certifiedRoles) {
      result.add(certifiedRole.getCertifiedRole());
    }
  }
  return result;
}

代码示例来源:origin: esig/dss

private static boolean hasQCTypeOID(CertificateWrapper certificate, QCStatementOids... qcStatements) {
  List<String> qcTypes = certificate.getQCTypes();
  if (Utils.isCollectionNotEmpty(qcTypes)) {
    for (QCStatementOids qcStatement : qcStatements) {
      if (qcTypes.contains(qcStatement.getOid())) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: esig/dss

private static boolean hasPolicyIdOIDs(CertificateWrapper certificate, CertificatePolicyOids... certificatePolicyIds) {
  List<String> policyIds = certificate.getPolicyIds();
  if (Utils.isCollectionNotEmpty(policyIds)) {
    for (CertificatePolicyOids policyId : certificatePolicyIds) {
      if (policyIds.contains(policyId.getOid())) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: esig/dss

@Override
public boolean check(CertificateToken certificateToken) {
  if (Utils.isCollectionNotEmpty(extendedKeyUsageOids)) {
    for (String oid : extendedKeyUsageOids) {
      if (!DSSASN1Utils.isExtendedKeyUsagePresent(certificateToken, new ASN1ObjectIdentifier(oid))) {
        return false;
      }
    }
  }
  return true;
}

代码示例来源:origin: esig/dss

private XmlChainItem getTrustAnchorCertificate() {
  List<XmlChainItem> chain = simpleReport.getChain();
  for (XmlChainItem xmlChainItem : chain) {
    if (Utils.isCollectionNotEmpty(xmlChainItem.getTrustAnchors())) {
      return xmlChainItem;
    }
  }
  return null;
}

代码示例来源:origin: esig/dss

public List<String> getCpsUrls() {
  List<String> result = new ArrayList<String>();
  List<XmlCertificatePolicy> certificatePolicyIds = certificate.getCertificatePolicies();
  if (Utils.isCollectionNotEmpty(certificatePolicyIds)) {
    for (XmlCertificatePolicy xmlCertificatePolicy : certificatePolicyIds) {
      if (Utils.isStringNotBlank(xmlCertificatePolicy.getCpsUrl())) {
        result.add(xmlCertificatePolicy.getCpsUrl());
      }
    }
  }
  return result;
}

代码示例来源:origin: esig/dss

private void setIndication() {
  XmlConclusion conclusion = result.getConclusion();
  if (conclusion != null) {
    if (Utils.isCollectionNotEmpty(conclusion.getErrors())) {
      conclusion.setIndication(Indication.FAILED);
    } else if (Utils.isCollectionNotEmpty(conclusion.getWarnings())) {
      conclusion.setIndication(Indication.INDETERMINATE);
    } else {
      conclusion.setIndication(Indication.PASSED);
    }
  }
}

代码示例来源:origin: esig/dss

private void setIndication() {
  XmlConclusion conclusion = result.getConclusion();
  if (conclusion != null) {
    if (Utils.isCollectionNotEmpty(conclusion.getErrors())) {
      conclusion.setIndication(Indication.FAILED);
    } else if (Utils.isCollectionNotEmpty(conclusion.getWarnings())) {
      conclusion.setIndication(Indication.INDETERMINATE);
    } else {
      conclusion.setIndication(Indication.PASSED);
    }
  }
}

代码示例来源:origin: esig/dss

public XmlSignature getXmlSignatureById(String signatureId) {
  List<XmlSignature> signatures = jaxbDetailedReport.getSignatures();
  if (Utils.isCollectionNotEmpty(signatures)) {
    for (XmlSignature xmlSignature : signatures) {
      if (Utils.areStringsEqual(signatureId, xmlSignature.getId())) {
        return xmlSignature;
      }
    }
  }
  return null;
}

代码示例来源:origin: esig/dss

private List<XmlOID> toOids(List<String> oids) {
  List<XmlOID> result = new ArrayList<XmlOID>();
  if (Utils.isCollectionNotEmpty(oids)) {
    for (String oid : oids) {
      XmlOID xmlOid = new XmlOID();
      xmlOid.setValue(oid);
      result.add(xmlOid);
    }
  }
  return result;
}

代码示例来源:origin: esig/dss

@Test
public void testCanConcludeOneTrustService() {
  CertificateWrapper emptyCert = new MockCertificateWrapper(AFTER_EIDAS_DATE, Collections.<String> emptyList(), Collections.<String> emptyList(),
      Collections.<String> emptyList());
  UniqueServiceFilter filter = new UniqueServiceFilter(emptyCert);
  List<TrustedServiceWrapper> trustServices = new ArrayList<TrustedServiceWrapper>();
  TrustedServiceWrapper ts0 = new TrustedServiceWrapper();
  ts0.setCapturedQualifiers(Arrays.asList(ServiceQualification.QC_STATEMENT, ServiceQualification.QC_WITH_QSCD, ServiceQualification.QC_FOR_ESIG));
  trustServices.add(ts0);
  List<TrustedServiceWrapper> filtered = filter.filter(trustServices);
  assertTrue(Utils.isCollectionNotEmpty(filtered));
}

代码示例来源:origin: esig/dss

@Test
public void listFiles() {
  File folder = new File("src/main/java");
  String[] extensions = new String[] { "java" };
  Collection<File> listFiles = Utils.listFiles(folder, extensions, true);
  assertTrue(Utils.isCollectionNotEmpty(listFiles));
  extensions = new String[] { "doc", "pdf" };
  listFiles = Utils.listFiles(folder, extensions, true);
  assertTrue(Utils.isCollectionEmpty(listFiles));
}

相关文章