@Override public boolean equals(Object o) { if(!(o instanceof Record)) { return false; } Record incoming = (Record)o; String recordId = this.getRecordId(); String incomingRecordId = incoming.getRecordId(); if(recordId == null || incomingRecordId == null) { return false; } if(recordId.equals(incomingRecordId)) { return true; } return false; }
@Override public int hashCode() { String recordId = this.getRecordId(); if(recordId == null) { return GeneralTools.generateUniqueId().hashCode(); } return recordId.hashCode(); }
synchronized Map<String,Record> all(String table) throws DBException { try { Map<String,Record> all = new HashMap<String,Record>(); Set<String> keys = this.cache.keySet(); for(String key:keys) { if(key.startsWith(table+":")) { Record record = this.cache.get(key); all.put(record.getRecordId(),record); } } return all; } catch(Exception e) { throw new DBException(Cache.class.getName(),"all", new Object[]{ "Exception: "+e.toString(), "Message: "+e.getMessage() }); } }
String recordId = record.getRecordId(); Log.i("OpenMobster Info", String.format("Record updated: channel = %s, id = %s.", table, record.getRecordId()));
private BusRegistration parse(Record record) { BusRegistration reg = new BusRegistration(record.getRecordId()); Set<String> names = record.getNames(); for(String name: names) { if(name.equals("recordId") || name.equals("dirty")) { continue; } reg.addInvocationHandler(record.getValue(name)); } return reg; }
public ChangeLogEntry(Record record) { this.id = record.getRecordId(); this.nodeId = record.getValue("storageId"); this.operation = record.getValue("operation"); this.recordId = record.getValue("sync-recordId"); }
public Anchor(Record record) { this.id = record.getRecordId(); this.target = record.getValue("target"); this.lastSync = record.getValue("lastSync"); this.nextSync = record.getValue("nextSync"); }
public SyncError(Record record) { this.id = record.getRecordId(); this.code = record.getValue("code"); this.source = record.getValue("source"); this.target = record.getValue("target"); }
String recordId = record.getRecordId(); if(recordId == null || recordId.trim().length() == 0) Log.i("OpenMobster Info", String.format("Record inserted: channel = %s, id = %s.", table, record.getRecordId()));
String recordId = record.getRecordId(); Log.i("OpenMobster Info", String.format("Record deleted: channel = %s, id = %s.", table, record.getRecordId()));
private void addRecord(String table,Record record) throws DBException String recordId = record.getRecordId();
public void update(String into, Record record) throws DBException { //Validate this.validateConnection(into, "update"); //Note: With Android, write threads lock the entire database. //so this operation is thread-safe //Check Dirty Status (support for long transactions) Record stored = this.cloudbMetaData.getCRUDProvider().select(into, record.getRecordId()); if(!stored.getDirtyStatus().equals(record.getDirtyStatus())) { throw new DBException(this.getClass().getName(),"update",new Object[]{into},DBException.ERROR_RECORD_STALE); } this.cloudbMetaData.getCRUDProvider().update(into, record); }
public RecordMap(Record record) { this.id = record.getRecordId(); this.source = record.getValue("source"); this.target = record.getValue("target"); this.guid = record.getValue("guid"); this.luid = record.getValue("luid"); }
this.cache.put(from,record.getRecordId(),record);
this.cache.put(from,record.getRecordId(), record);
private CloudPhoto parse(Record record) throws IOException { CloudPhoto photo = new CloudPhoto(); photo.setFullName(record.getValue("fullname")); String encoded = record.getValue("photo"); byte[] decoded = Base64.decode(encoded.getBytes()); photo.setPhoto(decoded); String mime = record.getValue("mime"); if(mime != null) { photo.setMimeType(mime); } Set<String> names = record.getNames(); for(String name:names) { if(!name.equals("fullname") && !name.equals("photo") && !name.equals("mime")) { photo.addTag(name); } } photo.setOid(record.getRecordId()); return photo; }
public MobileObject(Record record) this.recordId = record.getRecordId(); this.dirtyStatus = record.getDirtyStatus(); if(record.getValue("serverRecordId") != null)
private void prepareCursor(MatrixCursor cursor,Record record) String recordId = record.getRecordId(); cursor.addRow(new String[]{recordId,"recordId",record.getRecordId()}); cursor.addRow(new String[]{recordId,"storageId",record.getValue("storageId")}); cursor.addRow(new String[]{recordId,"dirty",record.getDirtyStatus()});