Search in sources :

Example 6 with UnauthorizedException

use of org.jivesoftware.xmpp.workgroup.UnauthorizedException in project Openfire by igniterealtime.

the class WorkgroupMacros method saveMacros.

public void saveMacros(Workgroup workgroup) {
    long id = workgroup.getID();
    MacroGroup group = getMacroGroup(workgroup);
    String saveString = xstream.toXML(group);
    DbProperties props = workgroup.getProperties();
    try {
        props.deleteProperty("jive.macro" + id);
        props.setProperty("jive.macro" + id, saveString);
    } catch (UnauthorizedException e) {
        Log.error(e.getMessage(), e);
    }
}
Also used : UnauthorizedException(org.jivesoftware.xmpp.workgroup.UnauthorizedException) DbProperties(org.jivesoftware.xmpp.workgroup.DbProperties)

Example 7 with UnauthorizedException

use of org.jivesoftware.xmpp.workgroup.UnauthorizedException in project Openfire by igniterealtime.

the class DbDispatcherInfoProvider method insertDispatcherInfo.

/**
     * Adds a new DispathcerInfo to the requestQueue.
     * @param queueID the id of the queue to add the Dispatcher to.
     * @param info the DispatcherInfo to add.
     * @throws UserAlreadyExistsException
     * @throws UnauthorizedException
     */
public void insertDispatcherInfo(long queueID, DispatcherInfo info) throws UserAlreadyExistsException, UnauthorizedException {
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(INSERT_DISPATCHER);
        pstmt.setString(1, info.getName());
        pstmt.setString(2, info.getDescription());
        pstmt.setInt(3, (int) info.getOfferTimeout());
        pstmt.setInt(4, (int) info.getRequestTimeout());
        pstmt.setLong(5, queueID);
        pstmt.executeUpdate();
    } catch (SQLException e) {
        Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
        throw new UnauthorizedException();
    } finally {
        DbConnectionManager.closeConnection(pstmt, con);
    }
}
Also used : SQLException(java.sql.SQLException) Connection(java.sql.Connection) UnauthorizedException(org.jivesoftware.xmpp.workgroup.UnauthorizedException) PreparedStatement(java.sql.PreparedStatement)

Example 8 with UnauthorizedException

use of org.jivesoftware.xmpp.workgroup.UnauthorizedException in project Openfire by igniterealtime.

the class DbDispatcherInfoProvider method updateDispatcherInfo.

/**
     * Updates a RequestQueues dispatcher.
     * @param queueID the id of the queue to update.
     * @param info the new DispatcherInfo.
     * @throws NotFoundException
     * @throws UnauthorizedException
     */
public void updateDispatcherInfo(long queueID, DispatcherInfo info) throws NotFoundException, UnauthorizedException {
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(UPDATE_DISPATCHER);
        pstmt.setString(1, info.getName());
        pstmt.setString(2, info.getDescription());
        pstmt.setInt(3, (int) info.getOfferTimeout());
        pstmt.setInt(4, (int) info.getRequestTimeout());
        pstmt.setLong(5, queueID);
        pstmt.executeUpdate();
    } catch (SQLException e) {
        Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
        throw new UnauthorizedException();
    } finally {
        DbConnectionManager.closeConnection(pstmt, con);
    }
}
Also used : SQLException(java.sql.SQLException) Connection(java.sql.Connection) UnauthorizedException(org.jivesoftware.xmpp.workgroup.UnauthorizedException) PreparedStatement(java.sql.PreparedStatement)

Aggregations

UnauthorizedException (org.jivesoftware.xmpp.workgroup.UnauthorizedException)8 DbProperties (org.jivesoftware.xmpp.workgroup.DbProperties)4 XStream (com.thoughtworks.xstream.XStream)3 Connection (java.sql.Connection)3 PreparedStatement (java.sql.PreparedStatement)3 SQLException (java.sql.SQLException)3 ArrayList (java.util.ArrayList)1 Element (org.dom4j.Element)1 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)1 Agent (org.jivesoftware.xmpp.workgroup.Agent)1 AgentNotFoundException (org.jivesoftware.xmpp.workgroup.AgentNotFoundException)1 Workgroup (org.jivesoftware.xmpp.workgroup.Workgroup)1 DataForm (org.xmpp.forms.DataForm)1 FormField (org.xmpp.forms.FormField)1 IQ (org.xmpp.packet.IQ)1 PacketError (org.xmpp.packet.PacketError)1