WebObjects 5.2.3

com.webobjects.webservices.generation
Class WOServiceUtilities

java.lang.Object
  extended bycom.webobjects.webservices.generation.WOServiceUtilities

public class WOServiceUtilities
extends Object


Nested Class Summary
static interface WOServiceUtilities.RuleSystemConstants
          Constants for keys used by the rule system to access values in a D2WContext
 
Constructor Summary
WOServiceUtilities()
           
 
Method Summary
static void addDestinationObjectToEOWithKey(WOEnterpriseObjectSerializationStrategy strategy, Object object, EOEnterpriseObject eo, String propertyName)
          Performs addObjectToBothSidesOfRelationshipWithKey using eo as the origin and object as the destination.
static NSArray aggregateValuesResult(NSArray result, NSArray translatedKeys, NSArray outputPartNames)
          Returns the result with all values associated with an aggregate key from translatedKeys placed into a WOStringKeyMap.
static EOQualifier buildQualifier(EOEntity entity, NSArray attributeNames, NSArray values, NSArray comparisonKeys, NSArray attributeClassNames, String unspecifiedArgumentKey)
          Returns an EOQualifier built to fetch objects where for each attribute name in attributeNames a qualifier, based on the corresponding value from values and comparison key from comparisonKeys, is added to an EOAndQualifier.
static EOEditingContext editingContextForContext(WOContext context)
          Returns an EOEditingContext based on information in context.
static EOGlobalID globalIDFromValues(EOEntity entity, NSArray attributeKeys, NSArray inputPartValues)
          Returns EOGlobalID of an object with primary key values created from inputPartValues.
static boolean shouldCommitChangesImmediately(WOContext context)
          Returns true if the operation should commit changes in its editing context immediately after completing its work, false if the operation should leave the changes in its editing context unsaved to the parent object store.
static Object valueForAggregateKey(String key, NSArray array)
          Returns the aggregate value for key key of NSArray array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WOServiceUtilities

public WOServiceUtilities()
Method Detail

addDestinationObjectToEOWithKey

public static void addDestinationObjectToEOWithKey(WOEnterpriseObjectSerializationStrategy strategy,
                                                   Object object,
                                                   EOEnterpriseObject eo,
                                                   String propertyName)
Performs addObjectToBothSidesOfRelationshipWithKey using eo as the origin and object as the destination.

Parameters:
strategy - the serialization strategy to use while handling the eo
object - destination object to add to eo using propertyName as a key
eo - EOEnterpriseObjects to add object to
propertyName - key to use when adding object to eo

aggregateValuesResult

public static NSArray aggregateValuesResult(NSArray result,
                                            NSArray translatedKeys,
                                            NSArray outputPartNames)

Returns the result with all values associated with an aggregate key from translatedKeys placed into a WOStringKeyMap. Values are placed into the WOStringKeyMap with the corresponding key from outputPartNames.

If there are no aggregate keys defined in the translatedKeys, then the result array is returned unchanged. Otherwise the array of resultant WOStringKeyMap objects is added to the result array. The value of arrays of values are computed by the valueForAggregateKey method.

Parameters:
result - array of result values
translatedKeys - array of EO key paths that will be returned
outputPartNames - array of SOAP element names for the result values
Returns:
array of results with aggregate key values converted to WOStringKeyMaps
See Also:
valueForAggregateKey(java.lang.String, com.webobjects.foundation.NSArray)

buildQualifier

public static EOQualifier buildQualifier(EOEntity entity,
                                         NSArray attributeNames,
                                         NSArray values,
                                         NSArray comparisonKeys,
                                         NSArray attributeClassNames,
                                         String unspecifiedArgumentKey)
Returns an EOQualifier built to fetch objects where for each attribute name in attributeNames a qualifier, based on the corresponding value from values and comparison key from comparisonKeys, is added to an EOAndQualifier.

Parameters:
entity - EOEntity the resulting qualifier will be built for
attributeNames - array of key paths to qualify
values - array of values, each corresponding to a key path of attributeNames
comparisonKeys - array of comparison keys, each corresponding to a key path of attributeNames
attributeClassNames - array of class name strings, each corresponding to a key path of attributeNames
unspecifiedArgumentKey - key that signifies that the client did not specify a value for an argument

editingContextForContext

public static EOEditingContext editingContextForContext(WOContext context)
Returns an EOEditingContext based on information in context. If context contains has a WOSession, that session's editing context is returned. Otherwise a new editing context is returned.

Parameters:
context - the WOContext associated with a WOOperation
Returns:
the session's EOEditingContext if a session exists, a new editing context otherwise

globalIDFromValues

public static EOGlobalID globalIDFromValues(EOEntity entity,
                                            NSArray attributeKeys,
                                            NSArray inputPartValues)

Returns EOGlobalID of an object with primary key values created from inputPartValues. The primary key attribute names of entity are compared with keys of attributeKeys if they match, the values in inputPartValues corresponding to the primary key attribute names of attributeKeys are used to generate an EOKeyGlobalID.

Note that attributeKeys may contain more attribute names than the primary key attributes for entity, but should not contain less.

Parameters:
entity - entity to create a global ID for
attributeKeys - array of EO attribute keys (generally from WOOperation.inputPartKeyPaths())
inputPartValues - array of object values (generally from WOOperation.inputPartValues())
Returns:
the EOGlobalID represnting the object with primary attribute keys and values from attributeKeys and inputPartValues

shouldCommitChangesImmediately

public static boolean shouldCommitChangesImmediately(WOContext context)

Returns true if the operation should commit changes in its editing context immediately after completing its work, false if the operation should leave the changes in its editing context unsaved to the parent object store.

If the operation is being invoked as part of a transaction (invoked between a WOBeginTransactionOperation and a WOCommitTransactionOperation or WORollbackTransactionOperation), then the operation should not save changes in its editing context so this method returns false. If the operation associated with context is not invoked as part of a transaction, then this method returns false.

Parameters:
context - the WOContext of a WOOperation
Returns:
true if the operation associated with context should commit its editing context changes immediately, false otherwise

valueForAggregateKey

public static Object valueForAggregateKey(String key,
                                          NSArray array)
Returns the aggregate value for key key of NSArray array.

Parameters:
key - aggregate key path to generate a value for
array - array of objects or other NSArrays of objects to aggregate values of
Returns:
the value for aggregate key key of NSArray array

Last updated Thu Oct 21 15:04:16 PDT 2004.

Copyright © 2004 Apple Computer, Inc.