Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSDictionary$_JavaNSDictionaryMapEntry


        String id = foundZones[idx];
        TimeZone tz = TimeZone.getTimeZone(id);

        NSArray<String> keys = new NSArray<String>(new String[] { ID_KEY, NAME_KEY, DST_KEY, OFF_KEY } );
        NSArray<Object> vals = new NSArray<Object>(new Object[] { id, tz.getDisplayName(), Integer.valueOf(tz.getDSTSavings()), Integer.valueOf(tz.getRawOffset()) } );
        NSDictionary foundValues = new NSDictionary(vals,keys);

        zonesHash.takeValueForKey(foundValues, id);
      }
      zones = zonesHash.immutableClone();
    }
View Full Code Here


  /**
    * @see com.webobjects.eoaccess.EODatabaseContext.Delegate#databaseContextShouldUpdateCurrentSnapshot(com.webobjects.eoaccess.EODatabaseContext, com.webobjects.foundation.NSDictionary, com.webobjects.foundation.NSDictionary, com.webobjects.eocontrol.EOGlobalID, com.webobjects.eoaccess.EODatabaseChannel)
    * @see EODatabase#snapshotForGlobalID(EOGlobalID, long)
    */
   public NSDictionary databaseContextShouldUpdateCurrentSnapshot(EODatabaseContext dbCtxt, NSDictionary existingSnapshot, NSDictionary fetchedRow, EOGlobalID gid, EODatabaseChannel dbChannel) {
     NSDictionary resultSnapshot =  (NSDictionary)perform("databaseContextShouldUpdateCurrentSnapshot", dbCtxt, existingSnapshot, fetchedRow, gid, dbChannel, null);
     if (resultSnapshot != null) {
       return resultSnapshot;
     }
    
     /* There is no way for this delegate method to say "do what you normally do". Our two choices for a default return value are
       never update the snapshot or always update it.  What we want is neither, we want the unchanged EOF behavior.  So we
       re-implement what EODatabaseChannel would so in the absence of this delegate method: updating of the snapshot depends
       whether we are refreshing and on the snapshot's age and the fetchTimestamp of the EC doing the fetching.
      */   
    try {
       // Again with the object rape.  EODatabaseChannel.currentEditingContext() is private and the underlying instance variable
       // is protected.  We need the ec, so we do what we have to...
       EOEditingContext ec = (EOEditingContext) currentEditingContext.invoke(dbChannel, new Object[] {});
      
       // Get the snapshot if it has not expired.  cachedSnapshot will be null if it has expired
       // If not null, it should be the same as the existingSnapshot parameter
       NSDictionary cachedSnapshot = dbCtxt.database().snapshotForGlobalID(gid, ec.fetchTimestamp());
   
       // If we are refreshing or the snapshot in the cache has timed out, but the fetched row
       // matches the cached snapshot, reset the time stamp by recording the existing snapshot again.
       if (existingSnapshot.equals(fetchedRow) && (dbChannel.isRefreshingObjects() || cachedSnapshot == null)) {
         dbCtxt.database().recordSnapshotForGlobalID(existingSnapshot, gid);
View Full Code Here

      byte[] object = new byte[0];
      dos.writeShort(object.length);
      dos.write(object);

      NSDictionary userInfo = notification.userInfo();
      if (userInfo == null) {
        userInfo = NSDictionary.EmptyDictionary;
      }

      dos.writeShort(userInfo.count());
      for (Object key : userInfo.allKeys()) {
        byte[] keyBytes = key.toString().getBytes();
        byte[] valueBytes = userInfo.objectForKey(key).toString().getBytes();
        dos.writeShort(keyBytes.length);
        dos.write(keyBytes);
        dos.writeShort(valueBytes.length);
        dos.write(valueBytes);
      }
View Full Code Here

        _value = value;
        _attribute = attribute;
    }

    public String sqlStringForBindingOnExpression(EOSQLExpression expression) {
        NSDictionary binding = expression.bindVariableDictionaryForAttribute( _attribute, _value );
        expression.addBindVariableDictionary(binding);
        return (String) binding.objectForKey(EOSQLExpression.BindVariablePlaceHolderKey);
    }
View Full Code Here

    }

    @Override
    public WOActionResults defaultAction() {
        //testIndexing();
        NSDictionary dict = new NSDictionary("TestValue", "TestKey");
        NSArray keys = new NSArray(new String[]{"test1", "test2"});
        _EOMutableKnownKeyDictionary vals;
        _EOMutableKnownKeyDictionary.Initializer initializer = new _EOMutableKnownKeyDictionary.Initializer(keys);
        vals = new _EOMutableKnownKeyDictionary(initializer);
        log.info(vals);
View Full Code Here

  public NSMutableDictionary formattersByKeypath() {
    if (formattersByKeypath == null) {
      NSArray columns = columns();
      formattersByKeypath = new NSMutableDictionary(columns.count());
      for (int i = 0; i < columns.count(); i++) {
        NSDictionary column = (NSDictionary) columns.objectAtIndex(i);
        String className = (String) column.valueForKey(FORMATTER_CLASS);
        if (className != null) {
          try {
            Format formatter = (Format) Class.forName(className).newInstance();
            String pattern = (String) column.valueForKey(FORMAT_PATTERN);
            if (pattern != null) {
              NSKeyValueCoding.DefaultImplementation.takeValueForKey(formatter, pattern, "pattern");
            }
            formattersByKeypath.setObjectForKey(formatter, column.valueForKey(KEY_PATH));
          }
          catch (Exception e) {
            throw NSForwardException._runtimeExceptionForThrowable(e);
          }
        }
View Full Code Here

   * @param sortConfig NSArray of sorts from grid configuration (not EOSortOrderings)
   */
  public static void updateDisplayGroupSort(WODisplayGroup dg, NSArray sortConfig) {
    NSMutableArray sortOrders = new NSMutableArray(sortConfig.count());
    for (int i = 0; i < sortConfig.count(); i++) {
      NSDictionary column = (NSDictionary) sortConfig.objectAtIndex(i);
      sortOrders.addObject(new ERXSortOrdering((String) column.objectForKey(KEY_PATH), (SORT_ASCENDING.equals(column.objectForKey(SORT_DIRECTION)) ? EOSortOrdering.CompareCaseInsensitiveAscending : EOSortOrdering.CompareCaseInsensitiveDescending)));
    }

    // Only set this if there has been an actual change to avoid discarding fetched objects
    if (! sortOrders.equals(dg.sortOrderings()) ) {
      dg.setSortOrderings(sortOrders);
View Full Code Here

                    byte[] buffer = message.getBuffer();
                    ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
                    ObjectInputStream dis = new ObjectInputStream(bais);
                    String name = (String) dis.readObject();
                    Object object = dis.readObject();
                    NSDictionary userInfo = (NSDictionary) dis.readObject();
                    NSNotification notification = new NSNotification(name, object, userInfo);
                    if (log.isDebugEnabled()) {
                        log.debug("Received notification: " + notification);
                    } else if (log.isInfoEnabled()) {
                        log.info("Received " + notification.name() + " notification.");
View Full Code Here

    protected void prepareEditRelationshipPage(D2WContext context, EditRelationshipPageInterface erpi, String entityName) {
      EOEditingContext ec = ERXEC.newEditingContext(session().defaultEditingContext().parentObjectStore());
      String keypath = keyPathFromRequest();
      String masterEntityName = ERXStringUtilities.firstPropertyKeyInKeyPath(keypath);
      String relationshipKey = ERXStringUtilities.keyPathWithoutFirstProperty(keypath);
      NSDictionary pk = primaryKeyFromRequest(ec, masterEntityName);
      EOEnterpriseObject masterObject = ERXEOControlUtilities.objectWithPrimaryKeyValue(ec, masterEntityName, pk, null);
      erpi.setMasterObjectAndRelationshipKey(masterObject, relationshipKey);
      erpi.setNextPage(previousPageFromRequest());
    }
View Full Code Here

        return hashMap.remove(key);
      }

      @Override
      public NSDictionary immutableClone() {
        return new NSDictionary(hashMap);
      }

      @Override
      public NSArray allKeys() {
        return new NSArray(hashMap.keySet());
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSDictionary$_JavaNSDictionaryMapEntry

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.