To edit or add content to this Wiki, you can simply create a new account at http://wocommunity.org/account.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

[code]
#if ($entity.packageName)
package $entity.superclassPackageName;
#end

import com.webobjects.foundation.*;
#set ($useControl = "false")
#if (!$entity.sortedClassToManyRelationships.empty)
#set ($useControl = "true")
#elseif (!$entity.sortedFetchSpecs.empty)
#set ($useControl = "true")
#elseif (!$entity.isAbstract)
#set ($useControl = "true")
#elseif (!$entity.parentSet)
#set ($useControl = "true")
#end
#if ($useControl == "true")
import com.webobjects.eocontrol.*;
#end
#set ($useBigDecimal = "false")
#foreach ($attribute in $entity.sortedClassAttributes)
#if (!$attribute.inherited)
#if ($attribute.javaClassName == "BigDecimal") #set ($useBigDecimal = "true")#end
#end
#end
#if ($useBigDecimal == "true")
import java.math.BigDecimal;
#end
#if (!$entity.sortedClassToManyRelationships.empty)
import java.util.*;
#end

/**

  • Java Class $
    Unknown macro: {entity.prefixClassNameWithOptionalPackage}
    .java generated for entity $
    Unknown macro: {entity.name}

    #if ($entity.parentSet)

    • <p>
    • The entity parent is $
      Unknown macro: {entity.parent.classNameWithDefault}
      • </p>
        #end
      • <p><b>
      • DO NOT EDIT. Make changes to $
        Unknown macro: {entity.classNameWithOptionalPackage}
        .java instead.
      • </b></p>
      • <p>
      • copyright $
        Unknown macro: {copyrightYear}
        $
        Unknown macro: {copyrightBy}
      • </p>
        */
        public abstract class $
        Unknown macro: {entity.prefixClassNameWithoutPackage}
        extends#if ($entity.parentSet) $
      #else EOGenericRecord#end {
      private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger( $
      Unknown macro: {entity.prefixClassNameWithoutPackage}
      .class);
      #foreach ($attribute in $entity.sortedClassAttributes)
      #if (!$attribute.inherited)

    /**

    • Key value for attribute $attribute.name
      */
      public static final String $
      Unknown macro: {attribute.capitalizedName}
      Key = "$attribute.name";
      #else

    // Inherited attribute $attribute.name
    #end
    #end
    #foreach ($relationship in $entity.sortedClassToOneRelationships)
    #if (!$relationship.inherited)

    /**

    • Key value for to one relationship $relationship.name
      */
      public static final String $
      Unknown macro: {relationship.capitalizedName}

      Key = "$relationship.name";
      #else

      // Inherited relationship $relationship.name
      #end
      #end
      #foreach ($relationship in $entity.sortedClassToManyRelationships)
      #if (!$relationship.inherited)

      /**

      • Key value for to many relationship $relationship.name
        */
        public static final String $
      Key = "$relationship.name";
      #else

    // Inherited relationship $relationship.name
    #end
    #end
    #if (!$entity.isAbstract)

    /**

    • Returns a newly initialized instance of $
    . The new object is inserted in the editing context.
    *
  • @param context
  • editing context to insert in.
  • @return newly initialized instance
    */
    public static $
    Unknown macro: {entity.prefixClassNameWithoutPackage}

    new$

    Unknown macro: {entity.classNameWithoutPackage}

    Instance(EOEditingContext context) {
    EOClassDescription description = EOClassDescription.classDescriptionForEntityName("$

    Unknown macro: {entity.name}

    ");
    EOEnterpriseObject object = description.createInstanceWithEditingContext(context, null);
    context.insertObject(object);
    return ($

    )object;
    }

/**

  • Returns a list of all the object in the shared editing context.
    *
  • @return list of $
    Unknown macro: {entity.name}

    */
    protected static NSArray<? extends $entity.prefixClassNameWithoutPackage> _all$

    Unknown macro: {entity.classNameWithoutPackage}

    Objects() {
    NSMutableArray<$entity.prefixClassNameWithoutPackage> result = null;
    NSArray<EOEnterpriseObject> aList = EOSharedEditingContext.defaultSharedEditingContext().objectsByEntityName().objectForKey("$

    ");
    if (aList != null)
    Unknown macro: { result = new NSMutableArray<$entity.prefixClassNameWithoutPackage>(aList.count()); for (EOEnterpriseObject anObject }
    return (result != null ? result : NSArray.<$entity.prefixClassNameWithoutPackage> emptyArray());
    }
    #end

/**

  • Returns the name of the entity attached to this class.
    *
  • @return name of the entity
    */
    public static String entity()
    Unknown macro: { return "$
    Unknown macro: {entity.name}

    ";
    }

    /**

    • Sole Constructor
      */
      public $
      Unknown macro: {entity.prefixClassNameWithoutPackage}
      ()
      Unknown macro: { super(); }
      #foreach ($fetchSpecification in $entity.sortedFetchSpecs)

    /**

    • Returns the object matching the fetch specification "$fetchSpecification.name".
      *
    • @param context
    • editing context to fetch in.
      #foreach ($binding in $fetchSpecification.distinctBindings)
    • @param $
      Unknown macro: {binding.name}
      Binding
    • fetch specification binding.
      #end
    • @return list of $
    */ public static NSArray<?> objectsFor$
    Unknown macro: {fetchSpecification.capitalizedName}
    (EOEditingContext context#foreach ($binding in $fetchSpecification.distinctBindings), $
    Unknown macro: {binding.javaClassName}
    $
    Unknown macro: {binding.name}

    Binding#end) {
    EOFetchSpecification spec = EOFetchSpecification.fetchSpecificationNamed("$

    Unknown macro: {fetchSpecification.name}

    ", "$

    Unknown macro: {entity.name}

    ");
    #if (!$fetchSpecification.distinctBindings.empty)
    NSMutableDictionary<String, Object> bindings = new NSMutableDictionary<String, Object>();
    #foreach ($binding in $fetchSpecification.distinctBindings)
    if ($

    Binding != null) bindings.setObjectForKey($
    Unknown macro: {binding.name}

    Binding, "$

    "); #end spec = spec.fetchSpecificationWithQualifierBindings(bindings);#end return context.objectsWithFetchSpecification(spec); }
    #end
    #foreach ($attribute in $entity.sortedClassAttributes)
    #if (!$attribute.inherited)

/**

  • Returns the attribute "$attribute.name".
    *
  • @return $attribute.name
    */
    public $attribute.javaClassName $
    Unknown macro: {attribute.name}

    () {
    return ($attribute.javaClassName)this.storedValueForKey("$

    ");
    }

/**

  • Sets the attribute "$attribute.name".
    *
  • @param value
  • $attribute.name.
    */
    public void set$
    Unknown macro: {attribute.capitalizedName}

    ($attribute.javaClassName value) {
    if (logger.isDebugEnabled())

    Unknown macro: { logger.debug( "value}

    this.takeStoredValueForKey(value, "$

    Unknown macro: {attribute.name}

    ");
    }

    /**

    • Initialize the attribute "$attribute.name".
      *
    • @param value
    • $attribute.name.
      */
      public void initialize$
    ($attribute.javaClassName value)
    Unknown macro: { this.set$
    Unknown macro: {attribute.capitalizedName}
    (value); }
    #end
    #end
    #foreach ($relationship in $entity.sortedClassToOneRelationships)
    #if (!$relationship.inherited)

/**

  • Returns the relationship "$relationship.name".
    *
  • @return $relationship.name
    */
    public $
    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    $

    Unknown macro: {relationship.name}

    () {
    return ($

    )this.storedValueForKey("$
    Unknown macro: {relationship.name}

    ");
    }

    /**

    • Sets the relationship "$relationship.name".
      *
    • @param value
    • $relationship.name.
      */
      public void set$
      Unknown macro: {relationship.capitalizedName}
      ($
      Unknown macro: {relationship.actualDestination.classNameWithDefault}
      value) {
      if (logger.isDebugEnabled())
      Unknown macro: { logger.debug( "value}
      this.takeStoredValueForKey(value, "$
    ");
    }

/**

  • Returns the relationship "$relationship.name".
    *
  • @return $relationship.name
    */
    public $
    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    $

    Unknown macro: {relationship.name}

    Relationship() {
    return ($

    )this.storedValueForKey("$
    Unknown macro: {relationship.name}

    ");
    }

    /**

    • Sets the relationship "$relationship.name". This method takes care of setting the reverse relationship if it exists.
      *
    • @param value
    • $relationship.name.
      */
      public void set$
      Unknown macro: {relationship.capitalizedName}
      Relationship($
      Unknown macro: {relationship.actualDestination.classNameWithDefault}

      value) {
      if (value == null) {
      $

      object = this.$
    ();
    if (object != null)
    this.removeObjectFromBothSidesOfRelationshipWithKey(object, "$
    Unknown macro: {relationship.name}

    ");
    } else {
    this.addObjectToBothSidesOfRelationshipWithKey(value, "$

    ");
    }
    }

/**

  • Initialize the relationship "$relationship.name".
    *
  • @param value
  • $relationship.name.
    */
    public void initialize$
    Unknown macro: {relationship.capitalizedName}

    ($

    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    value) {
    this.set$

    Relationship(value);
    }
    #end
    #end
    #foreach ($relationship in $entity.sortedClassToManyRelationships)
    #if (!$relationship.inherited)

/**

  • Returns the relationship "$relationship.name".
    *
  • @return list of $
    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    */
    @SuppressWarnings("unchecked")
    public NSArray<$

    > $
    Unknown macro: {relationship.name}

    () {
    NSArray aList = (NSArray)this.storedValueForKey("$

    ");
    if (aList != null )
    Unknown macro: { return aList; }
    else
    Unknown macro: { return NSArray.emptyArray(); }
    }

/**

  • Sets the relationship "$relationship.name".
    *
  • @param value
  • list of $
    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    .
    */
    public void set$

    Unknown macro: {relationship.capitalizedName}

    (NSArray<$

    > value)
    Unknown macro: { this.takeStoredValueForKey(value, "$
    Unknown macro: {relationship.name}

    ");
    }

    /**

    • Adds an object to the relationship "$relationship.name". This method log a warning if the object is not in the same editing context than the receiver.
      *
    • @param object
    • $
      Unknown macro: {relationship.actualDestination.classNameWithDefault}

      .
      */
      @SuppressWarnings("cast")
      public void addTo$

      Unknown macro: {relationship.capitalizedName}

      ($

      object) {
      if (logger.isDebugEnabled()) {
      logger.debug( "object: " + object);
      if ( (this.editingContext() Unable to render embedded object: File (= null) && (object != null) && (() not found. (this instanceof com.sPearWay.access.NamedObjectInterface)) || (! ((com.sPearWay.access.NamedObjectInterface)this).isReadOnly())) && ((! (object instanceof com.sPearWay.access.NamedObjectInterface)) || (! ((com.sPearWay.access.NamedObjectInterface)object).isReadOnly())) && ( ! this.editingContext().equals(object.editingContext()) ) )
      Unknown macro: { try
      Unknown macro: { throw new Exception("WrongEditingContext"); }
      catch(Exception exception)
      Unknown macro: { logger.warn("Relationship "$relationship.name" Exception " , exception); }
      }
      }
      this.includeObjectIntoPropertyWithKey(object, "$
    "); }

/**

  • Removes an object from the relationship "$relationship.name".
    *
  • @param object
  • $
    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    .
    */
    public void removeFrom$

    Unknown macro: {relationship.capitalizedName}

    ($

    object)
    Unknown macro: { if (logger.isDebugEnabled())
    Unknown macro: { logger.debug( "object}
    this.excludeObjectFromPropertyWithKey(object, "$
    Unknown macro: {relationship.name}

    ");
    }

    /**

    • Adds an object to the relationship "$relationship.name". This method takes care of setting the reverse relationship if it exists.
      *
    • @param object
    • $
      Unknown macro: {relationship.actualDestination.classNameWithDefault}

      .
      */
      public void addTo$

      Unknown macro: {relationship.capitalizedName}

      Relationship($

      object) {
      this.addObjectToBothSidesOfRelationshipWithKey(object, "$
    "); }

/**

  • Removes an object from the relationship "$relationship.name". This method takes care of setting the reverse relationship if it exists.
    *
  • @param object
  • $
    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    .
    */
    public void removeFrom$

    Unknown macro: {relationship.capitalizedName}

    Relationship($

    object) {
    this.removeObjectFromBothSidesOfRelationshipWithKey(object, "$
    Unknown macro: {relationship.name}

    ");
    }

    /**

    • Creates and returns a new object for the relationship "$relationship.name".
      *
    • @return $
      Unknown macro: {relationship.actualDestination.classNameWithDefault}

      .
      */
      public $

      create$
      Unknown macro: {relationship.capitalizedName}
      Relationship() {
      EOClassDescription classDescription = EOClassDescription.classDescriptionForEntityName("$
      Unknown macro: {relationship.actualDestination.name}
      ");
      EOEnterpriseObject object = classDescription.createInstanceWithEditingContext(this.editingContext(), null);
      this.editingContext().insertObject(object);
      this.addObjectToBothSidesOfRelationshipWithKey(object, "$
    ");
    return ($
    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    )object;
    }

    /**

    • Removes and deletes if appropriate an object from the relationship "$relationship.name".
    • <p>
    • The delete rule for "$relationship.name" is: $
      Unknown macro: {relationship.deleteRule.name}

      #if ($

      Unknown macro: {relationship.ownsDestination}

      ), and own destination#end<br/>

      • Possible choices are "Nullify", "Cascade", "Deny", "NoAction"
      • </p>
      • <p>
        #if ($
      != "Deny")
    • The object is removed from the relationship "$relationship.name" and its inverse relationship if it exists.
      #if ($
      Unknown macro: {relationship.deleteRule.name}
      == "Cascade")
    • The receiver cascade the delete rule, the object will be deleted from the editing context.
      #elseif ($
      Unknown macro: {relationship.ownsDestination}
      )
    • The receiver owns the object, the object will be deleted from the editing context.
      #end
      #else
    • The remove will be denied. This method does nothing.
      #end
    • </p>
      *
    • @param object
    • $
    .
    */
    public void delete$
    Unknown macro: {relationship.capitalizedName}

    Relationship($

    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    object) {
    // Delete rule for $

    Unknown macro: {relationship.name}

    is: $

    Unknown macro: {relationship.deleteRule.name}

    // Possible choices are "Nullify", "Cascade", "Deny", "NoAction"
    #if ($

    != "Deny")
    this.removeObjectFromBothSidesOfRelationshipWithKey(object, "$

    ");
    #if ($

    Unknown macro: {relationship.deleteRule.name}

    == "Cascade")
    // Cascade delete rule
    this.editingContext().deleteObject(object);
    #elseif ($

    Unknown macro: {relationship.ownsDestination}

    )
    // Own destination delete rule
    this.editingContext().deleteObject(object);
    #end
    #else
    // Deny delete rule
    #end
    }

    /**

    • Deletes all object from the relationship "$relationship.name". All delete rules are applied.
      */
      public void deleteAll$
    Relationships()
    Unknown macro: { for ( Iterator<$
    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    > objects = this.$

    Unknown macro: {relationship.name}

    ().vector().iterator(); objects.hasNext(); )
    this.delete$

    Unknown macro: {relationship.capitalizedName}

    Relationship(objects.next());
    }

    /**

    • Initialize the relationship "$relationship.name" with the list of values
      *
    • @param value
    • list of $
    . */ public void initialize$
    Unknown macro: {relationship.capitalizedName}

    (NSArray<$

    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    > value) {
    this.set$

    (value); }

/**

  • Initialize the relationship "$relationship.name" with one object
    *
  • @param value
  • $
    Unknown macro: {relationship.actualDestination.classNameWithDefault}

    .
    */
    public void initialize$

    Unknown macro: {relationship.capitalizedName}

    ($

    value)
    Unknown macro: { this.addTo$
    Unknown macro: {relationship.capitalizedName}
    Relationship(value); }
    #end
    #end
    }
    [code]
  • No labels