new StatementBuilder(statementText)
.putValue("entityType", CustomFieldEntityType.LINE_ITEM.toString())
.toStatement();
// Set defaults for page and offset.
CustomFieldPage page = new CustomFieldPage();
int offset = 0;
int i = 0;
List<Long> customFieldIds = new ArrayList<Long>();
do {
// Create a statement to page through custom fields.
filterStatement.setQuery(statementText + " OFFSET " + offset);
// Get custom fields by statement.
page = customFieldService.getCustomFieldsByStatement(filterStatement);
if (page.getResults() != null) {
for (CustomField customField : page.getResults()) {
System.out.println(i + ") Custom field with ID \""
+ customField.getId() + "\" and name \"" + customField.getName()
+ "\" was found.");
customFieldIds.add(customField.getId());
i++;
}
}
offset += 500;
} while (offset < page.getTotalResultSetSize());
System.out.println("Number of results found: " + page.getTotalResultSetSize());
} catch (Exception e) {
e.printStackTrace();
}
}