Search in sources :

Example 1 with RandomParameters

use of com.helger.as2lib.params.RandomParameters in project as2-lib by phax.

the class AS2Message method generateMessageID.

@Override
@Nonnull
@Nonempty
public String generateMessageID() {
    final CompositeParameters aParams = new CompositeParameters(false).add("date", new DateParameters()).add("msg", new MessageParameters(this)).add("rand", new RandomParameters());
    final String sIDFormat = partnership().getMessageIDFormat(DEFAULT_ID_FORMAT);
    final StringBuilder aSB = new StringBuilder();
    aSB.append('<');
    try {
        aSB.append(aParams.format(sIDFormat));
    } catch (final AS2InvalidParameterException ex) {
        // useless, but what to do?
        aSB.append(sIDFormat);
    }
    aSB.append('>');
    return aSB.toString();
}
Also used : CompositeParameters(com.helger.as2lib.params.CompositeParameters) AS2InvalidParameterException(com.helger.as2lib.params.AS2InvalidParameterException) MessageParameters(com.helger.as2lib.params.MessageParameters) DateParameters(com.helger.as2lib.params.DateParameters) RandomParameters(com.helger.as2lib.params.RandomParameters) Nonnull(javax.annotation.Nonnull) Nonempty(com.helger.commons.annotation.Nonempty)

Aggregations

AS2InvalidParameterException (com.helger.as2lib.params.AS2InvalidParameterException)1 CompositeParameters (com.helger.as2lib.params.CompositeParameters)1 DateParameters (com.helger.as2lib.params.DateParameters)1 MessageParameters (com.helger.as2lib.params.MessageParameters)1 RandomParameters (com.helger.as2lib.params.RandomParameters)1 Nonempty (com.helger.commons.annotation.Nonempty)1 Nonnull (javax.annotation.Nonnull)1