509912 messages in 941 lists

The problem with the module method decorateAssociationDescriptor() (living in roster demo) below is that it never gets called.
 
The intricasies of the framework's descriptor decorator core logic would need to be re-modeled in the demo packages (which would be a train wreck).
 
Who instantiates such a class (below) ? The core... not the example.
 
Now I worked hard to develop the editor. It works fine. It cannot run without proper descriptor logic.
 
So why am I continually being targeted? Is this more TrailsBlob bitterness?

I would like to put this behind and get on fertile soil.
 
1. The current ObjectReferenceDescriptor OneToOne descriptor logic models OneToMany and ManyToOne associations.
 
2. HardOneToOne OwningObjectReferenceDescriptor logic models a MONOGAMOUS OneToOne relationship. It comes with  very nice trails editor.
 
Alejandro would you please advise for a solution for HardOneToOne descriptor decorator logic ?  Or are you going to keep play this out.
 
Chris granted me commit priv's over a year ago. I put alot of heart into this since and countless man hours on Jira's, QA, Features. I also work in the defense industry and have projects spec'd on alot of the work I have developed and modeled in trails. Currently I have been taken out from code bing sniped. Chris belief that you would welcome the help a year ago is far from existing and never existed from the get go. I was never welcomed by you as a committer.
 
So how far is this going to go. Just ignore it and let it go it's path?
 
You could tell me to go find the nearest bridge and jump off. I could never be so cruel. I am the one taking the hits to the chin. You took the legs out from under the code I developed. You are obligated to help resolve this. To continue down the path of putting other out of business is wrong. I have 20+ behind me in project experience and have seen it all.
 
AND...
 
I'm Still looking for your best.

Best regards
Ken in nashua





Date: Tue, 5 Feb 2008 11:07:46 -0500
Subject: RE: [trails-dev] HardOneToOne and HibernateDescriptorDecorator

package org.trails.hibernate;

import java.beans.IntrospectionException;

import java.beans.Introspector;

import java.beans.PropertyDescriptor;

import java.lang.reflect.Field;

import java.lang.reflect.Method;

import ognl.Ognl;

import ognl.OgnlException;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import org.hibernate.mapping.Property;

import org.hibernate.type.Type;

import org.trails.descriptor.IClassDescriptor;

import org.trails.descriptor.IPropertyDescriptor;

import org.trails.descriptor.ObjectReferenceDescriptor;

import org.trails.descriptor.extension.OwningObjectReferenceDescriptor;

public class HardOneToOneDescriptorDecorator extends

HibernateDescriptorDecorator {

protected static final Log LOG = LogFactory

. getLog(HardOneToOneDescriptorDecorator. class );

@Override

public IPropertyDescriptor decorateAssociationDescriptor(Class type,

Property mappingProperty, IPropertyDescriptor descriptor,

IClassDescriptor parentClassDescriptor) {

super .decorateAssociationDescriptor(type, mappingProperty, descriptor,

parentClassDescriptor);

Type hibernateType = mappingProperty.getType();

Class parentClassType = parentClassDescriptor.getType();

ObjectReferenceDescriptor descriptorReference = new ObjectReferenceDescriptor(

type, descriptor, hibernateType.getReturnedClass());

try {

Field propertyField = parentClassType.getDeclaredField(descriptor

.getName());

PropertyDescriptor beanPropDescriptor = (PropertyDescriptor) Ognl

. getValue( "propertyDescriptors.{? name == '"

+ descriptor.getName() + "'}[0]" , Introspector

. getBeanInfo(parentClassType));

Method readMethod = beanPropDescriptor.getReadMethod();

// Start by checking for and retrieving mappedBy attribute inside

// the annotation

String inverseProperty = "" ;

if (readMethod

.isAnnotationPresent(javax.persistence. OneToOne . class )) {

inverseProperty = readMethod.getAnnotation(

javax.persistence. OneToOne . class ).mappedBy();

} else if (propertyField

.isAnnotationPresent(javax.persistence. OneToOne . class )) {

inverseProperty = propertyField.getAnnotation(

javax.persistence. OneToOne . class ).mappedBy();

} else {

// If there is none then just return the

// ObjectReferenceDescriptor

return descriptorReference;

}

if ( "" .equals(inverseProperty)) {

// http://forums.hibernate.org/viewtopic.php?t=974287&sid=12d018b08dffe07e263652190cfc4e60

// Caution... this does not support multiple

// class references across the OneToOne relationship

Class returnType = readMethod.getReturnType();

for ( int i = 0; i < returnType.getDeclaredMethods(). length ; i++) {

if (returnType.getDeclaredMethods()[i].getReturnType()

.equals(propertyField.getDeclaringClass())) {

Method theProperty = returnType.getDeclaredMethods()[i];

/* strips preceding 'get' */

inverseProperty = theProperty.getName().substring(3)

.toLowerCase();

break ;

}

}

}

/**

* Check identity owner/association

*/

if (readMethod

.isAnnotationPresent(org.trails.descriptor.annotation. HardOneToOne . class )) {

OwningObjectReferenceDescriptor owningObjectReferenceDescriptor = new OwningObjectReferenceDescriptor();

org.trails.descriptor.annotation. HardOneToOne .Identity identity = readMethod

.getAnnotation(

org.trails.descriptor.annotation. HardOneToOne . class )

.identity();

if (identity == org.trails.descriptor.annotation. HardOneToOne .Identity. OWNER ) {

inverseProperty = descriptor.getName();

if (inverseProperty.equals( "" )) {

// find inverse property for ognl usage

// http://forums.hibernate.org/viewtopic.php?t=974287&sid=12d018b08dffe07e263652190cfc4e60

// Caution... this does not support multiple

// class references across the OneToOne relationship

Class returnType = readMethod.getReturnType();

for ( int i = 0; i < returnType.getDeclaredMethods(). length ; i++) {

if (returnType.getDeclaredMethods()[i]

.getReturnType().equals(

propertyField.getDeclaringClass())) {

Method theProperty = returnType

.getDeclaredMethods()[i];

/* strips preceding 'get' */

inverseProperty = theProperty.getName()

.substring(3).toLowerCase();

break ;

}

}

}

owningObjectReferenceDescriptor

.setInverseProperty(inverseProperty);

descriptorReference.addExtension(

OwningObjectReferenceDescriptor. class .getName(),

owningObjectReferenceDescriptor);

}

}

} catch (SecurityException e) {

LOG .error(e.getMessage());

} catch (NoSuchFieldException e) {

LOG .error(e.getMessage());

} catch (OgnlException e) {

LOG .error(e.getMessage());

} catch (IntrospectionException e) {

LOG .error(e.getMessage());

}

return descriptorReference;

}

}



Climb to the top of the charts! Play the word scramble challenge with star power. Play now!


Connect and share in new ways with Windows Live. Get it now!

Message Attachments

  1. Attachment (6.72 kbytes - text/plain) Attachment open - Download download
Copyright 2006-2008 The Codehaus Foundation
Powered by Codehaus March (Version: 0.1-HEAD)