Package org.apache.ojb.broker.metadata

Examples of org.apache.ojb.broker.metadata.ClassDescriptor


{
  public void ojbAdd(Object anObject)
  {
    if (anObject != null)
    {
      ClassDescriptor cd = MetadataManager.getInstance().getRepository().getDescriptorFor(anObject.getClass());
            FieldDescriptor[] fields = cd.getPkFields();
            if(fields.length > 1 || fields.length == 0)
            {
                throw new MetadataException("ManageableHashMap can only be used for persistence capable objects with" +
                        " exactly one primiary key field defined in metadata, for " + anObject.getClass() + " the" +
                        " PK field count is " + fields.length);
View Full Code Here


        Iterator iter = allObjectsToBeRemoved.iterator();
        while (iter.hasNext())
        {
            Object obj = iter.next();
            ClassDescriptor cld = broker.getClassDescriptor(obj.getClass());
            if (broker.serviceBrokerHelper().assertValidPkForDelete(cld, obj))
            {   
                broker.delete(obj);
            }   
        }
View Full Code Here

    /**
     * Store m-side and intermediary
     */
    public void testStoringWithAutoUpdateFalse1()
    {
        ClassDescriptor cld = broker.getClassDescriptor(Paper.class);
        CollectionDescriptor cod = cld.getCollectionDescriptorByName("qualifiers");
        int autoUpdate = cod.getCascadingStore();

        cod.setCascadingStore(ObjectReferenceDescriptor.CASCADE_LINK);

        try
View Full Code Here

     * Store m-side, intermediary and n-side
     * n-side forced by using broker.store()
     */
    public void testStoringWithAutoUpdateFalse2()
    {
        ClassDescriptor cld = broker.getClassDescriptor(Paper.class);
        CollectionDescriptor cod = cld.getCollectionDescriptorByName("qualifiers");
        int autoUpdate = cod.getCascadingStore();

        cod.setCascadingStore(ObjectReferenceDescriptor.CASCADE_LINK);

        try
View Full Code Here

    /**
     * Store m-side, intermediary and n-side
     */
    public void testStoringWithAutoUpdateTrue()
    {
        ClassDescriptor cld = broker.getClassDescriptor(Paper.class);
        CollectionDescriptor cod = cld.getCollectionDescriptorByName("qualifiers");
        int autoUpdate = cod.getCascadingStore();

        cod.setCascadingStore(ObjectReferenceDescriptor.CASCADE_OBJECT);

        try
View Full Code Here


    // delete from intermediary table only when collection NOT removal aware
    public void testDelete_NonRemovalAware()
    {
        ClassDescriptor cld = broker.getClassDescriptor(Paper.class);
        CollectionDescriptor cod = cld.getCollectionDescriptorByName("qualifiers");
        Class collectionClass = cod.getCollectionClass();

        cod.setCollectionClass(ManageableArrayList.class);

        try
View Full Code Here

    }

    // delete from intermediary AND target-table when collection removal aware
    public void testDelete_RemovalAware()
    {
        ClassDescriptor cld = broker.getClassDescriptor(Paper.class);
        CollectionDescriptor cod = cld.getCollectionDescriptorByName("qualifiers");
        Class collectionClass = cod.getCollectionClass();

        cod.setCollectionClass(RemovalAwareCollection.class);

        try
View Full Code Here

     * @see OjbMetaTreeNode#_load()
     */
    protected boolean _load()
    {
      java.util.ArrayList newChildren = new java.util.ArrayList();
      ClassDescriptor itemClass = this.getRepository().getDescriptorFor(this.objRefDescriptor.getItemClassName());
      newChildren.add(getOjbMetaTreeModel().getClassDescriptorNodeForClassDescriptor(itemClass));
      this.alChildren = newChildren;
     
      java.util.Iterator it;
       
View Full Code Here

     * Answer the real ClassDescriptor for anObj
     * ie. aCld may be an Interface of anObj, so the cld for anObj is returned
     */
    private ClassDescriptor getRealClassDescriptor(ClassDescriptor aCld, Object anObj)
    {
        ClassDescriptor result;

        if(aCld.getClassOfObject() == ProxyHelper.getRealClass(anObj))
        {
            result = aCld;
        }
View Full Code Here

        {
            return getKeyValues(cld, handler.getIdentity(), convertToSql)//BRJ: convert Identity
        }
        else
        {
            ClassDescriptor realCld = getRealClassDescriptor(cld, objectOrProxy);
            return getValuesForObject(realCld.getPkFields(), objectOrProxy, convertToSql);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.metadata.ClassDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.