* @param subdomain New subdomain to assign to the service.
* @param description New description to assign to the service.
* @throws NotFoundException if service was not found.
*/
public void updateMultiUserChatService(Long serviceID, String subdomain, String description) throws NotFoundException {
MultiUserChatServiceImpl muc = (MultiUserChatServiceImpl) getMultiUserChatService(serviceID);
if (muc == null) throw new NotFoundException();
// A NotFoundException is thrown if the specified service was not found.
String oldsubdomain = muc.getServiceName();
if (!mucServices.containsKey(oldsubdomain)) {
// This should never occur, but just in case...
throw new NotFoundException();
}
if (oldsubdomain.equals(subdomain)) {
// Alright, all we're changing is the description. This is easy.
updateService(serviceID, subdomain, description);
// Update the existing service's description.
muc.setDescription(description);
}
else {
// Changing the subdomain, here's where it gets complex.
// Unregister existing muc service
unregisterMultiUserChatService(subdomain);
// Update the information stored about the MUC service
updateService(serviceID, subdomain, description);
// Create new MUC service with new settings
muc = new MultiUserChatServiceImpl(subdomain, description, muc.isHidden());
// Register to new service
registerMultiUserChatService(muc);
}
}