use of org.hisp.dhis.antlr.ParserExceptionWithoutContext in project dhis2-core by dhis2.
the class DimensionalItem method getDescription.
@Override
public final Object getDescription(ExprContext ctx, CommonExpressionVisitor visitor) {
DimensionalItemId itemId = getDimensionalItemId(ctx, visitor);
DimensionalItemObject item = visitor.getDimensionService().getDataDimensionalItemObject(itemId);
if (item == null) {
throw new ParserExceptionWithoutContext("Can't find " + itemId.getDimensionItemType().name() + " for '" + itemId + "'");
}
visitor.getItemDescriptions().put(ctx.getText(), item.getDisplayName());
return ValidationUtils.getNullReplacementValue(getItemValueType(item));
}
use of org.hisp.dhis.antlr.ParserExceptionWithoutContext in project dhis2-core by dhis2.
the class FunctionOrgUnitAncestor method getDescription.
@Override
public Object getDescription(ExpressionParser.ExprContext ctx, CommonExpressionVisitor visitor) {
for (TerminalNode uid : ctx.UID()) {
OrganisationUnit orgUnit = visitor.getIdObjectManager().get(OrganisationUnit.class, uid.getText());
if (orgUnit == null) {
throw new ParserExceptionWithoutContext("No organization unit defined for " + uid.getText());
}
visitor.getItemDescriptions().put(uid.getText(), orgUnit.getDisplayName());
}
return false;
}
use of org.hisp.dhis.antlr.ParserExceptionWithoutContext in project dhis2-core by dhis2.
the class ProgramItemPsEventdate method getDescription.
@Override
public Object getDescription(ExprContext ctx, CommonExpressionVisitor visitor) {
String programStageUid = ctx.uid0.getText();
ProgramStage programStage = visitor.getProgramStageService().getProgramStage(programStageUid);
if (programStage == null) {
throw new ParserExceptionWithoutContext("Program stage " + ctx.uid0.getText() + " not found");
}
visitor.getItemDescriptions().put(programStageUid, programStage.getDisplayName());
return DEFAULT_DATE_VALUE;
}
use of org.hisp.dhis.antlr.ParserExceptionWithoutContext in project dhis2-core by dhis2.
the class ProgramItemAttribute method getDescription.
@Override
public Object getDescription(ExprContext ctx, CommonExpressionVisitor visitor) {
String attributeId = getProgramAttributeId(ctx);
TrackedEntityAttribute attribute = visitor.getIdObjectManager().get(TrackedEntityAttribute.class, attributeId);
if (attribute == null) {
throw new ParserExceptionWithoutContext("Tracked entity attribute " + attributeId + " not found.");
}
visitor.getItemDescriptions().put(ctx.getText(), attribute.getDisplayName());
return ValidationUtils.getNullReplacementValue(attribute.getValueType());
}
use of org.hisp.dhis.antlr.ParserExceptionWithoutContext in project dhis2-core by dhis2.
the class ProgramItemAttribute method getSql.
@Override
public Object getSql(ExprContext ctx, CommonExpressionVisitor visitor) {
String attributeId = getProgramAttributeId(ctx);
String column = visitor.getStatementBuilder().columnQuote(attributeId);
if (visitor.getState().isReplaceNulls()) {
TrackedEntityAttribute attribute = visitor.getIdObjectManager().get(TrackedEntityAttribute.class, attributeId);
if (attribute == null) {
throw new ParserExceptionWithoutContext("Tracked entity attribute " + attributeId + " not found during SQL generation.");
}
column = replaceNullSqlValues(column, attribute.getValueType());
}
return column;
}
Aggregations