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


Java DataObjectRelationship类代码示例

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


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


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