本文整理汇总了Java中com.helger.commons.ValueEnforcer类的典型用法代码示例。如果您正苦于以下问题:Java ValueEnforcer类的具体用法?Java ValueEnforcer怎么用?Java ValueEnforcer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValueEnforcer类属于com.helger.commons包,在下文中一共展示了ValueEnforcer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateMPC
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
@Nonnull
public EChange updateMPC (@Nonnull final IMPC aMPC)
{
ValueEnforcer.notNull (aMPC, "MPC");
final MPC aRealMPC = getOfID (aMPC.getID ());
if (aRealMPC == null)
{
AuditHelper.onAuditModifyFailure (MPC.OT, aMPC.getID (), "no-such-id");
return EChange.UNCHANGED;
}
m_aRWLock.writeLock ().lock ();
try
{
BusinessObjectHelper.setLastModificationNow (aRealMPC);
internalUpdateItem (aRealMPC);
}
finally
{
m_aRWLock.writeLock ().unlock ();
}
AuditHelper.onAuditModifySuccess (MPC.OT, "all", aRealMPC.getID ());
return EChange.CHANGED;
}
示例2: PModeParty
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
public PModeParty (@Nullable final String sIDType,
@Nonnull @Nonempty final String sIDValue,
@Nonnull @Nonempty final String sRole,
@Nullable final String sUserName,
@Nullable final String sPassword)
{
m_sIDType = sIDType;
m_sIDValue = ValueEnforcer.notEmpty (sIDValue, "IDValue");
m_sRole = ValueEnforcer.notEmpty (sRole, "Role");
m_sUserName = sUserName;
m_sPassword = sPassword;
m_sID = m_sIDValue;
if (!StringHelper.getNotNull (m_sIDType).equals (""))
{
m_sID = m_sIDType + ":" + m_sIDValue;
}
}
示例3: PModeLegErrorHandling
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
public PModeLegErrorHandling (@Nullable final PModeAddressList aReportSenderErrorsTo,
@Nullable final PModeAddressList aReportReceiverErrorsTo,
@Nonnull final ETriState eReportAsResponse,
@Nonnull final ETriState eReportProcessErrorNotifyConsumer,
@Nonnull final ETriState eReportProcessErrorNotifyProducer,
@Nonnull final ETriState eReportDeliveryFailuresNotifyProducer)
{
m_aReportSenderErrorsTo = aReportSenderErrorsTo;
m_aReportReceiverErrorsTo = aReportReceiverErrorsTo;
m_eReportAsResponse = ValueEnforcer.notNull (eReportAsResponse, "ReportAsResponse");
m_eReportProcessErrorNotifyConsumer = ValueEnforcer.notNull (eReportProcessErrorNotifyConsumer,
"ReportProcessErrorNotifyConsumer");
m_eReportProcessErrorNotifyProducer = ValueEnforcer.notNull (eReportProcessErrorNotifyProducer,
"ReportProcessErrorNotifyProducer");
m_eReportDeliveryFailuresNotifyProducer = ValueEnforcer.notNull (eReportDeliveryFailuresNotifyProducer,
"ReportDeliveryFailuresNotifyProducer");
}
示例4: createPMode
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
@Nonnull
public IPMode createPMode (@Nonnull final PMode aPMode)
{
ValueEnforcer.notNull (aPMode, "PMode");
// If not valid throws IllegalStateException
validatePMode (aPMode);
m_aRWLock.writeLocked ( () -> {
internalCreateItem (aPMode);
});
AuditHelper.onAuditCreateSuccess (PMode.OT, aPMode.getID ());
s_aLogger.info ("Created PMode with ID '" + aPMode.getID () + "'");
return aPMode;
}
示例5: setCompressionMode
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
@Nonnull
public final WSS4JAttachment setCompressionMode (@Nonnull final EAS4CompressionMode eCM)
{
ValueEnforcer.notNull (eCM, "CompressionMode");
m_eCM = eCM;
if (eCM != null)
{
// Main MIME type is now the compression type MIME type
super.setMimeType (eCM.getMimeType ().getAsString ());
}
else
{
// Main MIME type is the uncompressed one (which may be null)
super.setMimeType (m_sUncompressedMimeType);
}
return this;
}
示例6: addToMimeMultipart
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
public void addToMimeMultipart (@Nonnull final MimeMultipart aMimeMultipart) throws MessagingException
{
ValueEnforcer.notNull (aMimeMultipart, "MimeMultipart");
final MimeBodyPart aMimeBodyPart = new MimeBodyPart ();
aMimeBodyPart.setHeader (CHttpHeader.CONTENT_ID, getId ());
// !IMPORTANT! DO NOT CHANGE the order of the adding a DH and then the last
// headers
// On some tests the datahandler did reset content-type and transfer
// encoding, so this is now the correct order
aMimeBodyPart.setDataHandler (new DataHandler (_getAsDataSource ()));
// After DataHandler!!
aMimeBodyPart.setHeader (CHttpHeader.CONTENT_TYPE, getMimeType ());
aMimeBodyPart.setHeader (CHttpHeader.CONTENT_TRANSFER_ENCODING, getContentTransferEncoding ().getID ());
aMimeMultipart.addBodyPart (aMimeBodyPart);
}
示例7: CryptoProperties
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
public CryptoProperties (@Nonnull final IReadableResource aRes)
{
ValueEnforcer.notNull (aRes, "Resource");
if (aRes.exists ())
try
{
m_aProps = new NonBlockingProperties ();
try (final InputStream aIS = aRes.getInputStream ())
{
m_aProps.load (aIS);
}
}
catch (final Throwable t)
{
throw new InitializationException ("Failed to init CryptoProperties from resource " + aRes + "!", t);
}
}
示例8: encryptSoapBodyPayload
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
@Nonnull
public Document encryptSoapBodyPayload (@Nonnull final ESOAPVersion eSOAPVersion,
@Nonnull final Document aDoc,
final boolean bMustUnderstand,
@Nonnull final ECryptoAlgorithmCrypt eCryptAlgo) throws Exception
{
ValueEnforcer.notNull (eSOAPVersion, "SOAPVersion");
ValueEnforcer.notNull (aDoc, "XMLDoc");
ValueEnforcer.notNull (eCryptAlgo, "CryptAlgo");
final CryptoProperties aCryptoProps = m_aCryptoFactory.getCryptoProperties ();
final WSSecHeader aSecHeader = new WSSecHeader (aDoc);
aSecHeader.insertSecurityHeader ();
final WSSecEncrypt aBuilder = new WSSecEncrypt (aSecHeader);
aBuilder.setKeyIdentifierType (WSConstants.BST_DIRECT_REFERENCE);
aBuilder.setSymmetricEncAlgorithm (eCryptAlgo.getAlgorithmURI ());
aBuilder.setUserInfo (aCryptoProps.getKeyAlias (), aCryptoProps.getKeyPassword ());
aBuilder.getParts ().add (new WSEncryptionPart ("Body", eSOAPVersion.getNamespaceURI (), "Content"));
final Attr aMustUnderstand = aSecHeader.getSecurityHeaderElement ()
.getAttributeNodeNS (eSOAPVersion.getNamespaceURI (), "mustUnderstand");
if (aMustUnderstand != null)
aMustUnderstand.setValue (eSOAPVersion.getMustUnderstandValue (bMustUnderstand));
return aBuilder.build (m_aCryptoFactory.getCrypto ());
}
示例9: createEbms3MessageInfo
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
/**
* Create a new message info.
*
* @param sMessageID
* The message ID. May neither be <code>null</code> nor empty.
* @param sRefToMessageID
* to set the reference to the previous message needed for two way
* exchanges
* @return Never <code>null</code>.
*/
@Nonnull
public static Ebms3MessageInfo createEbms3MessageInfo (@Nonnull @Nonempty final String sMessageID,
@Nullable final String sRefToMessageID)
{
ValueEnforcer.notEmpty (sMessageID, "MessageID");
final Ebms3MessageInfo aMessageInfo = new Ebms3MessageInfo ();
aMessageInfo.setMessageId (sMessageID);
if (StringHelper.hasText (sRefToMessageID))
aMessageInfo.setRefToMessageId (sRefToMessageID);
aMessageInfo.setTimestamp (PDTXMLConverter.getXMLCalendarNowUTC ());
return aMessageInfo;
}
示例10: moveMIMEHeadersToHTTPHeader
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
public static void moveMIMEHeadersToHTTPHeader (@Nonnull final MimeMessage aMimeMsg,
@Nonnull final HttpMessage aHttpMsg) throws MessagingException
{
ValueEnforcer.notNull (aMimeMsg, "MimeMsg");
ValueEnforcer.notNull (aHttpMsg, "HttpMsg");
// Move all mime headers to the HTTP request
final Enumeration <Header> aEnum = aMimeMsg.getAllHeaders ();
while (aEnum.hasMoreElements ())
{
final Header h = aEnum.nextElement ();
// Make a single-line HTTP header value!
aHttpMsg.addHeader (h.getName (), HttpHeaderMap.getUnifiedValue (h.getValue ()));
// Remove from MIME message!
aMimeMsg.removeHeader (h.getName ());
}
}
示例11: STXCharStream
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
private STXCharStream (@Nonnull final Reader aReader,
@Nonnegative final int nStartLine,
@Nonnegative final int nStartColumn,
@Nonnegative final int nBufferSize)
{
ValueEnforcer.isGE0 (nBufferSize, "BufferSize");
// Using a buffered reader gives a minimal speedup
m_aReader = StreamHelper.getBuffered (ValueEnforcer.notNull (aReader, "Reader"));
m_nLine = ValueEnforcer.isGE0 (nStartLine, "StartLine");
m_nColumn = ValueEnforcer.isGE0 (nStartColumn, "StartColumn") - 1;
m_nAvailable = nBufferSize;
m_nBufsize = nBufferSize;
m_aBuffer = new char [nBufferSize];
m_aBufLine = new int [nBufferSize];
m_aBufColumn = new int [nBufferSize];
m_aNextCharBuf = new char [DEFAULT_BUF_SIZE];
}
示例12: validateSignalMessage
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
public void validateSignalMessage (@Nonnull final Ebms3SignalMessage aSignalMsg, @Nonnull final ErrorList aErrorList)
{
ValueEnforcer.notNull (aSignalMsg, "SignalMsg");
if (StringHelper.hasNoText (aSignalMsg.getMessageInfo ().getMessageId ()))
{
aErrorList.add (_createError ("MessageID is missing but is mandatory!"));
}
}
示例13: AS4DuplicateItem
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
AS4DuplicateItem (@Nonnull final LocalDateTime aDT,
@Nonnull @Nonempty final String sMessageID,
@Nullable final String sProfileID,
@Nullable final String sPModeID)
{
m_aDT = ValueEnforcer.notNull (aDT, "DT");
m_sMessageID = ValueEnforcer.notEmpty (sMessageID, "MessageID");
m_sProfileID = sProfileID;
m_sPModeID = sPModeID;
}
示例14: AS4Profile
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
public AS4Profile (@Nonnull @Nonempty final String sID,
@Nonnull @Nonempty final String sDisplayName,
@Nonnull final ISupplier <? extends IAS4ProfileValidator> aProfileValidatorProvider,
@Nonnull final ISupplier <? extends PMode> aDefaultPModeProvider,
@Nonnull final IPModeIDProvider aPModeIDProvider)
{
m_sID = ValueEnforcer.notEmpty (sID, "ID");
m_sDisplayName = ValueEnforcer.notEmpty (sDisplayName, "DisplayName");
m_aProfileValidatorProvider = ValueEnforcer.notNull (aProfileValidatorProvider, "ProfileValidatorProvider");
m_aDefaultPModeProvider = ValueEnforcer.notNull (aDefaultPModeProvider, "aDefaultPModeProvider");
m_aPModeIDProvider = ValueEnforcer.notNull (aPModeIDProvider, "PModeIDProvider");
}
示例15: registerProfile
import com.helger.commons.ValueEnforcer; //导入依赖的package包/类
public void registerProfile (@Nonnull final IAS4Profile aAS4Profile)
{
ValueEnforcer.notNull (aAS4Profile, "AS4Profile");
final String sID = aAS4Profile.getID ();
m_aRWLock.writeLocked ( () -> {
if (m_aMap.containsKey (sID))
throw new IllegalStateException ("An AS4 profile with ID '" + sID + "' is already registered!");
m_aMap.put (sID, aAS4Profile);
});
s_aLogger.info ("Registered AS4 profile '" + sID + "'");
}