Package org.persvr.datasource

Examples of org.persvr.datasource.DataSource


   * can implement handlers for these to validate changes
   */
  public void restActions(){
    for (NewObject newObject : new ArrayList<NewObject>(newObjects)) {
      if(!newObject.processed){
        DataSource source = DataSourceManager.getSourceByPrototype(newObject.object.getPrototype());
        if (!("Array".equals(source.getId()) || "Object".equals(source.getId()))){
          Persistable rootQuery = ObjectId.idForObject(source,"").getTarget();
          Function postMethod = (Function) ScriptableObject.getProperty((Persistable) rootQuery, "post");
          if(postMethod instanceof Method)
            ((Method)postMethod).call(PersevereContextFactory.getContext(), GlobalData.getGlobalScope(), rootQuery, new Object[]{newObject.object}, true);
          else
            postMethod.call(PersevereContextFactory.getContext(), GlobalData.getGlobalScope(), rootQuery, new Object[]{newObject.object});
          Method onSave = (Method) ScriptableObject.getProperty(newObject.object, "onSave");
          onSave.call(PersevereContextFactory.getContext(), GlobalData.getGlobalScope(), newObject.object, new Object[0], true);
        }
        newObject.processed = true;
      }
    }
    Set<Persistable> changedObjects = new HashSet<Persistable>();
    Set<Persistable> deletedObjects = new HashSet<Persistable>();
    for (ChangeUpdate change : changes.values()) {
      if(!change.processed){
        Persistable object = change.target;
        DataSource source;
        if (change.key == null && !(object instanceof PersistableArray)) {
          deletedObjects.add(object);
          changedObjects.remove(object);
        }
        else if (!deletedObjects.contains(object)){
View Full Code Here


  }
  public static synchronized ObjectId idForString(String value) {
    ObjectId objId = idMap.get(value);
    if (objId == null) {
      int lastSlash = value.lastIndexOf('/');
      DataSource source;
      if (lastSlash == -1){
        source = DataSourceManager.getSource(value);
        objId = new ObjectId();
        objId.source = source;
        objId.subObjectId = null;
View Full Code Here

TOP

Related Classes of org.persvr.datasource.DataSource

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.