use of org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.relation.ProcessingMilestoning in project legend-engine by finos.
the class HelperRelationalBuilder method getColumn.
private static Column getColumn(TableAlias tableAlias, String propertyName) {
Table table = (Table) tableAlias._relationalElement();
BusinessMilestoning businessMilestoning = table._milestoning().selectInstancesOf(BusinessMilestoning.class).getFirst();
ProcessingMilestoning processingMilestoning = table._milestoning().selectInstancesOf(ProcessingMilestoning.class).getFirst();
switch(propertyName) {
case "from":
return businessMilestoning._from();
case "thru":
return businessMilestoning._thru();
case "in":
return processingMilestoning._in();
case "out":
return processingMilestoning._out();
default:
return null;
}
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.relation.ProcessingMilestoning in project legend-pure by finos.
the class DatabaseProcessor method processTableMilestoning.
private static void processTableMilestoning(CoreInstance tableCoreInstance, MapIterable<String, Column> columnsByName, Matcher matcher, ProcessorState processorState, ProcessorSupport processorSupport) {
if (tableCoreInstance instanceof Table) {
Table table = (Table) tableCoreInstance;
for (Milestoning milestoningInfo : table._milestoning()) {
milestoningInfo._owner(table);
if (milestoningInfo instanceof BusinessMilestoning) {
BusinessMilestoning businessMilestoning = (BusinessMilestoning) milestoningInfo;
if (processorSupport.instance_instanceOf(businessMilestoning._from(), M3Paths.String)) {
String businessFrom = businessMilestoning._from() == null ? "" : businessMilestoning._from().getName();
Column businessFromColumn = getColumn(table, columnsByName, businessFrom);
businessMilestoning._from(businessFromColumn);
}
if (processorSupport.instance_instanceOf(businessMilestoning._thru(), M3Paths.String)) {
String businessThru = businessMilestoning._thru() == null ? "" : businessMilestoning._thru().getName();
Column businessThruColumn = getColumn(table, columnsByName, businessThru);
businessMilestoning._thru(businessThruColumn);
}
} else if (milestoningInfo instanceof BusinessSnapshotMilestoning) {
BusinessSnapshotMilestoning businessSnapshotMilestoning = (BusinessSnapshotMilestoning) milestoningInfo;
if (processorSupport.instance_instanceOf(businessSnapshotMilestoning._snapshotDate(), M3Paths.String)) {
String snapshotDateColumnName = businessSnapshotMilestoning._snapshotDate().getName();
Column snapshotDateColumn = getColumn(table, columnsByName, snapshotDateColumnName);
if (!(snapshotDateColumn._type() instanceof Date)) {
throw new PureCompilationException(snapshotDateColumn.getSourceInformation(), "Column set as BUS_SNAPSHOT_DATE can only be of type : [Date]");
}
businessSnapshotMilestoning._snapshotDate(snapshotDateColumn);
}
} else if (milestoningInfo instanceof ProcessingMilestoning) {
ProcessingMilestoning processingMilestoning = (ProcessingMilestoning) milestoningInfo;
if (processorSupport.instance_instanceOf(processingMilestoning._in(), M3Paths.String)) {
String processingIn = processingMilestoning._in() == null ? "" : processingMilestoning._in().getName();
Column processingInColumn = getColumn(table, columnsByName, processingIn);
processingMilestoning._in(processingInColumn);
}
if (processorSupport.instance_instanceOf(processingMilestoning._out(), M3Paths.String)) {
String processingOut = processingMilestoning._out() == null ? "" : processingMilestoning._out().getName();
Column processingOutColumn = getColumn(table, columnsByName, processingOut);
processingMilestoning._out(processingOutColumn);
}
} else {
PostProcessor.processElement(matcher, milestoningInfo, processorState, processorSupport);
if (!milestoningInfo.hasBeenProcessed()) {
throw new PureCompilationException(milestoningInfo.getSourceInformation(), "Unknown milestoning type: " + PackageableElement.getUserPathForPackageableElement(milestoningInfo.getClassifier()));
}
}
}
}
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.relation.ProcessingMilestoning in project legend-pure by finos.
the class MilestoningPropertyMappingProcessor method getColumn.
private static Column getColumn(String milestoningPropertyName, TableAlias tableAlias) {
Table table = (Table) tableAlias._relationalElement();
BusinessMilestoning businessMilestoning = table._milestoning().selectInstancesOf(BusinessMilestoning.class).getFirst();
ProcessingMilestoning processingMilestoning = table._milestoning().selectInstancesOf(ProcessingMilestoning.class).getFirst();
switch(milestoningPropertyName) {
case "from":
return businessMilestoning._from();
case "thru":
return businessMilestoning._thru();
case "in":
return processingMilestoning._in();
case "out":
return processingMilestoning._out();
default:
return null;
}
}
Aggregations