use of io.lumeer.engine.api.event.ImportLinkTypeContent in project engine by Lumeer.
the class LinkInstanceFacade method createLinkInstances.
public List<LinkInstance> createLinkInstances(final List<LinkInstance> linkInstances, final boolean sendIndividualNotifications) {
if (linkInstances.size() > 0) {
final String linkTypeId = linkInstances.get(0).getLinkTypeId();
var linkType = checkCreateLinks(linkTypeId);
checkLinkDocumentsExists(linkInstances);
if (linkInstances.stream().anyMatch(linkInstance -> !linkInstance.getLinkTypeId().equals(linkTypeId))) {
throw new BadFormatException("Cannot create link instances of multiple link types at once.");
}
final List<LinkInstance> storedLinkInstances = createLinkInstances(linkType, linkInstances, sendIndividualNotifications);
if (importLinkTypeContentEvent != null) {
importLinkTypeContentEvent.fire(new ImportLinkTypeContent(linkType));
}
return storedLinkInstances;
}
return linkInstances;
}
Aggregations