Re: Velocity Template Errors on my Model...

From: David LeBer (dlebe..odeferous.com)
Date: Mon Dec 03 2007 - 17:42:12 EST

  • Next message: David LeBer: "Re: Velocity Template Errors on my Model..."

    On 3-Dec-07, at 5:05 PM, James Cicenia wrote:

    > OK -
    >
    > I put the new _Entity14.java and clicked the new switch and
    > generated my eos...

    I haven't been keeping up, where is this template?

    > 1) Error on a lot of these...
    >
    > public static UserPasswordArchive
    > fetchRequiredTOSUserPasswordArchive(EOEditingContext editingContext,
    > String keyName, Object value) {
    > return
    > _UserPasswordArchive
    > .fetchRequiredTOSUserPasswordArchive(editingContext, new
    > EOKeyValueQualifier(keyName, EOQualifier.QualifierOperatorEqual,
    > value));
    > }
    >
    > the above gives me an error saying that the arguments are wrong.
    >
    > that is then followed up by:
    >
    > public static LifeCycleState
    > fetchRequiredLifeCycleState(EOEditingContext editingContext,
    > EOQualifier qualifier) {
    > LifeCycleState eoObject =
    > _LifeCycleState.fetchLifeCycleState(editingContext, qualifier);
    > if (eoObject == null) {
    > throw new NoSuchElementException("There was no
    > TOSLifeCycleState that matched the qualifier '" + qualifier + "'.");
    > }
    > return eoObject;
    > }
    >
    > notice in the second method that the fetchLifeCycleState should
    > actually be fetchTOSLifeCycleState

    This is the template snippet (from here: <http://webobjects.mdimension.com/wolips/EOGenerator/Velocity%20EOGenerator%20Templates/
    >) that generates those methods:

       public static ${entity.classNameWithoutPackage} fetchRequired$
    {entity.name}(EOEditingContext editingContext, String keyName, Object
    value) {
         return ${entity.prefixClassNameWithoutPackage}.fetchRequired$
    {entity.name}(editingContext, new EOKeyValueQualifier(keyName,
    EOQualifier.QualifierOperatorEqual, value));
       }

       public static ${entity.classNameWithoutPackage} fetchRequired$
    {entity.classNameWithoutPackage}(EOEditingContext editingContext,
    EOQualifier qualifier) {
         ${entity.classNameWithoutPackage} eoObject = $
    {entity.prefixClassNameWithoutPackage}.fetch$
    {entity.classNameWithoutPackage}(editingContext, qualifier);
         if (eoObject == null) {
           throw new NoSuchElementException("There was no ${entity.name}
    that matched the qualifier '" + qualifier + "'.");
         }
         return eoObject;
       }

    It looks like the second one should be "fetchRequired${entity.name}"
    not "fetchRequired${entity.classNameWithoutPackage}"

    > 2)
    >
    > Notice the $relationship in the following:
    >
    >
    > public void
    > addToProjectRosterMemberProjectPhaseTasksRelationship
    > ($relationship.actualDestination.classNameWithDefault object) {
    > addObjectToBothSidesOfRelationshipWithKey(object,
    > "projectRosterMemberProjectPhaseTasks");
    > }
    >
    > public void
    > removeFromProjectRosterMemberProjectPhaseTasksRelationship
    > ($relationship.actualDestination.classNameWithDefault object) {
    > removeObjectFromBothSidesOfRelationshipWithKey(object,
    > "projectRosterMemberProjectPhaseTasks");
    > }
    >
    > public $relationship.actualDestination.classNameWithDefault
    > createProjectRosterMemberProjectPhaseTasksRelationship() {
    > EOClassDescription eoClassDesc =
    > EOClassDescription
    > .classDescriptionForEntityName("ProjectRosterMemberProjectPhaseTask");
    > EOEnterpriseObject eo =
    > eoClassDesc.createInstanceWithEditingContext(editingContext(), null);
    > editingContext().insertObject(eo);
    > addObjectToBothSidesOfRelationshipWithKey(eo,
    > "projectRosterMemberProjectPhaseTasks");
    > return ($relationship.actualDestination.classNameWithDefault) eo;
    > }
    >
    > public void
    > deleteProjectRosterMemberProjectPhaseTasksRelationship
    > ($relationship.actualDestination.classNameWithDefault object) {
    > removeObjectFromBothSidesOfRelationshipWithKey(object,
    > "projectRosterMemberProjectPhaseTasks");
    > editingContext().deleteObject(object);
    > }
    >
    > public void
    > deleteAllProjectRosterMemberProjectPhaseTasksRelationships() {
    > Enumeration objects =
    > projectRosterMemberProjectPhaseTasks
    > ().immutableClone().objectEnumerator();
    > while (objects.hasMoreElements()) {
    >
    > deleteProjectRosterMemberProjectPhaseTasksRelationship
    > (($
    > relationship
    > .actualDestination.classNameWithDefault)objects.nextElement());
    > }
    > }
    >
    >
    > That is it for now....
    >
    > Any thoughts?
    >
    > Thanks
    > James Cicenia
    >
    >
    >

    ;david

    --
    David LeBer
    Codeferous Software
    'co-def-er-ous' adj. Literally 'code-bearing'
    site:   http://codeferous.com
    blog: http://davidleber.net
    profile: http://www.linkedin.com/in/davidleber
    --
    Toronto Area Cocoa / WebObjects developers group:
    http://tacow.org
    



    This archive was generated by hypermail 2.0.0 : Mon Dec 03 2007 - 17:43:13 EST