當前位置: 首頁>>代碼示例>>Java>>正文


Java KimTypeAttributeBo類代碼示例

本文整理匯總了Java中org.kuali.rice.kim.impl.type.KimTypeAttributeBo的典型用法代碼示例。如果您正苦於以下問題:Java KimTypeAttributeBo類的具體用法?Java KimTypeAttributeBo怎麽用?Java KimTypeAttributeBo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


KimTypeAttributeBo類屬於org.kuali.rice.kim.impl.type包,在下文中一共展示了KimTypeAttributeBo類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initPersonDocRole

import org.kuali.rice.kim.impl.type.KimTypeAttributeBo; //導入依賴的package包/類
private PersonDocumentRole initPersonDocRole() throws Exception {
//		Map pkMap = new HashMap();
//		pkMap.put("roleId", "r1");
//		PersonDocumentRole docRole = (PersonDocumentRole)uiDocumentService.getBusinessObjectService().findByPrimaryKey(PersonDocumentRole.class, pkMap);
		PersonDocumentRole docRole = new PersonDocumentRole();
		docRole.setKimTypeId("roleType1");
		docRole.setRoleId("r1");
		KimTypeBo kimType = new KimTypeBo();
		kimType.setId("roleType1");
		kimType.setServiceName("kimRoleTypeService");
		List<KimTypeAttributeBo> attributeDefinitions = new ArrayList<KimTypeAttributeBo>();
		KimTypeAttributeBo attr1 = KradDataServiceLocator.getDataObjectService().find(KimTypeAttributeBo.class, "kimAttr3");

//		attr1.setKimAttributeId("kimAttrDefn2");
//		attr1.setSortCode("a");
//		attr1.setKimTypeAttributeId("kimAttr3");

		attributeDefinitions.add(attr1);
//		attr1 = new KimTypeAttributeBo();
//		attr1.setKimAttributeId("kimAttrDefn3");
//		attr1.setSortCode("b");
//		attr1.setKimTypeAttributeId("kimAttr4");

		KimTypeAttributeBo attr2 = KradDataServiceLocator.getDataObjectService().find(KimTypeAttributeBo.class, "kimAttr4");

		attributeDefinitions.add(attr2);
		kimType.setAttributeDefinitions(attributeDefinitions);

        Field fld = PersonDocumentRole.class.getDeclaredField("kimRoleType");
        fld.setAccessible(true);
        fld.set(docRole, kimType);

		return docRole;
	}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:35,代碼來源:UiDocumentServiceImplTest.java

示例2: initPersonDocRole

import org.kuali.rice.kim.impl.type.KimTypeAttributeBo; //導入依賴的package包/類
private PersonDocumentRole initPersonDocRole() throws Exception {
//		Map pkMap = new HashMap();
//		pkMap.put("roleId", "r1");
//		PersonDocumentRole docRole = (PersonDocumentRole)uiDocumentService.getBusinessObjectService().findByPrimaryKey(PersonDocumentRole.class, pkMap);
		PersonDocumentRole docRole = new PersonDocumentRole();
		docRole.setKimTypeId("roleType1");
		docRole.setRoleId("r1");
		KimTypeBo kimType = new KimTypeBo();
		kimType.setId("roleType1");
		kimType.setServiceName("kimRoleTypeService");
		List<KimTypeAttributeBo> attributeDefinitions = new ArrayList<KimTypeAttributeBo>();
		Map pkMap = new HashMap();
		pkMap.put("kimTypeAttributeId", "kimAttr3");
		KimTypeAttributeBo attr1 = (KimTypeAttributeBo) KRADServiceLocator.getBusinessObjectService().findByPrimaryKey(KimTypeAttributeBo.class, pkMap);

//		attr1.setKimAttributeId("kimAttrDefn2");
//		attr1.setSortCode("a");
//		attr1.setKimTypeAttributeId("kimAttr3");

		attributeDefinitions.add(attr1);
//		attr1 = new KimTypeAttributeBo();
//		attr1.setKimAttributeId("kimAttrDefn3");
//		attr1.setSortCode("b");
//		attr1.setKimTypeAttributeId("kimAttr4");

		pkMap.put("kimTypeAttributeId", "kimAttr4");
		KimTypeAttributeBo attr2 = (KimTypeAttributeBo) KRADServiceLocator.getBusinessObjectService().findByPrimaryKey(KimTypeAttributeBo.class, pkMap);

		attributeDefinitions.add(attr2);
		kimType.setAttributeDefinitions(attributeDefinitions);

        Field fld = PersonDocumentRole.class.getField("kimRoleType");
        fld.set(docRole, kimType);

		return docRole;
	}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:37,代碼來源:UiDocumentServiceImplTest.java

示例3: createRoleWithRecallPermission

import org.kuali.rice.kim.impl.type.KimTypeAttributeBo; //導入依賴的package包/類
/**
 * Creates a new role with recall permission qualified with doc type and custom app doc status
 * @param ns role namespace
 * @param name role name
 * @param recallPerm the pre-created Recall permission
 * @return the new recall-capable Role
 */
protected Role createRoleWithRecallPermission(String ns, String name, Permission recallPerm, String kimTypeName, String roleQualifierName) {
    // create a custom attribute for role qualification
    KimAttribute.Builder attribute = KimAttribute.Builder.create("org.kuali.rice.kim.bo.impl.KimAttributes", roleQualifierName, "KR-SYS");
    attribute.setAttributeLabel(roleQualifierName);
    attribute.setActive(true);
    KimAttributeBo customAttribute = KRADServiceLocator.getDataObjectService().save(KimAttributeBo.from(attribute.build()));

    // create a custom kim type for the custom attribute
    KimType.Builder kimType = KimType.Builder.create();
    kimType.setNamespaceCode("KR-SYS");
    kimType.setName(kimTypeName);
    kimType.setActive(true);
    KimTypeBo customKimType = KRADServiceLocator.getDataObjectService().save(KimTypeBo.from(kimType.build()));

    KimTypeAttribute.Builder kimTypeAttribute = KimTypeAttribute.Builder.create();
    kimTypeAttribute.setKimTypeId(customKimType.getId());
    kimTypeAttribute.setKimAttribute(KimAttribute.Builder.create(customAttribute));
    kimTypeAttribute.setActive(true);
    KimTypeAttributeBo customKimTypeAttribute = KRADServiceLocator.getDataObjectService().save(KimTypeAttributeBo.from(kimTypeAttribute.build()));

    kimType = KimType.Builder.create(customKimType);
    kimTypeAttribute = KimTypeAttribute.Builder.create(customKimTypeAttribute);
    kimType.setAttributeDefinitions(Collections.singletonList(kimTypeAttribute));
    customKimType = KRADServiceLocator.getDataObjectService().save(KimTypeBo.from(kimType.build()));

    KRADServiceLocator.getDataObjectService().flush(KimTypeBo.class);

    // create a new role
    Role.Builder role = Role.Builder.create();
    role.setActive(true);
    role.setDescription("RecallTest custom recall role");
    role.setName(ns);
    role.setNamespaceCode(name);
    role.setKimTypeId(customKimType.getId());
    Role customRole = KimApiServiceLocator.getRoleService().createRole(role.build());

    // create a custom attribute for role qualification

    Long chartAttributeId = getNextSequenceLongValue("KRIM_ATTR_DEFN_ID_S");
    KimAttributeBo chartAttribute = new KimAttributeBo();
    chartAttribute.setId("" + chartAttributeId);
    chartAttribute.setAttributeName(roleQualifierName);
    chartAttribute.setComponentName("org.kuali.rice.kim.bo.impl.KimAttributes");
    chartAttribute.setNamespaceCode("KR-SYS");
    chartAttribute.setAttributeLabel(roleQualifierName);
    chartAttribute.setActive(true);
    chartAttribute = KradDataServiceLocator.getDataObjectService().save(chartAttribute);

    KimApiServiceLocator.getRoleService().assignPermissionToRole(recallPerm.getId(), customRole.getId());

    List<String> recallCapableRoleIds = KimApiServiceLocator.getPermissionService().getRoleIdsForPermission(recallPerm.getNamespaceCode(), recallPerm.getName());
    Assert.assertFalse("No recall-capable roles found", recallCapableRoleIds.isEmpty());
    Assert.assertTrue("New role is not associated with Recall permission", recallCapableRoleIds.contains(customRole.getId()));

    return customRole;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:64,代碼來源:RecallActionTest.java

示例4: testCreateGroupWithCustomKimTypeAttributes

import org.kuali.rice.kim.impl.type.KimTypeAttributeBo; //導入依賴的package包/類
@Test
public void testCreateGroupWithCustomKimTypeAttributes() {
    // This test needs to be run in separate test class
    // with @BaselineTestCase.BaselineMode(BaselineTestCase.Mode.NONE)
    KimAttribute.Builder kimAttribute = KimAttribute.Builder.create(KIM_ATTRIBUTE_COMPONENT_NAME,
            KIM_ATTRIBUTE_NAME, NAMESPACE);
    kimAttribute.setAttributeLabel(KIM_ATTRIBUTE_LABEL);
    kimAttribute.setId(KIM_ATTRIBUTE_ID);
    kimAttribute.setActive(true);
    KimAttributeBo kimAddrBo = KRADServiceLocator.getDataObjectService().save(KimAttributeBo.from(kimAttribute.build()));

    KimType.Builder kimTypeBuilder = KimType.Builder.create();
    kimTypeBuilder.setId(KIM_TYPE_ID);
    kimTypeBuilder.setName(KIM_TYPE_NAME);
    kimTypeBuilder.setNamespaceCode(NAMESPACE);
    kimTypeBuilder.setServiceName(KIM_TYPE_SERVICE_NAME);
    kimTypeBuilder.setActive(true);
    KimTypeBo kimTypeBo = KRADServiceLocator.getDataObjectService().save(KimTypeBo.from(kimTypeBuilder.build()));

    KimTypeAttribute.Builder kimTypeAttributeBuilder = KimTypeAttribute.Builder.create();
    kimTypeAttributeBuilder.setId(KIM_TYPE_ATTRIBUTE_ID);
    kimTypeAttributeBuilder.setActive(true);
    kimTypeAttributeBuilder.setSortCode("a");
    kimTypeAttributeBuilder.setKimTypeId(KIM_TYPE_ID);
    kimTypeAttributeBuilder.setKimAttribute(kimAttribute);
    KimTypeAttributeBo kimTypeAttrBo = KRADServiceLocator.getDataObjectService().save(KimTypeAttributeBo.from(kimTypeAttributeBuilder.build()));

    kimTypeBuilder = KimType.Builder.create(KimApiServiceLocator.getKimTypeInfoService().getKimType(KIM_TYPE_ID));
    kimTypeAttributeBuilder = KimTypeAttribute.Builder.create(kimTypeAttrBo);
    List<KimTypeAttribute.Builder> attrList = Collections.singletonList(kimTypeAttributeBuilder);
    kimTypeBuilder.setAttributeDefinitions(attrList);

    kimTypeBo = KRADServiceLocator.getDataObjectService().save(KimTypeBo.from(kimTypeBuilder.build()));
    KRADServiceLocator.getDataObjectService().flush(KimTypeBo.class);

    Map<String, String> attributes = new HashMap<String, String>();
    attributes.put(KIM_ATTRIBUTE_NAME, KIM_ATTRIBUTE_VALUE);

    Group.Builder groupInfo = Group.Builder.create(NAMESPACE, GROUP_NAME, KIM_TYPE_ID);
    groupInfo.setAttributes(attributes);
    groupInfo.setActive(true);
    groupInfo.setDescription(KIM_ATTRIBUTE_LABEL + " " + KIM_ATTRIBUTE_VALUE);
    Group group = KimApiServiceLocator.getGroupService().createGroup(groupInfo.build());

    Group result = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(NAMESPACE, GROUP_NAME);
    assertEquals(groupInfo.isActive(), result.isActive());
    assertTrue(groupInfo.getNamespaceCode().equals(result.getNamespaceCode()));
    assertTrue(groupInfo.getName().equals(result.getName()));
    assertTrue(groupInfo.getKimTypeId().equals(result.getKimTypeId()));
    assertEquals(1, result.getAttributes().size());
    assertTrue(result.getAttributes().get(KIM_ATTRIBUTE_NAME).contains(KIM_ATTRIBUTE_VALUE));
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:53,代碼來源:GroupUpdateServiceApiCustomTest.java


注:本文中的org.kuali.rice.kim.impl.type.KimTypeAttributeBo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。