Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSTimestamp


      final String typeClassName = att.valueTypeClassName();
     
      if (NSTIMESTAMP_CANONICAL_CLASS_NAME.equals(typeClassName)) {
        long l = (Long) value;
       
        return new NSTimestamp(l);
      } else if (INTEGER_CANONICAL_CLASS_NAME.equals(typeClassName)) {
        return ((Number) value).intValue();
      }
    }
   
View Full Code Here


     @param  params     The param dictionary which must contain the above mentioned key-value pairs.
     *
     *  @return  always <code>true</code>
     */
    public final static boolean updateTimestamp(Object object, Object attribute, String key, NSDictionary params){
        NSKeyValueCoding.Utility.takeValueForKey(object, new NSTimestamp(), key);
        return true;
    }
View Full Code Here

    public static NSTimestamp aggregateTimestampWithQualifier(EOEditingContext ec,
            String entityName,
            String attributeName,
            String function,
            EOQualifier qualifier) {
      NSTimestamp timestamp = null;
      Object obj = _aggregateFunctionWithQualifier(ec, entityName, attributeName, function, NSTimestamp.class, null, qualifier);
      if (obj instanceof NSTimestamp) {
        timestamp = (NSTimestamp)obj;
      }
      return timestamp;
View Full Code Here

      } catch(InvocationTargetException e) {
        throw NSForwardException._runtimeExceptionForThrowable(e);
      }
    } else {
      if(value instanceof Timestamp) {
        return new NSTimestamp((Timestamp)value);
      }
      if(value instanceof Date) {
        Date temp = (Date)value;
        return new NSTimestamp(temp.getTime());
      } else {
        throw new JDBCAdaptorException(new StringBuilder().append(value).append(" of type ").append(value.getClass().getName()).append(" is not a valid Date type.  You must use java.sql.Timestamp, java.sql.Date, or java.sql.Time").toString(), null);
      }
    }
  }
View Full Code Here

        for (int i=0; i<theCount; i++) {
            WOResponse aResponse = responses[i];
            MInstance anInstance = (MInstance) instArray.objectAtIndex(i);
            if (aResponse != null) {
                anInstance.updateRegistration(new NSTimestamp());
                if (aResponse.headerForKey("x-webobjects-refusenewsessions") != null) {
                    anInstance.setRefusingNewSessions(true);
                } else {
                    anInstance.setRefusingNewSessions(false);
                }
View Full Code Here

            theApplication._lock.endReading();
        }
        WOResponse aResponse = WOApplication.application().createResponseInContext(null);
        aResponse.appendContentString(xml);
        aResponse.setHeader("text/xml", "content-type");
        aResponse.setHeader(aFormat.format(new NSTimestamp()), "Last-Modified");
        if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelDetailed, NSLog.DebugGroupDeployment))
            NSLog.debug.appendln("woConfigAction returned: " + xml);

        return aResponse;
    }
View Full Code Here

     * @throws IOException
     */
    private void parseDate(byte[] bytes, int startIndex, int marker) throws IOException {
      long longbits = readLong(bytes, startIndex);
      double date = Double.longBitsToDouble(longbits);
      NSTimestamp ts = new NSTimestamp((long)((date + kCFAbsoluteTimeIntervalSince1970) * 1000));
      // objectTable.add(new Date(ts.getTime()));
      objectTable.add(ts);
      if (logger.isDebugEnabled()) {
        logger.info("parseDate double=" + date + " long date=" + (long) date + " timestamp=" + ts + " converted=" + new Date(ts.getTime()));
      }
    }
View Full Code Here

      // The count is teh number of char not the number of bytes. With UTF-16BE there is 2 bytes per char.
      objectTable.add(new String(bytes, index, count * 2, encoding));
    }

    private static double _convertDate(Date date) {
      NSTimestamp ts = null;
      if (date instanceof NSTimestamp) {
        ts = (NSTimestamp) date;
      } else {
        // assume java.util.Date or java.sql.Date
        ts = new NSTimestamp(date);
      }

      return (ts.getTime() / 1000) - kCFAbsoluteTimeIntervalSince1970;
    }
View Full Code Here

                    aTrans = Integer.valueOf((String) aStatsDict.valueForKey("transactions"));
                } catch (Throwable ex) {
                    aTrans = null;
                }
                if (aTrans != null && (aTrans.intValue() > 0)) {
                    NSTimestamp aDate;
                    float aRunningTime;

                    try {
                        // Important! This relies on the fact that the stats will deliver startdate based on GMT, since new NSTimestamp is also base on GMT!
                        aDate = (NSTimestamp)StatsUtilities.dateFormatter.parseObject(aStartDate);
                        aRunningTime = (aDate.getTime() - System.currentTimeMillis()) / 1000;
                    } catch (java.text.ParseException ex) {
                        aRunningTime = (float) 0.0;
                        NSLog.err.appendln("Format error in StatsUtilities: " + aStartDate);
                        NSLog.err.appendln(ex.getErrorOffset());
                        NSLog.err.appendln("Actual Transactions Per Second rate is inaccurate.");
View Full Code Here

      switch (copyType) {
      case REFERENCE:
        Utility.copyAttribute(source, destination, attribute);
        break;
      case CURRENT_TIMESTAMP:
        destination.takeStoredValueForKey(new NSTimestamp(), attributeName);
        break;
      case UUID:
        destination.takeStoredValueForKey(UUID.randomUUID(), attributeName);
        break;
      case NULLIFY:
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSTimestamp

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.