use of com.zimbra.cs.account.UCService in project zm-mailbox by Zimbra.
the class SoapProvisioning method getAllUCServices.
@Override
public List<UCService> getAllUCServices() throws ServiceException {
ArrayList<UCService> result = new ArrayList<UCService>();
GetAllUCServicesResponse resp = invokeJaxb(new GetAllUCServicesRequest());
for (UCServiceInfo ucServiceInfo : resp.getUCServiceList()) {
result.add(new SoapUCService(ucServiceInfo, this));
}
return result;
}
use of com.zimbra.cs.account.UCService in project zm-mailbox by Zimbra.
the class DeleteUCService method handle.
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
ZimbraSoapContext zsc = getZimbraSoapContext(context);
Provisioning prov = Provisioning.getInstance();
String id = request.getElement(AdminConstants.E_ID).getText();
UCService ucService = prov.get(UCServiceBy.id, id);
if (ucService == null) {
throw AccountServiceException.NO_SUCH_UC_SERVICE(id);
}
checkRight(zsc, context, ucService, Admin.R_deleteUCService);
prov.deleteUCService(ucService.getId());
ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "DeleteUCService", "name", ucService.getName(), "id", ucService.getId() }));
Element response = zsc.createElement(AdminConstants.DELETE_UC_SERVICE_RESPONSE);
return response;
}
use of com.zimbra.cs.account.UCService in project zm-mailbox by Zimbra.
the class ModifyUCService method handle.
@Override
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
ZimbraSoapContext zsc = getZimbraSoapContext(context);
Provisioning prov = Provisioning.getInstance();
String id = request.getElement(AdminConstants.E_ID).getText();
Map<String, Object> attrs = AdminService.getAttrs(request);
UCService ucService = prov.get(Key.UCServiceBy.id, id);
if (ucService == null) {
throw AccountServiceException.NO_SUCH_UC_SERVICE(id);
}
checkRight(zsc, context, ucService, attrs);
// pass in true to checkImmutable
prov.modifyAttrs(ucService, attrs, true);
ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "ModifyUCService", "name", ucService.getName() }, attrs));
Element response = zsc.createElement(AdminConstants.MODIFY_UC_SERVICE_RESPONSE);
GetUCService.encodeUCService(response, ucService, null, null);
return response;
}
use of com.zimbra.cs.account.UCService in project zm-mailbox by Zimbra.
the class LdapProvisioning method extendLifeInCacheOrFlush.
public void extendLifeInCacheOrFlush(Entry entry) {
if (entry instanceof Account) {
accountCache.replace((Account) entry);
} else if (entry instanceof LdapCos) {
cosCache.replace((LdapCos) entry);
} else if (entry instanceof Domain) {
domainCache.replace((Domain) entry);
} else if (entry instanceof Server) {
serverCache.replace((Server) entry);
} else if (entry instanceof UCService) {
ucServiceCache.replace((UCService) entry);
} else if (entry instanceof XMPPComponent) {
xmppComponentCache.replace((XMPPComponent) entry);
} else if (entry instanceof LdapZimlet) {
zimletCache.replace((LdapZimlet) entry);
} else if (entry instanceof LdapAlwaysOnCluster) {
alwaysOnClusterCache.replace((AlwaysOnCluster) entry);
} else if (entry instanceof Group) {
/*
* DLs returned by Provisioning.get(DistributionListBy) and
* DLs/dynamic groups returned by Provisioning.getGroup(DistributionListBy)
* are "not" cached.
*
* DLs returned by Provisioning.getDLBasic(DistributionListBy) and
* DLs/dynamic groups returned by Provisioning.getGroupBasic(DistributionListBy)
* "are" cached.
*
* Need to flush out the cached entries if the instance being modified is not
* in cache. (i.e. the instance being modified was obtained by get/getGroup)
*/
Group modifiedInstance = (Group) entry;
Group cachedInstance = getGroupFromCache(DistributionListBy.id, modifiedInstance.getId());
if (cachedInstance != null && modifiedInstance != cachedInstance) {
groupCache.remove(cachedInstance);
}
}
}
use of com.zimbra.cs.account.UCService in project zm-mailbox by Zimbra.
the class LdapProvisioning method getUCServiceByName.
private UCService getUCServiceByName(String name, boolean nocache) throws ServiceException {
if (!nocache) {
UCService s = ucServiceCache.getByName(name);
if (s != null) {
return s;
}
}
try {
String dn = mDIT.ucServiceNameToDN(name);
ZAttributes attrs = helper.getAttributes(LdapUsage.GET_UCSERVICE, dn);
LdapUCService s = new LdapUCService(dn, attrs, this);
ucServiceCache.put(s);
return s;
} catch (LdapEntryNotFoundException e) {
return null;
} catch (ServiceException e) {
throw ServiceException.FAILURE("unable to lookup ucservice by name: " + name + " message: " + e.getMessage(), e);
}
}
Aggregations