Пример #1
0
 public void popRecord(int recID)
     throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException {
   try {
     this.recordStore.deleteRecord(recID);
   } catch (RecordStoreNotOpenException e) {
     this.alertError("popRecord:deleteRecord RecordStoreNotOpen");
     e.printStackTrace();
     throw e;
   } catch (InvalidRecordIDException e) {
     this.alertError("popRecord:deleteRecord InvalidRecordID");
     e.printStackTrace();
     throw e;
   } catch (RecordStoreException e) {
     this.alertError("popRecord:deleteRecord RecordStoreException");
     e.printStackTrace();
     throw e;
   }
 }
Пример #2
0
 /**
  * [EF] Add in scenario 05
  *
  * @param photoname
  * @param imageData
  * @param albumname
  * @throws InvalidImageDataException
  * @throws PersistenceMechanismException
  */
 public void addMediaData(MediaData mediaData, String albumname)
     throws InvalidImageDataException, PersistenceMechanismException {
   try {
     mediaRS = RecordStore.openRecordStore(album_label + albumname, true);
     mediaInfoRS = RecordStore.openRecordStore(info_label + albumname, true);
     int rid2; // new record ID for ImageData (metadata)
     rid2 = mediaInfoRS.getNextRecordID();
     mediaData.setRecordId(rid2);
     byte[] data1 = getByteFromMediaInfo(mediaData);
     mediaInfoRS.addRecord(data1, 0, data1.length);
   } catch (RecordStoreException e) {
     throw new PersistenceMechanismException();
   } finally {
     try {
       mediaRS.closeRecordStore();
       mediaInfoRS.closeRecordStore();
     } catch (RecordStoreNotOpenException e) {
       e.printStackTrace();
     } catch (RecordStoreException e) {
       e.printStackTrace();
     }
   }
 }