本文整理汇总了Java中gov.nih.nci.security.authorization.domainobjects.ProtectionElement.setApplication方法的典型用法代码示例。如果您正苦于以下问题:Java ProtectionElement.setApplication方法的具体用法?Java ProtectionElement.setApplication怎么用?Java ProtectionElement.setApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nih.nci.security.authorization.domainobjects.ProtectionElement
的用法示例。
在下文中一共展示了ProtectionElement.setApplication方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: createProtectionElement
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
/**
* @param protectionElement
*
* @throws CSTransactionException
* @see gov.nih.nci.security.AuthorizationManager#createProtectionElement(ProtectionElement)
*/
public void createProtectionElement(ProtectionElement protectionElement)throws CSTransactionException{
if(protectionElement==null){
throw new CSTransactionException("protection element could not be created as it is null");
}
protectionElement.setApplication(authorizationDAO.getApplication());
protectionElement.setUpdateDate(new Date());
authorizationDAO.createObject(protectionElement);
//authorizationDAO.createProtectionElement(protectionElement);
}
示例4: createProtectionElement
import gov.nih.nci.security.authorization.domainobjects.ProtectionElement; //导入方法依赖的package包/类
/**
* @param protectionElement
*
* @throws CSTransactionException
* @see gov.nih.nci.security.AuthorizationManager#createProtectionElement(ProtectionElement)
*/
public void createProtectionElement(ProtectionElement protectionElement)throws CSTransactionException{
if(protectionElement==null){
throw new CSTransactionException("protection element could not be created as it is null");
}
protectionElement.setApplication(authorizationDAO.getApplication());
protectionElement.setUpdateDate(new Date());
authorizationDAO.createObject(protectionElement);
//authorizationDAO.createProtectionElement(protectionElement);
}
示例5: 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)
+ "|");
}
示例6: 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)
+ "|");
}