Java Code Examples for com.helger.commons.collection.CollectionHelper#isNotEmpty()
The following examples show how to use
com.helger.commons.collection.CollectionHelper#isNotEmpty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PSXPathValidationHandlerSVRL.java From ph-schematron with Apache License 2.0 | 5 votes |
/** * Handle the diagnostic references of a single assert/report element * * @param aSrcDiagnostics * The list of diagnostic reference IDs in the source assert/report * element. May be <code>null</code> if no diagnostic references are * present * @param aDstList * The diagnostic reference list of the SchematronOutput to be filled. * May not be <code>null</code>. * @param aBoundAssertReport * The bound assert report element. Never <code>null</code>. * @param aRuleMatchingNode * The XML node of the XML document currently validated. Never * <code>null</code>. * @throws SchematronValidationException */ private void _handleDiagnosticReferences (@Nullable final List <String> aSrcDiagnostics, @Nonnull final List <DiagnosticReference> aDstList, @Nonnull final PSXPathBoundAssertReport aBoundAssertReport, @Nonnull final Node aRuleMatchingNode) throws SchematronValidationException { if (CollectionHelper.isNotEmpty (aSrcDiagnostics)) { if (m_aSchema.hasDiagnostics ()) { final PSDiagnostics aDiagnostics = m_aSchema.getDiagnostics (); for (final String sDiagnosticID : aSrcDiagnostics) { final PSXPathBoundDiagnostic aDiagnostic = aBoundAssertReport.getBoundDiagnosticOfID (sDiagnosticID); if (aDiagnostic == null) _warn (aDiagnostics, "Failed to resolve diagnostics with ID '" + sDiagnosticID + "'"); else { // Create the SVRL diagnostic-reference element final DiagnosticReference aDR = new DiagnosticReference (); aDR.setDiagnostic (sDiagnosticID); aDR.setText (_getErrorText (aDiagnostic.getAllBoundContentElements (), aRuleMatchingNode)); aDstList.add (aDR); } } } else _warn (m_aSchema, "Failed to resolve diagnostic because schema has no diagnostics"); } }
Example 2
Source File: PSAssertReport.java From ph-schematron with Apache License 2.0 | 5 votes |
@Nonnull public IMicroElement getAsMicroElement () { final IMicroElement ret = new MicroElement (CSchematron.NAMESPACE_SCHEMATRON, m_bIsAssert ? CSchematronXML.ELEMENT_ASSERT : CSchematronXML.ELEMENT_REPORT); ret.setAttribute (CSchematronXML.ATTR_ID, m_sID); ret.setAttribute (CSchematronXML.ATTR_FLAG, m_sFlag); ret.setAttribute (CSchematronXML.ATTR_TEST, m_sTest); if (CollectionHelper.isNotEmpty (m_aDiagnostics)) ret.setAttribute (CSchematronXML.ATTR_DIAGNOSTICS, StringHelper.getImploded (' ', m_aDiagnostics)); if (m_aRich != null) m_aRich.fillMicroElement (ret); if (m_aLinkable != null) m_aLinkable.fillMicroElement (ret); for (final Object aContent : m_aContent) if (aContent instanceof IMicroElement) ret.appendChild (((IMicroElement) aContent).getClone ()); else if (aContent instanceof String) ret.appendText ((String) aContent); else ret.appendChild (((IPSElement) aContent).getAsMicroElement ()); if (m_aForeignAttrs != null) for (final Map.Entry <String, String> aEntry : m_aForeignAttrs.entrySet ()) ret.setAttribute (aEntry.getKey (), aEntry.getValue ()); return ret; }
Example 3
Source File: WSClientConfig.java From ph-commons with Apache License 2.0 | 4 votes |
@OverrideOnDemand @OverridingMethodsMustInvokeSuper public void applyWSSettingsToBindingProvider (@Nonnull final BindingProvider aBP) { final Map <String, Object> aRequestContext = aBP.getRequestContext (); if (m_aEndpointAddress != null) { aRequestContext.put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, m_aEndpointAddress.toExternalForm ()); } if (m_aSSLSocketFactory != null) { aRequestContext.put ("com.sun.xml.ws.transport.https.client.SSLSocketFactory", m_aSSLSocketFactory); aRequestContext.put ("com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory", m_aSSLSocketFactory); } if (m_aHostnameVerifier != null) { aRequestContext.put ("com.sun.xml.ws.transport.https.client.hostname.verifier", m_aHostnameVerifier); aRequestContext.put ("com.sun.xml.internal.ws.transport.https.client.hostname.verifier", m_aHostnameVerifier); } if (hasConnectionTimeoutMS ()) { aRequestContext.put ("com.sun.xml.ws.connect.timeout", Integer.valueOf (m_nConnectionTimeoutMS)); aRequestContext.put ("com.sun.xml.internal.ws.connect.timeout", Integer.valueOf (m_nConnectionTimeoutMS)); } if (hasRequestTimeoutMS ()) { aRequestContext.put ("com.sun.xml.ws.request.timeout", Integer.valueOf (m_nRequestTimeoutMS)); aRequestContext.put ("com.sun.xml.internal.ws.request.timeout", Integer.valueOf (m_nRequestTimeoutMS)); } if (hasChunkSize ()) { aRequestContext.put ("com.sun.xml.ws.transport.http.client.streaming.chunk.size", Integer.valueOf (m_nChunkSize)); aRequestContext.put ("com.sun.xml.internal.ws.transport.http.client.streaming.chunk.size", Integer.valueOf (m_nChunkSize)); } if (StringHelper.hasText (m_sUserName)) { aRequestContext.put (BindingProvider.USERNAME_PROPERTY, m_sUserName); aRequestContext.put (BindingProvider.PASSWORD_PROPERTY, m_sPassword); } if (hasSOAPAction ()) { aRequestContext.put (BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE); aRequestContext.put (BindingProvider.SOAPACTION_URI_PROPERTY, m_sSOAPAction); } if (CollectionHelper.isNotEmpty (m_aHTTPHeaders)) { aRequestContext.put (MessageContext.HTTP_REQUEST_HEADERS, m_aHTTPHeaders); } if (m_eCookiesSupport.isDefined ()) { aRequestContext.put (BindingProvider.SESSION_MAINTAIN_PROPERTY, m_eCookiesSupport.getAsBooleanObj ()); } if (m_aHandlers.isNotEmpty ()) { @SuppressWarnings ("rawtypes") final List <Handler> aHandlers = aBP.getBinding ().getHandlerChain (); aHandlers.addAll (m_aHandlers); aBP.getBinding ().setHandlerChain (aHandlers); } customizeRequestContext (aRequestContext); if (m_bWorkAroundMASM0003) { // Introduced with Java 1.8.0_31?? // MASM0003: Default [ jaxws-tubes-default.xml ] configuration file was // not loaded final ClassLoader aContextClassLoader = ClassLoaderHelper.getContextClassLoader (); final ClassLoader aThisClassLoader = IPrivilegedAction.getClassLoader (getClass ()).invokeSafe (); if (aContextClassLoader == null) { LOGGER.info ("Manually setting thread context class loader to work around MASM0003 bug"); ClassLoaderHelper.setContextClassLoader (aThisClassLoader); } else { if (!aContextClassLoader.equals (aThisClassLoader)) { LOGGER.warn ("Manually overriding thread context class loader to work around MASM0003 bug"); ClassLoaderHelper.setContextClassLoader (aThisClassLoader); } } } }
Example 4
Source File: MimeTypeInfoManager.java From ph-commons with Apache License 2.0 | 3 votes |
/** * Check if any mime type is associated with the passed extension * * @param sExtension * The filename extension to search. May not be <code>null</code>. * @return <code>true</code> if at least one mime type is associated, * <code>false</code> if no mime type is associated with the extension */ public boolean containsMimeTypeForExtension (@Nonnull final String sExtension) { ValueEnforcer.notNull (sExtension, "Extension"); final ICommonsList <MimeTypeInfo> aInfos = getAllInfosOfExtension (sExtension); return CollectionHelper.isNotEmpty (aInfos); }