@Override
 public IDominoType getTypeDefinition(final Class<? extends IDominoType> type) {
   IDominoType result = getTypeDefinitions().get(type);
   if (result == null) {
     // TODO NTF improve exception handling
     try {
       result = type.newInstance();
     } catch (IllegalAccessException e) {
       ODAUtils.handleException(e);
     } catch (InstantiationException e) {
       ODAUtils.handleException(e);
     }
     getTypeDefinitions().put(type, result);
   }
   return result;
 }
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DateTime#setLocalTime(java.lang.String)
  */
 @Override
 public void setLocalTime(final String time) {
   try {
     idt = null;
     lotus.domino.DateTime worker = getDelegate();
     worker.setLocalTime(time);
     workDone(worker, true);
   } catch (NotesException ne) {
     ODAUtils.handleException(ne);
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DateTime#setLocalDate(int, int, int, boolean)
  */
 @Override
 public void setLocalDate(
     final int year, final int month, final int day, final boolean preserveLocalTime) {
   try {
     lotus.domino.DateTime worker = getDelegate();
     worker.setLocalDate(year, month, day, preserveLocalTime);
     workDone(worker, true);
   } catch (NotesException ne) {
     ODAUtils.handleException(ne);
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DateTime#getLocalTime()
  */
 @Override
 public String getLocalTime() {
   String ret = null;
   try {
     lotus.domino.DateTime worker = getDelegate();
     ret = worker.getLocalTime();
     workDone(worker, false);
   } catch (NotesException ne) {
     ODAUtils.handleException(ne);
   }
   return ret;
 }
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DateTime#convertToZone(int, boolean)
  */
 @Override
 public void convertToZone(final int zone, final boolean isDST) {
   try {
     lotus.domino.DateTime worker = getDelegate();
     worker.convertToZone(zone, isDST);
     workDone(worker, true);
   } catch (NotesException ne) {
     ODAUtils.handleException(ne);
   }
   // TODO NTF - find out what this actually does. The documentation is... vague
   // throw new UnimplementedException("convertToZone is not yet implemented.");
 }
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DateTime#getTimeZone()
  */
 @Override
 public int getTimeZone() {
   // TODO: are these the upper two bits of innard1
   int ret = 0;
   try {
     lotus.domino.DateTime worker = getDelegate();
     ret = worker.getTimeZone();
     workDone(worker, false);
   } catch (NotesException ne) {
     ODAUtils.handleException(ne);
   }
   return ret;
 }
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DateTime#getZoneTime()
  */
 @Override
 public String getZoneTime() {
   // TODO NTF - find out what this really does
   String ret = null;
   try {
     lotus.domino.DateTime worker = getDelegate();
     ret = worker.getZoneTime();
     workDone(worker, false);
   } catch (NotesException ne) {
     ODAUtils.handleException(ne);
   }
   return ret;
   // throw new UnimplementedException("getZoneTime is not yet implemented.");
 }
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DateTime#adjustYear(int, boolean)
  */
 @Override
 public void adjustYear(final int n, final boolean preserveLocalTime) {
   if (preserveLocalTime) {
     idt.adjustYear(n);
   } else {
     try {
       lotus.domino.DateTime worker = getDelegate();
       worker.adjustYear(n, preserveLocalTime);
       workDone(worker, true);
     } catch (NotesException ne) {
       ODAUtils.handleException(ne);
     }
   }
 }
 private void timeDifferenceCommon(final lotus.domino.DateTime dt, final Object[] res) {
   lotus.domino.DateTime dtLocal = dt;
   lotus.domino.DateTime lotusDTTmp = null;
   try {
     if (dtLocal instanceof org.openntf.domino.impl.DateTime) {
       lotusDTTmp = ((org.openntf.domino.impl.DateTime) dtLocal).getDelegate();
       dtLocal = lotusDTTmp;
     }
     lotus.domino.DateTime worker = getDelegate();
     if (res[0] instanceof Integer) {
       res[0] = worker.timeDifference(dtLocal);
     } else if (res[0] instanceof Double) {
       res[0] = worker.timeDifferenceDouble(dtLocal);
     }
     workDone(worker, false);
   } catch (NotesException ne) {
     ODAUtils.handleException(ne);
   } finally {
     if (lotusDTTmp != null) s_recycle(lotusDTTmp);
   }
 }
Beispiel #10
0
  /**
   * Initialize.
   *
   * @param delegate the delegate
   */
  private void initialize(final lotus.domino.DateTime delegate) {
    try {

      String innards = ((lotus.domino.local.DateTime) delegate).getReplicaID();
      int dateInnard = (int) Long.parseLong(innards.substring(0, 8), 16);
      int timeInnard = (int) Long.parseLong(innards.substring(8, 16), 16);
      idt = IDateTime.$.create();

      long millis = dateInnard == ANY ? 0 : ((dateInnard & 0xFFFFFF) - INNARD_OFFSET) * 86400000L;
      if (timeInnard != ANY) {
        millis += timeInnard * 10L;
      }
      idt.setLocalTime(millis);
      if (dateInnard == ANY) {
        idt.setAnyDate();
      }
      if (timeInnard == ANY) {
        idt.setAnyTime();
      }

    } catch (NotesException ne) {
      ODAUtils.handleException(ne);
    }
  }