class DomainServiceImpl implements DomainService, Constants {

	@Override
	public String updateDomain(final CreateUpdateDomain createUpdateDomain, final String userId) throws PacManException {
		boolean isDomainExits = domainRepository.existsById(createUpdateDomain.getName());
		if (isDomainExits) {
			Domain existingDomain = domainRepository.findById(createUpdateDomain.getName()).get();
			existingDomain.setDomainDesc(createUpdateDomain.getDesc());
			existingDomain.setConfig(createUpdateDomain.getConfig());
			existingDomain.setModifiedDate(new Date());
			existingDomain.setUserId(userId);
			domainRepository.save(existingDomain);
			return AdminConstants.DOMAIN_UPDATION_SUCCESS;
		} else {
			throw new PacManException(AdminConstants.DOMAIN_NAME_EXITS);
		}
	}

}