Source:
<code>protected void writeEntityBody(DirectoryEntry entry, JsonGenerator jg) throws IOException { String directoryName = entry.getDirectoryName(); DocumentModel document = entry.getDocumentModel(); <START> if (document == null) { <END> return; } String schemaName = directoryService.getDirectorySchema(directoryName); String passwordField = directoryService.getDirectoryPasswordField(directoryName); jg.writeStringField("directoryName", directoryName); jg.writeStringField("id", document.getId()); Schema schema = schemaManager.getSchema(schemaName); Writer<Property> propertyWriter = registry.getWriter(ctx, Property.class, APPLICATION_JSON_TYPE); jg.writeObjectFieldStart("properties"); Set<String> translated = ctx.getTranslated(ENTITY_TYPE); Set<String> fetched = ctx.getFetched(ENTITY_TYPE); for (Field field : schema.getFields()) { QName fieldName = field.getName(); String key = fieldName.getLocalName(); jg.writeFieldName(key); if (key.equals(passwordField)) { jg.writeString(""); } else { Property property = document.getProperty(fieldName.getPrefixedName()); boolean managed = false; Object value = property.getValue(); if (value instanceof String && StringUtils.isNotEmpty((String) value)) { String valueString = (String) value; if (fetched.contains(fieldName.getLocalName())) { try (Closeable resource = ctx.wrap().with(MAX_DEPTH_PARAM, "max").open()) { managed = writeFetchedValue(jg, directoryName, fieldName.getLocalName(), valueString); } } else if (translated.contains(fieldName.getLocalName())) { managed = writeTranslatedValue(jg, fieldName.getLocalName(), valueString); } } if (!managed) { propertyWriter.write(property, Property.class, Property.class, APPLICATION_JSON_TYPE, new OutputStreamWithJsonWriter(jg)); } } } jg.writeEndObject(); }</code><technical_language>Is needed</technical_language>

Target:
protected void writeEntityBody(DirectoryEntry entry, JsonGenerator jg) throws IOException { String directoryName = entry.getDirectoryName(); DocumentModel document = entry.getDocumentModel(); String schemaName = directoryService.getDirectorySchema(directoryName); String passwordField = directoryService.getDirectoryPasswordField(directoryName); jg.writeStringField("directoryName", directoryName); jg.writeStringField("id", document.getId()); Schema schema = schemaManager.getSchema(schemaName); Writer<Property> propertyWriter = registry.getWriter(ctx, Property.class, APPLICATION_JSON_TYPE); jg.writeObjectFieldStart("properties"); Set<String> translated = ctx.getTranslated(ENTITY_TYPE); Set<String> fetched = ctx.getFetched(ENTITY_TYPE); for (Field field : schema.getFields()) { QName fieldName = field.getName(); String key = fieldName.getLocalName(); jg.writeFieldName(key); if (key.equals(passwordField)) { jg.writeString(""); } else { Property property = document.getProperty(fieldName.getPrefixedName()); boolean managed = false; Object value = property.getValue(); if (value instanceof String && StringUtils.isNotEmpty((String) value)) { String valueString = (String) value; if (fetched.contains(fieldName.getLocalName())) { try (Closeable resource = ctx.wrap().with(MAX_DEPTH_PARAM, "max").open()) { managed = writeFetchedValue(jg, directoryName, fieldName.getLocalName(), valueString); } } else if (translated.contains(fieldName.getLocalName())) { managed = writeTranslatedValue(jg, fieldName.getLocalName(), valueString); } } if (!managed) { propertyWriter.write(property, Property.class, Property.class, APPLICATION_JSON_TYPE, new OutputStreamWithJsonWriter(jg)); } } } jg.writeEndObject(); }