diff --git a/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java b/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java index f7ae9489..1b463266 100644 --- a/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java +++ b/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java @@ -85,7 +85,7 @@ public class InboxService extends AbstractScheduledService { lastSyncDate = new Date(); lastSyncMessageCount = 0; try { - HashMap tagsNameToId = getAllTags(); + Map tagsNameToId = getAllTags(); inbox = openInbox(); Message[] messages = inbox.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false)); @@ -192,7 +192,7 @@ public class InboxService extends AbstractScheduledService { * @param message Message * @throws Exception e */ - private void importMessage(Message message, HashMap tags) throws Exception { + private void importMessage(Message message, Map tags) throws Exception { log.info("Importing message: " + message.getSubject()); // Parse the mail @@ -273,16 +273,16 @@ public class InboxService extends AbstractScheduledService { /** * Fetches a HashMap with all tag names as keys and their respective ids as values. * - * @return HashMap with all tags or null if not enabled + * @return Map with all tags or null if not enabled */ - private HashMap getAllTags() { + private Map getAllTags() { if (!ConfigUtil.getConfigBooleanValue(ConfigType.INBOX_AUTOMATIC_TAGS)) { return null; } TagDao tagDao = new TagDao(); List tags = tagDao.findByCriteria(new TagCriteria().setTargetIdList(null), new SortCriteria(1, true)); - HashMap tagsNameToId = new HashMap<>(); + Map tagsNameToId = new HashMap<>(); for (TagDto tagDto : tags) { tagsNameToId.put(tagDto.getName(), tagDto.getId()); } diff --git a/docs-web/src/main/java/com/sismics/docs/rest/resource/AppResource.java b/docs-web/src/main/java/com/sismics/docs/rest/resource/AppResource.java index e697997e..2163b7bb 100644 --- a/docs-web/src/main/java/com/sismics/docs/rest/resource/AppResource.java +++ b/docs-web/src/main/java/com/sismics/docs/rest/resource/AppResource.java @@ -396,6 +396,8 @@ public class AppResource extends BaseResource { * @apiName PostAppConfigInbox * @apiGroup App * @apiParam {Boolean} enabled True if the inbox scanning is enabled + * @apiParam {Boolean} autoTagsEnabled If true automatically add tags to document (prefixed by #) + * @apiParam {Boolean} deleteImported If true delete message from mailbox after import * @apiParam {String} hostname IMAP hostname * @apiParam {Integer} port IMAP port * @apiParam {String} username IMAP username @@ -432,6 +434,8 @@ public class AppResource extends BaseResource { } checkBaseFunction(BaseFunction.ADMIN); ValidationUtil.validateRequired(enabled, "enabled"); + ValidationUtil.validateRequired(autoTagsEnabled, "autoTagsEnabled"); + ValidationUtil.validateRequired(deleteImported, "deleteImported"); if (!Strings.isNullOrEmpty(portStr)) { ValidationUtil.validateInteger(portStr, "port"); }