* @param document The document.
* @return A link or <code>null</code>.
* @throws SiteException if an error occurs.
*/
protected Link getExistingLink(String path, Document document) throws SiteException {
SiteNode node = document.area().getSite().getNode(path);
Link link = null;
String uuid = node.getUuid();
if (uuid != null) {
if (node.hasLink(document.getLanguage())) {
link = node.getLink(document.getLanguage());
} else if (node.getLanguages().length > 0) {
link = node.getLink(node.getLanguages()[0]);
}
}
return link;
}