Back

Adding Categories to Content when Calling Checkin

Description

The code below can be used to add a category by key to a contentlet when calling the checkin method.

Code

User user = APILocator.getUserAPI().getSystemUser(); 
CategoryAPIImpl categoryAPIImpl = new CategoryAPIImpl();
Category category = categoryAPIImpl.findByKey("mykey", user, false);
List<Category> categoryList = new ArrayList<Category>();
categoryList.add(category);
content = conAPI.checkin(content, user, false, categoryList);