}
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
MetadataFacet metadataFacet = null;
try
{
Node root = session.getRootNode();
Node node = root.getNode( getFacetPath( repositoryId, facetId, name ) );
MetadataFacetFactory metadataFacetFactory = metadataFacetFactories.get( facetId );
if ( metadataFacetFactory != null )
{
metadataFacet = metadataFacetFactory.createMetadataFacet( repositoryId, name );
Map<String, String> map = new HashMap<String, String>();
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