import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
+import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
import org.opendaylight.yangtools.yang.model.util.ModuleIdentifierImpl;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
@Override
public void onPreLinkageDeclared(final StmtContext.Mutable<String, BelongsToStatement,
EffectiveStatement<String, BelongsToStatement>> belongsToCtx) {
- belongsToCtx.addRequiredSource(RevisionSourceIdentifier.create(belongsToCtx.getStatementArgument()));
+ belongsToCtx.addRequiredSource(getSourceIdentifier(belongsToCtx));
}
@Override
EffectiveStatement<String, BelongsToStatement>> belongsToCtx) {
ModelActionBuilder belongsToAction = belongsToCtx.newInferenceAction(ModelProcessingPhase.SOURCE_LINKAGE);
- final ModuleIdentifier belongsToModuleIdentifier = getModuleIdentifier(belongsToCtx);
+ final SourceIdentifier belongsToSourceIdentifier = getSourceIdentifier(belongsToCtx);
+ final ModuleIdentifier belongsToModuleIdentifier = ModuleIdentifierImpl.create(
+ belongsToCtx.getStatementArgument(), Optional.empty(),
+ Optional.of(SimpleDateFormatUtil.DEFAULT_BELONGS_TO_DATE));
final Prerequisite<StmtContext<?, ?, ?>> belongsToPrereq = belongsToAction.requiresCtx(belongsToCtx,
ModuleNamespaceForBelongsTo.class, belongsToModuleIdentifier.getName(),
ModelProcessingPhase.SOURCE_LINKAGE);
public void apply(final InferenceContext ctx) {
StmtContext<?, ?, ?> belongsToModuleCtx = belongsToPrereq.resolve(ctx);
- belongsToCtx.addToNs(BelongsToModuleContext.class, belongsToModuleIdentifier, belongsToModuleCtx);
+ belongsToCtx.addToNs(BelongsToModuleContext.class, belongsToSourceIdentifier, belongsToModuleCtx);
belongsToCtx.addToNs(BelongsToPrefixToModuleIdentifier.class,
StmtContextUtils.findFirstDeclaredSubstatement(belongsToCtx, PrefixStatement.class)
.getStatementArgument(), belongsToModuleIdentifier);
});
}
- private static ModuleIdentifier getModuleIdentifier(final Mutable<String, BelongsToStatement,
+ private static SourceIdentifier getSourceIdentifier(final StmtContext<String, BelongsToStatement,
EffectiveStatement<String, BelongsToStatement>> belongsToCtx) {
- return ModuleIdentifierImpl.create(belongsToCtx.getStatementArgument(), Optional.empty(),
- Optional.of(SimpleDateFormatUtil.DEFAULT_BELONGS_TO_DATE));
+ return RevisionSourceIdentifier.create(belongsToCtx.getStatementArgument());
}
@Override