// Create a statement to select labels ordered by name.
Statement filterStatement =
new StatementBuilder("ORDER BY name LIMIT 500").toStatement();
// Get labels by statement.
LabelPage page = labelService.getLabelsByStatement(filterStatement);
if (page.getResults() != null) {
int i = page.getStartIndex();
for (Label label : page.getResults()) {
List<String> labelTypes = new ArrayList<String>();
for (LabelType labelType : label.getTypes()) {
labelTypes.add(labelType.toString());
}
System.out.println(i + ") Label with ID \"" + label.getId()
+ "\", name \"" + label.getName()
+ "\", and types {" + StringUtils.join(labelTypes, ",") + "} was found.");
i++;
}
}
System.out.println("Number of results found: " + page.getTotalResultSetSize());
} catch (Exception e) {
e.printStackTrace();
}
}