Created
January 19, 2018 18:35
-
-
Save kuckmc01/ce8275f5e3e8ad62d1306d3e1f4a63a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String[] getValuesAsStringArray(final Resource resource, final String propertyToExtract){ | |
try { | |
final Node node = resource.adaptTo(Node.class); | |
final Property property = node.getProperty(propertyToExtract); | |
final Resource childProperty = resource.getChild(propertyToExtract); | |
if(property.isMultiple() && childProperty != null){ | |
return childProperty.adaptTo(String[].class); | |
}else{ | |
return new String[]{ childProperty.adaptTo(String.class) }; | |
} | |
} catch (RepositoryException e) { | |
log.error("Problem accessing node information ",e); | |
} | |
return new String[]{""}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment