Package org.apache.commons.lang.time

Examples of org.apache.commons.lang.time.FastDateFormat$Rule


            String segment = currTextSegment.toString();
            List<Rule> parentMatches = getMatches().peek();
            int len = parentMatches.size();
            for ( int i = 0; i < len; ++i )
            {
                Rule r = parentMatches.get( i );
                if ( r instanceof TextSegmentHandler )
                {
                    TextSegmentHandler h = (TextSegmentHandler) r;
                    try
                    {
View Full Code Here


    {

        @Override
        protected void configure()
        {
            forPattern( "bar" ).addRule( new Rule()
            {

                @Override
                public void body( String namespace, String name, String text )
                    throws Exception
View Full Code Here

            Log log = getDigester().getLogger();
            boolean debug = log.isDebugEnabled();
            for ( int i = 0; i < rules.size(); i++ )
            {
                int j = ( rules.size() - i ) - 1;
                Rule rule = rules.get( j );
                if ( debug )
                {
                    log.debug( "  Fire end() for " + rule );
                }
                try
                {
                    rule.end( namespaceURI, name );
                }
                catch ( Exception e )
                {
                    throw getDigester().createSAXException( e );
                }
View Full Code Here

    this.orderString=orderString;
    this.logger = logger;
    this.logDateFormat = logDateFormat;
    this.timeZone =timeZone;
        this.startTime = new Date();
        final FastDateFormat dateformat;
        if (this.timeZone == null) {
          dateformat = FastDateFormat.getInstance(this.logDateFormat);
        } else {
          dateformat = FastDateFormat.getInstance(this.logDateFormat, TimeZone.getTimeZone(this.timeZone));
        }
        paramPut(LOG_TIME, dateformat.format(new Date()));
        this.paramPut(REPLY_TIME,REPLY_TIME);
        this.paramPut(LOG_ID, "0");
  }
View Full Code Here

              return null;
          }
          ASN1Sequence seq = (ASN1Sequence)obj;
         
          String prefix = "";
      FastDateFormat dateF = FastDateFormat.getInstance("yyyyMMdd");
          for (int i = 0; i < seq.size(); i++) {
            Attribute attr = Attribute.getInstance(seq.getObjectAt(i));
            if (!StringUtils.isEmpty(result)) {
              prefix = ", ";
            }
            if (attr.getAttrType().getId().equals(id_pda_dateOfBirth)) {
              ASN1Set set = attr.getAttrValues();
              // Come on, we'll only allow one dateOfBirth, we're not allowing such frauds with multiple birth dates
              DERGeneralizedTime time = DERGeneralizedTime.getInstance(set.getObjectAt(0));
              Date date = time.getDate();
              String dateStr = dateF.format(date);
              result += prefix + "dateOfBirth="+dateStr;
            }
            if (attr.getAttrType().getId().equals(id_pda_placeOfBirth)) {
              ASN1Set set = attr.getAttrValues();
              // same here only one placeOfBirth
View Full Code Here

        }{
        // Test time constraints
        final EndEntityProfile profile = new EndEntityProfile();
        Date now = new Date();
        Date endOfTime = new Date(Long.MAX_VALUE);
        FastDateFormat sm = FastDateFormat.getInstance("yyyy-MM-dd HH:mm");
        String staticNow = sm.format(now);
        String relativeNow = "0:00:00";
        String staticEndOfTime = sm.format(endOfTime);
        String relativeEndOfTime = "33000:00:00"; // ~100 years
        String staticInvalid = "XXXX-XX-XX XX:XX PM";
        String relativeInvalid = "XXXXX:XXX:XXX";
        String relativeNegative = "-10:00:00";
        ExtendedInformation ei = new ExtendedInformation();
View Full Code Here

              setRemainingLoginAttempts(DEFAULT_REMAININGLOGINATTEMPTS);
            }
            // In EJBCA 4.0.0 we changed the date format
          if (getVersion() < 3) {
            final DateFormat oldDateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.US);
            final FastDateFormat newDateFormat = FastDateFormat.getInstance("yyyy-MM-dd HH:mm");
            try {
              final String oldCustomStartTime = getCustomData(ExtendedInformation.CUSTOM_STARTTIME);
              if ( !isEmptyOrRelative(oldCustomStartTime) ) {
                // We use an absolute time format, so we need to upgrade
                  final String newCustomStartTime = newDateFormat.format(oldDateFormat.parse(oldCustomStartTime));
              setCustomData(ExtendedInformation.CUSTOM_STARTTIME, newCustomStartTime);
              if (log.isDebugEnabled()) {
                log.debug("Upgraded " + ExtendedInformation.CUSTOM_STARTTIME + " from \"" + oldCustomStartTime + "\" to \"" + newCustomStartTime + "\" in ExtendedInformation.");
              }
              }
        } catch (ParseException e) {
          log.error("Unable to upgrade " + ExtendedInformation.CUSTOM_STARTTIME + " in extended user information.", e);
        }
            try {
              final String oldCustomEndTime = getCustomData(ExtendedInformation.CUSTOM_ENDTIME);
              if ( !isEmptyOrRelative(oldCustomEndTime) ) {
                // We use an absolute time format, so we need to upgrade
                  final String newCustomEndTime = newDateFormat.format(oldDateFormat.parse(oldCustomEndTime));
              setCustomData(ExtendedInformation.CUSTOM_ENDTIME, newCustomEndTime);
              if (log.isDebugEnabled()) {
                log.debug("Upgraded " + ExtendedInformation.CUSTOM_ENDTIME + " from \"" + oldCustomEndTime + "\" to \"" + newCustomEndTime + "\" in ExtendedInformation.");
              }
              }
View Full Code Here

             * doesUserFullfillEndEntityProfile check and this is what need to upgrade from:
             *     DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.US)
             */
          if (getVersion() < 13) {
            final DateFormat oldDateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.US);
            final FastDateFormat newDateFormat = FastDateFormat.getInstance("yyyy-MM-dd HH:mm");
            try {
              final String oldStartTime = getValue(STARTTIME, 0);
              if (!isEmptyOrRelative(oldStartTime)) {
                // We use an absolute time format, so we need to upgrade
                  final String newStartTime = newDateFormat.format(oldDateFormat.parse(oldStartTime));
              setValue(STARTTIME, 0, newStartTime);
              if (log.isDebugEnabled()) {
                log.debug("Upgraded " + STARTTIME + " from \"" + oldStartTime + "\" to \"" + newStartTime + "\" in EndEntityProfile.");
              }
              }
        } catch (ParseException e) {
          log.error("Unable to upgrade " + STARTTIME + " in EndEntityProfile! Manual interaction is required (edit and verify).", e);
        }
            try {
              final String oldEndTime = getValue(ENDTIME, 0);
              if (!isEmptyOrRelative(oldEndTime)) {
                // We use an absolute time format, so we need to upgrade
                  final String newEndTime = newDateFormat.format(oldDateFormat.parse(oldEndTime));
              setValue(ENDTIME, 0, newEndTime);
              if (log.isDebugEnabled()) {
                log.debug("Upgraded " + ENDTIME + " from \"" + oldEndTime + "\" to \"" + newEndTime + "\" in EndEntityProfile.");
              }
              }
View Full Code Here

  /**
   * Converts the current value to Text using the pattern that has been set or a default pattern
   * if no pattern has been set
   */
  public static String convertToString(Calendar c, String pattern, Locale locale) {
    FastDateFormat formatter = getFormatter(pattern, locale);

    return formatter.format(c);
  }
View Full Code Here

    return formatter.format(c);
  }

  public static String convertToString(Date date, String pattern, Locale locale) {
    FastDateFormat formatter = getFormatter(pattern, locale);

    return formatter.format(date);
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.lang.time.FastDateFormat$Rule

Copyright © 2018 www.massapicom. 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.