Package org.persvr.data

Examples of org.persvr.data.ObjectId$HiddenObjectId


* @author Kris Zyp
* This is an SQL database table data source
*/
public class DatabaseTableDataSource extends DatabaseDataSource implements WritableDataSource, ChangeableData {
  protected Object getValueFromRs(ResultSet rs) throws Exception {
    ObjectId rowId = ObjectId.idForObject(DatabaseTableDataSource.this, rs.getString(columnCount + 1));
    // use the row to initialize this object
    synchronized(rowId){
      PersistableInitializer initializer = DataSourceHelper.initializeObject(rowId);
      mapResult(initializer, rs, rowId.subObjectId);
    }
View Full Code Here


    private AliasMarkerObject(String alias) {
      this.alias = alias;
    }
    @Override
    public ObjectId getId() {
      return new ObjectId() {
        @Override
        public String toString() {
          return AliasMarkerObject.this.alias;
        }
      };
View Full Code Here

    }
    return value;
  }
  //TODO: mapArray
  public void mapObject(PersistableInitializer initializer, final String objectId) throws Exception {
    ObjectId objId = ObjectId.idForObject(this, objectId);

    final Object object = getMap(objectId).resolved;
    mapJson(initializer,object,objectId);
  }
View Full Code Here

    makeDirty(objectId);
  }

  protected void handleNewObject(Object value, final String key, final String parentId){
    if (value instanceof ObjectId) {
      ObjectId id = (ObjectId) value;
        id.persistIfNeeded(new StartAsEmptyPersister(){

          @Override
          public void initializeAsList(List<? extends Object> values) throws Exception {
            int i = 0;
            for(Object value : values){
View Full Code Here

  protected void newJson(String json) throws Exception {
    //TODO: This needs to be able to handle RPCs
    Scriptable xhr = makeRequest("POST", sourceUrl, json, 0, 0);
    String response = getTextFromXhr(xhr);

    ObjectId objId = ObjectId.idForObject(this, sourceUrl);
    synchronized(objId){
      mapJson(DataSourceHelper.initializeObject(objId), JSON.parse(response), sourceUrl);
    }
  }
View Full Code Here

      mapJson(DataSourceHelper.initializeObject(objId), JSON.parse(response), sourceUrl);
    }
  }
  protected Object mapJson(PersistableInitializer initializer, final Object object, final String objectId) {
    // the id might resolve differently after downloading a class
    ObjectId objId = ObjectId.idForObject(this, objectId);
    Identification newId = Identification.idForString(getId() + '/' + objectId);

    if(newId instanceof ObjectId && objId.source != newId.source){
      objId.source = newId.source;
      objId.subObjectId = newId.subObjectId;
View Full Code Here

  String JSPON_URL_TOKEN = "/jspon/";
  @Override
  public ObjectId idFromJSPONObject(Map object, ObjectId defaultId, boolean mustMatchId)  {
   
      try {
      ObjectId targetId;
      String key;
      String sourceUrl = currentUrl.get();
      Date changesSince=null;
      if (object.containsKey("id")) {
        targetId = ObjectId.idForString(sourceUrl + object.remove("id")); // TODO: Just get the string and do the initialization in array or method
View Full Code Here

        }
      }
    }
  }
  public NewObjectPersister recordNewObject(Persistable object) throws Exception {
    ObjectId existingId = object.getId();
    Object className = existingId.source instanceof ClassDataSource ?
        object.getId().subObjectId : object.get("id");
    if(!(className instanceof String) || ((String)className).startsWith("s$")){
      className = (Math.random() + "").substring(2);
    }
   
    object.delete("id");
    existingId.assignId(this, (String) className);
    Object superType = object.get("extends");
    final DataSource newSource;
    if(((PersistableClass) object).persist){
      newSource = DataSourceManager.createNewSource((String) className,superType instanceof Persistable ? ((Persistable) superType).getId().subObjectId : "Object",(PersistableClass) object);
    }else{
View Full Code Here

  public void recordPropertyAddition(final String objectId, String name, final Object value, int attributes) throws Exception {
    if (objectId != null) {
      if ("instances".equals(name)) {
        throw new RuntimeException("can not change data");
      }
      ObjectId configId = sourceToConfigObject.get(objectId);
      if(configId != null){
        Transaction.addAffectedSource((WritableDataSource) configId.source);
        ((WritableDataSource) configId.source).recordPropertyAddition(configId.subObjectId, name, value, 0);
      }
    }
View Full Code Here

      }
    }
  }

  public void recordPropertyChange(String objectId, String name, Object value, int attributes) throws Exception {
    ObjectId configId = sourceToConfigObject.get(objectId);
    if(configId != null){
      Transaction.addAffectedSource((WritableDataSource) configId.source);
 
      ((WritableDataSource) configId.source).recordPropertyChange(configId.subObjectId, name, value, 0);
    }
View Full Code Here

TOP

Related Classes of org.persvr.data.ObjectId$HiddenObjectId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.