Search in sources :

Example 6 with TimestampArgument

use of com.unboundid.util.args.TimestampArgument in project ldapsdk by pingidentity.

the class ManageAccountProcessor method getDates.

/**
 * Retrieves the value of the "operationValue" argument from the provided
 * subcommand's argument parser as an array of {@code Date} objects.
 *
 * @param  subcommand     The subcommand to examine.
 * @param  commandBuffer  The buffer to which the manage-account command line
 *                        should be appended.
 *
 * @return  The value of the "operationValue" argument.
 */
@NotNull()
private static Date[] getDates(@NotNull final SubCommand subcommand, @NotNull final StringBuilder commandBuffer) {
    final ArgumentParser parser = subcommand.getArgumentParser();
    final TimestampArgument arg = parser.getTimestampArgument("operationValue");
    final List<Date> dateList = arg.getValues();
    final Date[] dateArray = new Date[dateList.size()];
    dateList.toArray(dateArray);
    if (arg.isPresent()) {
        for (final Date d : dateArray) {
            commandBuffer.append(' ');
            commandBuffer.append(arg.getIdentifierString());
            commandBuffer.append(' ');
            commandBuffer.append(StaticUtils.encodeGeneralizedTime(d));
        }
    }
    return dateArray;
}
Also used : TimestampArgument(com.unboundid.util.args.TimestampArgument) ArgumentParser(com.unboundid.util.args.ArgumentParser) Date(java.util.Date) NotNull(com.unboundid.util.NotNull)

Example 7 with TimestampArgument

use of com.unboundid.util.args.TimestampArgument in project ldapsdk by pingidentity.

the class ManageAccountProcessor method getDate.

/**
 * Retrieves the value of the "operationValue" argument from the provided
 * subcommand's argument parser as a {@code Date}.
 *
 * @param  subcommand     The subcommand to examine.
 * @param  commandBuffer  The buffer to which the manage-account command line
 *                        should be appended.
 *
 * @return  The value of the "operationValue" argument.
 */
@NotNull()
private static Date getDate(@NotNull final SubCommand subcommand, @NotNull final StringBuilder commandBuffer) {
    final ArgumentParser parser = subcommand.getArgumentParser();
    final TimestampArgument arg = parser.getTimestampArgument("operationValue");
    final Date dateValue = arg.getValue();
    if (arg.isPresent()) {
        commandBuffer.append(' ');
        commandBuffer.append(arg.getIdentifierString());
        commandBuffer.append(' ');
        commandBuffer.append(StaticUtils.encodeGeneralizedTime(dateValue));
    }
    return dateValue;
}
Also used : TimestampArgument(com.unboundid.util.args.TimestampArgument) ArgumentParser(com.unboundid.util.args.ArgumentParser) Date(java.util.Date) NotNull(com.unboundid.util.NotNull)

Aggregations

TimestampArgument (com.unboundid.util.args.TimestampArgument)7 ArgumentParser (com.unboundid.util.args.ArgumentParser)6 BooleanValueArgument (com.unboundid.util.args.BooleanValueArgument)5 StringArgument (com.unboundid.util.args.StringArgument)5 BooleanArgument (com.unboundid.util.args.BooleanArgument)4 DNArgument (com.unboundid.util.args.DNArgument)4 FileArgument (com.unboundid.util.args.FileArgument)4 IntegerArgument (com.unboundid.util.args.IntegerArgument)4 NotNull (com.unboundid.util.NotNull)3 SubCommand (com.unboundid.util.args.SubCommand)3 Date (java.util.Date)3 ASN1BitString (com.unboundid.asn1.ASN1BitString)2 FilterArgument (com.unboundid.util.args.FilterArgument)2 IPAddressArgumentValueValidator (com.unboundid.util.args.IPAddressArgumentValueValidator)2 ArrayList (java.util.ArrayList)2 LinkedHashSet (java.util.LinkedHashSet)2 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)1 InMemoryDirectoryServer (com.unboundid.ldap.listener.InMemoryDirectoryServer)1 InMemoryDirectoryServerConfig (com.unboundid.ldap.listener.InMemoryDirectoryServerConfig)1 DN (com.unboundid.ldap.sdk.DN)1