/** * Creates a SyncLink instance out of a {@link CnALink} instance. SyncLink is a JAXB Xml class * generated out of verinice import and export XML schema files: sernet/verinice/service/sync * sync.xsd data.xsd mapping.xsd * * @param syncLink * @param link */ public static void transform(CnALink link, List<SyncLink> syncLinkXmlList) { SyncLink syncLink = new SyncLink(); syncLink.setDependant(ExportFactory.createExtId(link.getDependant())); syncLink.setDependency(ExportFactory.createExtId(link.getDependency())); syncLink.setRelationId(link.getRelationId()); if (link.getComment() != null && !link.getComment().isEmpty()) { syncLink.setComment(link.getComment()); } syncLinkXmlList.add(syncLink); }
private void exportLinks(final SyncData syncData) { for (final CnALink link : linkSet) { CnATreeElement dependant = link.getDependant(); dependant = getFromCache(dependant); if (dependant == null) { log.warn("Dependant of link not found. Check access rights. " + link.getId()); continue; } link.setDependant(dependant); CnATreeElement dependency = link.getDependency(); dependency = getFromCache(dependency); if (dependency == null) { log.warn("Dependency of link not found. Check access rights. " + link.getId()); continue; } link.setDependency(dependency); ExportFactory.transform(link, syncData.getSyncLink()); } }