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


Java ProtectionGroup.getProtectionElements方法代码示例

本文整理汇总了Java中gov.nih.nci.security.authorization.domainobjects.ProtectionGroup.getProtectionElements方法的典型用法代码示例。如果您正苦于以下问题:Java ProtectionGroup.getProtectionElements方法的具体用法?Java ProtectionGroup.getProtectionElements怎么用?Java ProtectionGroup.getProtectionElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gov.nih.nci.security.authorization.domainobjects.ProtectionGroup的用法示例。


在下文中一共展示了ProtectionGroup.getProtectionElements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleDeleted

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入方法依赖的package包/类
@SuppressWarnings({"PMD.ExcessiveMethodLength", "unchecked" })
static void handleDeleted(Collection<Protectable> deletedInstances) {
    if (deletedInstances == null) {
        return;
    }

    try {
        for (final Protectable p : deletedInstances) {
            LOG.debug("Deleting records for obj of type: " + p.getClass().getName() + " for user "
                    + CaArrayUsernameHolder.getUser());
            final List<UserGroupRoleProtectionGroup> l = getUserGroupRoleProtectionGroups(p);
            for (final UserGroupRoleProtectionGroup ugrpg : l) {
                if (ugrpg.getGroup() != null) {
                    authMgr.removeGroupRoleFromProtectionGroup(ugrpg.getProtectionGroup().getProtectionGroupId()
                            .toString(), ugrpg.getGroup().getGroupId().toString(), new String[] {ugrpg.getRole()
                            .getId().toString() });
                } else {
                    authMgr.removeUserRoleFromProtectionGroup(ugrpg.getProtectionGroup().getProtectionGroupId()
                            .toString(), ugrpg.getUser().getUserId().toString(), new String[] {ugrpg.getRole()
                            .getId().toString() });
                }
            }
            final ProtectionGroup pg = getProtectionGroup(p);
            LOG.debug("HAndling delete for protection group " + pg.getProtectionGroupName());
            final Set<ProtectionElement> protElements = pg.getProtectionElements();
            final ProtectionElement pe = protElements.iterator().next();
            authMgr.removeProtectionGroup(pg.getProtectionGroupId().toString());
            authMgr.removeProtectionElement(pe.getProtectionElementId().toString());
        }
    } catch (final CSTransactionException e) {
        LOG.warn("Unable to remove CSM elements from deleted object: " + e.getMessage(), e);
    }
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:34,代码来源:SecurityUtils.java

示例2: getProtectionElements

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入方法依赖的package包/类
public Set getProtectionElements(String protectionGroupId)
		throws CSObjectNotFoundException {
	Session s = null;
	Set result = new HashSet();
	try {
		s = HibernateSessionFactoryHelper.getAuditSession(sf);
		ProtectionGroup protectionGroup = (ProtectionGroup) this
				.getObjectByPrimaryKey(s, ProtectionGroup.class, new Long(
						protectionGroupId));
		result = protectionGroup.getProtectionElements();
		
		List list = new ArrayList();
		Iterator toSortIterator = result.iterator();
		while(toSortIterator.hasNext()){ list.add(toSortIterator.next()); }
		Collections.sort(list);
		result.clear();
		result.addAll(list);
		
		log.debug("The result size is: " + result.size());

	} catch (Exception ex) {
		if (log.isDebugEnabled())
			log
					.debug("Authorization|||getProtectionElements|Failure|Error in obtaining Protection Elements for Protection Group Id "
							+ protectionGroupId + "|" + ex.getMessage());
		throw new CSObjectNotFoundException(
				"An error occurred while obtaining Associated Protection Elements for the Protection Group\n"
						+ ex.getMessage(), ex);
	} finally {
		try {
			s.close();
		} catch (Exception ex2) {
			if (log.isDebugEnabled())
				log
						.debug("Authorization|||getProtectionElements|Failure|Error in Closing Session |"
								+ ex2.getMessage());
		}
	}
	if (log.isDebugEnabled())
		log
				.debug("Authorization|||getProtectionElements|Success|Succesful in obtaining Protection Elements for Protection Group Id "
						+ protectionGroupId + "|");
	return result;
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:45,代码来源:AuthorizationDAOImpl.java

示例3: getProtectionElements

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入方法依赖的package包/类
public Set getProtectionElements(String protectionGroupId)
		throws CSObjectNotFoundException {
	Session s = null;
	Set result = new HashSet();
	try {
		s = HibernateSessionFactoryHelper.getAuditSession(sf);
		ProtectionGroup protectionGroup = (ProtectionGroup) this
				.getObjectByPrimaryKey(s, ProtectionGroup.class, new Long(
						protectionGroupId));
		result = protectionGroup.getProtectionElements();

		List list = new ArrayList();
		Iterator toSortIterator = result.iterator();
		while(toSortIterator.hasNext()){ list.add(toSortIterator.next()); }
		Collections.sort(list);
		result.clear();
		result.addAll(list);

		log.debug("The result size is: " + result.size());

	} catch (Exception ex) {
		if (log.isDebugEnabled())
			log
					.debug("Authorization|||getProtectionElements|Failure|Error in obtaining Protection Elements for Protection Group Id "
							+ protectionGroupId + "|" + ex.getMessage());
		throw new CSObjectNotFoundException(
				"An error occurred while obtaining Associated Protection Elements for the Protection Group\n"
						+ ex.getMessage(), ex);
	} finally {
		try {
			s.close();
		} catch (Exception ex2) {
			if (log.isDebugEnabled())
				log
						.debug("Authorization|||getProtectionElements|Failure|Error in Closing Session |"
								+ ex2.getMessage());
		}
	}
	if (log.isDebugEnabled())
		log
				.debug("Authorization|||getProtectionElements|Success|Succesful in obtaining Protection Elements for Protection Group Id "
						+ protectionGroupId + "|");
	return result;
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:45,代码来源:AuthorizationDAOImpl.java


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