Examples of GeneralizedTime


Examples of org.apache.directory.api.util.GeneralizedTime

        {
            DateFormat targetFormat = DateFormat.getDateTimeInstance( DateFormat.MEDIUM, DateFormat.LONG );

            try
            {
                GeneralizedTime generalizedTime = new GeneralizedTime( displayValue );
                Date date = generalizedTime.getCalendar().getTime();
                displayValue = targetFormat.format( date ) + " (" + displayValue + ")"; //$NON-NLS-1$ //$NON-NLS-2$
            }
            catch ( ParseException pe )
            {
                // show the raw value in that case
View Full Code Here

Examples of org.apache.directory.api.util.GeneralizedTime

        if ( value != null && value instanceof String )
        {
            String s = ( String ) value;

            // Trying to parse the value
            GeneralizedTime generalizedTime = null;
            try
            {
                generalizedTime = "".equals( s ) ? null : new GeneralizedTime( s ); //$NON-NLS-1$
            }
            catch ( ParseException pe )
            {
                // The value could not be parsed correctly

                // Displaying an error window indicating to the user that the value is bogus
                // and asking him if he wants to continue to edit the value with current date and time selected
                if ( MessageDialog.openConfirm( PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages
                    .getString( "GeneralizedTimeValueEditor.BogusDateAndTimeValue" ), NLS.bind( //$NON-NLS-1$
                    Messages.getString( "GeneralizedTimeValueEditor.TheValueIsBogus" ), new String[] //$NON-NLS-1$
                    { s } ) ) )
                {
                    // Generating today's date and time
                    generalizedTime = new GeneralizedTime( Calendar.getInstance() );
                }
                else
                {
                    return false;
                }
View Full Code Here

Examples of org.apache.directory.api.util.GeneralizedTime

        this.value = value;

        // If the initial value is null, we take the current date/time
        if ( this.value == null )
        {
            this.value = new GeneralizedTime( Calendar.getInstance() );
        }
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.util.GeneralizedTime

        {
            DateFormat targetFormat = DateFormat.getDateTimeInstance( DateFormat.MEDIUM, DateFormat.LONG );

            try
            {
                GeneralizedTime generalizedTime = new GeneralizedTime( displayValue );
                Date date = generalizedTime.getCalendar().getTime();
                displayValue = targetFormat.format( date ) + " (" + displayValue + ")"; //$NON-NLS-1$ //$NON-NLS-2$
            }
            catch ( ParseException pe )
            {
                // show the raw value in that case
View Full Code Here

Examples of org.apache.directory.shared.ldap.util.GeneralizedTime

        if ( value != null && value instanceof String )
        {
            String s = ( String ) value;

            // Trying to parse the value
            GeneralizedTime generalizedTime = null;
            try
            {
                generalizedTime = "".equals( s ) ? null : new GeneralizedTime( s ); //$NON-NLS-1$
            }
            catch ( ParseException pe )
            {
                // The value could not be parsed correctly

                // Displaying an error window indicating to the user that the value is bogus
                // and asking him if he wants to continue to edit the value with current date and time selected
                if ( MessageDialog.openConfirm( PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages
                    .getString( "GeneralizedTimeValueEditor.BogusDateAndTimeValue" ), NLS.bind( //$NON-NLS-1$
                    Messages.getString( "GeneralizedTimeValueEditor.TheValueIsBogus" ), new String[] //$NON-NLS-1$
                    { s } ) ) )
                {
                    // Generating today's date and time
                    generalizedTime = new GeneralizedTime( Calendar.getInstance() );
                }
                else
                {
                    return false;
                }
View Full Code Here

Examples of org.apache.directory.shared.ldap.util.GeneralizedTime

        this.value = value;

        // If the initial value is null, we take the current date/time
        if ( this.value == null )
        {
            this.value = new GeneralizedTime( Calendar.getInstance() );
        }
    }
View Full Code Here

Examples of org.apache.directory.shared.util.GeneralizedTime

    {
        try
        {
            String prepared = PrepareString.normalize( value, PrepareString.StringType.DIRECTORY_STRING );

            GeneralizedTime time = new GeneralizedTime( prepared );
            String normalized = time.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN_SEC_FRACTION,
                FractionDelimiter.DOT, 3, TimeZoneFormat.Z );

            return normalized;
        }
        catch ( IOException ioe )
View Full Code Here

Examples of org.apache.directory.shared.util.GeneralizedTime

    {
        try
        {
            String prepared = PrepareString.normalize( value, PrepareString.StringType.DIRECTORY_STRING );

            GeneralizedTime time = new GeneralizedTime( prepared );
            String normalized = time.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN_SEC_FRACTION,
                FractionDelimiter.DOT, 3, TimeZoneFormat.Z );

            return normalized;
        }
        catch ( IOException ioe )
View Full Code Here

Examples of org.apache.directory.shared.util.GeneralizedTime

            return ( backendValue == null ? -1 : 1 );
        }

        // Both objects must be stored as String for generalized tim.
        // But we need to normalize the values first.
        GeneralizedTime backendTime;
        try
        {
            String prepared = PrepareString.normalize( backendValue, PrepareString.StringType.DIRECTORY_STRING );
            backendTime = new GeneralizedTime( prepared );
        }
        catch ( IOException ioe )
        {
            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, backendValue ) );
        }
        catch ( ParseException pe )
        {
            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, backendValue ) );
        }

        GeneralizedTime assertTime;
        try
        {
            String prepared = PrepareString.normalize( assertValue, PrepareString.StringType.DIRECTORY_STRING );
            assertTime = new GeneralizedTime( prepared );
        }
        catch ( IOException ioe )
        {
            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, assertValue ) );
        }
View Full Code Here

Examples of org.apache.directory.shared.util.GeneralizedTime

     */
    @Test
    public void testYearMonthDayHourMinZulu() throws ParseException
    {
        String gt = "200801021213Z";
        GeneralizedTime generalizedTime = new GeneralizedTime( gt );
        String result = generalizedTime.toGeneralizedTime();
        assertEquals( gt, result );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.