Package pt.opensoft.util

Examples of pt.opensoft.util.DateTime


                    case Types.TINYINT:
                        varWriter.writeNumeric(rs.getString(i), meta.getColumnDisplaySize(i));
                        break;
                    case Types.DATE:
                    case Types.TIMESTAMP:
                        varWriter.writeDate(new DateTime(new Date(rs.getDate(i).getTime())), "yyyyMMdd");
                        break;
                    default:
                        varWriter.writeString(rs.getString(i), meta.getColumnDisplaySize(i));
                }
            }
View Full Code Here


      NumberFormat nf = NumberUtil.getNumberFormat(format, true);
      return nf.format(fValue);
    }

    if (type.equals("D")) {  // date
      DateTime date = new DateTime(value, format);
      return date.format(format);
    }

    return value;
  }
View Full Code Here

      logger.warning("NOT STARTED!");
      return;
    }
    boolean atFixedRate = daemon.hasFixedRate();
    if (daemon.hasStartAt()) {
      DateTime startAt = daemon.getStartAt();
      if (daemon.hasPolling()) {
        DateTime polling = daemon.getPolling();
        if (atFixedRate) {
          logger.info("startAt(" + startAt + ", " + polling + ")");
          timer.scheduleAtFixedRate(daemonTask, startAt, daemon.getPeriod());
        } else {
          logger.info("startAt(" + startAt + ", " + polling + ", constantRate)");
          timer.schedule(daemonTask, startAt, daemon.getPeriod());
        }
        return;
      }
      logger.info("runOnceAt(" + startAt + ")");
      timer.schedule(daemonTask, startAt);
      return;
    }
    if (daemon.hasDelay()) {
      DateTime delay = daemon.getDelay();
      if (daemon.hasPolling()) {
        DateTime polling = daemon.getPolling();
        if (atFixedRate) {
          logger.info("delay(" + delay + ", " + polling + ")");
          timer.scheduleAtFixedRate(daemonTask, daemon.getDelayMillis(), daemon.getPeriod());
        } else {
          logger.info("delay(" + delay + ", " + polling + ", constantRate)");
View Full Code Here

  /**
   * @return new XmlDateTime based on the current time, with a timeshift of 0 ("GMT" zone)
   */
  public static XmlDateTime now() {
    return new XmlDateTime(new DateTime(new Date()), TimeZone.getTimeZone(GMT));
  }
View Full Code Here

  public DateTime getDateTime(){
    long localTime = msSinceEpoch;
    if (timezoneShift != null) {
      localTime += timezoneShift.longValue() * TIMEZONE_EQUALIZER;
    }
    return new DateTime(localTime);
  }
View Full Code Here

     * @param renderer
     * @param storedProcedure
     */
    private void initContext(VelocityRenderer renderer, StoredProcedure storedProcedure) {
        renderer.addToContext("metadata", storedProcedure);
        renderer.addToContext("date", new DateTime());
        renderer.addToContext("util", this.generatorUtil);
    }
View Full Code Here

    if (this.currentVersion == null) {
      throw new BuildException("MUST DEFINE 'currentVersion' ATTRIBUTE");
    }

    try {
      DateTime now = new DateTime();
      Regex version = new Regex(VERSION_PATTERN);
      Regex geek = new Regex(TECNICAL_PATTERN);

      BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(
        this.inputFilePath), "ISO-8859-1"));
      PrintStream writer = new PrintStream(new FileOutputStream(this.outputFilePath), false, "ISO-8859-1");

      writer.println("[Vers�o " + this.currentVersion + " (" + now.formatDate() + ")]");
      writer.println();

      boolean fullFile = this.lastVersion.equals(this.currentVersion);

      String line = reader.readLine();
View Full Code Here

        }
        timer.stop();
        if (log) logger.info(timer.ellapsed(), FINISHED);
        if (hasPolling()) setStatus(SCHEDULED); // corre mais do que uma vez
        else setStatus(FINISHED); // j� terminou
        lastRunTime = new DateTime();
        setNextRunTime();
    }
View Full Code Here

    }

    public void setStartAt(DateTime startAt) {
        this.startAt = startAt;
        if (startAt == null) return;
        DateTime now = new DateTime();
        startAt.setYear(now.getYear());
        startAt.setMonth(now.getMonth());
        startAt.setDay(now.getDay());
        if (startAt.before(now)) {
            if (hasPolling()) {
                startAt.addMillis((int) getPeriod());
            } else {
                startAt.addDays(1);
View Full Code Here

    private void setNextRunTime() {
        if (!hasPolling()) {
            nextRunTime = null;
        } else {
            if (nextRunTime == null) {
                if (hasStartAt()) nextRunTime = new DateTime(getStartAt());
                if (hasDelay()) {
                    nextRunTime = new DateTime(startedAt);
                    nextRunTime.addHours(getDelay().get(Calendar.HOUR_OF_DAY));
                    nextRunTime.addMinutes(getDelay().get(Calendar.MINUTE));
                    nextRunTime.addSeconds(getDelay().get(Calendar.SECOND));
                    nextRunTime.addMillis(getDelay().get(Calendar.MILLISECOND));
                }
View Full Code Here

TOP

Related Classes of pt.opensoft.util.DateTime

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.