in objectModel/TypeScript/Cdm/CdmCorpusDefinition.ts [2068:2199]
private reportErrorStatus(found: CdmObjectBase, symbolDef: string, expectedType: cdmObjectType): CdmObjectBase {
const ctx: resolveContext = this.ctx as resolveContext;
switch (expectedType) {
case cdmObjectType.traitRef:
if (!isCdmTraitDefinition(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'trait', symbolDef);
return undefined;
}
break;
case cdmObjectType.dataTypeRef:
if (!isDataTypeDefinition(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'dataType', symbolDef);
return undefined;
}
break;
case cdmObjectType.entityRef:
if (!isEntityDefinition(found) && !isProjection(found) && !isConstantEntityDefinition(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'entity or type projection or type constant entity', symbolDef);
return undefined;
}
break;
case cdmObjectType.parameterDef:
if (!isParameterDefinition(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'parameter', symbolDef);
return undefined;
}
break;
case cdmObjectType.purposeRef:
if (!isPurposeDefinition(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'purpose', symbolDef);
return undefined;
}
break;
case cdmObjectType.traitGroupRef:
if (!isCdmTraitGroupDefinition(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'traitGroup', symbolDef);
return undefined;
}
break;
case cdmObjectType.attributeGroupRef:
if (!isAttributeGroupDefinition(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'attributeGroup', symbolDef);
return undefined;
}
break;
case cdmObjectType.projectionDef:
if (!isProjection(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'projection', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationAddCountAttributeDef:
if (!isOperationAddCountAttribute(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'add count attribute operation', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationAddSupportingAttributeDef:
if (!isOperationAddSupportingAttribute(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'add supporting attribute operation', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationAddTypeAttributeDef:
if (!isOperationAddTypeAttribute(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'add type attribute operation', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationExcludeAttributesDef:
if (!isOperationExcludeAttributes(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'exclude attributes operation', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationArrayExpansionDef:
if (!isOperationArrayExpansion(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'array expansion operation', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationCombineAttributesDef:
if (!isOperationCombineAttributes(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'combine attributes operation', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationRenameAttributesDef:
if (!isOperationRenameAttributes(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'rename attributes operation', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationReplaceAsForeignKeyDef:
if (!isOperationReplaceAsForeignKey(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'replace as foreign key operation', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationIncludeAttributesDef:
if (!isOperationIncludeAttributes(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'include attributes operation', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationAddAttributeGroupDef:
if (!isOperationAddAttributeGroup(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'add attribute group operation', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationAlterTraitsDef:
if (!isOperationAlterTraits(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'alter traits operation', symbolDef);
return undefined;
}
break;
case cdmObjectType.operationAddArtifactAttributeDef:
if (!isOperationAddArtifactAttribute(found)) {
Logger.error(this.ctx, this.TAG, this.reportErrorStatus.name, found.atCorpusPath, cdmLogCode.ErrUnexpectedType, 'add artifact attribute operation', symbolDef);
return undefined;
}
break;
default:
}
return found;
}