public SNode createChildNode(Object parameterObject, SModel model, String pattern) { SNode childNode = SModelUtil_new.instantiateConceptDeclaration( NameUtil.nodeFQName(mySmartConcept), model, GlobalScope.getInstance()); String referentRole = SModelUtil.getGenuineLinkRole(mySmartReference); childNode.setReferenceTarget(referentRole, myReferentNode); NodeFactoryManager.setupNode( mySmartConcept, childNode, myCurrentChild, myParentNode, model, getScope()); return childNode; }
public void checkNode( final SNode node, LanguageErrorsComponent component, final IOperationContext operationContext, IScope scope) { if (operationContext == null) { return; } if (SNodeUtil.getMetaLevel(node) != 0) { return; } SNode concept = SNodeOperations.getConceptDeclaration(node); for (SReference ref : SNodeOperations.getReferences(node)) { SNode target = SLinkOperations.getTargetNode(ref); SNode ld = SLinkOperations.findLinkDeclaration(ref); // don't check unresolved and broken references, they should already have an error message if ((target == null) || ld == null) { continue; } component.addDependency(target); component.addDependency(ld); component.addDependency(node); component.addDependency(SNodeOperations.getParent(node)); for (SNode c : SNodeOperations.getChildren(node)) { component.addDependency(c); } String linkRole = SModelUtil.getGenuineLinkRole(ld); final SNode linkTarget = SLinkOperations.getTarget(ld, "target", false); final INodeReferentSearchScopeProvider scopeProvider = ModelConstraintsUtil.getSearchScopeProvider(concept, linkRole); SearchScopeStatus searchScopeStatus = component.runCheckingAction( new _FunctionTypes._return_P0_E0<SearchScopeStatus>() { public SearchScopeStatus invoke() { return ModelConstraintsUtil.createSearchScope( scopeProvider, SNodeOperations.getModel(node), SNodeOperations.getParent(node), node, linkTarget, operationContext); } }); if (searchScopeStatus.isError()) { component.addError( node, searchScopeStatus.getMessage(), (SNode) null, new ReferenceMessageTarget(SLinkOperations.getRole(ref))); } else if (!(searchScopeStatus.isDefault() || searchScopeStatus.getSearchScope().isInScope(target))) { String name = target.getName(); component.addError( node, "reference" + ((name == null ? "" : " " + name)) + " (" + SLinkOperations.getRole(ref) + ") is out of search scope", searchScopeStatus.getReferenceValidatorNode(), new ReferenceMessageTarget(SLinkOperations.getRole(ref))); } } }