Package org.apache.ojb.broker

Examples of org.apache.ojb.broker.Identity



  public Object getObjectById(final Class entityClass, final Object idValue) throws DataAccessException {
    return execute(new PersistenceBrokerCallback() {
      public Object doInPersistenceBroker(PersistenceBroker pb) throws PersistenceBrokerException {
        Identity id = pb.serviceIdentity().buildIdentity(entityClass, idValue);
        Object result = pb.getObjectByIdentity(id);
        if (result == null) {
          throw new ObjectRetrievalFailureException(entityClass, idValue);
        }
        return result;
View Full Code Here


    MockControl pbControl = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb = (PersistenceBroker) pbControl.getMock();
    MockControl idfControl = MockControl.createControl(IdentityFactory.class);
    final IdentityFactory idf = (IdentityFactory) idfControl.getMock();

    Identity identity = new Identity(String.class, Object.class, new Object[] {"id"});
    pb.serviceIdentity();
    pbControl.setReturnValue(idf, 1);
    idf.buildIdentity(String.class, "id");
    idfControl.setReturnValue(identity, 1);
    pb.getObjectByIdentity(identity);
View Full Code Here

     
      while (iter.hasNext())
      {
        // obtain a StateManager
        pc = (PersistenceCapable) iter.next();
        Identity oid = new Identity(pc, broker);
        StateManagerInternal smi = pmi.getStateManager(oid, pc.getClass());
       
        // fetch attributes into StateManager
      JDOClass jdoClass = Helper.getJDOClass(pc.getClass());
      fieldNums = jdoClass.getManagedFieldNumbers();
View Full Code Here

    public synchronized int delete(
        BitSet loadedFields,
        BitSet dirtyFields,
        StateManagerInternal sm)
    {
      Identity oid = (Identity)sm.getInternalObjectId();
      logger.debug("OjbStoreManager.delete(" + oid + ")");
        try
        {
          fetch(sm,null);
            connector.getBroker().delete(sm.getObject());
View Full Code Here

    {
        PersistenceBroker broker = connector.getBroker();
        try
        {
          Object instance = sm.getObject();
            Identity oid = (Identity) sm.getInternalObjectId();
            if (oid == null)
            {               
                oid = new Identity(instance,broker);
            }
            broker.removeFromCache(instance);
            PersistenceCapable pc = (PersistenceCapable) broker.getObjectByIdentity(oid);

            JDOClass jdoClass = Helper.getJDOClass(pc.getClass());
View Full Code Here

    public synchronized Object createObjectId(
        StateManagerInternal sm,
        PersistenceManagerInternal pm)
    {
        PersistenceCapable obj = sm.getObject();
        Identity oid = new Identity(obj, connector.getBroker());
        return oid;
    }
View Full Code Here

        PersistenceCapable pc,
        Object oid,
        Class cls,
        PersistenceManagerInternal pm)
    {
        return new Identity(pc, connector.getBroker());
    }
View Full Code Here

     * @see com.sun.jdori.StoreManager#getExternalObjectId(Object oid,
     * PersistenceCapable pc)
     */
    public synchronized Object getExternalObjectId(Object objectId, PersistenceCapable pc)
    {
        return new Identity(pc, connector.getBroker());
    }
View Full Code Here

    /**
     * @see com.sun.jdori.StoreManager#copyKeyFieldsFromObjectId
     */
    public void copyKeyFieldsFromObjectId(StateManagerInternal sm, Class pcClass)
    {
        new Identity(sm.getObject(), connector.getBroker());
    }
View Full Code Here

    }

    /** remove an objects entry from the object registry */
    public void remove(Object pKey)
    {
        Identity id;
        if(pKey instanceof Identity)
        {
            id = (Identity) pKey;
        }
        else
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.Identity

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.