242243244245246247248249250251252
final Txn transaction = tm.beginTransaction(); try { final Collection child = broker.getOrCreateCollection(transaction, uri.toCollectionPathURI()); broker.saveCollection(transaction, child); tm.commit(transaction); } catch (final Exception e) { tm.abort(transaction); return false; } finally { tm.close(transaction);
331332333334335336337338339340341
newName = destinationPath.lastSegment(); transaction = tm.beginTransaction(); broker.moveResource(transaction, doc, destination, newName); tm.commit(transaction); return true; } catch ( final Exception e ) { e.printStackTrace(); if (transaction != null) {tm.abort(transaction);}
397398399400401402403404405406407
// resource = null; // collection = null; // initialized = false; // uri = ((Resource)dest).uri; tm.commit(transaction); return true; } catch ( final Exception e ) { e.printStackTrace(); if (transaction != null) {tm.abort(transaction);}
483484485486487488489490491492493
// info.getDocument().getMetadata().setMimeType(mimeType.getName()); is = new FileInputSource(file); collection.store(txn, broker, info, is, false); tm.commit(txn); } catch ( final Exception e ) { e.printStackTrace(); if (txn != null) {tm.abort(txn);} } finally {
615616617618619620621622623624625
if(doc.getResourceType() == DocumentImpl.BINARY_FILE) {collection.removeBinaryResource(txn, broker, doc);} else {collection.removeXMLResource(txn, broker, uri.lastSegment());} tm.commit(txn); return true; } catch (final Exception e) { if (txn != null) {tm.abort(txn);} return false;
721722723724725726727728729730731
collection.addBinaryResource(transaction, broker, blob, is, mimeType.getName(), 0L , new Date(), new Date()); } tm.commit(transaction); } catch (final Exception e) { tm.abort(transaction); throw new IOException(e); } finally { tm.close(transaction);
12991300130113021303130413051306130713081309
txn = tm.beginTransaction(); method.modify(collection); broker.saveCollection(txn, collection); tm.commit(txn); } else { collection = resource.getCollection(); txn = tm.beginTransaction();
13091310131113121313131413151316131713181319
txn = tm.beginTransaction(); method.modify(resource); broker.storeMetadata(txn, resource); tm.commit(txn); } } } catch (final IOException e) { if (txn != null) { tm.abort(txn);
178179180181182183184185186187188
col.store(txn, broker, info, new InputSource(is), false); } finally { is.close(); } txManager.commit(txn); } else { txn = txManager.beginTransaction(); FileInputStream is = new FileInputStream(file); try {
192193194195196197198199200201202
MimeType.BINARY_TYPE.getName(), file.length()); } finally { is.close(); } txManager.commit(txn); } } catch (Exception e) { if (txn != null) { txManager.abort(txn); }