@TimedResource @GET @Path("/{accountId:" + UUID_PATTERN + "}/" + ALL_TAGS) @Produces(APPLICATION_JSON) @ApiOperation(value = "Retrieve account tags", response = TagJson.class, responseContainer = "List") @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id supplied"), @ApiResponse(code = 404, message = "Account not found")}) public Response getAllTags(@PathParam(ID_PARAM_NAME) final UUID accountId, @QueryParam(QUERY_OBJECT_TYPE) final ObjectType objectType, @QueryParam(QUERY_INCLUDED_DELETED) @DefaultValue("false") final Boolean includedDeleted, @QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode, @javax.ws.rs.core.Context final HttpServletRequest request) throws TagDefinitionApiException { final TenantContext tenantContext = context.createTenantContextWithAccountId(accountId, request); final List<Tag> tags = objectType != null ? tagUserApi.getTagsForAccountType(accountId, objectType, includedDeleted, tenantContext) : tagUserApi.getTagsForAccount(accountId, includedDeleted, tenantContext); return createTagResponse(accountId, tags, auditMode, tenantContext); }
@Test(groups = "slow") public void testApiTagOnAccount() throws Exception { busHandler.pushExpectedEvents(NextEvent.TAG); tagUserApi.addTag(account.getId(), ObjectType.ACCOUNT, ControlTagType.AUTO_INVOICING_OFF.getId(), callContext); assertListenerStatus(); busHandler.pushExpectedEvents(NextEvent.TAG); tagUserApi.addTag(account.getId(), ObjectType.ACCOUNT, ControlTagType.AUTO_PAY_OFF.getId(), callContext); assertListenerStatus(); List<Tag> tags = tagUserApi.getTagsForAccount(account.getId(), false, callContext); Assert.assertEquals(tags.size(), 2); checkTagsExists(tags); tags = tagUserApi.getTagsForObject(account.getId(), ObjectType.ACCOUNT, false, callContext); Assert.assertEquals(tags.size(), 2); checkTagsExists(tags); tags = tagUserApi.getTagsForAccountType(account.getId(), ObjectType.ACCOUNT, false, callContext); Assert.assertEquals(tags.size(), 2); checkTagsExists(tags); }
checkTagsExists(tags); tags = tagUserApi.getTagsForAccountType(account.getId(), ObjectType.INVOICE, false, callContext); Assert.assertEquals(tags.size(), 2); checkTagsExists(tags); checkTagsExists(tags); tags = tagUserApi.getTagsForAccountType(account.getId(), ObjectType.INVOICE, false, callContext); Assert.assertEquals(tags.size(), 2); checkTagsExists(tags);