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


Java ProtectionElement.setObjectId方法代码示例

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


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

示例1: testModifyProtectionElement

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
private void testModifyProtectionElement() throws CSTransactionException, CSObjectNotFoundException 
{
	ProtectionElement tempProtectionElement = new ProtectionElement();
	java.util.Date midnight_jan2_1970 = new java.util.Date(24L*60L*60L*1000L);

	tempProtectionElement = userProvisioningManager.getProtectionElementById("4");
	
	tempProtectionElement.setProtectionElementName(ProtectionElementStringArray[3][0] + "Modified");
	tempProtectionElement.setProtectionElementDescription(ProtectionElementStringArray[3][1] + "Modified");
	tempProtectionElement.setObjectId(ProtectionElementStringArray[3][2] + "Modified");
	tempProtectionElement.setAttribute(ProtectionElementStringArray[3][3] + "Modified");
	tempProtectionElement.setUpdateDate(midnight_jan2_1970);	//TODO: Not updating the "Update Date"
	
	userProvisioningManager.modifyProtectionElement(tempProtectionElement); 
	
	tempProtectionElement = userProvisioningManager.getProtectionElementById("4");
	
	assertEquals("\nmodifyProtectionElement did not modify the Name\n", ProtectionElementStringArray[3][0] + "Modified", tempProtectionElement.getProtectionElementName());
	assertEquals("\nmodifyProtectionElement did not modify the Description\n", ProtectionElementStringArray[3][1] + "Modified", tempProtectionElement.getProtectionElementDescription());
	assertEquals("\nmodifyProtectionElement did not modify the Object ID\n", ProtectionElementStringArray[3][2] + "Modified", tempProtectionElement.getObjectId());
	assertEquals("\nmodifyProtectionElement did not modify the Attribute\n", ProtectionElementStringArray[3][3] + "Modified", tempProtectionElement.getAttribute());
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:23,代码来源:UserProvisioningManagerTest.java

示例2: createUptOperationProtectionElement

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
private ProtectionElement createUptOperationProtectionElement(UserProvisioningManager upManager, String objectId, Application application) throws CSTransactionException
{
	ProtectionElement pe = new ProtectionElement();
	String peName=Constants.UPT_OPERATION_DISABLE_FLAG+":"+objectId;
	pe.setProtectionElementName(peName);
	pe.setObjectId(objectId);
	
	String peDesc="System required protection element :"+objectId +"'\n Do not change its unique object ID.";
	pe.setProtectionElementDescription(peDesc);
	upManager.createProtectionElement(pe);
	// pe has been as to current application
	//set it to target application
	pe.setApplication(application);			
	upManager.modifyProtectionElement(pe);
	return pe;
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:17,代码来源:ApplicationForm.java

示例3: testCreateProtectionElement

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
private void testCreateProtectionElement() throws CSTransactionException
{
	for (int x = 0; x < NumberOfProtectionElementsToTest; x++)
	{
		ProtectionElement tempProtectionElement = new ProtectionElement();
		java.util.Date CurrentTime = new java.util.Date();
		tempProtectionElement.setProtectionElementName(ProtectionElementStringArray[x][0]);
		tempProtectionElement.setProtectionElementDescription(ProtectionElementStringArray[x][1]);
		tempProtectionElement.setObjectId(ProtectionElementStringArray[x][2]);
		tempProtectionElement.setAttribute(ProtectionElementStringArray[x][3]);
		tempProtectionElement.setUpdateDate(CurrentTime);

		userProvisioningManager.createProtectionElement(tempProtectionElement);

		tempProtectionElement = null;
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:18,代码来源:RegressionTest.java

示例4: xtestModifyProtectionElement

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
private void xtestModifyProtectionElement() throws CSTransactionException, CSObjectNotFoundException 
{
	ProtectionElement tempProtectionElement = new ProtectionElement();
	java.util.Date midnight_jan2_1970 = new java.util.Date(24L*60L*60L*1000L);

	tempProtectionElement = userProvisioningManager.getProtectionElementById("4");
	
	tempProtectionElement.setProtectionElementName(ProtectionElementStringArray[3][0] + "Modified");
	tempProtectionElement.setProtectionElementDescription(ProtectionElementStringArray[3][1] + "Modified");
	tempProtectionElement.setObjectId(ProtectionElementStringArray[3][2] + "Modified");
	tempProtectionElement.setAttribute(ProtectionElementStringArray[3][3] + "Modified");
	tempProtectionElement.setUpdateDate(midnight_jan2_1970);	//TODO: Not updating the "Update Date"
	
	userProvisioningManager.modifyProtectionElement(tempProtectionElement); 
	
	tempProtectionElement = userProvisioningManager.getProtectionElementById("4");
	
	assertEquals("\nmodifyProtectionElement did not modify the Name\n", ProtectionElementStringArray[3][0] + "Modified", tempProtectionElement.getProtectionElementName());
	assertEquals("\nmodifyProtectionElement did not modify the Description\n", ProtectionElementStringArray[3][1] + "Modified", tempProtectionElement.getProtectionElementDescription());
	assertEquals("\nmodifyProtectionElement did not modify the Object ID\n", ProtectionElementStringArray[3][2] + "Modified", tempProtectionElement.getObjectId());
	assertEquals("\nmodifyProtectionElement did not modify the Attribute\n", ProtectionElementStringArray[3][3] + "Modified", tempProtectionElement.getAttribute());
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:23,代码来源:UserProvisioningManagerTest.java

示例5: createProtectionGroup

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
@SuppressWarnings("PMD.ExcessiveMethodLength")
private static ProtectionGroup createProtectionGroup(Protectable p, User csmUser) throws CSObjectNotFoundException,
        CSTransactionException {

    final ProtectionElement pe = new ProtectionElement();
    final Application application = getApplication();
    pe.setApplication(application);
    pe.setObjectId(p.getClass().getName());
    pe.setAttribute("id");
    pe.setValue(p.getId().toString());
    pe.setUpdateDate(new Date());
    authMgr.createProtectionElement(pe);

    final ProtectionGroup pg = new ProtectionGroup();
    pg.setApplication(application);
    pg.setProtectionElements(Collections.singleton(pe));
    pg.setProtectionGroupName("PE(" + pe.getProtectionElementId() + ") group");
    pg.setUpdateDate(new Date());
    authMgr.createProtectionGroup(pg);

    addOwner(pg, csmUser);
    assignSystemAdministratorAccess(pg);
    return pg;
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:25,代码来源:SecurityUtils.java

示例6: searchObjects

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
public SearchResult searchObjects(UserProvisioningManager userProvisioningManager) throws Exception 
{
	ProtectionElement protectionElement = new ProtectionElement();
	
	if (this.protectionElementName != null && !(this.protectionElementName.trim().equalsIgnoreCase("")))
		protectionElement.setProtectionElementName(this.protectionElementName);
	if (this.protectionElementType != null && !(this.protectionElementType.trim().equalsIgnoreCase("")))
		protectionElement.setProtectionElementType(this.protectionElementType);
	if (this.protectionElementObjectId != null && !(this.protectionElementObjectId.trim().equalsIgnoreCase("")))
		protectionElement.setObjectId(this.protectionElementObjectId);
	if (this.protectionElementAttribute != null && !(this.protectionElementAttribute.trim().equalsIgnoreCase("")))
		protectionElement.setAttribute(this.protectionElementAttribute);
	if (this.protectionElementValue != null && !(this.protectionElementValue.trim().equalsIgnoreCase("")))
		protectionElement.setValue(this.protectionElementValue);
	
	SearchCriteria searchCriteria = new ProtectionElementSearchCriteria(protectionElement);
	List list = userProvisioningManager.getObjects(searchCriteria);
	SearchResult searchResult = new SearchResult();
	searchResult.setSearchResultMessage(searchCriteria.getMessage());
	searchResult.setSearchResultObjects(list);
	return searchResult;
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:23,代码来源:ProtectionElementForm.java

示例7: testCreateProtectionElement

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
private static void testCreateProtectionElement() throws CSTransactionException 
{
	for (int x=0; x<NumberOfProtectionElementsToTest; x++)
	{
		ProtectionElement tempProtectionElement = new ProtectionElement();
		java.util.Date CurrentTime = new java.util.Date();
		tempProtectionElement.setProtectionElementName(ProtectionElementStringArray[x][0]);
		tempProtectionElement.setProtectionElementDescription(ProtectionElementStringArray[x][1]);
		tempProtectionElement.setObjectId(ProtectionElementStringArray[x][2]);
		tempProtectionElement.setAttribute(ProtectionElementStringArray[x][3]);
		tempProtectionElement.setUpdateDate(CurrentTime);
		
		userProvisioningManager.createProtectionElement(tempProtectionElement);
		
		tempProtectionElement = null;
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:18,代码来源:PrimeCSMData.java

示例8: getPrivilegeMap3

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
public void getPrivilegeMap3(){
	// thru group
	try{
		AuthorizationManager am = (AuthorizationManager)upm;
		ArrayList al = new ArrayList();
		ProtectionElement pe1 = new ProtectionElement();
		pe1.setObjectId("TestElement3");
		al.add(pe1);
		Collection map = am.getPrivilegeMap("testcaseuser3",al);
		Iterator it = map.iterator();
		while (it.hasNext())
		{
			ObjectPrivilegeMap opm = (ObjectPrivilegeMap)it.next();
			ProtectionElement pe = opm.getProtectionElement();
			System.out.println("The Protection Element is : " + pe.getObjectId()+" : " + pe.getAttribute());
			Collection privList = opm.getPrivileges();
			Iterator it2 = privList.iterator();
			while (it2.hasNext())
			{
				Privilege priv = (Privilege)it2.next();
				System.out.println("The Privilege is : " + priv.getName());
			}
		}
	}catch(Exception ex){
		ex.printStackTrace();
	}
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:28,代码来源:TestClient.java

示例9: getPrivilegeMap2

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
public void getPrivilegeMap2(){
	// both object id and attribute
	try{
		AuthorizationManager am = (AuthorizationManager)upm;
		ArrayList al = new ArrayList();
		ProtectionElement pe1 = new ProtectionElement();
		pe1.setObjectId("TestElement2");
		pe1.setAttribute("TestElement2");
		al.add(pe1);
		Collection map = am.getPrivilegeMap("testcaseuser2",al);
		Iterator it = map.iterator();
		while (it.hasNext())
		{
			ObjectPrivilegeMap opm = (ObjectPrivilegeMap)it.next();
			ProtectionElement pe = opm.getProtectionElement();
			System.out.println("The Protection Element is : " + pe.getObjectId()+" : " + pe.getAttribute());
			Collection privList = opm.getPrivileges();
			Iterator it2 = privList.iterator();
			while (it2.hasNext())
			{
				Privilege priv = (Privilege)it2.next();
				System.out.println("The Privilege is : " + priv.getName());
			}
		}
	}catch(Exception ex){
		ex.printStackTrace();
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:29,代码来源:TestClient.java

示例10: createProtectionElementInstance

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
private ProtectionElement createProtectionElementInstance(StudyConfiguration studyConfiguration) {
    ProtectionElement element = new ProtectionElement();
    element.setAttribute(STUDY_ATTRIBUTE);
    element.setObjectId(STUDY_OBJECT);
    element.setValue(String.valueOf(studyConfiguration.getStudy().getId()));
    return element;
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:8,代码来源:SecurityManagerImpl.java

示例11: getPrivilegeMap4

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
public void getPrivilegeMap4(){
	// Wrong info
	try{
		AuthorizationManager am = (AuthorizationManager)upm;
		ArrayList al = new ArrayList();
		ProtectionElement pe1 = new ProtectionElement();
		pe1.setObjectId("NoSuchElement");
		al.add(pe1);
		Collection map = am.getPrivilegeMap("testcaseuser1",al);
		Iterator it = map.iterator();
		while (it.hasNext())
		{
			ObjectPrivilegeMap opm = (ObjectPrivilegeMap)it.next();
			ProtectionElement pe = opm.getProtectionElement();
			System.out.println("The Protection Element is : " + pe.getObjectId()+" : " + pe.getAttribute());
			Collection privList = opm.getPrivileges();
			Iterator it2 = privList.iterator();
			while (it2.hasNext())
			{
				Privilege priv = (Privilege)it2.next();
				System.out.println("The Privilege is : " + priv.getName());
			}
		}
	}catch(Exception ex){
		ex.printStackTrace();
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:28,代码来源:TestClient.java

示例12: createProtectionElement

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
/**
 * Test method: void createPrivilege(Privilege)
 */
protected ProtectionElement createProtectionElement() throws CSTransactionException {

	ProtectionElement pe = new ProtectionElement();
	pe.setObjectId( "" + System.currentTimeMillis() );
	pe.setProtectionElementDescription( "Test Desc");
	pe.setProtectionElementName( "Test PE Name" + System.currentTimeMillis());
		
	upm.createProtectionElement( pe );
	System.out.println("Created PE with ID: " + pe.getProtectionElementId() );
	return pe;

}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:16,代码来源:AuthorizationDAOImplTest.java

示例13: setOwnerForProtectionElement

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
public void setOwnerForProtectionElement(String protectionElementObjectId,
		String[] userNames) throws CSTransactionException {

	Session s = null;
	Transaction t = null;
	if (StringUtilities.isBlank(protectionElementObjectId)) {
		throw new CSTransactionException("object Id can't be null!");
	}
	try {
		

		Set users = new HashSet();

		for (int i = 0; i < userNames.length; i++) {
			User user = this.getUser(userNames[i]);
			if (user != null) {
				users.add(user);
			}
		}
		ProtectionElement pe = new ProtectionElement();
		pe.setObjectId(protectionElementObjectId);
		pe.setApplication(application);
		SearchCriteria sc = new ProtectionElementSearchCriteria(pe);
		List l = this.getObjects(sc);

		ProtectionElement protectionElement = (ProtectionElement) l.get(0);

		protectionElement.setOwners(users);
		s = HibernateSessionFactoryHelper.getAuditSession(sf);
		t = s.beginTransaction();
		s.update(protectionElement);
		t.commit();
		s.flush();
		auditLog.info("Assigning Users as Owner for Protection Element with Object Id " + protectionElement.getObjectId() + " and Attribute " + protectionElement.getAttribute());		
	} catch (Exception ex) {
		log.error(ex);
		try {
			t.rollback();
		} catch (Exception ex3) {
			if (log.isDebugEnabled())
				log
						.debug("Authorization|||setOwnerForProtectionElement|Failure|Error in Rolling Back Transaction|"
								+ ex3.getMessage());
		}
		if (log.isDebugEnabled())
			log
					.debug("Authorization|||setOwnerForProtectionElement|Failure|Error Setting owner for Protection Element object Name"
							+ protectionElementObjectId
							+ " for users "
							+ StringUtilities
									.stringArrayToString(userNames)
							+ "|"
							+ ex.getMessage());
		throw new CSTransactionException(
				"An error occured in setting multiple owners for the Protection Element\n"
						+ ex.getMessage(), ex);
	} finally {
		try {
			
			s.close();
		} catch (Exception ex2) {
			if (log.isDebugEnabled())
				log
						.debug("Authorization|||setOwnerForProtectionElement|Failure|Error in Closing Session |"
								+ ex2.getMessage());
		}
	}
	if (log.isDebugEnabled())
		log
				.debug("Authorization|||setOwnerForProtectionElement|Success|Successful in Setting owner for Protection Element object Name"
						+ protectionElementObjectId
						+ " for users "
						+ StringUtilities.stringArrayToString(userNames)
						+ "|");
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:76,代码来源:AuthorizationDAOImpl.java

示例14: setOwnerForProtectionElement

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
public void setOwnerForProtectionElement(String protectionElementObjectId,
		String[] userNames) throws CSTransactionException {

	Session s = null;
	Transaction t = null;
	if (StringUtilities.isBlank(protectionElementObjectId)) {
		throw new CSTransactionException("object Id can't be null!");
	}
	try {


		Set users = new HashSet();

		for (int i = 0; i < userNames.length; i++) {
			User user = this.getUser(userNames[i]);
			if (user != null) {
				users.add(user);
			}
		}
		ProtectionElement pe = new ProtectionElement();
		pe.setObjectId(protectionElementObjectId);
		pe.setApplication(application);
		SearchCriteria sc = new ProtectionElementSearchCriteria(pe);
		List l = this.getObjects(sc);

		ProtectionElement protectionElement = (ProtectionElement) l.get(0);

		protectionElement.setOwners(users);
		s = HibernateSessionFactoryHelper.getAuditSession(sf);
		t = s.beginTransaction();
		s.update(protectionElement);
		t.commit();
		s.flush();
		auditLog.info("Assigning Users as Owner for Protection Element with Object Id " + protectionElement.getObjectId() + " and Attribute " + protectionElement.getAttribute());
	} catch (Exception ex) {
		log.error(ex);
		try {
			t.rollback();
		} catch (Exception ex3) {
			if (log.isDebugEnabled())
				log
						.debug("Authorization|||setOwnerForProtectionElement|Failure|Error in Rolling Back Transaction|"
								+ ex3.getMessage());
		}
		if (log.isDebugEnabled())
			log
					.debug("Authorization|||setOwnerForProtectionElement|Failure|Error Setting owner for Protection Element object Name"
							+ protectionElementObjectId
							+ " for users "
							+ StringUtilities
									.stringArrayToString(userNames)
							+ "|"
							+ ex.getMessage());
		throw new CSTransactionException(
				"An error occured in setting multiple owners for the Protection Element\n"
						+ ex.getMessage(), ex);
	} finally {
		try {

			s.close();
		} catch (Exception ex2) {
			if (log.isDebugEnabled())
				log
						.debug("Authorization|||setOwnerForProtectionElement|Failure|Error in Closing Session |"
								+ ex2.getMessage());
		}
	}
	if (log.isDebugEnabled())
		log
				.debug("Authorization|||setOwnerForProtectionElement|Success|Successful in Setting owner for Protection Element object Name"
						+ protectionElementObjectId
						+ " for users "
						+ StringUtilities.stringArrayToString(userNames)
						+ "|");
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:76,代码来源:AuthorizationDAOImpl.java

示例15: doAuthorization

import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
/**
 * Method performs the following authorization: Creates a protection element
 * that represents the employee record Creates the employee protection
 * element to protected the Employee's data Create a User in the security
 * schema for Authorization Assigns the employee to a business unit Assigns
 * the employee as the owner of their record Assigns full access to HR
 * Managers only
 * 
 * @param request
 * @param empl
 * @throws CSException
 */
private void doAuthorization(HttpServletRequest request, Employee empl)
		throws Exception {

	try {

		//Create a protection element that represents the employee record
		ProtectionElement pe = new ProtectionElement();
		pe.setObjectId(SecurityUtils.getEmployeeObjectId(empl));
		pe.setProtectionElementName("EMPLOYEE_RECORD_"
				+ empl.getEmployeeId());
		pe
				.setProtectionElementDescription("The gov.nih.nci.security.ri.valueObject.Employee Object");

		//create the employee protection element to protected the
		//employee's data
		getAuthorizationManager().createProtectionElement(pe);

		//Create the User for Authorization
		User user = createUser(empl);

		//Assign the User to the appropriate UserGroup
		getUserProvisioningManager().assignUserToGroup(user.getLoginName(),
				SecurityUtils.getEmployeeGroup(empl));

		//assign the employee as owner of record
		getAuthorizationManager().setOwnerForProtectionElement(
				user.getLoginName(), pe.getObjectId(), null);

		//assign the employee to his business unit
		getAuthorizationManager().assignProtectionElement(
				empl.getBusinessUnit(), pe.getObjectId());

		//If they are not part of HR division then add
		//employee record so that HR managers can view
		//all employee data
		if (!HR_DIVISION.equals(empl.getBusinessUnit())) {
			//assign access to the employee for HR Division
			getAuthorizationManager().assignProtectionElement(HR_DIVISION,
					pe.getObjectId());
		}

	} catch (CSException ex) {
		log
				.fatal(
						"The Security Service encountered a fatal exception.",
						ex);
		throw new Exception(
				"The Security Service encountered a fatal exception.", ex);
	}

}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:64,代码来源:CreateEmployeeAction.java


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