0001: package org.enhydra.shark.partmappersistence;
0002:
0003: import java.util.ArrayList;
0004: import java.util.List;
0005:
0006: import org.enhydra.dods.DODS;
0007: import org.enhydra.shark.api.admin.ParticipantMappingManagerAdmin;
0008: import org.enhydra.shark.api.client.wfmc.wapi.WMSessionHandle;
0009: import org.enhydra.shark.api.internal.partmappersistence.ParticipantMap;
0010: import org.enhydra.shark.api.internal.working.CallbackUtilities;
0011: import org.enhydra.shark.partmappersistence.data.GroupUserDO;
0012: import org.enhydra.shark.partmappersistence.data.GroupUserPackLevelParticipantDO;
0013: import org.enhydra.shark.partmappersistence.data.GroupUserPackLevelParticipantQuery;
0014: import org.enhydra.shark.partmappersistence.data.GroupUserProcLevelParticipantDO;
0015: import org.enhydra.shark.partmappersistence.data.GroupUserProcLevelParticipantQuery;
0016: import org.enhydra.shark.partmappersistence.data.GroupUserQuery;
0017: import org.enhydra.shark.partmappersistence.data.NormalUserDO;
0018: import org.enhydra.shark.partmappersistence.data.NormalUserQuery;
0019: import org.enhydra.shark.partmappersistence.data.PackLevelParticipantDO;
0020: import org.enhydra.shark.partmappersistence.data.PackLevelParticipantQuery;
0021: import org.enhydra.shark.partmappersistence.data.ProcLevelParticipantDO;
0022: import org.enhydra.shark.partmappersistence.data.ProcLevelParticipantQuery;
0023: import org.enhydra.shark.partmappersistence.data.UserPackLevelParticipantDO;
0024: import org.enhydra.shark.partmappersistence.data.UserPackLevelParticipantQuery;
0025: import org.enhydra.shark.partmappersistence.data.UserProcLevelParticipantDO;
0026: import org.enhydra.shark.partmappersistence.data.UserProcLevelParticipantQuery;
0027: import org.enhydra.shark.partmappersistence.data.XPDLParticipantPackageDO;
0028: import org.enhydra.shark.partmappersistence.data.XPDLParticipantPackageQuery;
0029: import org.enhydra.shark.partmappersistence.data.XPDLParticipantProcessDO;
0030: import org.enhydra.shark.partmappersistence.data.XPDLParticipantProcessQuery;
0031: import org.enhydra.shark.utilities.dods.DODSUtilities;
0032:
0033: import com.lutris.appserver.server.sql.DBTransaction;
0034: import com.lutris.appserver.server.sql.DatabaseManagerException;
0035: import com.lutris.appserver.server.sql.LogicalDatabase;
0036:
0037: /**
0038: * Implementation of ParticipantMappingsManager interface
0039: *
0040: * @author Zoran Milakovic
0041: */
0042: public class DODSParticipantMappingAdmin implements
0043: ParticipantMappingManagerAdmin {
0044:
0045: // TODO zoran Ako je processId == "" tretirati ga kao null.
0046:
0047: public static final String LDB_PARAM_NAME = "DODSParticipantMappingAdmin.DatabaseName";
0048:
0049: protected static LogicalDatabase db;
0050:
0051: public void configure(CallbackUtilities cus) throws Exception {
0052: if (null == cus) {
0053: throw new Exception(
0054: "Cannot configure without call back impl.");
0055: }
0056: DODSUtilities.init(cus.getProperties());
0057: String dbName = cus.getProperty(LDB_PARAM_NAME, DODS
0058: .getDatabaseManager().getDefaultDB());
0059: try {
0060: db = DODS.getDatabaseManager().findLogicalDatabase(dbName);
0061:
0062: } catch (Exception e) {
0063: cus.error(null, "Couldn't find logical database " + dbName,
0064: e);
0065: throw e;
0066: }
0067: setLDBName();
0068: }
0069:
0070: /**
0071: * Save new ParticipantMap to database.
0072: *
0073: * @param pm ParticipantMap to save
0074: * @return boolean true if everything is ok, false otherwise
0075: * @exception Exception Exception will be thrown if error occur.
0076: */
0077: public boolean saveParticipantMapping(ParticipantMap pm)
0078: throws Exception {
0079: boolean retVal = true;
0080: if (!checkValidity(pm)) {
0081: throw new Exception("Participant mapping [ " + pm
0082: + " ] is not valid");
0083: }
0084: if (doesParticipantMappingExist(pm)) {
0085: throw new Exception("Participant mapping already exists");
0086: }
0087:
0088: DBTransaction dbt = getDBTransaction();
0089:
0090: // if group user
0091: if (pm.getIsGroupUser()) {
0092: // FIXME
0093: // GroupUserProcLevelParticipantDO mappDO =
0094: // GroupUserProcLevelParticipantDO.createVirgin();
0095: GroupUserDO groupDO = this .checkGroups(pm);
0096: // process level participant
0097: if (pm.getProcessDefinitionId() != null) {
0098: ProcLevelParticipantDO procLevPartDO = this
0099: .checkProcLevelParticipant(pm);
0100: GroupUserProcLevelParticipantDO gplPart = GroupUserProcLevelParticipantDO
0101: .createVirgin(dbt);
0102: gplPart.setPARTICIPANTOID(procLevPartDO);
0103: gplPart.setUSEROID(groupDO);
0104: gplPart.save();
0105: }
0106: // package level participant
0107: else {
0108: PackLevelParticipantDO pckgLevPartDO = this
0109: .checkPackLevelParticipant(pm);
0110: GroupUserPackLevelParticipantDO gplPart = GroupUserPackLevelParticipantDO
0111: .createVirgin(dbt);
0112: gplPart.setPARTICIPANTOID(pckgLevPartDO);
0113: gplPart.setUSEROID(groupDO);
0114: gplPart.save();
0115: }
0116:
0117: }
0118: // if single user
0119: else {
0120: // FIXME
0121: // UserProcLevelParticipantDO mappDO =
0122: // UserProcLevelParticipantDO.createVirgin(dbt);
0123: NormalUserDO userDO = this .checkUsers(pm);
0124: if (pm.getProcessDefinitionId() != null) {
0125: ProcLevelParticipantDO procLevPartDO = this
0126: .checkProcLevelParticipant(pm);
0127: UserProcLevelParticipantDO uplPart = UserProcLevelParticipantDO
0128: .createVirgin(dbt);
0129: uplPart.setPARTICIPANTOID(procLevPartDO);
0130: uplPart.setUSEROID(userDO);
0131: uplPart.save();
0132: } else {
0133: PackLevelParticipantDO pckgLevPartDO = this
0134: .checkPackLevelParticipant(pm);
0135: UserPackLevelParticipantDO uplPart = UserPackLevelParticipantDO
0136: .createVirgin(dbt);
0137: uplPart.setPARTICIPANTOID(pckgLevPartDO);
0138: uplPart.setUSEROID(userDO);
0139: uplPart.save();
0140: }
0141: }
0142:
0143: return retVal;
0144: }
0145:
0146: /**
0147: * Delete specified ParticipantMap from database.
0148: *
0149: * @param pm ParticipantMap to delete
0150: * @return boolean true if everything is ok, false otherwise
0151: * @exception Exception Exception will be thrown if error occur.
0152: */
0153: public boolean deleteParticipantMapping(ParticipantMap pm)
0154: throws Exception {
0155: boolean retVal = true;
0156: if (!checkValidity(pm)) {
0157: throw new Exception("Participant mapping [ " + pm
0158: + " ] is not valid");
0159: }
0160:
0161: String processId = pm.getProcessDefinitionId();
0162: boolean isGroup = pm.getIsGroupUser();
0163: // process level part.
0164: if (processId != null) {
0165: // group user
0166: if (isGroup) {
0167: this .deleteGroupProcLevelPart(pm);
0168: }
0169: // single user
0170: else {
0171: this .deleteNormalProcLevelPart(pm);
0172: }
0173: }
0174: // package level part.
0175: else {
0176: // group user
0177: if (isGroup) {
0178: this .deleteGroupPackLevelPart(pm);
0179: }
0180: // single user
0181: else {
0182: this .deleteNormalPackLevelPart(pm);
0183: }
0184: }
0185:
0186: return retVal;
0187:
0188: }
0189:
0190: /**
0191: * Check if specified participant map exist in database.
0192: *
0193: * @param pm ParticipantMap to delete
0194: * @return boolean true if everything is ok, false otherwise
0195: * @exception Exception Exception will be thrown if error occur.
0196: */
0197: public boolean doesParticipantMappingExist(ParticipantMap pm)
0198: throws Exception {
0199: boolean isExist = false;
0200: if (!checkValidity(pm)) {
0201: throw new Exception("Participant mapping [ " + pm
0202: + " ] is not valid");
0203: }
0204:
0205: DBTransaction dbt = getDBTransaction();
0206:
0207: // if group user
0208: if (pm.getIsGroupUser()) {
0209: // FIXME
0210: // GroupUserProcLevelParticipantDO mappDO =
0211: // GroupUserProcLevelParticipantDO.createVirgin(dbt);
0212: GroupUserDO groupDO = this .checkGroups(pm);
0213: // process level participant
0214: if (pm.getProcessDefinitionId() != null) {
0215: ProcLevelParticipantDO procLevPartDO = this
0216: .checkProcLevelParticipant(pm);
0217: GroupUserProcLevelParticipantQuery gplPartQuery = new GroupUserProcLevelParticipantQuery(
0218: dbt);
0219: gplPartQuery.setQueryPARTICIPANTOID(procLevPartDO);
0220: gplPartQuery.setQueryUSEROID(groupDO);
0221: if (gplPartQuery.getNextDO() != null) {
0222: isExist = true;
0223: }
0224: }
0225: // package level participant
0226: else {
0227: PackLevelParticipantDO pckgLevPartDO = this
0228: .checkPackLevelParticipant(pm);
0229: GroupUserPackLevelParticipantQuery gplPartQuery = new GroupUserPackLevelParticipantQuery(
0230: dbt);
0231: gplPartQuery.setQueryPARTICIPANTOID(pckgLevPartDO);
0232: gplPartQuery.setQueryUSEROID(groupDO);
0233: if (gplPartQuery.getNextDO() != null) {
0234: isExist = true;
0235: }
0236: }
0237: }
0238: // if single user
0239: else {
0240: // FIXME
0241: // UserProcLevelParticipantDO mappDO =
0242: // UserProcLevelParticipantDO.createVirgin(dbt);
0243: NormalUserDO userDO = this .checkUsers(pm);
0244: if (pm.getProcessDefinitionId() != null) {
0245: ProcLevelParticipantDO procLevPartDO = this
0246: .checkProcLevelParticipant(pm);
0247: UserProcLevelParticipantQuery uplPartQuery = new UserProcLevelParticipantQuery(
0248: dbt);
0249: uplPartQuery.setQueryPARTICIPANTOID(procLevPartDO);
0250: uplPartQuery.setQueryUSEROID(userDO);
0251: if (uplPartQuery.getNextDO() != null) {
0252: isExist = true;
0253: }
0254: } else {
0255: PackLevelParticipantDO pckgLevPartDO = this
0256: .checkPackLevelParticipant(pm);
0257: UserPackLevelParticipantQuery uplPartQuery = new UserPackLevelParticipantQuery(
0258: dbt);
0259: uplPartQuery.setQueryPARTICIPANTOID(pckgLevPartDO);
0260: uplPartQuery.setQueryUSEROID(userDO);
0261: if (uplPartQuery.getNextDO() != null) {
0262: isExist = true;
0263: }
0264: }
0265: }
0266:
0267: return isExist;
0268: }
0269:
0270: /**
0271: * Gets all ParticipantMappings from database.
0272: *
0273: * @return List List with participant mappings.
0274: * @exception Exception Exception will be thrown if error occur.
0275: */
0276: public ParticipantMap[] getAllParticipantMappings()
0277: throws Exception {
0278: List list = new ArrayList();
0279:
0280: DBTransaction dbt = getDBTransaction();
0281:
0282: // group users, package level
0283: GroupUserPackLevelParticipantQuery gplQuery = new GroupUserPackLevelParticipantQuery(
0284: dbt);
0285: GroupUserPackLevelParticipantDO[] gplDOArray = gplQuery
0286: .getDOArray();
0287: for (int i = 0; i < gplDOArray.length; i++) {
0288: ParticipantMap pm = this .createParticipantMap();
0289: pm.setParticipantId(gplDOArray[i].getPARTICIPANTOID()
0290: .getPARTICIPANT_ID());
0291: pm.setPackageId(gplDOArray[i].getPARTICIPANTOID()
0292: .getPACKAGEOID().getPACKAGE_ID());
0293: pm.setUsername(gplDOArray[i].getUSEROID().getUSERNAME());
0294: pm.setProcessDefinitionId(null);
0295: pm.setIsGroupUser(true);
0296: list.add(pm);
0297: }
0298: // group users, process level
0299: GroupUserProcLevelParticipantQuery gprlQuery = new GroupUserProcLevelParticipantQuery(
0300: dbt);
0301: GroupUserProcLevelParticipantDO[] gprlDOArray = gprlQuery
0302: .getDOArray();
0303: for (int i = 0; i < gprlDOArray.length; i++) {
0304: ParticipantMap pm = this .createParticipantMap();
0305: pm.setParticipantId(gprlDOArray[i].getPARTICIPANTOID()
0306: .getPARTICIPANT_ID());
0307: pm.setPackageId(gprlDOArray[i].getPARTICIPANTOID()
0308: .getPROCESSOID().getPACKAGEOID().getPACKAGE_ID());
0309: pm.setUsername(gprlDOArray[i].getUSEROID().getUSERNAME());
0310: pm.setProcessDefinitionId(gprlDOArray[i]
0311: .getPARTICIPANTOID().getPROCESSOID()
0312: .getPROCESS_ID());
0313: pm.setIsGroupUser(true);
0314: list.add(pm);
0315: }
0316: // single users, package level
0317: UserPackLevelParticipantQuery uplQuery = new UserPackLevelParticipantQuery(
0318: dbt);
0319: UserPackLevelParticipantDO[] uplDOArray = uplQuery.getDOArray();
0320: for (int i = 0; i < uplDOArray.length; i++) {
0321: ParticipantMap pm = this .createParticipantMap();
0322: pm.setParticipantId(uplDOArray[i].getPARTICIPANTOID()
0323: .getPARTICIPANT_ID());
0324: pm.setPackageId(uplDOArray[i].getPARTICIPANTOID()
0325: .getPACKAGEOID().getPACKAGE_ID());
0326: pm.setUsername(uplDOArray[i].getUSEROID().getUSERNAME());
0327: pm.setProcessDefinitionId(null);
0328: pm.setIsGroupUser(false);
0329: list.add(pm);
0330: }
0331: // single users, process level
0332: UserProcLevelParticipantQuery uprlQuery = new UserProcLevelParticipantQuery(
0333: dbt);
0334: UserProcLevelParticipantDO[] uprlDOArray = uprlQuery
0335: .getDOArray();
0336: for (int i = 0; i < uprlDOArray.length; i++) {
0337: ParticipantMap pm = this .createParticipantMap();
0338: pm.setParticipantId(uprlDOArray[i].getPARTICIPANTOID()
0339: .getPARTICIPANT_ID());
0340: pm.setPackageId(uprlDOArray[i].getPARTICIPANTOID()
0341: .getPROCESSOID().getPACKAGEOID().getPACKAGE_ID());
0342: pm.setUsername(uprlDOArray[i].getUSEROID().getUSERNAME());
0343: pm.setProcessDefinitionId(uprlDOArray[i]
0344: .getPARTICIPANTOID().getPROCESSOID()
0345: .getPROCESS_ID());
0346: pm.setIsGroupUser(false);
0347: list.add(pm);
0348: }
0349: // return list with all participant mappings
0350: ParticipantMap[] pms = new ParticipantMap[list.size()];
0351: list.toArray(pms);
0352: return pms;
0353: }
0354:
0355: /**
0356: * Method createParticipantMap create new ParticipantMap object.
0357: *
0358: * @return a ParticipantMap
0359: */
0360: public ParticipantMap createParticipantMap() {
0361: return new ParticipantMap();
0362: }
0363:
0364: /**
0365: * Gets all participant mappings for specified parameters.
0366: */
0367: public ParticipantMap[] getParticipantMappings(
0368: WMSessionHandle shandle, String packageId,
0369: String packageVer, String processDefinitionId,
0370: String participantId) throws Exception {
0371: List list = new ArrayList();
0372:
0373: DBTransaction dbt = getDBTransaction();
0374:
0375: // empty string is same as null
0376: if (processDefinitionId != null
0377: && processDefinitionId.trim().equals(""))
0378: processDefinitionId = null;
0379:
0380: if (processDefinitionId == null) {
0381: // group users, package level
0382: XPDLParticipantPackageQuery pQuery = new XPDLParticipantPackageQuery(
0383: dbt);
0384: pQuery.setQueryPACKAGE_ID(packageId);
0385: pQuery.requireUniqueInstance();
0386: XPDLParticipantPackageDO pDO = pQuery.getNextDO();
0387:
0388: PackLevelParticipantQuery plpQuery = new PackLevelParticipantQuery(
0389: dbt);
0390: plpQuery.setQueryPARTICIPANT_ID(participantId);
0391: plpQuery.setQueryPACKAGEOID(pDO);
0392: plpQuery.requireUniqueInstance();
0393: PackLevelParticipantDO plpDO = plpQuery.getNextDO();
0394:
0395: GroupUserPackLevelParticipantQuery gplQuery = new GroupUserPackLevelParticipantQuery(
0396: dbt);
0397: gplQuery.setQueryPARTICIPANTOID(plpDO);
0398: GroupUserPackLevelParticipantDO[] gplDOArray = gplQuery
0399: .getDOArray();
0400:
0401: for (int i = 0; i < gplDOArray.length; i++) {
0402: ParticipantMap pm = this .createParticipantMap();
0403: pm.setParticipantId(gplDOArray[i].getPARTICIPANTOID()
0404: .getPARTICIPANT_ID());
0405: pm.setPackageId(gplDOArray[i].getPARTICIPANTOID()
0406: .getPACKAGEOID().getPACKAGE_ID());
0407: pm
0408: .setUsername(gplDOArray[i].getUSEROID()
0409: .getUSERNAME());
0410: pm.setProcessDefinitionId(null);
0411: pm.setIsGroupUser(true);
0412: list.add(pm);
0413: }
0414: // single users, package level
0415: UserPackLevelParticipantQuery uplQuery = new UserPackLevelParticipantQuery(
0416: dbt);
0417: uplQuery.setQueryPARTICIPANTOID(plpDO);
0418: UserPackLevelParticipantDO[] uplDOArray = uplQuery
0419: .getDOArray();
0420:
0421: for (int i = 0; i < uplDOArray.length; i++) {
0422: ParticipantMap pm = this .createParticipantMap();
0423: pm.setParticipantId(uplDOArray[i].getPARTICIPANTOID()
0424: .getPARTICIPANT_ID());
0425: pm.setPackageId(uplDOArray[i].getPARTICIPANTOID()
0426: .getPACKAGEOID().getPACKAGE_ID());
0427: pm
0428: .setUsername(uplDOArray[i].getUSEROID()
0429: .getUSERNAME());
0430: pm.setProcessDefinitionId(null);
0431: pm.setIsGroupUser(false);
0432: list.add(pm);
0433: }
0434: } else {
0435: // group users, process level
0436: XPDLParticipantProcessQuery pQuery = new XPDLParticipantProcessQuery(
0437: dbt);
0438: pQuery.setQueryPROCESS_ID(processDefinitionId);
0439: pQuery.requireUniqueInstance();
0440: XPDLParticipantProcessDO pDO = pQuery.getNextDO();
0441:
0442: ProcLevelParticipantQuery plpQuery = new ProcLevelParticipantQuery(
0443: dbt);
0444: plpQuery.setQueryPARTICIPANT_ID(participantId);
0445: plpQuery.setQueryPROCESSOID(pDO);
0446: plpQuery.requireUniqueInstance();
0447: ProcLevelParticipantDO plpDO = plpQuery.getNextDO();
0448:
0449: GroupUserProcLevelParticipantQuery gprlQuery = new GroupUserProcLevelParticipantQuery(
0450: dbt);
0451: gprlQuery.setQueryPARTICIPANTOID(plpDO);
0452: GroupUserProcLevelParticipantDO[] gprlDOArray = gprlQuery
0453: .getDOArray();
0454:
0455: for (int i = 0; i < gprlDOArray.length; i++) {
0456: ParticipantMap pm = this .createParticipantMap();
0457: pm.setParticipantId(gprlDOArray[i].getPARTICIPANTOID()
0458: .getPARTICIPANT_ID());
0459: pm.setPackageId(gprlDOArray[i].getPARTICIPANTOID()
0460: .getPROCESSOID().getPACKAGEOID()
0461: .getPACKAGE_ID());
0462: pm.setUsername(gprlDOArray[i].getUSEROID()
0463: .getUSERNAME());
0464: pm.setProcessDefinitionId(gprlDOArray[i]
0465: .getPARTICIPANTOID().getPROCESSOID()
0466: .getPROCESS_ID());
0467: pm.setIsGroupUser(true);
0468: list.add(pm);
0469: }
0470: // single users, process level
0471: UserProcLevelParticipantQuery uprlQuery = new UserProcLevelParticipantQuery(
0472: dbt);
0473: uprlQuery.setQueryPARTICIPANTOID(plpDO);
0474: UserProcLevelParticipantDO[] uprlDOArray = uprlQuery
0475: .getDOArray();
0476: for (int i = 0; i < uprlDOArray.length; i++) {
0477: ParticipantMap pm = this .createParticipantMap();
0478: pm.setParticipantId(uprlDOArray[i].getPARTICIPANTOID()
0479: .getPARTICIPANT_ID());
0480: pm.setPackageId(uprlDOArray[i].getPARTICIPANTOID()
0481: .getPROCESSOID().getPACKAGEOID()
0482: .getPACKAGE_ID());
0483: pm.setUsername(uprlDOArray[i].getUSEROID()
0484: .getUSERNAME());
0485: pm.setProcessDefinitionId(uprlDOArray[i]
0486: .getPARTICIPANTOID().getPROCESSOID()
0487: .getPROCESS_ID());
0488: pm.setIsGroupUser(false);
0489: list.add(pm);
0490: }
0491: }
0492: // return list with all participant mappings
0493: ParticipantMap[] pms = new ParticipantMap[list.size()];
0494: list.toArray(pms);
0495: return pms;
0496: }
0497:
0498: /**
0499: * Method deleteParticipantMappings delete participant mappings for specified
0500: * parameters.
0501: *
0502: * @param packageId Package id
0503: * @param processDefinitionId Process id
0504: * @param participantId Participant id
0505: * @return boolean true if OK, false otherwise
0506: * @exception Exception Exception will be thrown if error occur.
0507: */
0508: public boolean deleteParticipantMappings(String packageId,
0509: String packageVersion, String processDefinitionId,
0510: String participantId) throws Exception {
0511: boolean retVal = true;
0512:
0513: DBTransaction dbt = getDBTransaction();
0514:
0515: // empty string is same as null
0516: if (processDefinitionId != null
0517: && processDefinitionId.trim().equals(""))
0518: processDefinitionId = null;
0519: ParticipantMap pm = this .createParticipantMap();
0520:
0521: pm.setPackageId(packageId);
0522: pm.setProcessDefinitionId(processDefinitionId);
0523: pm.setParticipantId(participantId);
0524: // normal users
0525: NormalUserQuery nuQuery = new NormalUserQuery(dbt);
0526: NormalUserDO[] nuDOArr = nuQuery.getDOArray();
0527: for (int i = 0; i < nuDOArr.length; i++) {
0528: pm.setIsGroupUser(false);
0529: pm.setUsername(nuDOArr[i].getUSERNAME());
0530: if (processDefinitionId != null) {
0531: this .deleteNormalProcLevelPart(pm);
0532: } else {
0533: this .deleteNormalPackLevelPart(pm);
0534: }
0535: }
0536: // group users
0537: GroupUserQuery guQuery = new GroupUserQuery(dbt);
0538: GroupUserDO[] guDOArr = guQuery.getDOArray();
0539: for (int i = 0; i < guDOArr.length; i++) {
0540: pm.setIsGroupUser(true);
0541: pm.setUsername(guDOArr[i].getUSERNAME());
0542: if (processDefinitionId != null) {
0543: this .deleteGroupProcLevelPart(pm);
0544: } else {
0545: this .deleteGroupPackLevelPart(pm);
0546: }
0547: }
0548:
0549: return retVal;
0550: }
0551:
0552: /**
0553: * Method deleteParticipantMappings delete participant mappings for specified
0554: * parameters.
0555: *
0556: * @param userOrGroupName user or a group name
0557: * @return boolean true if everything is OK, false otherwise
0558: * @exception Exception Exception will be thrown if error occur.
0559: */
0560: public boolean deleteParticipantMappingsForUserOrGroup(
0561: String userOrGroupName) throws Exception {
0562: boolean retVal = true;
0563:
0564: DBTransaction dbt = getDBTransaction();
0565:
0566: NormalUserQuery userQuery = new NormalUserQuery(dbt);
0567: userQuery.setQueryUSERNAME(userOrGroupName);
0568: userQuery.requireUniqueInstance();
0569: NormalUserDO userDO = userQuery.getNextDO();
0570:
0571: // process level part.
0572: UserProcLevelParticipantQuery uplpQuery = new UserProcLevelParticipantQuery(
0573: dbt);
0574: uplpQuery.setQueryUSEROID(userDO);
0575: UserProcLevelParticipantDO[] uplpDOArray = uplpQuery
0576: .getDOArray();
0577: for (int i = 0; i < uplpDOArray.length; i++) {
0578: XPDLParticipantProcessDO procDO = uplpDOArray[i]
0579: .getPARTICIPANTOID().getPROCESSOID();
0580: uplpDOArray[i].delete();
0581:
0582: this .deleteProcLevParticipant(uplpDOArray[i]
0583: .getPARTICIPANTOID());
0584:
0585: // process
0586: this .deleteProcess(procDO);
0587: XPDLParticipantPackageDO pckDO = procDO.getPACKAGEOID();
0588: this .deletePackage(pckDO);
0589: }
0590:
0591: // package level part.
0592: UserPackLevelParticipantQuery upclpQuery = new UserPackLevelParticipantQuery(
0593: dbt);
0594: upclpQuery.setQueryUSEROID(userDO);
0595: UserPackLevelParticipantDO[] upclpDOArray = upclpQuery
0596: .getDOArray();
0597: for (int i = 0; i < upclpDOArray.length; i++) {
0598: upclpDOArray[i].delete();
0599:
0600: this .deletePackLevParticipant(upclpDOArray[i]
0601: .getPARTICIPANTOID());
0602: XPDLParticipantPackageDO pckDO = upclpDOArray[i]
0603: .getPARTICIPANTOID().getPACKAGEOID();
0604: this .deletePackage(pckDO);
0605: }
0606: if (userDO != null)
0607: this .deleteNormalUser(userDO);
0608: // group user
0609: GroupUserQuery groupQuery = new GroupUserQuery(dbt);
0610: groupQuery.requireUniqueInstance();
0611: groupQuery.setQueryUSERNAME(userOrGroupName);
0612: GroupUserDO groupDO = groupQuery.getNextDO();
0613:
0614: // process level part.
0615: GroupUserProcLevelParticipantQuery gplpQuery = new GroupUserProcLevelParticipantQuery(
0616: dbt);
0617: gplpQuery.setQueryUSEROID(groupDO);
0618: GroupUserProcLevelParticipantDO[] gplpDOArray = gplpQuery
0619: .getDOArray();
0620: for (int i = 0; i < gplpDOArray.length; i++) {
0621: XPDLParticipantProcessDO procDO = gplpDOArray[i]
0622: .getPARTICIPANTOID().getPROCESSOID();
0623: gplpDOArray[i].delete();
0624:
0625: this .deleteProcLevParticipant(gplpDOArray[i]
0626: .getPARTICIPANTOID());
0627:
0628: // process
0629: this .deleteProcess(procDO);
0630: XPDLParticipantPackageDO pckDO = procDO.getPACKAGEOID();
0631: this .deletePackage(pckDO);
0632: }
0633:
0634: // package level part.
0635: GroupUserPackLevelParticipantQuery gpclpQuery = new GroupUserPackLevelParticipantQuery(
0636: dbt);
0637: gpclpQuery.setQueryUSEROID(groupDO);
0638: GroupUserPackLevelParticipantDO[] gpclpDOArray = gpclpQuery
0639: .getDOArray();
0640: for (int i = 0; i < gpclpDOArray.length; i++) {
0641: gpclpDOArray[i].delete();
0642:
0643: this .deletePackLevParticipant(gpclpDOArray[i]
0644: .getPARTICIPANTOID());
0645: XPDLParticipantPackageDO pckDO = gpclpDOArray[i]
0646: .getPARTICIPANTOID().getPACKAGEOID();
0647: this .deletePackage(pckDO);
0648: }
0649: if (groupDO != null)
0650: this .deleteGroupUser(groupDO);
0651:
0652: return retVal;
0653: }
0654:
0655: public boolean checkValidity(ParticipantMap pm) {
0656: if (pm == null || pm.getPackageId() == null
0657: || pm.getPackageId().trim().equals("")
0658: || pm.getParticipantId() == null
0659: || pm.getParticipantId().trim().equals("")
0660: || pm.getUsername() == null
0661: || pm.getUsername().trim().equals("")) {
0662: return false;
0663: }
0664:
0665: return true;
0666: }
0667:
0668: private XPDLParticipantPackageDO checkPackage(ParticipantMap pm)
0669: throws Exception {
0670: DBTransaction dbt = getDBTransaction();
0671:
0672: // package
0673: XPDLParticipantPackageQuery pckgQuery = new XPDLParticipantPackageQuery(
0674: dbt);
0675: XPDLParticipantPackageDO pckgDO = null;
0676:
0677: pckgQuery.setQueryPACKAGE_ID(pm.getPackageId());
0678: pckgQuery.requireUniqueInstance();
0679: pckgDO = pckgQuery.getNextDO();
0680: if (pckgDO == null) {
0681: // insert new package
0682: pckgDO = XPDLParticipantPackageDO.createVirgin(dbt);
0683: pckgDO.setPACKAGE_ID(pm.getPackageId());
0684: pckgDO.save();
0685:
0686: }
0687: return pckgDO;
0688: }
0689:
0690: private XPDLParticipantProcessDO checkProcess(ParticipantMap pm)
0691: throws Exception {
0692: DBTransaction dbt = getDBTransaction();
0693:
0694: // process and package
0695: XPDLParticipantProcessQuery procQuery = new XPDLParticipantProcessQuery(
0696: dbt);
0697: XPDLParticipantProcessDO processDO = null;
0698: XPDLParticipantPackageQuery pckgQuery = new XPDLParticipantPackageQuery(
0699: dbt);
0700: XPDLParticipantPackageDO pckgDO = null;
0701:
0702: String processID = pm.getProcessDefinitionId();
0703: // FIXME
0704: // String packageID = pm.getPackageId();
0705: if (processID != null) {
0706: pckgQuery.setQueryPACKAGE_ID(pm.getPackageId());
0707: pckgQuery.requireUniqueInstance();
0708: pckgDO = pckgQuery.getNextDO();
0709: if (pckgDO == null) {
0710: // insert new package
0711: pckgDO = XPDLParticipantPackageDO.createVirgin(dbt);
0712: pckgDO.setPACKAGE_ID(pm.getPackageId());
0713: pckgDO.save();
0714: }
0715:
0716: procQuery.setQueryPROCESS_ID(processID);
0717: procQuery.setQueryPACKAGEOID(pckgDO);
0718: procQuery.requireUniqueInstance();
0719: processDO = procQuery.getNextDO();
0720: if (processDO == null) {
0721: // insert new process
0722: processDO = XPDLParticipantProcessDO.createVirgin(dbt);
0723: processDO.setPROCESS_ID(pm.getProcessDefinitionId());
0724:
0725: processDO.setPACKAGEOID(pckgDO);
0726: processDO.save();
0727:
0728: }
0729: }
0730: return processDO;
0731: }
0732:
0733: private ProcLevelParticipantDO checkProcLevelParticipant(
0734: ParticipantMap pm) throws Exception {
0735: DBTransaction dbt = getDBTransaction();
0736:
0737: // participants
0738: ProcLevelParticipantQuery procLevPartQuery = new ProcLevelParticipantQuery(
0739: dbt);
0740: ProcLevelParticipantDO procLevPartDO = null;
0741: XPDLParticipantProcessDO procDO = this .checkProcess(pm);
0742:
0743: procLevPartQuery.setQueryPARTICIPANT_ID(pm.getParticipantId());
0744: procLevPartQuery.setQueryPROCESSOID(procDO);
0745: procLevPartQuery.requireUniqueInstance();
0746: procLevPartDO = procLevPartQuery.getNextDO();
0747: if (procLevPartDO == null) {
0748: procLevPartDO = ProcLevelParticipantDO.createVirgin(dbt);
0749: procLevPartDO.setPARTICIPANT_ID(pm.getParticipantId());
0750: procLevPartDO.setPROCESSOID(procDO);
0751: procLevPartDO.save();
0752:
0753: }
0754: return procLevPartDO;
0755: }
0756:
0757: private PackLevelParticipantDO checkPackLevelParticipant(
0758: ParticipantMap pm) throws Exception {
0759: DBTransaction dbt = getDBTransaction();
0760:
0761: // participants
0762: PackLevelParticipantQuery packLevPartQuery = new PackLevelParticipantQuery(
0763: dbt);
0764: PackLevelParticipantDO packLevPartDO = null;
0765: XPDLParticipantPackageDO packDO = this .checkPackage(pm);
0766:
0767: packLevPartQuery.setQueryPARTICIPANT_ID(pm.getParticipantId());
0768: packLevPartQuery.setQueryPACKAGEOID(packDO);
0769: packLevPartQuery.requireUniqueInstance();
0770: packLevPartDO = packLevPartQuery.getNextDO();
0771: if (packLevPartDO == null) {
0772: packLevPartDO = PackLevelParticipantDO.createVirgin(dbt);
0773: packLevPartDO.setPARTICIPANT_ID(pm.getParticipantId());
0774: packLevPartDO.setPACKAGEOID(packDO);
0775: packLevPartDO.save();
0776:
0777: }
0778: return packLevPartDO;
0779: }
0780:
0781: private NormalUserDO checkUsers(ParticipantMap pm) throws Exception {
0782: DBTransaction dbt = getDBTransaction();
0783:
0784: // participants
0785: NormalUserQuery userQuery = new NormalUserQuery(dbt);
0786: NormalUserDO userDO = null;
0787:
0788: userQuery.setQueryUSERNAME(pm.getUsername());
0789: userQuery.requireUniqueInstance();
0790: userDO = userQuery.getNextDO();
0791: if (userDO == null) {
0792: userDO = NormalUserDO.createVirgin(dbt);
0793: userDO.setUSERNAME(pm.getUsername());
0794: userDO.save();
0795:
0796: }
0797: return userDO;
0798: }
0799:
0800: private GroupUserDO checkGroups(ParticipantMap pm) throws Exception {
0801: DBTransaction dbt = getDBTransaction();
0802:
0803: GroupUserQuery groupQuery = new GroupUserQuery(dbt);
0804: GroupUserDO groupDO = null;
0805:
0806: groupQuery.setQueryUSERNAME(pm.getUsername());
0807: groupQuery.requireUniqueInstance();
0808: groupDO = groupQuery.getNextDO();
0809: if (groupDO == null) {
0810: groupDO = GroupUserDO.createVirgin(dbt);
0811: groupDO.setUSERNAME(pm.getUsername());
0812: groupDO.save();
0813:
0814: }
0815: return groupDO;
0816: }
0817:
0818: private void deleteProcLevParticipant(ProcLevelParticipantDO plpDO)
0819: throws Exception {
0820: DBTransaction dbt = getDBTransaction();
0821:
0822: // proc level participant
0823: if (plpDO == null)
0824: return;
0825: GroupUserProcLevelParticipantQuery gulQuery = new GroupUserProcLevelParticipantQuery(
0826: dbt);
0827: gulQuery.setQueryPARTICIPANTOID(plpDO);
0828:
0829: UserProcLevelParticipantQuery ulQuery = new UserProcLevelParticipantQuery(
0830: dbt);
0831: ulQuery.setQueryPARTICIPANTOID(plpDO);
0832:
0833: if (gulQuery.getDOArray().length == 0
0834: && ulQuery.getDOArray().length == 0)
0835: plpDO.delete();
0836: }
0837:
0838: private void deletePackLevParticipant(PackLevelParticipantDO plpDO)
0839: throws Exception {
0840: // pack level participant
0841: if (plpDO == null)
0842: return;
0843:
0844: DBTransaction dbt = getDBTransaction();
0845:
0846: GroupUserPackLevelParticipantQuery gulQuery = new GroupUserPackLevelParticipantQuery(
0847: dbt);
0848: gulQuery.setQueryPARTICIPANTOID(plpDO);
0849: UserPackLevelParticipantQuery ulQuery = new UserPackLevelParticipantQuery(
0850: dbt);
0851: ulQuery.setQueryPARTICIPANTOID(plpDO);
0852: UserPackLevelParticipantDO[] ulDOArr = ulQuery.getDOArray();
0853: if (gulQuery.getDOArray().length == 0 && ulDOArr.length == 0)
0854: plpDO.delete();
0855: }
0856:
0857: private void deleteNormalUser(NormalUserDO userDO) throws Exception {
0858: if (userDO == null)
0859: return;
0860:
0861: DBTransaction dbt = getDBTransaction();
0862:
0863: UserProcLevelParticipantQuery uprlQuery = new UserProcLevelParticipantQuery(
0864: dbt);
0865: uprlQuery.setQueryUSEROID(userDO);
0866: UserPackLevelParticipantQuery upclQuery = new UserPackLevelParticipantQuery(
0867: dbt);
0868: upclQuery.setQueryUSEROID(userDO);
0869: if (uprlQuery.getDOArray().length == 0
0870: && upclQuery.getDOArray().length == 0) {
0871: userDO.delete();
0872: }
0873: }
0874:
0875: private void deleteGroupUser(GroupUserDO userDO) throws Exception {
0876: if (userDO == null)
0877: return;
0878:
0879: DBTransaction dbt = getDBTransaction();
0880:
0881: GroupUserProcLevelParticipantQuery uprlQuery = new GroupUserProcLevelParticipantQuery(
0882: dbt);
0883: uprlQuery.setQueryUSEROID(userDO);
0884: GroupUserPackLevelParticipantQuery upclQuery = new GroupUserPackLevelParticipantQuery(
0885: dbt);
0886: upclQuery.setQueryUSEROID(userDO);
0887: if (uprlQuery.getDOArray().length == 0
0888: && upclQuery.getDOArray().length == 0) {
0889: userDO.delete();
0890: }
0891: }
0892:
0893: private void deleteProcess(XPDLParticipantProcessDO procDO)
0894: throws Exception {
0895: // process
0896: if (procDO == null)
0897: return;
0898:
0899: DBTransaction dbt = getDBTransaction();
0900:
0901: ProcLevelParticipantQuery plpQuery = new ProcLevelParticipantQuery(
0902: dbt);
0903: plpQuery.setQueryPROCESSOID(procDO);
0904: ProcLevelParticipantDO[] plpDOArr = plpQuery.getDOArray();
0905: if (plpDOArr.length == 0)
0906: procDO.delete();
0907: }
0908:
0909: private void deletePackage(XPDLParticipantPackageDO pckDO)
0910: throws Exception {
0911: // package
0912: if (pckDO == null)
0913: return;
0914:
0915: DBTransaction dbt = getDBTransaction();
0916:
0917: XPDLParticipantProcessQuery pQuery = new XPDLParticipantProcessQuery(
0918: dbt);
0919: pQuery.setQueryPACKAGEOID(pckDO);
0920: PackLevelParticipantQuery pcLQuery = new PackLevelParticipantQuery(
0921: dbt);
0922: pcLQuery.setQueryPACKAGEOID(pckDO);
0923: if (pQuery.getDOArray().length == 0
0924: && pcLQuery.getDOArray().length == 0)
0925: pckDO.delete();
0926: }
0927:
0928: private void deleteGroupProcLevelPart(ParticipantMap pm)
0929: throws Exception {
0930: String username = pm.getUsername();
0931: String packageId = pm.getPackageId();
0932: String processId = pm.getProcessDefinitionId();
0933: String participantId = pm.getParticipantId();
0934:
0935: DBTransaction dbt = getDBTransaction();
0936:
0937: GroupUserQuery gQuery = null;
0938: GroupUserDO gDO = null;
0939: if (username != null && !username.trim().equals("")) {
0940: gQuery = new GroupUserQuery(dbt);
0941: gQuery.setQueryUSERNAME(username);
0942: gQuery.requireUniqueInstance();
0943: gDO = gQuery.getNextDO();
0944: }
0945:
0946: XPDLParticipantPackageQuery pckQuery = new XPDLParticipantPackageQuery(
0947: dbt);
0948: pckQuery.setQueryPACKAGE_ID(packageId);
0949: pckQuery.requireUniqueInstance();
0950: XPDLParticipantPackageDO pckDO = pckQuery.getNextDO();
0951:
0952: XPDLParticipantProcessQuery pQuery = new XPDLParticipantProcessQuery(
0953: dbt);
0954: pQuery.setQueryPROCESS_ID(processId);
0955: pQuery.setQueryPACKAGEOID(pckDO);
0956: pQuery.requireUniqueInstance();
0957: XPDLParticipantProcessDO procDO = pQuery.getNextDO();
0958:
0959: ProcLevelParticipantQuery plpQuery = new ProcLevelParticipantQuery(
0960: dbt);
0961: plpQuery.setQueryPARTICIPANT_ID(participantId);
0962: plpQuery.setQueryPROCESSOID(procDO);
0963: plpQuery.requireUniqueInstance();
0964: ProcLevelParticipantDO plpDO = plpQuery.getNextDO();
0965:
0966: GroupUserProcLevelParticipantQuery gulQuery = new GroupUserProcLevelParticipantQuery(
0967: dbt);
0968: if (gDO != null)
0969: gulQuery.setQueryUSEROID(gDO);
0970: gulQuery.setQueryPARTICIPANTOID(plpDO);
0971: GroupUserProcLevelParticipantDO[] gulDOArr = gulQuery
0972: .getDOArray();
0973: for (int i = 0; i < gulDOArr.length; i++) {
0974: gulDOArr[i].delete();
0975: }
0976:
0977: // delete unnecessarily data
0978: // proc level participant
0979: this .deleteProcLevParticipant(plpDO);
0980: // process
0981: this .deleteProcess(procDO);
0982: // package
0983: this .deletePackage(pckDO);
0984: // group user
0985: if (gDO != null)
0986: this .deleteGroupUser(gDO);
0987: }
0988:
0989: private void deleteNormalProcLevelPart(ParticipantMap pm)
0990: throws Exception {
0991: String username = pm.getUsername();
0992: String packageId = pm.getPackageId();
0993: String processId = pm.getProcessDefinitionId();
0994: String participantId = pm.getParticipantId();
0995:
0996: DBTransaction dbt = getDBTransaction();
0997:
0998: NormalUserQuery gQuery = null;
0999: NormalUserDO gDO = null;
1000: if (username != null && !username.trim().equals("")) {
1001: gQuery = new NormalUserQuery(dbt);
1002: gQuery.setQueryUSERNAME(username);
1003: gQuery.requireUniqueInstance();
1004: gDO = gQuery.getNextDO();
1005: }
1006:
1007: XPDLParticipantPackageQuery pckQuery = new XPDLParticipantPackageQuery(
1008: dbt);
1009: pckQuery.setQueryPACKAGE_ID(packageId);
1010: pckQuery.requireUniqueInstance();
1011: XPDLParticipantPackageDO pckDO = pckQuery.getNextDO();
1012:
1013: XPDLParticipantProcessQuery pQuery = new XPDLParticipantProcessQuery(
1014: dbt);
1015: pQuery.setQueryPROCESS_ID(processId);
1016: pQuery.setQueryPACKAGEOID(pckDO);
1017: pQuery.requireUniqueInstance();
1018: XPDLParticipantProcessDO procDO = pQuery.getNextDO();
1019:
1020: ProcLevelParticipantQuery plpQuery = new ProcLevelParticipantQuery(
1021: dbt);
1022: plpQuery.setQueryPARTICIPANT_ID(participantId);
1023: plpQuery.setQueryPROCESSOID(procDO);
1024: plpQuery.requireUniqueInstance();
1025: ProcLevelParticipantDO plpDO = plpQuery.getNextDO();
1026:
1027: UserProcLevelParticipantQuery gulQuery = new UserProcLevelParticipantQuery(
1028: dbt);
1029: if (gDO != null)
1030: gulQuery.setQueryUSEROID(gDO);
1031: gulQuery.setQueryPARTICIPANTOID(plpDO);
1032: UserProcLevelParticipantDO[] gulDOArr = gulQuery.getDOArray();
1033: for (int i = 0; i < gulDOArr.length; i++) {
1034: gulDOArr[i].delete();
1035: }
1036:
1037: // delete unnecessairly data
1038: // proc level participant
1039: this .deleteProcLevParticipant(plpDO);
1040: // process
1041: this .deleteProcess(procDO);
1042: // package
1043: this .deletePackage(pckDO);
1044: // single user
1045: if (gDO != null)
1046: this .deleteNormalUser(gDO);
1047: }
1048:
1049: private void deleteGroupPackLevelPart(ParticipantMap pm)
1050: throws Exception {
1051: String username = pm.getUsername();
1052: String packageId = pm.getPackageId();
1053: String participantId = pm.getParticipantId();
1054:
1055: DBTransaction dbt = getDBTransaction();
1056:
1057: GroupUserQuery gQuery = null;
1058: GroupUserDO gDO = null;
1059: if (username != null && !username.trim().equals("")) {
1060: gQuery = new GroupUserQuery(dbt);
1061: gQuery.setQueryUSERNAME(username);
1062: gQuery.requireUniqueInstance();
1063: gDO = gQuery.getNextDO();
1064: }
1065:
1066: XPDLParticipantPackageQuery pckQuery = new XPDLParticipantPackageQuery(
1067: dbt);
1068: pckQuery.setQueryPACKAGE_ID(packageId);
1069: pckQuery.requireUniqueInstance();
1070: XPDLParticipantPackageDO pckDO = pckQuery.getNextDO();
1071:
1072: PackLevelParticipantQuery plpQuery = new PackLevelParticipantQuery(
1073: dbt);
1074: plpQuery.setQueryPARTICIPANT_ID(participantId);
1075: plpQuery.setQueryPACKAGEOID(pckDO);
1076: plpQuery.requireUniqueInstance();
1077: PackLevelParticipantDO plpDO = plpQuery.getNextDO();
1078:
1079: GroupUserPackLevelParticipantQuery gulQuery = new GroupUserPackLevelParticipantQuery(
1080: dbt);
1081: if (gDO != null)
1082: gulQuery.setQueryUSEROID(gDO);
1083: gulQuery.setQueryPARTICIPANTOID(plpDO);
1084: GroupUserPackLevelParticipantDO[] gulDOArr = gulQuery
1085: .getDOArray();
1086: for (int i = 0; i < gulDOArr.length; i++) {
1087: gulDOArr[i].delete();
1088: }
1089:
1090: // delete unnecessarily data
1091: // pack level participant
1092: this .deletePackLevParticipant(plpDO);
1093: // package
1094: this .deletePackage(pckDO);
1095: // group user
1096: if (gDO != null)
1097: this .deleteGroupUser(gDO);
1098: }
1099:
1100: private void deleteNormalPackLevelPart(ParticipantMap pm)
1101: throws Exception {
1102: String username = pm.getUsername();
1103: String packageId = pm.getPackageId();
1104: String participantId = pm.getParticipantId();
1105:
1106: DBTransaction dbt = getDBTransaction();
1107:
1108: NormalUserQuery gQuery = null;
1109: NormalUserDO gDO = null;
1110: if (username != null && !username.trim().equals("")) {
1111: gQuery = new NormalUserQuery(dbt);
1112: gQuery.setQueryUSERNAME(username);
1113: gQuery.requireUniqueInstance();
1114: gDO = gQuery.getNextDO();
1115: }
1116:
1117: XPDLParticipantPackageQuery pckQuery = new XPDLParticipantPackageQuery(
1118: dbt);
1119: pckQuery.setQueryPACKAGE_ID(packageId);
1120: pckQuery.requireUniqueInstance();
1121: XPDLParticipantPackageDO pckDO = pckQuery.getNextDO();
1122:
1123: PackLevelParticipantQuery plpQuery = new PackLevelParticipantQuery(
1124: dbt);
1125: plpQuery.setQueryPARTICIPANT_ID(participantId);
1126: plpQuery.setQueryPACKAGEOID(pckDO);
1127: plpQuery.requireUniqueInstance();
1128: PackLevelParticipantDO plpDO = plpQuery.getNextDO();
1129:
1130: UserPackLevelParticipantQuery gulQuery = new UserPackLevelParticipantQuery(
1131: dbt);
1132: if (gDO != null)
1133: gulQuery.setQueryUSEROID(gDO);
1134: gulQuery.setQueryPARTICIPANTOID(plpDO);
1135: UserPackLevelParticipantDO[] gulDOArr = gulQuery.getDOArray();
1136: for (int i = 0; i < gulDOArr.length; i++) {
1137: gulDOArr[i].delete();
1138: }
1139:
1140: // delete unnecessairly data
1141: // pack level participant
1142: this .deletePackLevParticipant(plpDO);
1143: // package
1144: this .deletePackage(pckDO);
1145: // single user
1146: if (gDO != null)
1147: this .deleteNormalUser(gDO);
1148: }
1149:
1150: protected DBTransaction getDBTransaction() throws Exception {
1151: return db.createTransaction();
1152: }
1153:
1154: protected void setLDBName() {
1155: String defDBName = DODS.getDatabaseManager().getDefaultDB();
1156: try {
1157: String dbName = db.getName();
1158: DODS.getDatabaseManager().setDefaultDatabase(dbName);
1159: refreshDOCaches();
1160: } catch (Exception _) {
1161: _.printStackTrace();
1162: } finally {
1163: try {
1164: DODS.getDatabaseManager().setDefaultDatabase(defDBName);
1165: } catch (DatabaseManagerException e) {
1166: e.printStackTrace();
1167: }
1168: }
1169: }
1170:
1171: protected void refreshDOCaches() throws Exception {
1172: GroupUserPackLevelParticipantDO.refreshCache();
1173: UserPackLevelParticipantDO.refreshCache();
1174: ProcLevelParticipantDO.refreshCache();
1175: XPDLParticipantPackageDO.refreshCache();
1176: NormalUserDO.refreshCache();
1177: PackLevelParticipantDO.refreshCache();
1178: XPDLParticipantProcessDO.refreshCache();
1179: GroupUserProcLevelParticipantDO.refreshCache();
1180: GroupUserDO.refreshCache();
1181: UserProcLevelParticipantDO.refreshCache();
1182: }
1183:
1184: }
|