本文整理匯總了Java中gov.nih.nci.security.dao.hibernate.ProtectionGroupProtectionElement類的典型用法代碼示例。如果您正苦於以下問題:Java ProtectionGroupProtectionElement類的具體用法?Java ProtectionGroupProtectionElement怎麽用?Java ProtectionGroupProtectionElement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ProtectionGroupProtectionElement類屬於gov.nih.nci.security.dao.hibernate包,在下文中一共展示了ProtectionGroupProtectionElement類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: removeProtectionElementsFromProtectionGroup
import gov.nih.nci.security.dao.hibernate.ProtectionGroupProtectionElement; //導入依賴的package包/類
public void removeProtectionElementsFromProtectionGroup(
String protectionGroupId, String[] protectionElementIds)
throws CSTransactionException {
Session s = null;
Transaction t = null;
Set pgpes = new HashSet();
try {
s = HibernateSessionFactoryHelper.getAuditSession(sf);
ProtectionGroup protectionGroup = (ProtectionGroup) this
.getObjectByPrimaryKey(s, ProtectionGroup.class, new Long(
protectionGroupId));
for (int i = 0; i < protectionElementIds.length; i++) {
ProtectionGroupProtectionElement intersection = new ProtectionGroupProtectionElement();
ProtectionElement protectionElement = (ProtectionElement) this
.getObjectByPrimaryKey(s, ProtectionElement.class,
new Long(protectionElementIds[i]));
intersection.setProtectionGroup(protectionGroup);
intersection.setProtectionElement(protectionElement);
intersection.setUpdateDate(new Date());
pgpes.add(intersection);
//this.removeObject(intersection);
}
t = s.beginTransaction();
Iterator iter = pgpes.iterator();
while(iter.hasNext()){
this.removeObject((ProtectionGroupProtectionElement)iter.next());
}
t.commit();
s.flush();
auditLog.info("Deassinging Protection Elements from Protection Group " + protectionGroup.getProtectionGroupName());
} catch (Exception ex) {
log.error(ex);
try {
t.rollback();
} catch (Exception ex3) {
if (log.isDebugEnabled())
log
.debug("Authorization|||removeProtectionElementsFromProtectionGroup|Failure|Error in Rolling Back Transaction|"
+ ex3.getMessage());
}
log
.debug("Authorization|||removeProtectionElementsFromProtectionGroup|Failure|Error Occured in deassigning Protection Elements "
+ StringUtilities
.stringArrayToString(protectionElementIds)
+ " to Protection Group"
+ protectionGroupId
+ "|"
+ ex.getMessage());
throw new CSTransactionException(
"An error occured in deassigning Protection Elements from Protection Group\n"
+ ex.getMessage(), ex);
} finally {
try {
s.close();
} catch (Exception ex2) {
if (log.isDebugEnabled())
log
.debug("Authorization|||removeProtectionElementsFromProtectionGroup|Failure|Error in Closing Session |"
+ ex2.getMessage());
}
}
log
.debug("Authorization|||removeProtectionElementsFromProtectionGroup|Success|Success in deassigning Protection Elements "
+ StringUtilities
.stringArrayToString(protectionElementIds)
+ " to Protection Group" + protectionGroupId + "|");
}
示例2: removeProtectionElementsFromProtectionGroup
import gov.nih.nci.security.dao.hibernate.ProtectionGroupProtectionElement; //導入依賴的package包/類
public void removeProtectionElementsFromProtectionGroup(
String protectionGroupId, String[] protectionElementIds)
throws CSTransactionException {
Session s = null;
Transaction t = null;
try {
s = sf.openSession();
t = s.beginTransaction();
ProtectionGroup protectionGroup = (ProtectionGroup) this
.getObjectByPrimaryKey(s, ProtectionGroup.class, new Long(
protectionGroupId));
for (int i = 0; i < protectionElementIds.length; i++) {
ProtectionGroupProtectionElement intersection = new ProtectionGroupProtectionElement();
List list = s.find("from gov.nih.nci.security.dao.hibernate.ProtectionGroupProtectionElement protectionGroupProtectionElement" +
" where protectionGroupProtectionElement.protectionElement.protectionElementId="+protectionElementIds[i]+
" and protectionGroupProtectionElement.protectionGroup.protectionGroupId="+protectionGroupId);
if(list!=null && list.size()>0)
this.removeObject(list.get(0));
}
t.commit();
} catch (Exception ex) {
log.error(ex);
try {
t.rollback();
} catch (Exception ex3) {
if (log.isDebugEnabled())
log
.debug("Authorization|||removeProtectionElementsFromProtectionGroup|Failure|Error in Rolling Back Transaction|"
+ ex3.getMessage());
}
log
.debug("Authorization|||removeProtectionElementsFromProtectionGroup|Failure|Error Occured in deassigning Protection Elements "
+ StringUtilities
.stringArrayToString(protectionElementIds)
+ " to Protection Group"
+ protectionGroupId
+ "|"
+ ex.getMessage());
throw new CSTransactionException(
"An error occured in deassigning Protection Elements from Protection Group\n"
+ ex.getMessage(), ex);
} finally {
try {
s.close();
} catch (Exception ex2) {
if (log.isDebugEnabled())
log
.debug("Authorization|||removeProtectionElementsFromProtectionGroup|Failure|Error in Closing Session |"
+ ex2.getMessage());
}
}
log
.debug("Authorization|||removeProtectionElementsFromProtectionGroup|Success|Success in deassigning Protection Elements "
+ StringUtilities
.stringArrayToString(protectionElementIds)
+ " to Protection Group" + protectionGroupId + "|");
}