@Override
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
MetadataFacet metadataFacet = null;
try
{
Node root = getJcrSession().getRootNode();
Node node = root.getNode( getFacetPath( repositoryId, facetId, name ) );
if ( metadataFacetFactories == null )
{
return metadataFacet;
}
MetadataFacetFactory metadataFacetFactory = metadataFacetFactories.get( facetId );
if ( metadataFacetFactory != null )
{
metadataFacet = metadataFacetFactory.createMetadataFacet( repositoryId, name );
Map<String, String> map = new HashMap<>();
for ( Property property : JcrUtils.getProperties( node ) )
{
String p = property.getName();
if ( !p.startsWith( "jcr:" ) )
{
map.put( p, property.getString() );
}
}
metadataFacet.fromProperties( map );
}
}
catch ( PathNotFoundException e )
{
// ignored - the facet doesn't exist, so return null