Commit f6f54d41 authored by Martin Lowe's avatar Martin Lowe 🇨🇦
Browse files

Change logo update to create org info entry when none exists

parent 619677f7
......@@ -160,14 +160,17 @@ public class DefaultImageStoreService implements ImageStoreService {
&& ImageStoreFormat.ImageStoreFormats.WEB.equals(format.get()) && StringUtils.isNumeric(fileName)) {
// get a ref to the given organization information object
OrganizationInformation oi = dao.getReference(Integer.valueOf(fileName), OrganizationInformation.class);
// as long as this org exists, update the logo
if (oi != null) {
oi.setLargeLogo(bytes);
oi.setSmallLogo(bytes);
oi.setLargeMime(mimeType);
oi.setSmallMime(mimeType);
dao.add(new RDBMSQuery<>(new RequestWrapper(), filters.get(OrganizationInformation.class)), Arrays.asList(oi));
// if the entry doesn't exist, create one
if (oi == null) {
oi = new OrganizationInformation();
oi.setOrganizationID(Integer.valueOf(fileName));
}
oi.setLargeLogo(bytes);
oi.setSmallLogo(bytes);
oi.setLargeMime(mimeType);
oi.setSmallMime(mimeType);
dao.add(new RDBMSQuery<>(new RequestWrapper(), filters.get(OrganizationInformation.class)), Arrays.asList(oi));
}
// write will create and overwrite file by default if it exists
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment