Package org.objectweb.speedo.mim.api

Examples of org.objectweb.speedo.mim.api.StateItf


    public void speedoRefresh(PersistentObjectItf sp, Map map, Collection fgHints){
        try {
          if (map != null && !map.containsKey(sp.getPName())) {
            map.put(sp.getPName(), sp);
            tpm.refresh(tx, sp);
            StateItf sa = (StateItf) tpm.readIntention(tx, sp, null);
            sa.refresh(this, map, fgHints);
          }
        } catch (PersistenceException e) {
        throw new JDOException("Impossible to refresh a persistent instance", e);
      }
    }
View Full Code Here


      // Verify the transaction is active
      if (!tx.isActive()) {
        throw new JDOUserException("DeletePersistent " +
            "must be called in an active transaction");
      }
      StateItf sa = null;
      try {
        if (!sp.jdoIsPersistent()) {
          throw new JDOUserException(
              "DeletePersistent on an instance non persistent.");
        }
        if (sp.jdoIsDeleted()) {
          return;
        }
             sp.speedoGetHome().sendEvent(HomeItf.PRE_REMOVE, sp, null);
        sa = (StateItf) tpm.unexport(tx, sp);
             sp.speedoGetHome().sendEvent(HomeItf.POST_REMOVE, sp, null);
      } catch (RolledBackPersistenceException e) {
        throw ((JDOTransactionItf) tx).rollBackOnInternalError(e);
      } catch (PersistenceException e) {
        throw new JDOException("", ExceptionHelper.getNested(e));
      }
      //remove the multivalued fields and cascade delete
      sa.deletePersistent(this);
        if (logger.isLoggable(BasicLevel.DEBUG)) {
            logger.log(BasicLevel.DEBUG,
                    "Delete a persistent instance, identifier=" + sp.getPName());
        }
    }
View Full Code Here

    public void speedoRetrieve(PersistentObjectItf sp, Map map, Collection fgHints){
        try {
          if (map != null && !map.containsKey(sp.getPName())) {
            map.put(sp.getPName(), sp);
            tpm.refresh(tx, sp);
            StateItf sa = (StateItf) tpm.readIntention(tx, sp, null);
            sa.retrieve(this, map, fgHints);
          }
        } catch (PersistenceException e) {
        throw new JDOException("Impossible to retrieve a persistent instance", e);
      }
    }
View Full Code Here

    }
      jdopo.speedoGetHome().sendEvent(HomeItf.PRE_DETACH, jdopo, null);
    //persistent_new or persistent_dirty: updated with object id and version
    if(jdopo.jdoIsTransactional() && jdopo.jdoIsDirty()){
      try{
        StateItf sa = (StateItf) tpm.writeIntention(tx, jdopo, null);
        if(!sa.hasBeenFlush()){
          //flush
          tpm.flush(tx, sa);
        }
      } catch (Exception e) {
        throw new JDODataStoreException(
View Full Code Here

        sp = (PersistentObjectItf) detached;
      } else {
        sp = (PersistentObjectItf) speedoGetObjectById(oid, false);
      }
        sp.speedoGetHome().sendEvent(HomeItf.PRE_ATTACH, sp, null);
      StateItf sar = sp.speedoGetHome().readIntention(sp, null);
      //if made persistent in this method
      // force the state to detached_dirty
      if (oid == null) {
        sar.forceDetachedDirty();
      }
      //call the attach method on the po
      sp.speedoGetHome().attachCopy(sp, this, map, detached, sar);
      // if made persistent in this method
      // restore the state to detached_none
      if (oid == null) {
        sar.restoreDetachedNone();
      }
      //change the version on attach
      sar.speedoChangeVersion();
        sp.speedoGetHome().sendEvent(HomeItf.POST_ATTACH, sp, null);
      return sp;
    } catch (Exception e) {
      Exception ie = ExceptionHelper.getNested(e);
      String msg = "Impossible to attach a copy of the persistent object with the identifier: " + oid;
View Full Code Here

      pcm = jf.getPClassMapping(po.getClass());
    }
    po.init(pcm);
        po.speedoGetHome().sendEvent(HomeItf.PRE_NEW, po, null);
    Object hints = po.speedoGetPNameHints();
    final StateItf state;
        if (hints == null) {
            state = (StateItf) tpm.export(tx, po);
        } else {
          state = (StateItf) tpm.export(tx, po, hints);
        }
        if (logger.isLoggable(BasicLevel.DEBUG)) {
            logger.log(BasicLevel.DEBUG,
                    "New persistent instance, identifier=" + po.getPName());
        }
        if (map == null) {
          //call the po to make persistent the reference field
          state.makePersistent(this);
        } else {
          //call the po to make persistent the reference field, with the map context
          state.makePersistentOnAttach(this, map);
        }
        po.speedoGetHome().sendEvent(HomeItf.POST_NEW, po, null);
        return po;
  }
View Full Code Here

    public void jdoMakeDirty(String fieldName) {
        // no fields => does nothing
    }

    public boolean jdoIsDirty() {
        StateItf sa = speedoGetState();
        return sa != null
                && !LifeCycle.isTransient(sa.speedoGetStatus())
                && LifeCycle.isDirty(sa.speedoGetStatus());
    }
View Full Code Here

    }
    public void jdoReplaceObjectId(Object arg0) {
        //TODO: IMPLEMENT JDO 2
    }
    public boolean jdoIsTransactional() {
        StateItf sa = speedoGetState();
        return sa != null
                && !LifeCycle.isTransient(sa.speedoGetStatus())
                && LifeCycle.isTransactional(sa.speedoGetStatus());
    }
View Full Code Here

    public boolean jdoIsPersistent() {
      return speedoIsPersistent();
    }

    public boolean jdoIsNew() {
        StateItf sa = speedoGetState();
        return sa != null && LifeCycle.isNew(sa.speedoGetStatus());
    }
View Full Code Here

        StateItf sa = speedoGetState();
        return sa != null && LifeCycle.isNew(sa.speedoGetStatus());
    }

    public boolean jdoIsDeleted() {
        StateItf sa = speedoGetState();
        return sa != null && LifeCycle.isDeleted(sa.speedoGetStatus());
    }
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.mim.api.StateItf

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.