use of org.vcell.util.document.VersionInfo in project vcell by virtualcell.
the class ServerDocumentManager method removeUserFromGroup0.
/**
* Insert the method's description here.
* Creation date: (11/28/00 5:43:44 PM)
* @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
*/
private VersionInfo removeUserFromGroup0(User user, VersionInfo versionInfo, VersionableType vType, Hashtable vInfoHash, String userToAdd) throws DataAccessException {
//
// unpublish from database
//
VersionInfo newVersionInfo = dbServer.groupRemoveUser(user, vType, versionInfo.getVersion().getVersionKey(), userToAdd, false);
//
// replace versionInfo in hashTable
//
vInfoHash.remove(versionInfo.getVersion().getVersionKey());
vInfoHash.put(newVersionInfo.getVersion().getVersionKey(), newVersionInfo);
return newVersionInfo;
}
use of org.vcell.util.document.VersionInfo in project vcell by virtualcell.
the class DBTopLevel method getMathModelXML.
/**
* This method was created in VisualAge.
* @return cbit.sql.Versionable
* @param object cbit.sql.Versionable
* @param name java.lang.String
* @param bVersion boolean
* @exception org.vcell.util.DataAccessException The exception description.
* @exception java.sql.SQLException The exception description.
* @exception cbit.sql.RecordChangedException The exception description.
*/
String getMathModelXML(User user, KeyValue key, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, ObjectNotFoundException {
Object lock = new Object();
VersionableType versionableType = VersionableType.MathModelMetaData;
Connection con = conFactory.getConnection(lock);
DbDriver driver = getDbDriver(versionableType);
try {
//
// Getting the corresponding VersionInfo will fail if you don't have permission to the object.
// This is needed because the DbDriver-level services can return objects directly from the
// cache without checking for permissions first.
//
// This check is placed in DbTopLevel because this is the client API entry point.
// Child objects (of the requested object) are given permission by reachablity anyway,
// so if the user is allowed permission to the parent, no further checks are necessary.
//
Vector<VersionInfo> vInfos = getVersionableInfos(user, key, versionableType, true, true, false);
if (vInfos.size() == 0) {
throw new ObjectNotFoundException(versionableType.getTypeName() + " not found");
}
return driver.getVersionableXML(con, versionableType, key);
} catch (Throwable e) {
lg.error(e.getMessage(), e);
if (bEnableRetry && isBadConnection(con)) {
conFactory.failed(con, lock);
return getMathModelXML(user, key, false);
} else {
handle_DataAccessException_SQLException(e);
// never gets here;
return null;
}
} finally {
conFactory.release(con, lock);
}
}
use of org.vcell.util.document.VersionInfo in project vcell by virtualcell.
the class DBTopLevel method findReferences.
/**
* Insert the method's description here.
* Creation date: (11/6/2005 10:16:41 AM)
* @return cbit.vcell.modeldb.ReferenceQueryResult
* @param user cbit.vcell.server.User
* @param rqs cbit.vcell.modeldb.ReferenceQuerySpec
*/
ReferenceQueryResult findReferences(User user, ReferenceQuerySpec rqs2, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException {
Object lock = new Object();
Connection con = conFactory.getConnection(lock);
try {
// Use MathDescription for search if ExternalData
VersionableType rqsVType = null;
KeyValue[] vTypeKeys = null;
if (rqs2.isVersionableType()) {
rqsVType = rqs2.getVersionableType();
vTypeKeys = new KeyValue[] { rqs2.getKeyValue() };
} else if (rqs2.isExternalDataIdentiferType()) {
DbDriver.cleanupDeletedReferences(con, user, rqs2.getExternalDataIdentifier(), false);
con.commit();
rqsVType = VersionableType.MathDescription;
vTypeKeys = getMathDescKeysForExternalData(rqs2.getKeyValue(), user, true);
if (vTypeKeys == null || vTypeKeys.length == 0) {
return null;
}
}
if (rqsVType == null) {
throw new DataAccessException("findAllReferences error: Couldn't determine Query type");
}
VersionableFamily finalVersionalbeFamily = null;
for (int k = 0; k < vTypeKeys.length; k += 1) {
// Find references
VersionableFamily vf = getAllReferences(user, vTypeKeys[k], rqsVType, true);
// Check permission
if (vf.bDependants()) {
VersionableTypeVersion[] vtvArr = vf.getUniqueDependants();
for (int i = 0; i < vtvArr.length; i += 1) {
if (vtvArr[i].getVType().equals(VersionableType.BioModelMetaData)) {
Vector<VersionInfo> checkedVInfos = getVersionableInfos(user, vtvArr[i].getVersion().getVersionKey(), VersionableType.BioModelMetaData, false, true, true);
if (checkedVInfos == null || checkedVInfos.size() == 0) {
throw new DataAccessException("References Not Accessible");
}
} else if (vtvArr[i].getVType().equals(VersionableType.MathModelMetaData)) {
Vector<VersionInfo> checkedVInfos = getVersionableInfos(user, vtvArr[i].getVersion().getVersionKey(), VersionableType.MathModelMetaData, false, true, true);
if (checkedVInfos == null || checkedVInfos.size() == 0) {
throw new DataAccessException("References Not Accessible");
}
}
}
}
if (finalVersionalbeFamily == null) {
finalVersionalbeFamily = vf;
} else {
VersionableRelationship[] versRelArr = vf.getDependantRelationships();
for (int r = 0; r < versRelArr.length; r += 1) {
finalVersionalbeFamily.addDependantRelationship(versRelArr[r]);
}
}
}
return new ReferenceQueryResult(finalVersionalbeFamily);
} catch (Throwable e) {
lg.error(e.getMessage(), e);
if (bEnableRetry && isBadConnection(con)) {
conFactory.failed(con, lock);
return findReferences(user, rqs2, false);
} else {
handle_DataAccessException_SQLException(e);
// never gets here;
return null;
}
} finally {
conFactory.release(con, lock);
}
}
Aggregations