@Test(expected = PersistenceException.class) public void doAction_invalidTag() throws PersistenceException { action = new SetPageTagsAction(context, "invalid"); action.doAction(resource); }
@Override public String doAction(Resource resource) throws PersistenceException { Page page = context.getPageManager().getContainingPage(resource); if (page == null) { return "Unable to find a page for resource " + resource.getPath(); } List<Tag> tagsToSet = getTagsToSet(); String successMessage = "Set page tags on " + page.getPath() + ": " + getTagListAsString(tagsToSet); if (context.isDryRun()) { return successMessage; } TagManager tagManager = context.getTagManager(); tagManager.setTags(page.getContentResource(), tagsToSet.toArray(new Tag[tagsToSet.size()])); return successMessage; }
SetPageTagsAction implements Action { @Override public String doAction(Resource resource) throws PersistenceException { Page page = context.getPageManager().getContainingPage(resource); if (page == null) { return "Unable to find a page for resource " + resource.getPath(); } List<Tag> tagsToSet = getTagsToSet(); String successMessage = "Set page tags on " + page.getPath() + ": " + getTagListAsString(tagsToSet); if (context.isDryRun()) { return successMessage; } TagManager tagManager = context.getTagManager(); tagManager.setTags(page.getContentResource(), tagsToSet.toArray(new Tag[tagsToSet.size()])); return successMessage; } }
SetPageTagsAction implements Action { @Override public String doAction(Resource resource) throws PersistenceException { Page page = context.getPageManager().getContainingPage(resource); if (page == null) { return "Unable to find a page for resource " + resource.getPath(); } List<Tag> tagsToSet = getTagsToSet(); String successMessage = "Set page tags on " + page.getPath() + ": " + getTagListAsString(tagsToSet); if (context.isDryRun()) { return successMessage; } TagManager tagManager = context.getTagManager(); tagManager.setTags(page.getContentResource(), tagsToSet.toArray(new Tag[tagsToSet.size()])); return successMessage; } SetPageTagsAction(BindingContext context, String... tags); }
SetPageTagsAction implements Action { @Override public String doAction(Resource resource) throws PersistenceException { Page page = context.getPageManager().getContainingPage(resource); if (page == null) { return "Unable to find a page for resource " + resource.getPath(); } List<Tag> tagsToSet = getTagsToSet(); String successMessage = "Set page tags on " + page.getPath() + ": " + getTagListAsString(tagsToSet); if (context.isDryRun()) { return successMessage; } TagManager tagManager = context.getTagManager(); tagManager.setTags(page.getContentResource(), tagsToSet.toArray(new Tag[tagsToSet.size()])); return successMessage; } SetPageTagsAction(BindingContext context, String... tags); @Override String doAction(Resource resource); }
SetPageTagsAction implements Action { @Override public String doAction(Resource resource) throws PersistenceException { Page page = context.getPageManager().getContainingPage(resource); if (page == null) { return "Unable to find a page for resource " + resource.getPath(); } List<Tag> tagsToSet = getTagsToSet(); String successMessage = "Set page tags on " + page.getPath() + ": " + getTagListAsString(tagsToSet); if (context.isDryRun()) { return successMessage; } TagManager tagManager = context.getTagManager(); tagManager.setTags(page.getContentResource(), tagsToSet.toArray(new Tag[tagsToSet.size()])); return successMessage; } SetPageTagsAction(BindingContext context, String... tags); @Override String doAction(Resource resource);  }