当前位置: 首页>>代码示例>>Java>>正文


Java ClassDescriptor.getCollectionDescriptors方法代码示例

本文整理汇总了Java中org.apache.ojb.broker.metadata.ClassDescriptor.getCollectionDescriptors方法的典型用法代码示例。如果您正苦于以下问题:Java ClassDescriptor.getCollectionDescriptors方法的具体用法?Java ClassDescriptor.getCollectionDescriptors怎么用?Java ClassDescriptor.getCollectionDescriptors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ojb.broker.metadata.ClassDescriptor的用法示例。


在下文中一共展示了ClassDescriptor.getCollectionDescriptors方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listCollectionObjectTypes

import org.apache.ojb.broker.metadata.ClassDescriptor; //导入方法依赖的package包/类
@Override
public Map<String, Class> listCollectionObjectTypes(Class boClass) {
	if (boClass == null) {
		throw new IllegalArgumentException("Class specified in the parameter was null.");
	}

	Map<String, Class> references = new HashMap<String, Class>();
	ClassDescriptor classDescriptor = null;
	try {
		classDescriptor = getClassDescriptor(boClass);
	} catch (ClassNotPersistableException cnpe) {
		return references;
	}

	Collection<CollectionDescriptor> collectionDescriptors = classDescriptor.getCollectionDescriptors(true);
	for (CollectionDescriptor collectionDescriptor : collectionDescriptors) {
		references.put(collectionDescriptor.getAttributeName(), collectionDescriptor.getItemClass());
	}

	return references;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:PersistenceStructureServiceOjbImpl.java

示例2: getMappedTree

import org.apache.ojb.broker.metadata.ClassDescriptor; //导入方法依赖的package包/类
private static void getMappedTree(String rootClass, Collection<DescriptorRepository> descriptorRepositories, Set<String> processed) {
    if (processed.contains(rootClass)) {
        return;
    }

    processed.add(rootClass);
    final ClassDescriptor cd = findClassDescriptor(rootClass, descriptorRepositories);
    if (cd != null) {
        final Collection<ObjectReferenceDescriptor> ords = cd.getObjectReferenceDescriptors();
        if (ords != null) {
            for (ObjectReferenceDescriptor ord : ords) {
                getMappedTree(ord.getItemClassName(), descriptorRepositories, processed);
            }
        }

        final Collection<CollectionDescriptor> clds = cd.getCollectionDescriptors();
        if (clds != null) {
            for (ObjectReferenceDescriptor cld : clds) {
                getMappedTree(cld.getItemClassName(), descriptorRepositories, processed);
            }
        }

    } else {
        LOG.warn("ClassDescriptor not found for " + rootClass);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:OjbUtil.java

示例3: cascadeDeleteFor

import org.apache.ojb.broker.metadata.ClassDescriptor; //导入方法依赖的package包/类
/**
 * Walk through the object graph of the specified delete object. Was used for
 * recursive object graph walk.
 */
private void cascadeDeleteFor(ObjectEnvelope mod, List alreadyPrepared)
{
    // avoid endless recursion
    if(alreadyPrepared.contains(mod.getIdentity())) return;

    alreadyPrepared.add(mod.getIdentity());

    ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass());

    List refs = cld.getObjectReferenceDescriptors(true);
    cascadeDeleteSingleReferences(mod, refs, alreadyPrepared);

    List colls = cld.getCollectionDescriptors(true);
    cascadeDeleteCollectionReferences(mod, colls, alreadyPrepared);
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:20,代码来源:ObjectEnvelopeTable.java

示例4: getCustomizedFields

import org.apache.ojb.broker.metadata.ClassDescriptor; //导入方法依赖的package包/类
private Collection<String> getCustomizedFields(String clazz) {
    final ClassDescriptor cd = OjbUtil.findClassDescriptor(clazz, descriptorRepositories);
    if (cd != null) {
        Collection<String> customizedFields = new ArrayList<String>();
        for (CollectionDescriptor cld : (Collection<CollectionDescriptor>) cd.getCollectionDescriptors()) {
            if (cld.getQueryCustomizer() != null) {
                customizedFields.add(cld.getAttributeName());
            }
        }
        return customizedFields;
    }
    return Collections.emptySet();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:14,代码来源:CustomizerResolver.java

示例5: isBidirectional

import org.apache.ojb.broker.metadata.ClassDescriptor; //导入方法依赖的package包/类
private boolean isBidirectional(String thisClass, String itemClass) {
    final ClassDescriptor cd = OjbUtil.findClassDescriptor(itemClass, descriptorRepositories);
    Collection<CollectionDescriptor> clds = cd.getCollectionDescriptors();
    if (clds != null) {
        for (CollectionDescriptor cld : clds) {
            if (cld.getItemClassName().equals(thisClass)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:ManyToManyResolver.java

示例6: getMappedBy

import org.apache.ojb.broker.metadata.ClassDescriptor; //导入方法依赖的package包/类
private String getMappedBy(String thisClass, String itemClass) {
    final ClassDescriptor cd = OjbUtil.findClassDescriptor(itemClass, descriptorRepositories);
    Collection<CollectionDescriptor> clds = cd.getCollectionDescriptors();
    if (clds != null) {
        for (CollectionDescriptor cld : clds) {
            if (cld.getItemClassName().equals(thisClass)) {
                return cld.getAttributeName();
            }
        }
    }
    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:ManyToManyResolver.java

示例7: cascadeInsertFor

import org.apache.ojb.broker.metadata.ClassDescriptor; //导入方法依赖的package包/类
/**
 * Walk through the object graph of the specified insert object. Was used for
 * recursive object graph walk.
 */
private void cascadeInsertFor(ObjectEnvelope mod, List alreadyPrepared)
{
    // avoid endless recursion, so use List for registration
    if(alreadyPrepared.contains(mod.getIdentity())) return;
    alreadyPrepared.add(mod.getIdentity());

    ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass());

    List refs = cld.getObjectReferenceDescriptors(true);
    cascadeInsertSingleReferences(mod, refs, alreadyPrepared);

    List colls = cld.getCollectionDescriptors(true);
    cascadeInsertCollectionReferences(mod, colls, alreadyPrepared);
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:19,代码来源:ObjectEnvelopeTable.java

示例8: buildConstraints

import org.apache.ojb.broker.metadata.ClassDescriptor; //导入方法依赖的package包/类
private void buildConstraints(ClassDescriptor cd) {
    Vector collectionDescriptors = cd.getCollectionDescriptors();
    for (int i = 0; i < collectionDescriptors.size(); i++) {
        CollectionDescriptor collectionDescriptor = (CollectionDescriptor) collectionDescriptors.get(i);
        if (collectionDescriptor.isMtoNRelation()) {
            buildManyToManyConstraints(cd, collectionDescriptor);
        } else {
            buildOneToManyReferences(cd, collectionDescriptor);
        }
    }
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:12,代码来源:TorqueForeignKeyGenerator.java

示例9: storeCollections

import org.apache.ojb.broker.metadata.ClassDescriptor; //导入方法依赖的package包/类
/**
 * Store/Link collections of objects poiting to <b>obj</b>.
 * More info please see comments in source.
 *
 * @param obj real object which we will store collections for
 * @throws PersistenceBrokerException if some goes wrong - please see the error message for details
 */
private void storeCollections(Object obj, ClassDescriptor cld, boolean insert) throws PersistenceBrokerException
{
    // get all members of obj that are collections and store all their elements
    Collection listCods = cld.getCollectionDescriptors();
    // return if nothing to do
    if (listCods.size() == 0)
    {
        return;
    }
    Iterator i = listCods.iterator();
    while (i.hasNext())
    {
        CollectionDescriptor cod = (CollectionDescriptor) i.next();

        // if CASCADE_NONE was set, do nothing with referenced objects
        if (cod.getCascadingStore() != ObjectReferenceDescriptor.CASCADE_NONE)
        {
            Object referencedObjects = cod.getPersistentField().get(obj);
            if (cod.isMtoNRelation())
            {
                storeAndLinkMtoN(false, obj, cod, referencedObjects, insert);
            }
            else
            {
                storeAndLinkOneToMany(false, obj, cod, referencedObjects, insert);
            }

            // BRJ: only when auto-update = object (CASCADE_OBJECT)
            //
            if ((cod.getCascadingStore() == ObjectReferenceDescriptor.CASCADE_OBJECT)
                    && (referencedObjects instanceof ManageableCollection))
            {
                ((ManageableCollection) referencedObjects).afterStore(this);
            }
        }
    }
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:45,代码来源:PersistenceBrokerImpl.java

示例10: handleDependentCollections

import org.apache.ojb.broker.metadata.ClassDescriptor; //导入方法依赖的package包/类
/**
 * Mark for creation all objects that were included into dependent collections.
 * Mark for deletion all objects that were excluded from dependent collections.
 */
private ArrayList handleDependentCollections(Identity oid, Object obj,
        Object[] origCollections, Object[] newCollections,
        Object[] newCollectionsOfObjects)
        throws LockingException
{
    ClassDescriptor mif = _pb.getClassDescriptor(obj.getClass());
    Collection colDescs = mif.getCollectionDescriptors();
    ArrayList newObjects = new ArrayList();
    int count = 0;

    for (Iterator it = colDescs.iterator(); it.hasNext(); count++)
    {
        CollectionDescriptor cds = (CollectionDescriptor) it.next();

        if (cds.getOtmDependent())
        {
            ArrayList origList = (origCollections == null ? null
                                    : (ArrayList) origCollections[count]);
            ArrayList newList = (ArrayList) newCollections[count];

            if (origList != null)
            {
                for (Iterator it2 = origList.iterator(); it2.hasNext(); )
                {
                    Identity origOid = (Identity) it2.next();

                    if ((newList == null) || !newList.contains(origOid))
                    {
                        markDelete(origOid, oid, true);
                    }
                }
            }

            if (newList != null)
            {
                int countElem = 0;
                for (Iterator it2 = newList.iterator(); it2.hasNext(); countElem++)
                {
                    Identity newOid = (Identity) it2.next();

                    if ((origList == null) || !origList.contains(newOid))
                    {
                        ContextEntry entry = (ContextEntry) _objects.get(newOid);

                        if (entry == null)
                        {
                            ArrayList relCol = (ArrayList)
                                    newCollectionsOfObjects[count];
                            Object relObj = relCol.get(countElem);
                            insertInternal(newOid, relObj, LockType.WRITE_LOCK,
                                           true, null, new Stack());
                            newObjects.add(newOid);
                        }
                    }
                }
            }
        }
    }

    return newObjects;
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:66,代码来源:ConcreteEditingContext.java


注:本文中的org.apache.ojb.broker.metadata.ClassDescriptor.getCollectionDescriptors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。