当前位置: 首页>>代码示例>>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;未经允许,请勿转载。