public void setComponentInformation(ComponentInformation componentInformation) {
if (componentInformation.getId() != getComponentOfForum().getId()) {
throw new IllegalArgumentException(
"Service should work with the same component as the componentInformation argument.");
}
Component forumComponent = getDao().getComponent();
forumComponent.setName(componentInformation.getName());
forumComponent.setDescription(componentInformation.getDescription());
forumComponent.setProperty(LOGO_TOOLTIP_PROPERTY, componentInformation.getLogoTooltip());
forumComponent.setProperty(TITLE_PREFIX_PROPERTY, componentInformation.getTitlePrefix());
forumComponent.setProperty(COPYRIGHT_PROPERTY, componentInformation.getCopyright());
if (!StringUtils.isEmpty(componentInformation.getLogo())) {
forumComponent.setProperty(LOGO_PROPERTY, componentInformation.getLogo());
}
if (!StringUtils.isEmpty(componentInformation.getIcon())) {
forumComponent.setProperty(COMPONENT_FAVICON_PNG_PARAM, componentInformation.getIcon());
Base64Wrapper wrapper = new Base64Wrapper();
byte[] favIcon = wrapper.decodeB64Bytes(componentInformation.getIcon());
try {
String iconInTheIcoFormat = icoFormatImageService.preProcessAndEncodeInString64(favIcon);
forumComponent.setProperty(COMPONENT_FAVICON_ICO_PARAM, iconInTheIcoFormat);
} catch (ImageProcessException e) {
LOGGER.error("Can't convert fav icon to *.ico format", e);
}
}
DateTime now = new DateTime();
now = now.withMillisOfSecond(0);
forumComponent.setProperty(COMPONENT_INFO_CHANGE_DATE_PROPERTY, String.valueOf(now.getMillis()));
}