Package org.infoglue.cms.entities.management

Examples of org.infoglue.cms.entities.management.Language


        return ent.getValueObject();
    }    

    public LanguageVO create(Database db, LanguageVO languageVO) throws ConstraintException, SystemException, Exception
    {
        Language ent = new LanguageImpl();
        ent.setValueObject(languageVO);
        db.create(ent);
        return ent.getValueObject();
    }    
View Full Code Here


    public void delete(LanguageVO languageVO) throws ConstraintException, SystemException
    {
    Database db = CastorDatabaseService.getDatabase();
    ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();

    Language language = null;

    try
    {
      beginTransaction(db);
View Full Code Here

   * This method removes a Language from the system and also cleans out all depending repositoryLanguages.
   */
 
    public void delete(Database db, LanguageVO languageVO) throws ConstraintException, SystemException
    {
    Language language = getLanguageWithId(languageVO.getId(), db);
    RepositoryLanguageController.getController().deleteAllRepositoryLanguageWithLanguage(language, db);       
     
    deleteEntity(LanguageImpl.class, languageVO.getLanguageId(), db);
    }       
View Full Code Here

    public Language getLanguageWithId(Integer languageId) throws ConstraintException, SystemException, Bug
    {
        Database db = CastorDatabaseService.getDatabase();
        ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();

        Language language = null;

        try
        {
      beginTransaction(db);
View Full Code Here

  }

    public Language getLanguageWithRepositoryLanguageId(Integer repositoryLanguageId, Database db) throws ConstraintException, SystemException, Bug
    {
    RepositoryLanguage repositoryLanguage = (RepositoryLanguage) getObjectWithId(RepositoryLanguageImpl.class, repositoryLanguageId, db);
    Language language = repositoryLanguage.getLanguage();
       
    return language;
    }
View Full Code Here

      oql.bind(repositoryId);
     
        QueryResults results = oql.execute(Database.READONLY);
      while(results.hasMore())
          {
        Language language = (Language)results.next();
                list.add(language.getValueObject());
          }
           
      results.close();
      oql.close();
     
View Full Code Here

    else
    {
      Database db = CastorDatabaseService.getDatabase();
      ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();
 
      Language language = null;
 
      beginTransaction(db);
 
      try
      {
        language = getMasterLanguage(db, repositoryId);
             
        //If any of the validations or setMethods reported an error, we throw them up now before create.
        ceb.throwIfNotEmpty();

        if(language != null)
        {
            languageVO = language.getValueObject();
            CacheController.cacheObject("masterLanguageCache", languageKey, languageVO);
        }
       
        commitTransaction(db);
      }
View Full Code Here

    {
      logger.info("There was an cached master language:" + languageVO.getName());
    }
    else
    {
      Language language = getMasterLanguage(db, repositoryId);
             
      if(language != null)
      {
          languageVO = language.getValueObject();
          CacheController.cacheObject("masterLanguageCache", languageKey, languageVO);
      }       
    }
   
    return languageVO; 
View Full Code Here

   * This method returns the master language within an transaction.
   */
 
  private Language getMasterLanguage(Database db, Integer repositoryId) throws SystemException, Exception
  {
    Language language = null;

    OQLQuery oql = db.getOQLQuery( "SELECT l FROM org.infoglue.cms.entities.management.impl.simple.LanguageImpl l WHERE l.repositoryLanguages.repository.repositoryId = $1 ORDER BY l.repositoryLanguages.sortOrder, l.languageId");
    oql.bind(repositoryId);
   
    QueryResults results = oql.execute(Database.READONLY);
View Full Code Here

    public LanguageVO update(LanguageVO languageVO) throws ConstraintException, SystemException
    {
        Database db = CastorDatabaseService.getDatabase();
        ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();

        Language language = null;

        beginTransaction(db);

        try
        {
            //add validation here if needed
            language = getLanguageWithId(languageVO.getLanguageId(), db);
            language.setValueObject(languageVO);

            //If any of the validations or setMethods reported an error, we throw them up now before create.
            ceb.throwIfNotEmpty();
           
            commitTransaction(db);
        }
        catch(ConstraintException ce)
        {
            logger.warn("An error occurred so we should not complete the transaction:" + ce, ce);
            rollbackTransaction(db);
            throw ce;
        }
        catch(Exception e)
        {
            logger.error("An error occurred so we should not complete the transaction:" + e, e);
            rollbackTransaction(db);
            throw new SystemException(e.getMessage());
        }


        return language.getValueObject();
    }       
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.management.Language

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.