Examples of PortalException


Examples of com.liferay.portal.PortalException

      }
      else {
        return false;
      }
    } catch (Exception e) {
      throw new PortalException(e);
    }
  }
View Full Code Here

Examples of com.liferay.portal.kernel.exception.PortalException

    Class<?> clazz = throwable.getClass();

    String className = clazz.getName();

    if (className.equals(PortalException.class.getName())) {
      return new PortalException();
    }

    if (className.equals(SystemException.class.getName())) {
      return new SystemException();
    }
View Full Code Here

Examples of org.jasig.portal.PortalException

            xslt.transform();
            String html = results.toString();
            pw.print(html);
        } catch (Exception e)
        {
            throw new PortalException("Problem generating content.", e);
        }
    }
View Full Code Here

Examples of org.jasig.portal.PortalException

        String errorMessage = e.getMessage();
        try { RDBMServices.rollback(con); } catch ( SQLException sqle ) {
           log.error( sqle.getMessage(), sqle );
           errorMessage += ":" + sqle.getMessage();
        }
         throw new PortalException(errorMessage, e);
       }
    }
View Full Code Here

Examples of org.jasig.portal.PortalException

        return node;

     } catch (Exception e) {
      log.error(e,e);
        throw new PortalException(e);
       }

    }
View Full Code Here

Examples of org.jasig.portal.PortalException

        String errorMessage = e.getMessage();
        try { RDBMServices.rollback(con); } catch ( SQLException sqle ) {
           log.error( sqle.toString() );
           errorMessage += ":" + sqle.getMessage();
        }
         throw new PortalException(errorMessage, e);
       }
}
View Full Code Here

Examples of org.jasig.portal.PortalException

        return count > 0;

     } catch (Exception e) {
      log.error(e,e);
        throw new PortalException(e);
       }
  }
View Full Code Here

Examples of org.jasig.portal.PortalException

        String errorMessage = e.getMessage();
        try { RDBMServices.rollback(con); } catch ( SQLException sqle ) {
           log.error( sqle.getMessage(), sqle );
           errorMessage += ":" + sqle.getMessage();
        }
         throw new PortalException(errorMessage, e);
       }
    }
View Full Code Here

Examples of org.jasig.portal.PortalException

     * @exception PortalException if an error occurs
     */
public synchronized void setAggregatedLayout (IPerson person, UserProfile profile, IAggregatedLayout layoutImpl ) throws PortalException {

    if ( !(layoutImpl instanceof AggregatedLayout) )
       throw new PortalException("The user layout object should have \"AggregatedLayout\" type");

    AggregatedLayout layout = (AggregatedLayout) layoutImpl;
    int userId = person.getID();
    int profileId=profile.getProfileId();
    int layoutId = Integer.parseInt(layoutImpl.getId());
   
    Connection con = null;
   
  try {
 
    con  = RDBMServices.getConnection();
      RDBMServices.setAutoCommit(con, false);

      PreparedStatement psSelect = null;
      final String sQuery = "SELECT LAYOUT_ID FROM UP_USER_PROFILE WHERE USER_ID=? AND PROFILE_ID=?";
      try {
          psSelect = con.prepareStatement(sQuery);
          psSelect.setInt(1, userId);
          psSelect.setInt(2, profileId);
        ResultSet rs = null;
        try {
              rs = psSelect.executeQuery();
             if (rs.next()) {
               rs.getInt(1);
             if ( rs.wasNull() ) {
                    final String sUpdateProfileQuery = "UPDATE UP_USER_PROFILE SET LAYOUT_ID=? WHERE USER_ID=? AND PROFILE_ID=?";
                    PreparedStatement psUpdateUserProfile = null;
                    try {
                        psUpdateUserProfile = con.prepareStatement(sUpdateProfileQuery);
                        psUpdateUserProfile.setInt(1,layoutId);
                        psUpdateUserProfile.setInt(2,userId);
                        psUpdateUserProfile.setInt(3, profileId);
                        if (log.isDebugEnabled())
                            log.debug("AggregatedUserLayoutStore::setAggregatedLayout(): " + sUpdateProfileQuery);
                        psUpdateUserProfile.executeUpdate();
                    } finally {
                        if (psUpdateUserProfile != null){
                            try { psUpdateUserProfile.close(); } catch (Exception e){}
                        }
                    }
             }
             }
          } finally {
            if (rs != null){
                try {rs.close();} catch (Exception e) {}
            }
          }
      } finally {
          if (psSelect != null){
              try { psSelect.close(); } catch (Exception e){}
          }
      }
         
     
      final String sSelectInitQuery = "SELECT INIT_NODE_ID FROM UP_USER_LAYOUT_AGGR WHERE USER_ID=? AND LAYOUT_ID=?";
      if (log.isDebugEnabled())
          log.debug("AggregatedUserLayoutStore::setAggregatedLayout(): " + sSelectInitQuery);
      String firstNodeId = layout.getLayoutFolder(layout.getRootId()).getFirstChildNodeId();
      PreparedStatement psSelectInit = null;
      try {
          psSelectInit = con.prepareStatement(sSelectInitQuery);
          psSelectInit.setInt(1,userId);
          psSelectInit.setInt(2,layoutId);
          ResultSet rsInit = null;
          try {
              rsInit = psSelectInit.executeQuery();
              if ( !rsInit.next() ) {
                 final String insertLayoutQuery = "INSERT INTO UP_USER_LAYOUT_AGGR (LAYOUT_ID,USER_ID,LAYOUT_TITLE,INIT_NODE_ID) VALUES (?,?,?,?)";
                 PreparedStatement psInsertLayout = null;
                 try {
                     psInsertLayout = con.prepareStatement(insertLayoutQuery);
               psInsertLayout.setInt(1,layoutId);
               psInsertLayout.setInt(2,userId);
               psInsertLayout.setString(3, new String (person.getFullName()+" layout"));
               psInsertLayout.setInt(4,Integer.parseInt(firstNodeId));
                     if (log.isDebugEnabled())
                         log.debug("AggregatedUserLayoutStore::setAggregatedLayout(): "+insertLayoutQuery+ "  with values ("+layoutId+", "+userId+", "+new String (person.getFullName()+" layout")+", "+firstNodeId+")");
               psInsertLayout.executeUpdate();
                 } finally {
                     if (psInsertLayout != null){
                         try { psInsertLayout.close(); } catch (Exception e){}
                     }
                 }
             } else {
                 final String sUpdateQuery = "UPDATE UP_USER_LAYOUT_AGGR SET INIT_NODE_ID=? WHERE LAYOUT_ID=? AND USER_ID=?";
                 PreparedStatement psUpdateLayout = null;
                 try {
                     psUpdateLayout = con.prepareStatement(sUpdateQuery);
                     psUpdateLayout.setInt(1,Integer.parseInt(firstNodeId));
                     psUpdateLayout.setInt(2,layoutId);
                     psUpdateLayout.setInt(3, userId);
                     if (log.isDebugEnabled())
                         log.debug("AggregatedUserLayoutStore::setAggregatedLayout(): " + sUpdateQuery);
                     psUpdateLayout.executeUpdate();
                 } finally {
                     if (psUpdateLayout != null){
                         try { psUpdateLayout.close(); } catch (Exception e){}
                     }
                 }
             }
          } finally {
              if (rsInit != null){
                  try { rsInit.close(); } catch (Exception e){}
              }
          }
      } finally {
          if (psSelectInit != null){
              try { psSelectInit.close(); } catch (Exception e){}
          }
      }
     
      // Clear the previous data related to the user layout
      PreparedStatement psDeleteLayout = null;
      try {
          psDeleteLayout = con.prepareStatement("DELETE FROM UP_LAYOUT_STRUCT_AGGR WHERE USER_ID=? AND LAYOUT_ID=?");
          // Deleting the node from the user layout
          psDeleteLayout.setInt(1,userId);
          psDeleteLayout.setInt(2,layoutId);
          psDeleteLayout.executeUpdate();
      } finally {
          if (psDeleteLayout != null){
              try { psDeleteLayout.close(); } catch (Exception e){}
          }
      }

     
      // Deleting restrictions for regular nodes
      PreparedStatement psDeleteLayoutRestriction = null;
      try {
          psDeleteLayoutRestriction = con.prepareStatement("DELETE FROM UP_LAYOUT_RESTRICTIONS WHERE USER_ID=? AND LAYOUT_ID=?");
          // Deleting restrictions for the node
          psDeleteLayoutRestriction.setInt(1,userId);
          psDeleteLayoutRestriction.setInt(2,layoutId);
          psDeleteLayoutRestriction.executeUpdate();
      } finally {
          if (psDeleteLayoutRestriction != null){
              try { psDeleteLayoutRestriction.close(); } catch (Exception e){}
          }
      }

      // Add prepared statements
      PreparedStatement  psAddLayoutNode = con.prepareStatement(LAYOUT_ADD_SQL);
      PreparedStatement  psAddLayoutRestriction = con.prepareStatement(LAYOUT_RESTRICTION_ADD_SQL);
    

       // The loop for all the nodes from the layout
       for ( Enumeration nodeIds = layout.getNodeIds(); nodeIds.hasMoreElements() ;) {
        String strNodeId = nodeIds.nextElement().toString();

        if ( !strNodeId.equals(IALFolderDescription.ROOT_FOLDER_ID) && !strNodeId.equals(IALFolderDescription.LOST_FOLDER_ID) ) {

         ALNode node = layout.getNode(strNodeId);

         int fragmentId = CommonUtils.parseInt(node.getFragmentId());
         int fragmentNodeId = CommonUtils.parseInt(node.getFragmentNodeId());

         if ( fragmentNodeId > 0 || fragmentId <= 0 ) {
        
          /* boolean channelParamsExist = false;

               if ( node.getNodeType() == IUserLayoutNodeDescription.CHANNEL ) {
                int publishId = CommonUtils.parseInt(((IALChannelDescription)node.getNodeDescription()).getChannelPublishId());
                  ResultSet rsChan = stmt.executeQuery("SELECT CHAN_ID FROM UP_CHANNEL WHERE CHAN_ID=" + publishId);
                  try {
                   if ( rsChan.next() )
                     channelParamsExist = true;
                  } finally {
                     rsChan.close();
                    }
               }*/

                 addUserLayoutNode(userId,layoutId,node,psAddLayoutNode,psAddLayoutRestriction,null,null,null);
         }  
        } // End if
       } // End for

       // Commit all the changes
      RDBMServices.commit(con);

      if ( psAddLayoutNode != null ) psAddLayoutNode.close();
      if ( psAddLayoutRestriction != null ) psAddLayoutRestriction.close();


    } catch (Exception e) {
        log.error(e,e);
        try {
          RDBMServices.rollback(con);
        } catch ( Exception ee ) {
            /*ignore*/
        }
        throw new PortalException(e);
    } finally {
    RDBMServices.releaseConnection(con);
    }
}
View Full Code Here

Examples of org.jasig.portal.PortalException

    if ( stmt != null ) stmt.close();
    if ( con != null ) con.close();

    return fragments;
  } catch ( Exception e ) {
      throw new PortalException(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.