• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DataObjectRelationship类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.kuali.rice.krad.bo.DataObjectRelationship的典型用法代码示例。如果您正苦于以下问题:Java DataObjectRelationship类的具体用法?Java DataObjectRelationship怎么用?Java DataObjectRelationship使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataObjectRelationship类属于org.kuali.rice.krad.bo包,在下文中一共展示了DataObjectRelationship类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testBOMetaDataService

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
@Test
@Legacy
   /**
    * test that a business object relationship definitions have the expected values
    */
public void testBOMetaDataService() throws Exception {
	Account ta = new Account();
DataObjectRelationship br = KNSServiceLocator.getBusinessObjectMetaDataService().getBusinessObjectRelationship(
	ta, "extension.accountType");
	assertEquals( "mismatch on parent class", Account.class, br.getParentClass() );
	assertEquals( "mismatch on related class", AccountType.class, br.getRelatedClass() );
	System.out.println( br.getParentToChildReferences() );
assertEquals("parent/child key not correct - should be extension.accountTypeCode/accountTypeCode",
	"accountTypeCode", br.getParentToChildReferences().get("extension.accountTypeCode"));
	br = KNSServiceLocator.getBusinessObjectMetaDataService().getBusinessObjectRelationship( ta, "extension" );
	assertNull( "extension is not lookupable, should have returned null", br );
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:ExtensionAttributeTest.java


示例2: hasAutoQuickfinderRelationship

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
/**
 * Determines wheter or not to create an automatic quickfinder widget for this field within the current lifecycle.
 *
 * @return True if an automatic quickfinder widget should be created for this field on the current lifecycle.
 */
protected boolean hasAutoQuickfinderRelationship() {
    String propertyName = getBindingInfo().getBindingName();

    // get object instance and class for parent
    View view = ViewLifecycle.getView();
    Object model = ViewLifecycle.getModel();
    Object parentObject = ViewModelUtils.getParentObjectForMetadata(view, model, this);
    Class<?> parentObjectClass = null;
    if (parentObject != null) {
        parentObjectClass = parentObject.getClass();
    }

    // get relationship from metadata service
    @SuppressWarnings("deprecation")
    DataObjectRelationship relationship = null;
    if (parentObject != null) {
        relationship = KRADServiceLocatorWeb.getLegacyDataAdapter().getDataObjectRelationship(parentObject,
                parentObjectClass, propertyName, "", true, true, false);
    }

    return relationship != null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:InputFieldBase.java


示例3: getRelationshipForField

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
/**
 * Retrieves any {@link org.kuali.rice.krad.bo.DataObjectRelationship} that is associated with the given
 * field and has a configured lookup view.
 *
 * @param view view instance the quickfinder is associated with
 * @param model object containing the view data
 * @param field input field instance the quickfinder should apply to
 * @return data object relationship for the field, or null if one could not be found
 */
protected DataObjectRelationship getRelationshipForField(View view, Object model, InputField field) {
    String propertyName = field.getBindingInfo().getBindingName();

    // get object instance and class for parent
    Object parentObject = ViewModelUtils.getParentObjectForMetadata(view, model, field);
    Class<?> parentObjectClass = null;
    if (parentObject != null) {
        parentObjectClass = parentObject.getClass();
    }

    // get relationship from metadata service
    if (parentObjectClass != null) {
        return KRADServiceLocatorWeb.getLegacyDataAdapter().getDataObjectRelationship(parentObject,
                parentObjectClass, propertyName, "", true, true, false);
    }

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


示例4: setAdditionalDisplayPropertyForCodes

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
/**
 * For attributes that are codes (determined by whether they have a
 * reference to a KualiCode bo and similar naming) sets the name as an
 * additional display property
 * 
 * @param businessObjectClass -
 *            class containing attribute
 * @param attributeName - 
 *            name of attribute in the business object
 * @param field - 
 *            property display element
 */
public static void setAdditionalDisplayPropertyForCodes(Class businessObjectClass, String attributeName, PropertyRenderingConfigElement field) {
	try {
		DataObjectRelationship relationship = getBusinessObjectMetaDataService().getBusinessObjectRelationship(
				(BusinessObject) businessObjectClass.newInstance(), attributeName);

		if (relationship != null && attributeName.startsWith(relationship.getParentAttributeName())
				&& KualiCode.class.isAssignableFrom(relationship.getRelatedClass())) {
			field.setAdditionalDisplayPropertyName(relationship.getParentAttributeName() + "."
					+ KRADPropertyConstants.NAME);
		}
	} catch (Exception e) {
		throw new RuntimeException("Cannot get new instance of class to check for KualiCode references: "
				+ e.getMessage());
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:FieldUtils.java


示例5: getRelationshipMetadata

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
protected DataObjectRelationship getRelationshipMetadata(Class<?> dataObjectClass, String attributeName,
        String attributePrefix) {

    RelationshipDefinition relationshipDefinition = getDictionaryRelationship(dataObjectClass, attributeName);
    if (relationshipDefinition == null) {
        return null;
    }

    DataObjectRelationship dataObjectRelationship = new DataObjectRelationship(
            relationshipDefinition.getSourceClass(), relationshipDefinition.getObjectAttributeName(),
            relationshipDefinition.getTargetClass());

    if (!StringUtils.isEmpty(attributePrefix)) {
        attributePrefix += ".";
    }

    List<PrimitiveAttributeDefinition> primitives = relationshipDefinition.getPrimitiveAttributes();
    for (PrimitiveAttributeDefinition primitiveAttributeDefinition : primitives) {
        dataObjectRelationship.getParentToChildReferences().put(
                attributePrefix + primitiveAttributeDefinition.getSourceName(),
                primitiveAttributeDefinition.getTargetName());
    }

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


示例6: isAttributeLookupable

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
@Override
   public boolean isAttributeLookupable(Class boClass, String attributeName) {
	Object obj = null;
	if (boClass != null && BusinessObject.class.isAssignableFrom(boClass)) {
		obj = ObjectUtils.createNewObjectFromClass(boClass);
	}
	if (obj != null) {
		BusinessObject bo = (BusinessObject) obj;
		DataObjectRelationship relationship = getBusinessObjectRelationship(bo, attributeName);

		if (relationship != null && relationship.getRelatedClass() != null
				&& BusinessObject.class.isAssignableFrom(relationship.getRelatedClass())) {
			return isLookupable(relationship.getRelatedClass());
		}
		else {
			return false;
		}
	}
	else {
		return false;
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:BusinessObjectMetaDataServiceImpl.java


示例7: getReferenceComponentLabel

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
@Override
public String getReferenceComponentLabel(Class componentClass, String propertyName) {
    DataObjectRelationship relationship = null;
    try {
        relationship = businessObjectMetaDataService.getBusinessObjectRelationship((BusinessObject) componentClass.newInstance(), propertyName);
    }
    catch (Exception e) {
        if ( LOG.isDebugEnabled() ) {
            LOG.debug("KfsBusinessObjectMetadataServiceImpl unable to instantiate componentClass: " + componentClass, e);
        }
    }
    if (relationship != null) {
        return dataDictionaryService.getDataDictionary().getBusinessObjectEntry(relationship.getRelatedClass().getName()).getObjectLabel();
    }
    return "";
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:17,代码来源:OleBusinessObjectMetaDataServiceImpl.java


示例8: getRelationshipMetadata

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
/**
 * get the relationship metadata for the detail line fields
 * 
 * @return the relationship metadata for the detail line fields
 */
public Map<String, DataObjectRelationship> getRelationshipMetadata() {
    LOG.debug("getRelationshipMetadata() start");

    PersistenceStructureService persistenceStructureService = SpringContext.getBean(PersistenceStructureService.class);

    Map<String, DataObjectRelationship> relationshipMetadata = new HashMap<String, DataObjectRelationship>();
    for (String attributeName : this.getInquirableFieldNames()) {
        Map<String, Class<? extends BusinessObject>> primitiveReference = LookupUtils.getPrimitiveReference(newDetailLine, attributeName);

        if (primitiveReference != null && !primitiveReference.isEmpty()) {
            DataObjectRelationship primitiveRelationship = this.getPrimitiveDataObjectRelationship(persistenceStructureService.getRelationshipMetadata(newDetailLine.getClass(), attributeName));
            relationshipMetadata.put(attributeName, primitiveRelationship);
        }
    }

    return relationshipMetadata;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:23,代码来源:EffortCertificationForm.java


示例9: getPrimitiveDataObjectRelationship

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
/**
 * pick up the primitive relationship for an attribute from a set of relationships. Generally, the primitive relationship is
 * that has the minimum number of primary keys.
 * 
 * @param relationshipMetadata the relationship metadata that contains the primitive relationship
 * @return the primitive relationship for an attribute from a set of relationships.
 */
protected DataObjectRelationship getPrimitiveDataObjectRelationship(Map<String, DataObjectRelationship> relationshipMetadata) {
    int minCountOfKeys = Integer.MAX_VALUE;
    DataObjectRelationship primitiveRelationship = null;

    for (String attribute : relationshipMetadata.keySet()) {
        DataObjectRelationship currentRelationship = relationshipMetadata.get(attribute);

        Map<String, String> parentToChildReferences = currentRelationship.getParentToChildReferences();
        if (parentToChildReferences.size() < minCountOfKeys) {
            minCountOfKeys = parentToChildReferences.size();
            primitiveRelationship = currentRelationship;
        }
    }
    return primitiveRelationship;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:23,代码来源:EffortCertificationForm.java


示例10: getReferenceComponentLabel

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
@Override
public String getReferenceComponentLabel(Class componentClass, String propertyName) {
    DataObjectRelationship relationship = null;
    try {
        relationship = businessObjectMetaDataService.getBusinessObjectRelationship((BusinessObject) componentClass.newInstance(), propertyName);
    }
    catch (Exception e) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("KfsBusinessObjectMetadataServiceImpl unable to instantiate componentClass: " + componentClass, e);
        }
    }
    if (relationship != null) {
        return dataDictionaryService.getDataDictionary().getBusinessObjectEntry(relationship.getRelatedClass().getName()).getObjectLabel();
    }
    return "";
}
 
开发者ID:kuali,项目名称:kfs,代码行数:17,代码来源:KfsBusinessObjectMetaDataServiceImpl.java


示例11: testBOMetaDataService

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
@Test
   /**
    * test that a business object relationship definitions have the expected values
    */
public void testBOMetaDataService() throws Exception {
	Account ta = new Account();
DataObjectRelationship br = KNSServiceLocator.getBusinessObjectMetaDataService().getBusinessObjectRelationship(
	ta, "extension.accountType");
	assertEquals( "mismatch on parent class", Account.class, br.getParentClass() );
	assertEquals( "mismatch on related class", AccountType.class, br.getRelatedClass() );
	System.out.println( br.getParentToChildReferences() );
assertEquals("parent/child key not correct - should be extension.accountTypeCode/accountTypeCode",
	"accountTypeCode", br.getParentToChildReferences().get("extension.accountTypeCode"));
	br = KNSServiceLocator.getBusinessObjectMetaDataService().getBusinessObjectRelationship( ta, "extension" );
	assertNull( "extension is not lookupable, should have returned null", br );
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:17,代码来源:ExtensionAttributeTest.java


示例12: generateLookupParameters

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
protected void generateLookupParameters(InputField field, DataObjectRelationship relationship) {
    lookupParameters = new HashMap<String, String>();
    for (Map.Entry<String, String> entry : relationship.getParentToChildReferences().entrySet()) {
        String fromField = entry.getKey();
        String toField = entry.getValue();

        // TODO: displayedFieldnames and displayedQFFieldNames in
        // generateLookupParameters(BusinessObject,
        // String, DataObjectRelationship, String, List, String)

        if (relationship.getUserVisibleIdentifierKey() == null || relationship.getUserVisibleIdentifierKey().equals(
                fromField)) {
            lookupParameters.put(fromField, toField);
        }
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:17,代码来源:QuickFinder.java


示例13: isAttributeLookupable

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
public boolean isAttributeLookupable(Class boClass, String attributeName) {
	Object obj = null;
	if (boClass != null && BusinessObject.class.isAssignableFrom(boClass)) {
		obj = ObjectUtils.createNewObjectFromClass(boClass);
	}
	if (obj != null) {
		BusinessObject bo = (BusinessObject) obj;
		DataObjectRelationship relationship = getBusinessObjectRelationship(bo, attributeName);

		if (relationship != null && relationship.getRelatedClass() != null
				&& BusinessObject.class.isAssignableFrom(relationship.getRelatedClass())) {
			return isLookupable(relationship.getRelatedClass());
		}
		else {
			return false;
		}
	}
	else {
		return false;
	}
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:22,代码来源:BusinessObjectMetaDataServiceImpl.java


示例14: setupForInputField

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
/**
 * If quickfinder not manually configured attempts to find a relationship to build the quickfinder on, then also
 * adjusts the path for any configured field conversions, lookup parameters, and refresh refreshes.
 *
 * @param view view instance the quickfinder is associated with
 * @param model object containing the view data
 * @param inputField input field instance the quickfinder should apply to
 */
protected void setupForInputField(View view, Object model, InputField inputField) {
    // if quickfinder class name not specified, attempt to find a relationship to build the quickfinder from
    if (StringUtils.isBlank(dataObjectClassName)) {
        DataObjectRelationship relationship = getRelationshipForField(view, model, inputField);

        // if no relationship found cannot have a quickfinder
        if (relationship == null) {
            setRender(false);

            return;
        }

        dataObjectClassName = relationship.getRelatedClass().getName();

        if ((fieldConversions == null) || fieldConversions.isEmpty()) {
            generateFieldConversions(relationship);
        }

        if ((lookupParameters == null) || lookupParameters.isEmpty()) {
            generateLookupParameters(relationship);
        }
    }

    // adjust paths based on associated attribute field
    updateFieldConversions(inputField.getBindingInfo());
    updateLookupParameters(inputField.getBindingInfo());
    updateReferencesToRefresh(inputField.getBindingInfo());

    // add the quickfinders action as an input field addon
    inputField.addPostInputAddon(quickfinderAction);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:40,代码来源:QuickFinder.java


示例15: generateFieldConversions

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
/**
 * Generates the lookup field conversions based on the references from the given relationship.
 *
 * @param relationship relationship field conversions will be generated from
 */
protected void generateFieldConversions(DataObjectRelationship relationship) {
    fieldConversions = new HashMap<String, String>();

    for (Map.Entry<String, String> entry : relationship.getParentToChildReferences().entrySet()) {
        String fromField = entry.getValue();
        String toField = entry.getKey();

        fieldConversions.put(fromField, toField);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:QuickFinder.java


示例16: generateLookupParameters

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
/**
 * Generates the lookup parameters based on the references from the given relationship.
 *
 * @param relationship relationship lookup parameters will be generated from
 */
protected void generateLookupParameters(DataObjectRelationship relationship) {
    lookupParameters = new HashMap<String, String>();

    for (Map.Entry<String, String> entry : relationship.getParentToChildReferences().entrySet()) {
        String fromField = entry.getKey();
        String toField = entry.getValue();

        if (relationship.getUserVisibleIdentifierKey() == null || relationship.getUserVisibleIdentifierKey().equals(
                fromField)) {
            lookupParameters.put(fromField, toField);
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:QuickFinder.java


示例17: getDataObjectRelationship

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.LegacyDataAdapter#getDataObjectRelationship(java.lang.Object, java.lang.Class,
 * java.lang.String, java.lang.String, boolean, boolean, boolean)
 */
@Override
public DataObjectRelationship getDataObjectRelationship(Object dataObject, Class<?> dataObjectClass,
        String attributeName, String attributePrefix, boolean keysOnly, boolean supportsLookup,
        boolean supportsInquiry) {
    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:MockLegacyDataAdapter.java


示例18: generateFieldConversions

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
@Deprecated
private static String generateFieldConversions(Object businessObject, String collectionName, DataObjectRelationship relationship, String propertyPrefix, List displayedFieldNames, String nestedObjectPrefix) {
    String fieldConversions = "";

    if ( LOG.isDebugEnabled() ) {
        LOG.debug( "generateFieldConversions(" + businessObject.getClass().getName() + "," + collectionName + ",\n" + relationship + "\n," + propertyPrefix + "," + displayedFieldNames + "," + nestedObjectPrefix + ")" );
    }

    // get the references for the given property
    for ( Map.Entry<String,String> entry : relationship.getParentToChildReferences().entrySet() ) {
        String fromField = entry.getValue();
        String toField = entry.getKey();

        // find the displayed to field mapping
        if (!displayedFieldNames.contains(toField)) {
            toField = translateToDisplayedField(businessObject.getClass(), toField, displayedFieldNames);
        }

        if (StringUtils.isNotBlank(fieldConversions)) {
            fieldConversions += ",";
        }

        if ( StringUtils.isNotEmpty( propertyPrefix ) ) {
            toField = propertyPrefix + "." + toField;
        }

        if ( StringUtils.isNotEmpty( collectionName ) ) {
            toField = collectionName + toField;
        }

        fieldConversions += fromField + ":" + toField;
    }

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


示例19: generateLookupParameters

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
@Deprecated
private static String generateLookupParameters(Object businessObject, String collectionName, DataObjectRelationship relationship, String propertyPrefix, List displayedFieldNames, String nestedObjectPrefix) {

    String lookupParameters = "";

    List displayedQFFieldNames = getBusinessObjectDictionaryService().getLookupFieldNames(relationship.getRelatedClass());
    for ( Map.Entry<String,String> entry : relationship.getParentToChildReferences().entrySet() ) {
        String fromField = entry.getKey();
        String toField = entry.getValue();

        if ( relationship.getUserVisibleIdentifierKey() == null || relationship.getUserVisibleIdentifierKey().equals( fromField ) ) {
            // find the displayed from field mapping
            if (!displayedFieldNames.contains(fromField)) {
                fromField = translateToDisplayedField(businessObject.getClass(), fromField, displayedFieldNames);
            }

            // translate to field
            if (displayedQFFieldNames != null && !displayedQFFieldNames.contains(toField)) {
                toField = translateToDisplayedField(relationship.getRelatedClass(), toField, displayedQFFieldNames);
            }

            if (StringUtils.isNotBlank(lookupParameters)) {
                lookupParameters += ",";
            }

            if (propertyPrefix != null && !propertyPrefix.equals("")) {
                fromField = propertyPrefix + "." + fromField;
            }

            if ( StringUtils.isNotEmpty( collectionName ) ) {
                fromField = collectionName + fromField;
            }

            lookupParameters += fromField + ":" + toField;
        }
    }

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


示例20: getDataObjectRelationship

import org.kuali.rice.krad.bo.DataObjectRelationship; //导入依赖的package包/类
@Override
public DataObjectRelationship getDataObjectRelationship(Object dataObject, Class<?> dataObjectClass,
           String attributeName, String attributePrefix, boolean keysOnly, boolean supportsLookup,
           boolean supportsInquiry) {
       RelationshipDefinition ddReference = getDictionaryRelationship(dataObjectClass, attributeName);

       return getDataObjectRelationship(ddReference, dataObject, dataObjectClass, attributeName, attributePrefix,
               keysOnly, supportsLookup, supportsInquiry);
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:DataObjectMetaDataServiceImpl.java



注:本文中的org.kuali.rice.krad.bo.DataObjectRelationship类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Method类代码示例发布时间:2022-05-22
下一篇:
Java VoidVisitor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap