db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata ObjectReferenceDescriptor.java
Date Fri, 13 Jun 2003 18:48:12 GMT
brj         2003/06/13 11:48:12

  Modified:    src/java/org/apache/ojb/broker/metadata
                        ObjectReferenceDescriptor.java
  Log:
  some style fixes
  
  Revision  Changes    Path
  1.28      +49 -50    db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java
  
  Index: ObjectReferenceDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ObjectReferenceDescriptor.java	10 Jun 2003 20:42:09 -0000	1.27
  +++ ObjectReferenceDescriptor.java	13 Jun 2003 18:48:12 -0000	1.28
  @@ -120,55 +120,54 @@
       /**
        *
        */
  -    public FieldDescriptor[] getForeignKeyFieldDescriptors(ClassDescriptor mif)
  -    {
  -        FieldDescriptor[] foreignKeyFieldDescriptors = null;
  -        if ((foreignKeyFieldDescriptors = (FieldDescriptor[]) fkFieldMap.get(mif)) == null)
  -        {
  -            // 1. collect vector of indices of Fk-Fields
  -            Vector v = getForeignKeyFields();
  -            // 2. get FieldDescriptor for each index from Class-descriptor
  -            // 2A. In a many-to-many relationship foreignkeyfields vector will be null.
  -            if (v != null)
  -            {
  -                Vector ret;
  -                if (mif.isInterface())
  -                {
  -                    //exchange interface class descriptor with first concrete
  -                    //class
  -                    Vector extents = mif.getExtentClasses();
  -                    Class firstConcreteClass = (Class) extents.get(0);
  -                    mif = getClassDescriptor().getRepository().getDescriptorFor(firstConcreteClass);
  -                }
  -                ret = new Vector();
  -
  -                Iterator iter = v.iterator();
  -                while (iter.hasNext())
  -                {
  -                    Object fk = iter.next();
  -	            FieldDescriptor fkfd;
  -		    if (fk instanceof Integer) 
  -		    {
  -			Integer index = (Integer) fk;
  -			fkfd = mif.getFieldDescriptorByIndex(index.intValue());
  -		    }	
  -		    else
  -		    {
  -			fkfd = mif.getFieldDescriptorByName((String) fk);
  -		    }
  -		    if (fkfd == null) 
  -		    {
  -			throw new OJBRuntimeException("Incorrect field reference \"" + fk + "\" in " + this);
  -		    }
  -		    ret.add(fkfd);
  -                }
  -                foreignKeyFieldDescriptors =
  -                        (FieldDescriptor[]) ret.toArray(new FieldDescriptor[ret.size()]);
  -                fkFieldMap.put(mif, foreignKeyFieldDescriptors);
  -            }
  -        }
  -        return foreignKeyFieldDescriptors;
  -    }
  +	public FieldDescriptor[] getForeignKeyFieldDescriptors(ClassDescriptor mif)
  +	{
  +		FieldDescriptor[] foreignKeyFieldDescriptors = null;
  +		if ((foreignKeyFieldDescriptors = (FieldDescriptor[]) fkFieldMap.get(mif)) == null)
  +		{
  +			// 1. collect vector of indices of Fk-Fields
  +			Vector v = getForeignKeyFields();
  +			// 2. get FieldDescriptor for each index from Class-descriptor
  +			// 2A. In a many-to-many relationship foreignkeyfields vector will be null.
  +			if (v != null)
  +			{
  +				Vector ret;
  +				if (mif.isInterface())
  +				{
  +					//exchange interface class descriptor with first concrete
  +					//class
  +					Vector extents = mif.getExtentClasses();
  +					Class firstConcreteClass = (Class) extents.get(0);
  +					mif = getClassDescriptor().getRepository().getDescriptorFor(firstConcreteClass);
  +				}
  +				ret = new Vector();
  +
  +				Iterator iter = v.iterator();
  +				while (iter.hasNext())
  +				{
  +					Object fk = iter.next();
  +					FieldDescriptor fkfd;
  +					if (fk instanceof Integer)
  +					{
  +						Integer index = (Integer) fk;
  +						fkfd = mif.getFieldDescriptorByIndex(index.intValue());
  +					}
  +					else
  +					{
  +						fkfd = mif.getFieldDescriptorByName((String) fk);
  +					}
  +					if (fkfd == null)
  +					{
  +						throw new OJBRuntimeException("Incorrect field reference \"" + fk + "\" in " + this);
  +					}
  +					ret.add(fkfd);
  +				}
  +				foreignKeyFieldDescriptors = (FieldDescriptor[]) ret.toArray(new FieldDescriptor[ret.size()]);
  +				fkFieldMap.put(mif, foreignKeyFieldDescriptors);
  +			}
  +		}
  +		return foreignKeyFieldDescriptors;
  +	}
   
       /**
        * @throws MetadataException if an error occours while accessing ForeingKey values
on obj
  @@ -371,7 +370,7 @@
           String name = this.getAttributeName();
           if (name == null)
           {
  -        	name = tags.TAG_SUPER;
  +        	name = RepositoryElements.TAG_SUPER;
           }
           result += "        " + tags.getAttribute(FIELD_NAME, name) + eol;
   
  
  
  

Mime
View raw message