Examples of IBaseEntity


Examples of org.infoglue.cms.entities.kernel.IBaseEntity

      else
      {
        // Check for excluded object
        while (results.hasMore())
              {
                IBaseEntity o = (IBaseEntity) results.next();
                logger.info("Validating...." + o.getIdAsObject() + ":" + excludeObject + ":" + o.getIdAsObject().equals(excludeObject));
                if(excludeObject != null)
                {
            if (!o.getIdAsObject().equals(excludeObject))
              valueExist = true;
                }
          else
          {
                  if (o.getId().compareTo(excludeId) != 0)
                    valueExist = true;
          }
              }
      }
     
View Full Code Here

Examples of org.infoglue.cms.entities.kernel.IBaseEntity

   * This method fetches one object in read only mode and returns it's value object.
   */
 
  protected BaseEntityVO getVOWithId(Class arg, Integer id, Database db, boolean retry) throws SystemException, Bug
  {
    IBaseEntity vo = null;
    try
    {
      RequestAnalyser.getRequestAnalyser().incApproximateNumberOfDatabaseQueries();
      vo = (IBaseEntity)db.load(arg, id, Database.READONLY);
    }
    catch(Exception e)
    {
      try
      {
        if(retry)
        {
          logger.info("Error getting object. Message: " + e.getMessage() + ". Retrying...");
          vo = (IBaseEntity)getVOWithId(arg, id, db, false);
        }
        else
        {
          logger.info("Error getting object. Message: " + e.getMessage() + ". Not retrying...");
          throw new SystemException("An error occurred when we tried to fetch the object " + arg.getName() + ". Reason:" + e.getMessage(), e);
        }
      }
      catch(Exception e2)
      {
        throw new SystemException("An error occurred when we tried to fetch the object " + arg.getName() + ". Reason:" + e.getMessage(), e);   
      }
    }
    finally
    {
      RequestAnalyser.getRequestAnalyser().decApproximateNumberOfDatabaseQueries();
    }
   
    if(vo == null)
    {
      throw new Bug("The object with id [" + id + "] was not found. This should never happen.");
    }
       
    return vo.getVO();
  }
View Full Code Here

Examples of org.infoglue.cms.entities.kernel.IBaseEntity

    public static BaseEntityVO updateEntity(Class arg, BaseEntityVO vo) throws Bug, SystemException
    {
        Database db = CastorDatabaseService.getDatabase();

        IBaseEntity entity = null;

        beginTransaction(db);

        try
        {
            entity = (IBaseEntity) getObjectWithId(arg, vo.getId(), db);
            entity.setVO(vo);

            commitTransaction(db);
        }
        catch(Exception e)
        {
            logger.error("An error occurred so we should not complete the transaction: " + e.getMessage());
            logger.warn("An error occurred so we should not complete the transaction: " + e.getMessage(), e);
            rollbackTransaction(db);
            throw new SystemException(e.getMessage());
        }

        return entity.getVO();
    }       
View Full Code Here

Examples of org.infoglue.cms.entities.kernel.IBaseEntity

    }       

   
  public static BaseEntityVO updateEntity(Class arg, BaseEntityVO vo, Database db) throws Bug, SystemException
  {
    IBaseEntity entity = null;

    entity = (IBaseEntity) getObjectWithId(arg, vo.getId(), db);
    entity.setVO(vo);

    return entity.getVO();
  }       
View Full Code Here

Examples of org.infoglue.cms.entities.kernel.IBaseEntity

    public static BaseEntityVO updateEntity(Class entClass, BaseEntityVO vo, String collectionMethod, Class manyClass, String[] manyIds) throws ConstraintException, SystemException
    {
        Database db = CastorDatabaseService.getDatabase();
        ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();

        IBaseEntity entity = null;

        beginTransaction(db);

        try
        {
            //add validation here if needed
            List manyList = new ArrayList();
            if(manyIds != null)
      {
            for (int i=0; i < manyIds.length; i++)
              {
                IBaseEntity manyEntity = (IBaseEntity) getObjectWithId(manyClass, new Integer(manyIds[i]), db);
                logger.info("!!Using experimental code: BaseController::update. getting " + manyEntity.toString());
                manyList.add(manyEntity);
              }
      }
     
   
View Full Code Here

Examples of org.infoglue.cms.entities.kernel.IBaseEntity

   * Update entity and a collection with other entities
   * Experimental, use with caution
   */
    public static IBaseEntity updateEntity(Class entClass, BaseEntityVO vo, String collectionMethod, Class manyClass, String[] manyIds, Database db) throws ConstraintException, SystemException, Exception
    {
        IBaseEntity entity = null;

        List manyList = new ArrayList();
        if(manyIds != null)
    {
          for (int i=0; i < manyIds.length; i++)
            {
              IBaseEntity manyEntity = (IBaseEntity) getObjectWithId(manyClass, new Integer(manyIds[i]), db);
              logger.info("!!Using experimental code: BaseController::update. getting " + manyEntity.toString());
              manyList.add(manyEntity);
            }
    }
   
        entity = (IBaseEntity) getObjectWithId(entClass, vo.getId(), db);
View Full Code Here

Examples of org.infoglue.cms.entities.kernel.IBaseEntity

   * This method fetches one object in read only mode and returns it's value object.
   */
 
    public static BaseEntityVO getVOWithId(Class arg, Integer id, Database db) throws SystemException, Bug
    {
        IBaseEntity vo = null;
        try
        {
        vo = (IBaseEntity)db.load(arg, id, Database.READONLY);
        }
        catch(Exception e)
        {
            throw new SystemException("An error occurred when we tried to fetch the object " + arg.getName() + ". Reason:" + e.getMessage(), e);   
        }
   
        if(vo == null)
        {
            throw new Bug("The object with id [" + id + "] was not found. This should never happen.");
        }
       
      return vo.getVO();
    }
View Full Code Here

Examples of org.infoglue.cms.entities.kernel.IBaseEntity

   * This method fetches one object in read only mode and returns it's value object.
   */
 
  public static BaseEntityVO getVOWithId(Class arg, String id, Database db) throws SystemException, Bug
  {
    IBaseEntity vo = null;
    try
    {
      vo = (IBaseEntity)db.load(arg, id, Database.READONLY);
    }
    catch(Exception e)
    {
      throw new SystemException("An error occurred when we tried to fetch the object " + arg.getName() + ". Reason:" + e.getMessage(), e);   
    }
   
    if(vo == null)
    {
      throw new Bug("The object with id [" + id + "] was not found. This should never happen.");
    }
       
    return vo.getVO();
  }
View Full Code Here

Examples of org.infoglue.cms.entities.kernel.IBaseEntity

      oql = db.getOQLQuery( "SELECT u FROM " + arg.getName() + " u ORDER BY u." + primaryKey);
      QueryResults results = oql.execute(Database.READONLY);
     
      while (results.hasMore())
      {
        IBaseEntity baseEntity = (IBaseEntity)results.next();
        resultList.add(baseEntity.getVO());
      }
    }
    catch(ClassCastException e)
    {
      throw new Bug("The object [" + arg.getName() + "] is of the wrong type. This should never happen.", e);
View Full Code Here

Examples of org.infoglue.cms.entities.kernel.IBaseEntity

      oql = db.getOQLQuery( "SELECT u FROM " + arg.getName() + " u ORDER BY u." + primaryKey);
      QueryResults results = oql.execute(Database.READONLY);
     
      while (results.hasMore())
      {
        IBaseEntity baseEntity = (IBaseEntity)results.next();
        resultList.add(baseEntity);
      }
    }
    catch(ClassCastException e)
    {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.