- this.qname = ctx.getStatementArgument();
- this.path = Utils.getSchemaPath(ctx);
- this.constraintsDef = new EffectiveConstraintDefinitionImpl(this);
-
- initSubstatementCollectionsAndFields();
- initCopyType(ctx);
- }
-
- private void initCopyType(
- final StmtContext<QName, AnyxmlStatement, EffectiveStatement<QName, AnyxmlStatement>> ctx) {
-
- List<TypeOfCopy> copyTypesFromOriginal = ctx.getCopyHistory();
-
- if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
- augmenting = true;
- }
- if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
- addedByUses = true;
- }
- if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
- addedByUses = augmenting = true;
- }
-
- if (ctx.getOriginalCtx() != null) {
- original = (AnyXmlSchemaNode) ctx.getOriginalCtx().buildEffective();
- }
- }
-
- private void initSubstatementCollectionsAndFields() {
- Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
-
- List<UnknownSchemaNode> unknownNodesInit = new LinkedList<>();
-
- boolean configurationInit = false;
- for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
- if (effectiveStatement instanceof UnknownSchemaNode) {
- UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
- unknownNodesInit.add(unknownNode);
- }
- if (!configurationInit
- && effectiveStatement instanceof ConfigEffectiveStatementImpl) {
- ConfigEffectiveStatementImpl configStmt = (ConfigEffectiveStatementImpl) effectiveStatement;
- this.configuration = configStmt.argument();
- configurationInit = true;
- }
- }
-
- this.unknownNodes = ImmutableList.copyOf(unknownNodesInit);
- }
-
- @Override
- public QName getQName() {
- return qname;
- }
-
- @Override
- public SchemaPath getPath() {
- return path;
- }
-
- @Override
- public boolean isAugmenting() {
- return augmenting;
- }
-
- @Override
- public boolean isAddedByUses() {
- return addedByUses;