Welcome to Tridion Stackexchange.
Here you can find the code example to get the publication metadata, I assume you are using DXA 2.2 Java + DXA Model Extension + GraphiQL provider.
private static final String PublicationCustomMetadata = "CustomMetadataFieldName";
String PublicationCustomMetadataValue;
Publication publication = apiClientProvider.getClient().getPublication(
ContentNamespace.Sites,
publicationId,
"requiredMeta:" + PublicationCustomMetadata,
null);
String PublicationCustomMetadataValue = publication == null ||
publication.getCustomMetas() == null ||
!publication.getCustomMetas()
.getEdges()
.stream()
.anyMatch(meta -> PublicationCustomMetadata.equals(meta.getNode().getValue()));
Updated:
In the backend, it will generate something like Graphql query request for customMetas
{
publication(namespaceId: 1, publicationId:8)
{
customMetas(filter: "requiredMeta:CustomMetadataFieldName")
{
edges
{
node
{
key
value
}
}
}
}
}
I hope it helps.