本文整理汇总了Java中gov.nih.nci.security.authorization.domainobjects.ProtectionElement类的典型用法代码示例。如果您正苦于以下问题:Java ProtectionElement类的具体用法?Java ProtectionElement怎么用?Java ProtectionElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProtectionElement类属于gov.nih.nci.security.authorization.domainobjects包,在下文中一共展示了ProtectionElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: xtestCreateProtectionElement
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入依赖的package包/类
private void xtestCreateProtectionElement() throws CSTransactionException
{
for (int x=0; x<NumberOfProtectionElementsToxtest; 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;
}
}
示例2: assignProtectionElementToGroup
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入依赖的package包/类
/**
* @param protectionElement
* @param userProvisioningManager
* @param dynamicGroups
* @param i
* @throws CSException
*/
private void assignProtectionElementToGroup(
ProtectionElement protectionElement, String GroupsName)
{
try {
UserProvisioningManager userProvisioningManager = getUserProvisioningManager();
userProvisioningManager.assignProtectionElement(GroupsName,
protectionElement.getObjectId());
Logger.out.debug("Associated protection group: " + GroupsName
+ " to protectionElement"
+ protectionElement.getProtectionElementName());
}
catch (CSException e) {
Logger.out
.error(
"The Security Service encountered an error while associating protection group: "
+ GroupsName
+ " to protectionElement"
+ protectionElement
.getProtectionElementName());
}
}
示例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;
}
}
示例4: 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());
}
示例5: setUp
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入依赖的package包/类
protected void setUp() {
protectionElement1 = new ProtectionElement();
protectionElement1.setProtectionElementId(new Long(1));
protectionElement1.setProtectionElementName("ProtectionElement1");
protectionElement1copy = new ProtectionElement();
protectionElement1copy.setProtectionElementId(new Long(1));
protectionElement1copy.setProtectionElementName("ProtectionElement1");
protectionElement1copy2 = new ProtectionElement();
protectionElement1copy2.setProtectionElementId(new Long(1));
protectionElement1copy2.setProtectionElementName("ProtectionElement1");
protectionElement2 = new ProtectionElement();
protectionElement2.setProtectionElementId(new Long(2));
protectionElement2.setProtectionElementName("ProtectionElement2");
protectionElement3 = new ProtectionElement();
protectionElement3.setProtectionElementId(new Long(3));
protectionElement3.setProtectionElementName("ProtectionElement3");
}
示例6: retrieveAuthorizedStudyElementsGroupIds
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入依赖的package包/类
@SuppressWarnings(UNCHECKED) // CSM API is untyped
private Set<Long> retrieveAuthorizedStudyElementsGroupIds(Set<ProtectionGroup> protectionGroups)
throws CSException {
Set<Long> authorizedStudyElementsGroupIds = new HashSet<Long>();
for (ProtectionGroup group : protectionGroups) {
Set<ProtectionElement> elements =
getAuthorizationManager().getProtectionElements(String.valueOf(group.getProtectionGroupId()));
for (ProtectionElement element : elements) {
if (AUTHORIZED_STUDY_ELEMENTS_GROUP_OBJECT.equals(element.getObjectId())
&& NumberUtils.isNumber(element.getValue())) {
authorizedStudyElementsGroupIds.add(Long.valueOf(element.getValue()));
}
}
}
return authorizedStudyElementsGroupIds;
}
示例7: 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;
}
}
示例8: testRemoveProtectionElement
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入依赖的package包/类
private void testRemoveProtectionElement() throws CSTransactionException
{
try
{
for (int x = 0; x < NumberOfProtectionElementsToTest; x++)
{
ProtectionElement obj = new ProtectionElement();
obj.setProtectionElementName(ProtectionElementStringArray[x][0]);
SearchCriteria sc = new ProtectionElementSearchCriteria(obj);
List objList = userProvisioningManager.getObjects(sc);
userProvisioningManager.removeProtectionElement(((ProtectionElement) objList.get(0)).getProtectionElementId().toString());
}
assertTrue(true);
}
catch (Exception e)
{
assertTrue(false);
}
}
示例9: testGetProtectionElementById
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入依赖的package包/类
private void testGetProtectionElementById() throws CSObjectNotFoundException
{
try
{
for (int x = 0; x < NumberOfProtectionElementsToTest; x++)
{
ProtectionElement obj = new ProtectionElement();
obj.setProtectionElementName(ProtectionElementStringArray[x][0]);
SearchCriteria sc = new ProtectionElementSearchCriteria(obj);
List appList = userProvisioningManager.getObjects(sc);
ProtectionElement tempProtectionElement = userProvisioningManager.getProtectionElementById(((ProtectionElement) appList.get(0)).getProtectionElementId().toString());
AssertEqualsForProtectionElements(x, tempProtectionElement);
}
assertTrue(true);
}
catch (Exception e)
{
assertTrue(false);
}
}
示例10: 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;
}
示例11: getProjectsForOwner
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<Project> getProjectsForOwner(User user) {
final String q =
"SELECT DISTINCT p FROM " + Project.class.getName() + " p left join fetch p.experiment e where p.id in"
+ "(select pe.value from " + ProtectionElement.class.getName()
+ " pe where pe.objectId = :objectId and pe.attribute = :attribute and "
+ " pe.application = :application and :user in elements(pe.owners)) ";
final Query query = getCurrentSession().createQuery(q);
query.setString("objectId", Project.class.getName());
query.setString("attribute", "id");
query.setEntity("application", SecurityUtils.getApplication());
query.setEntity("user", user);
@SuppressWarnings("unchecked")
final List<Project> projects = query.list();
return projects; // NOPMD
}
示例12: testProtectionGroupModify
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入依赖的package包/类
/**
public void testProtectionGroupModify(){
UserProvisioningManager upm = SecurityServiceProvider.getUserProvisioningManger("Security");
try{
ProtectionGroup pg = upm.getProtectionGroup(new Long("2"));
ProtectionGroup pg1 = upm.getProtectionGroup(new Long("50"));
pg1.setParentProtectionGroup(pg);
upm.modifyProtectionGroup(pg1);
}catch(Exception ex){
ex.printStackTrace();
}
}
*/
public void testProtectionElementCreate(){
//UserProvisioningManager upm = SecurityServiceProvider.getUserProvisioningManger("Security");
try{
/**
for(int i=1;i<100000;i++){
ProtectionElement pe = new ProtectionElement();
pe.setProtectionElementName("PE_Name_"+i);
pe.setObjectId("X_Y_Z_"+i);
pe.setProtectionElementDescription("PE_Desc"+i);
upm.createProtectionElement(pe);
System.out.println("The returned id is"+pe.getProtectionElementId());
}
*/
ProtectionElement pe = new ProtectionElement();
pe.setProtectionElementId(new Long(20));
upm.createProtectionElement(pe);
}catch(Exception ex){
ex.printStackTrace();
System.out.println("Error:"+ex.getMessage());
}
}
示例13: 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);
SearchCriteria searchCriteria = new ProtectionElementSearchCriteria(protectionElement);
List list = userProvisioningManager.getObjects(searchCriteria);
SearchResult searchResult = new SearchResult();
searchResult.setSearchResultMessage(searchCriteria.getMessage());
searchResult.setSearchResultObjects(list);
return searchResult;
}
示例14: getSecurityMapForPublicRole
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入依赖的package包/类
public Set<TableProtectionElement> getSecurityMapForPublicRole()
throws CSObjectNotFoundException {
Set<ProtectionElement> pes = upm.getProtectionElements(publicProtGroupId.toString());
Set<TableProtectionElement> retSet = new HashSet<TableProtectionElement>();
Map<String, TableProtectionElement> tempHastable = new Hashtable<String, TableProtectionElement>();
for (ProtectionElement pElement : pes) {
TableProtectionElement el = new TableProtectionElement(pElement);
el.addRole(readRoleName);
tempHastable.put(pElement.getProtectionElementName(), el);
}
retSet.addAll(tempHastable.values());
return retSet;
}
示例15: testEquality
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入依赖的package包/类
public void testEquality() {
assertTrue(protectionElement1.equals(protectionElement1copy));
assertFalse(protectionElement1.equals(protectionElement2));
assertFalse(protectionElement1.equals(protectionElement3));
ProtectionElement protectionElement1subtype = new ProtectionElement() {
};
protectionElement1subtype.setProtectionElementId(new Long(4));
protectionElement1subtype.setProtectionElementName("ProtectionElement4");
assertFalse(protectionElement1.equals(protectionElement1subtype));
assertReflexivity();
assertSymmetry();
assertTransitivity();
assertConsistency();
assertNullComparison();
}