本文整理汇总了Java中org.kuali.rice.kim.api.common.template.Template类的典型用法代码示例。如果您正苦于以下问题:Java Template类的具体用法?Java Template怎么用?Java Template使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Template类属于org.kuali.rice.kim.api.common.template包,在下文中一共展示了Template类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPermission
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
/**
* @return a KimPermissionInfo object for the given name, namespace, and varargs "=" delimited attributes
*/
private PermissionBo createPermission(Template permissionTemplate, String name, String namespace, List<String> attrs) {
PermissionBo perm = new PermissionBo();
perm.setName(name);
perm.setNamespaceCode(namespace);
perm.setTemplate(PermissionTemplateBo.from(permissionTemplate));
perm.setTemplateId(permissionTemplate.getId());
Map<String,String> permissionDetails = new HashMap<String,String>();
for (String attr : attrs) {
String [] splitAttr = attr.split("=", 2);
permissionDetails.put(splitAttr[0], splitAttr[1]);
}
List<PermissionAttributeBo> attrBos = KimAttributeDataBo
.createFrom(PermissionAttributeBo.class, permissionDetails,
perm.getTemplate().getKimTypeId());
perm.setAttributeDetails(attrBos);
return perm;
}
示例2: testIngesterPermissionExampleLikeRice
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
@Test
/**
* tests {@link NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImpl#getMatchingPermissions(java.util.Map, java.util.List)}
*/
public void testIngesterPermissionExampleLikeRice() {
Map<String, String> requestedDetails = getUseIngesterRequestedDetails();
List<PermissionBo> permissionsList = new ArrayList<PermissionBo>();
Template template = KimApiServiceLocator.getPermissionService().findPermTemplateByNamespaceCodeAndName("KR-NS",
"Use Screen");
permissionsList.add(createPermission(template, "Use All Screens", "KR-SYS", "namespaceCode=KR*"));
PermissionBo exactMatch = createPermission(template, "Use Ingester Screen", "KR-WKFLW", "actionClass=" + INGESTER_ACTION, "namespaceCode=KR-WKFLW");
permissionsList.add(exactMatch);
List<Permission> immutablePermissionList = new ArrayList<Permission>();
for (PermissionBo bo : permissionsList) {
immutablePermissionList.add(PermissionBo.to(bo));
}
List<Permission> returnedPermissions = permissionService.getMatchingPermissions(requestedDetails, immutablePermissionList);
assertTrue(returnedPermissions.size() == 1);
assertTrue(returnedPermissions.get(0).equals(PermissionBo.to(exactMatch)));
}
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImplTest.java
示例3: testIngesterPermissionExampleLikeKFS
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
/**
* tests for the data described in KULRICE-3770
*/
@Test
public void testIngesterPermissionExampleLikeKFS() {
Map<String, String> requestedDetails = getUseIngesterRequestedDetails();
List<PermissionBo> permissionsList = new ArrayList<PermissionBo>();
Template template = KimApiServiceLocator.getPermissionService().findPermTemplateByNamespaceCodeAndName("KR-NS", "Use Screen");
permissionsList.add(createPermission(template, "Use Screen", "KR-SYS", "namespaceCode=KR*"));
PermissionBo exactMatch = createPermission(template, "Use Screen", "KR-WKFLW", "actionClass=" + INGESTER_ACTION);
permissionsList.add(exactMatch);
List<Permission> immutablePermissionList = new ArrayList<Permission>();
for (PermissionBo bo : permissionsList) { immutablePermissionList.add(PermissionBo.to(bo));}
List<Permission> returnedPermissions = permissionService.getMatchingPermissions(requestedDetails, immutablePermissionList);
assertTrue(returnedPermissions.size() == 1);
assertTrue(returnedPermissions.get(0).equals(PermissionBo.to(exactMatch)));
}
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImplTest.java
示例4: createPermission
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
/**
* creates a test permission
*
* @param permissionTemplate - the Template to use to create this permission
* @param name - the permission name
* @param namespace - the namespace code to use
* @param attrs - attributes to set for this permission
*
* @return a KimPermissionInfo object for the given name, namespace, and varargs "=" delimited attributes
*/
private PermissionBo createPermission(Template permissionTemplate, String name, String namespace, String ... attrs) {
PermissionBo perm = new PermissionBo();
perm.setName(name);
perm.setNamespaceCode(namespace);
perm.setTemplate(PermissionTemplateBo.from(permissionTemplate));
perm.setTemplateId(permissionTemplate.getId());
Map<String,String> permissionDetails = new HashMap<String,String>();
for (String attr : attrs) {
String [] splitAttr = attr.split("=", 2);
permissionDetails.put(splitAttr[0], splitAttr[1]);
}
List<PermissionAttributeBo> attrBos = KimAttributeDataBo
.createFrom(PermissionAttributeBo.class, permissionDetails,
perm.getTemplate().getKimTypeId());
perm.setAttributeDetails(attrBos);
return perm;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImplTest.java
示例5: create
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
/**
* Creates a Permission from an existing {@link PermissionContract}.
*/
public static Builder create(PermissionContract contract) {
Builder builder = new Builder(contract.getNamespaceCode(), contract.getName());
builder.setId(contract.getId());
builder.setDescription(contract.getDescription());
if (contract.getAttributes() != null) {
builder.setAttributes(contract.getAttributes());
}
builder.setActive(contract.isActive());
builder.setVersionNumber(contract.getVersionNumber());
builder.setObjectId(contract.getObjectId());
if (contract.getTemplate() != null
&& contract.getTemplate().getName() != null
&& contract.getTemplate().getNamespaceCode() != null) {
builder.setTemplate(Template.Builder.create(contract.getTemplate()));
}
return builder;
}
示例6: create
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
/**
* Creates a Responsibility from an existing {@link ResponsibilityContract}.
*/
public static Builder create(ResponsibilityContract contract) {
Builder builder = new Builder(contract.getNamespaceCode(), contract.getName());
builder.setId(contract.getId());
builder.setDescription(contract.getDescription());
if (contract.getAttributes() != null) {
builder.setAttributes(contract.getAttributes());
}
builder.setActive(contract.isActive());
builder.setVersionNumber(contract.getVersionNumber());
builder.setObjectId(contract.getObjectId());
if (contract.getTemplate() != null
&& contract.getTemplate().getName() != null
&& contract.getTemplate().getNamespaceCode() != null) {
builder.setTemplate(Template.Builder.create(contract.getTemplate()));
}
return builder;
}
示例7: from
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
/**
* Converts a immutable object to its mutable counterpart
* @param im immutable object
* @return the mutable bo
*/
public static PermissionTemplateBo from(Template im) {
if (im == null) {
return null;
}
PermissionTemplateBo bo = new PermissionTemplateBo();
bo.setId(im.getId());
bo.setNamespaceCode(im.getNamespaceCode());
bo.setName(im.getName());
bo.setDescription(im.getDescription());
bo.setActive(im.isActive());
bo.setKimTypeId(im.getKimTypeId());
bo.setVersionNumber(im.getVersionNumber());
bo.setObjectId(im.getObjectId());
return bo;
}
示例8: getPermissionTypeService
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
protected PermissionTypeService getPermissionTypeService(Template permissionTemplate) {
if ( permissionTemplate == null ) {
throw new IllegalArgumentException( "permissionTemplate may not be null" );
}
KimType kimType = kimTypeInfoService.getKimType( permissionTemplate.getKimTypeId() );
String serviceName = kimType.getServiceName();
// if no service specified, return a default implementation
if ( StringUtils.isBlank( serviceName ) ) {
return defaultPermissionTypeService;
}
try {
Object service = GlobalResourceLoader.getService(QName.valueOf(serviceName));
// if we have a service name, it must exist
if ( service == null ) {
throw new RuntimeException("null returned for permission type service for service name: " + serviceName);
}
// whatever we retrieved must be of the correct type
if ( !(service instanceof PermissionTypeService) ) {
throw new RuntimeException( "Service " + serviceName + " was not a PermissionTypeService. Was: " + service.getClass().getName() );
}
return (PermissionTypeService)service;
} catch( Exception ex ) {
// sometimes service locators throw exceptions rather than returning null, handle that
throw new RuntimeException( "Error retrieving service: " + serviceName + " from the KimImplServiceLocator.", ex );
}
}
示例9: findPermissionTemplates
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
@Override
public TemplateQueryResults findPermissionTemplates(final QueryByCriteria queryByCriteria)
throws RiceIllegalArgumentException {
incomingParamCheck(queryByCriteria, "queryByCriteria");
QueryResults<PermissionTemplateBo> results = dataObjectService.findMatching(PermissionTemplateBo.class, queryByCriteria);
TemplateQueryResults.Builder builder = TemplateQueryResults.Builder.create();
builder.setMoreResultsAvailable(results.isMoreResultsAvailable());
builder.setTotalRowCount(results.getTotalRowCount());
final List<Template.Builder> ims = new ArrayList<Template.Builder>();
for (PermissionTemplateBo bo : results.getResults()) {
ims.add(Template.Builder.create(bo));
}
builder.setResults(ims);
return builder.build();
}
示例10: findRespTemplateByNamespaceCodeAndName
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
@Override
public Template findRespTemplateByNamespaceCodeAndName(final String namespaceCode, final String name) throws RiceIllegalArgumentException {
incomingParamCheck(namespaceCode, "namespaceCode");
incomingParamCheck(name, "name");
final Map<String, Object> criteria = new HashMap<String, Object>();
criteria.put("namespaceCode", namespaceCode);
criteria.put("name", name);
criteria.put("active", Boolean.TRUE);
QueryResults<ResponsibilityTemplateBo> bos =
getDataObjectService().findMatching(ResponsibilityTemplateBo.class,
QueryByCriteria.Builder.andAttributes(criteria).build());
if (bos != null && bos.getResults() != null) {
if (bos.getResults().size() > 1) {
throw new RiceIllegalStateException("more than one Responsibility Template found with namespace code: " + namespaceCode + " and name: " + name);
}
final Iterator<ResponsibilityTemplateBo> i = bos.getResults().iterator();
return i.hasNext() ? ResponsibilityTemplateBo.to(i.next()) : null;
}
return null;
}
示例11: findResponsibilityTemplates
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
@Override
public TemplateQueryResults findResponsibilityTemplates(final QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException {
incomingParamCheck(queryByCriteria, "queryByCriteria");
QueryResults<ResponsibilityTemplateBo> results = getDataObjectService().
findMatching(ResponsibilityTemplateBo.class, queryByCriteria);
TemplateQueryResults.Builder builder = TemplateQueryResults.Builder.create();
builder.setMoreResultsAvailable(results.isMoreResultsAvailable());
builder.setTotalRowCount(results.getTotalRowCount());
final List<Template.Builder> ims = new ArrayList<Template.Builder>();
for (ResponsibilityTemplateBo bo : results.getResults()) {
ims.add(Template.Builder.create(bo));
}
builder.setResults(ims);
return builder.build();
}
示例12: getResponsibilityTypeServicesByTemplateId
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
private Map<String, ResponsibilityTypeService> getResponsibilityTypeServicesByTemplateId(Collection<Responsibility> responsibilities) {
Map<String, ResponsibilityTypeService> responsibilityTypeServices = new HashMap<String, ResponsibilityTypeService>(responsibilities.size());
for (Responsibility responsibility : responsibilities) {
final Template t = responsibility.getTemplate();
final KimType type = kimTypeInfoService.getKimType(t.getKimTypeId());
final String serviceName = type.getServiceName();
if (serviceName != null) {
ResponsibilityTypeService responsibiltyTypeService = GlobalResourceLoader.getService(QName.valueOf(serviceName));
if (responsibiltyTypeService != null) {
responsibilityTypeServices.put(responsibility.getTemplate().getId(), responsibiltyTypeService);
} else {
responsibilityTypeServices.put(responsibility.getTemplate().getId(), defaultResponsibilityTypeService);
}
}
}
return Collections.unmodifiableMap(responsibilityTypeServices);
}
示例13: from
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
/**
* Converts a immutable object to its mutable counterpart
* @param im immutable object
* @return the mutable bo
*/
public static PermissionTemplateBo from(Template im) {
if (im == null) {
return null;
}
PermissionTemplateBo bo = new PermissionTemplateBo();
bo.setId(im.getId());
bo.setNamespaceCode(im.getNamespaceCode());
bo.setName(im.getName());
bo.setDescription(im.getDescription());
bo.setActive(im.isActive());
bo.setKimTypeId(im.getKimTypeId());
bo.setVersionNumber(im.getVersionNumber());
bo.setObjectId(im.getObjectId());
return bo;
}
示例14: getAllTemplates
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
@Override
public List<Template> getAllTemplates() {
if ( allTemplates.isEmpty() ) {
Map<String,String> criteria = new HashMap<String,String>(1);
criteria.put( KRADPropertyConstants.ACTIVE, "Y" );
List<PermissionTemplateBo> impls = (List<PermissionTemplateBo>) businessObjectService.findMatching( PermissionTemplateBo.class, criteria );
List<Template> infos = new ArrayList<Template>( impls.size() );
for ( PermissionTemplateBo impl : impls ) {
infos.add( PermissionTemplateBo.to(impl) );
}
Collections.sort(infos, new Comparator<Template>() {
@Override public int compare(Template tmpl1,
Template tmpl2) {
int result = tmpl1.getNamespaceCode().compareTo(tmpl2.getNamespaceCode());
if ( result != 0 ) {
return result;
}
result = tmpl1.getName().compareTo(tmpl2.getName());
return result;
}
});
allTemplates.addAll(infos);
}
return Collections.unmodifiableList(allTemplates);
}
示例15: findPermissionTemplates
import org.kuali.rice.kim.api.common.template.Template; //导入依赖的package包/类
@Override
public TemplateQueryResults findPermissionTemplates(final QueryByCriteria queryByCriteria)
throws RiceIllegalArgumentException {
incomingParamCheck(queryByCriteria, "queryByCriteria");
GenericQueryResults<PermissionTemplateBo> results = criteriaLookupService.lookup(PermissionTemplateBo.class, queryByCriteria);
TemplateQueryResults.Builder builder = TemplateQueryResults.Builder.create();
builder.setMoreResultsAvailable(results.isMoreResultsAvailable());
builder.setTotalRowCount(results.getTotalRowCount());
final List<Template.Builder> ims = new ArrayList<Template.Builder>();
for (PermissionTemplateBo bo : results.getResults()) {
ims.add(Template.Builder.create(bo));
}
builder.setResults(ims);
return builder.build();
}