private void validatePrinterLabelTemplates( Account account, LabelPrinter printer, StringBuffer problems, boolean appendComma) { Map templates = printer.getLabelTemplates(); // if there are no label templates defined for the printer, return an error if (templates.isEmpty()) { if (appendComma) { problems.append(","); } problems.append( " printer with name = " + printer.getName() + " in account with id = " + account.getId() + " has no label templates defined."); appendComma = true; } else { Iterator iterator = templates.keySet().iterator(); while (iterator.hasNext()) { LabelTemplate template = (LabelTemplate) templates.get(iterator.next()); // make sure every template refers to a known template definition String templateDefinitionName = template.getLabelTemplateDefinitionName(); if (printer .getParent() .getLabelTemplateDefinitions() .get(templateDefinitionName.toLowerCase()) == null) { if (appendComma) { problems.append(","); } problems.append( " label template for printer (" + printer.getName() + ") references an unknown labelTemplateDefinition (" + templateDefinitionName + ")"); appendComma = true; } // make sure every template has a fully qualified name value String fullName = template.getFullyQualifiedName(); if (ApiFunctions.isEmpty(fullName)) { if (appendComma) { problems.append(","); } problems.append( " label template with labelTemplateDefinitionName = " + templateDefinitionName + " has no fully qualified name value"); appendComma = true; } } } }