Java Code Examples for javax.mail.Flags.Flag#SEEN
The following examples show how to use
javax.mail.Flags.Flag#SEEN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageIdMapperTest.java From james-project with Apache License 2.0 | 6 votes |
@Test void addingFlagToAMessageThatAlreadyHasThisFlagShouldResultInNoChange() throws Exception { message1.setUid(mapperProvider.generateMessageUid()); ModSeq modSeq = mapperProvider.generateModSeq(benwaInboxMailbox); message1.setModSeq(modSeq); Flags flags = new Flags(Flag.SEEN); message1.setFlags(flags); sut.save(message1); sut.setFlags(message1.getMessageId(), ImmutableList.of(message1.getMailboxId()), flags, FlagsUpdateMode.ADD); List<MailboxMessage> messages = sut.find(ImmutableList.of(message1.getMessageId()), MessageMapper.FetchType.Body); assertThat(messages).hasSize(1); assertThat(messages.get(0).createFlags()).isEqualTo(flags); }
Example 2
Source File: MessageIdMapperTest.java From james-project with Apache License 2.0 | 6 votes |
@Test void setFlagsShouldReturnUpdatedFlagsWhenNoop() throws Exception { message1.setUid(mapperProvider.generateMessageUid()); ModSeq modSeq = mapperProvider.generateModSeq(benwaInboxMailbox); message1.setModSeq(modSeq); Flags flags = new Flags(Flag.SEEN); message1.setFlags(flags); sut.save(message1); Multimap<MailboxId, UpdatedFlags> mailboxIdUpdatedFlagsMap = sut.setFlags(message1.getMessageId(), ImmutableList.of(message1.getMailboxId()), flags, FlagsUpdateMode.ADD); assertThat(mailboxIdUpdatedFlagsMap.asMap()) .containsOnly(MapEntry.entry(message1.getMailboxId(), ImmutableList.of(UpdatedFlags.builder() .modSeq(modSeq) .uid(message1.getUid()) .newFlags(flags) .oldFlags(flags) .build()))); }
Example 3
Source File: ImapServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
private void setFlag(NodeRef nodeRef, Flag flag, boolean value) { String permission = (flag == Flag.DELETED ? PermissionService.DELETE_NODE : PermissionService.WRITE_PROPERTIES); AccessStatus status = permissionService.hasPermission(nodeRef, permission); if (status == AccessStatus.DENIED) { if(flag == Flag.DELETED) { logger.debug("[setFlag] Access denied to set DELETED FLAG:" + nodeRef); throw new AccessDeniedException("No permission to set DELETED flag"); } if(flag == Flag.SEEN) { logger.debug("[setFlag] Access denied to set SEEN FLAG:" + nodeRef); //TODO - should we throw an exception here? //throw new AccessDeniedException("No permission to set DELETED flag"); } else { logger.debug("[setFlag] Access denied to set flag:" + nodeRef); throw new AccessDeniedException("No permission to set flag:" + flag.toString()); } } else { checkForFlaggableAspect(nodeRef); policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE); policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); try { if(logger.isDebugEnabled()) { logger.debug("set flag nodeRef:" + nodeRef + ",flag:" + flagToQname.get(flag) + ", value:" + value); } nodeService.setProperty(nodeRef, flagToQname.get(flag), value); messageCache.remove(nodeRef); } finally { policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE); policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); } } }