本文整理汇总了Java中org.ligoj.bootstrap.core.NamedBean.copy方法的典型用法代码示例。如果您正苦于以下问题:Java NamedBean.copy方法的具体用法?Java NamedBean.copy怎么用?Java NamedBean.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ligoj.bootstrap.core.NamedBean
的用法示例。
在下文中一共展示了NamedBean.copy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findGroupsByName
import org.ligoj.bootstrap.core.NamedBean; //导入方法依赖的package包/类
/**
* Search the LDAP Groups matching to the given criteria and for type
* "Project". Node identifier is ignored for now.
*
* @param criteria
* the search criteria.
* @return LDAP Groups matching the criteria.
* @see ContainerScope#TYPE_PROJECT
*/
@GET
@Path("group/{node}/{criteria}")
@Consumes(MediaType.APPLICATION_JSON)
public List<INamableBean<String>> findGroupsByName(@PathParam("criteria") final String criteria) {
final List<INamableBean<String>> result = new ArrayList<>();
final String criteriaClean = Normalizer.normalize(criteria);
final Set<GroupOrg> managedGroups = groupLdapResource.getContainers();
final List<ContainerScope> types = containerScopeResource.findAllDescOrder(ContainerType.GROUP);
for (final GroupOrg group : managedGroups) {
final ContainerScope scope = groupLdapResource.toScope(types, group);
// Check type and criteria
if (scope != null && ContainerScope.TYPE_PROJECT.equals(scope.getName())
&& group.getId().contains(criteriaClean)) {
// Return the nice name
final INamableBean<String> bean = new NamedBean<>();
NamedBean.copy(group, bean);
result.add(bean);
}
}
return result;
}
示例2: newContainerCountVo
import org.ligoj.bootstrap.core.NamedBean; //导入方法依赖的package包/类
/**
* Build a new secured container managing the effective visibility and rights.
*
* @param rawContainer
* the raw container contained sensitive data.
* @param managedWrite
* The containers the current user can write.
* @param managedAdmin
* The containers the current user can administer.
* @param types
* The defined type with locking information.
* @return A secured container with right and lock information the current user has.
*/
protected ContainerCountVo newContainerCountVo(final ContainerOrg rawContainer, final Set<T> managedWrite, final Set<T> managedAdmin,
final List<ContainerScope> types) {
final ContainerCountVo securedUserOrg = new ContainerCountVo();
NamedBean.copy(rawContainer, securedUserOrg);
securedUserOrg.setCanWrite(managedWrite.contains(rawContainer));
securedUserOrg.setCanAdmin(managedAdmin.contains(rawContainer));
securedUserOrg.setContainerType(type);
// Find the closest type
final ContainerScope scope = toScope(types, rawContainer);
if (scope != null) {
securedUserOrg.setScope(scope.getName());
securedUserOrg.setLocked(scope.isLocked());
}
securedUserOrg.setLocked(securedUserOrg.isLocked() || rawContainer.isLocked());
return securedUserOrg;
}
示例3: toVo
import org.ligoj.bootstrap.core.NamedBean; //导入方法依赖的package包/类
/**
* Simple transformer, securing sensible date. DN is not forwarded.
*/
protected ContainerWithScopeVo toVo(final T rawGroupLdap) {
// Find the closest type
final ContainerWithScopeVo securedUserOrg = new ContainerWithScopeVo();
final List<ContainerScope> scopes = containerScopeResource.findAllDescOrder(type);
final ContainerScope scope = toScope(scopes, rawGroupLdap);
NamedBean.copy(rawGroupLdap, securedUserOrg);
if (scope != null) {
securedUserOrg.setScope(scope.getName());
}
return securedUserOrg;
}