📄 rmsadapter.java
字号:
return recordId; } catch (IOException ioe) { throw new ApplicationException(ioe); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public void deleteTheaterSchedule(int recordId) throws ApplicationException { delete(remoteDataRecordStore, recordId); return; } public Movie loadMovie(int recordId) throws ApplicationException { try { byte[] data = remoteDataRecordStore.getRecord(recordId); return Movie.deserialize(new DataInputStream(new ByteArrayInputStream(data))); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public int storeMovie(Movie movie, int recordId) throws ApplicationException { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); DataOutputStream dataStream = new DataOutputStream(stream); movie.serialize(dataStream); dataStream.flush(); if (recordId > 0) { remoteDataRecordStore.setRecord(recordId, stream.toByteArray(), 0, stream.size()); } else { recordId = remoteDataRecordStore.addRecord(stream.toByteArray(), 0, stream.size()); } return recordId; } catch (IOException ioe) { throw new ApplicationException(ioe); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public void deleteMovie(int recordId) throws ApplicationException { delete(remoteDataRecordStore, recordId); return; } public MovieRating loadMovieRating(int recordId) throws ApplicationException { try { byte[] data = remoteDataRecordStore.getRecord(recordId); return MovieRating.deserialize(new DataInputStream(new ByteArrayInputStream(data))); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public int storeMovieRating(MovieRating movieRating, int recordId) throws ApplicationException { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); DataOutputStream dataStream = new DataOutputStream(stream); movieRating.serialize(dataStream); dataStream.flush(); if (recordId > 0) { remoteDataRecordStore.setRecord(recordId, stream.toByteArray(), 0, stream.size()); } else { recordId = remoteDataRecordStore.addRecord(stream.toByteArray(), 0, stream.size()); } return recordId; } catch (IOException ioe) { throw new ApplicationException(ioe); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public void deleteMovieRating(int recordId) throws ApplicationException { delete(remoteDataRecordStore, recordId); return; } public Preferences loadPreferences(int recordId) throws ApplicationException { try { byte[] data = localDataRecordStore.getRecord(recordId); return Preferences.deserialize(new DataInputStream(new ByteArrayInputStream(data))); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public int storePreferences(Preferences preferences, int recordId) throws ApplicationException { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); DataOutputStream dataStream = new DataOutputStream(stream); preferences.serialize(dataStream); dataStream.flush(); if (recordId > 0) { localDataRecordStore.setRecord(recordId, stream.toByteArray(), 0, stream.size()); } else { recordId = localDataRecordStore.addRecord(stream.toByteArray(), 0, stream.size()); } return recordId; } catch (IOException ioe) { throw new ApplicationException(ioe); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public SyncAnchor loadSyncAnchor(int recordId) throws ApplicationException { try { byte[] data = localDataRecordStore.getRecord(recordId); return SyncAnchor.deserialize(new DataInputStream(new ByteArrayInputStream(data))); } catch (RecordStoreException rse) { throw new ApplicationException(rse); } } public int storeSyncAnchor(SyncAnchor syncAnchor, int recordId) throws ApplicationException { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); DataOutputStream dataStream = new DataOutputStream(stream); syncAnchor.serialize(dataStream); dataStream.flush(); if (recordId > 0) { localDataRecordStore.setRecord(recordId, stream.toByteArray(), 0, stream.size()); } else { recordId = localDataRecordStore.addRecord(stream.toByteArray(), 0, stream.size()); } return recordId; } catch (IOException ioe) { throw new ApplicationException(ioe); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public AccountInfo loadAccountInfo(int recordId) throws ApplicationException { try { byte[] data = localDataRecordStore.getRecord(recordId); return AccountInfo.deserialize(new DataInputStream(new ByteArrayInputStream(data))); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public int storeAccountInfo(AccountInfo accountInfo, int recordId) throws ApplicationException { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); DataOutputStream dataStream = new DataOutputStream(stream); accountInfo.serialize(dataStream); dataStream.flush(); if (recordId > 0) { localDataRecordStore.setRecord(recordId, stream.toByteArray(), 0, stream.size()); } else { recordId = localDataRecordStore.addRecord(stream.toByteArray(), 0, stream.size()); } return recordId; } catch (IOException ioe) { throw new ApplicationException(ioe); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public IndexedResourceBundle loadResourceBundle(int recordId) throws ApplicationException { try { byte[] data = localDataRecordStore.getRecord(recordId); return IndexedResourceBundle.deserialize(new DataInputStream(new ByteArrayInputStream(data))); } catch (RecordStoreException rse) { throw new ApplicationException(rse); } } public int storeResourceBundle(IndexedResourceBundle bundle, int recordId) throws ApplicationException { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); DataOutputStream dataStream = new DataOutputStream(stream); bundle.serialize(dataStream); dataStream.flush(); if (recordId > 0) { localDataRecordStore.setRecord(recordId, stream.toByteArray(), 0, stream.size()); } else { recordId = localDataRecordStore.addRecord(stream.toByteArray(), 0, stream.size()); } return recordId; } catch (IOException ioe) { throw new ApplicationException(ioe); } catch (RecordStoreException rse) { throw new ApplicationException(rse); } } public RecommendationRecipient loadRecommendationRecipient(int recordId) throws ApplicationException { try { byte[] data = remoteDataRecordStore.getRecord(recordId); return RecommendationRecipient.deserialize(new DataInputStream(new ByteArrayInputStream(data))); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public int storeRecommendationRecipient(RecommendationRecipient recommendationRecipient, int recordId) throws ApplicationException { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); DataOutputStream dataStream = new DataOutputStream(stream); recommendationRecipient.serialize(dataStream); dataStream.flush(); if (recordId > 0) { remoteDataRecordStore.setRecord(recordId, stream.toByteArray(), 0, stream.size()); } else { recordId = remoteDataRecordStore.addRecord(stream.toByteArray(), 0, stream.size()); } return recordId; } catch (IOException ioe) { throw new ApplicationException(ioe); } catch (RecordStoreException rse) { rse.printStackTrace(); throw new ApplicationException(rse); } } public void deleteRecommendationRecipient(int recordId) throws ApplicationException { delete(remoteDataRecordStore, recordId); return; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -