Search in sources :

Example 11 with AccountLogger

use of com.zimbra.common.util.AccountLogger in project zm-mailbox by Zimbra.

the class GetAccountLoggers method handle.

@Override
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(context);
    Server localServer = Provisioning.getInstance().getLocalServer();
    checkRight(zsc, context, localServer, Admin.R_manageAccountLogger);
    // Look up account
    Account account = AddAccountLogger.getAccountFromLoggerRequest(request);
    Element response = zsc.createElement(AdminConstants.GET_ACCOUNT_LOGGERS_RESPONSE);
    for (AccountLogger al : LogFactory.getAllAccountLoggers()) {
        if (al.getAccountName().equals(account.getName())) {
            Element eLogger = response.addElement(AdminConstants.E_LOGGER);
            eLogger.addAttribute(AdminConstants.A_CATEGORY, al.getCategory());
            eLogger.addAttribute(AdminConstants.A_LEVEL, al.getLevel().toString());
        }
    }
    return response;
}
Also used : Account(com.zimbra.cs.account.Account) Server(com.zimbra.cs.account.Server) AccountLogger(com.zimbra.common.util.AccountLogger) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) Element(com.zimbra.common.soap.Element)

Aggregations

AccountLogger (com.zimbra.common.util.AccountLogger)11 Account (com.zimbra.cs.account.Account)8 SoapProvisioning (com.zimbra.cs.account.soap.SoapProvisioning)8 List (java.util.List)4 Test (org.junit.Test)3 Element (com.zimbra.common.soap.Element)2 Server (com.zimbra.cs.account.Server)2 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 DistributionList (com.zimbra.cs.account.DistributionList)1 Provisioning (com.zimbra.cs.account.Provisioning)1 GetAllAccountLoggersRequest (com.zimbra.soap.admin.message.GetAllAccountLoggersRequest)1 GetAllAccountLoggersResponse (com.zimbra.soap.admin.message.GetAllAccountLoggersResponse)1 AccountLoggerInfo (com.zimbra.soap.admin.type.AccountLoggerInfo)1