Skip to content

Commit

Permalink
[incubator-kie-issues#1344] Fixed as per PR suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele-Cardosi committed Jun 28, 2024
1 parent 12ae119 commit b41ed9f
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ public FEELFnResult<TemporalAccessor> invoke(@ParameterName( "from" ) String val
}
}

public FEELFnResult<TemporalAccessor> manageDateTimeException(DateTimeException e, String val) {
return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "date", e));
}


public FEELFnResult<TemporalAccessor> invoke(@ParameterName( "year" ) Number year, @ParameterName( "month" ) Number month, @ParameterName( "day" ) Number day) {
if ( year == null ) {
return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "year", "cannot be null"));
Expand Down Expand Up @@ -104,4 +99,8 @@ public FEELFnResult<TemporalAccessor> invoke(@ParameterName( "from" ) TemporalAc
return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "from", "date-parsing exception", e));
}
}

protected FEELFnResult<TemporalAccessor> manageDateTimeException(DateTimeException e, String val) {
return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "date", e));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
import org.kie.dmn.api.feel.runtime.events.FEELEvent.Severity;
import org.kie.dmn.feel.runtime.events.InvalidParametersEvent;

/**
* provisional access for DMN14-126
*/
public class RoundDownFunction
extends BaseFEELFunction {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
import org.kie.dmn.api.feel.runtime.events.FEELEvent.Severity;
import org.kie.dmn.feel.runtime.events.InvalidParametersEvent;

/**
* provisional access for DMN14-126
*/
public class RoundHalfDownFunction
extends BaseFEELFunction {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
import org.kie.dmn.api.feel.runtime.events.FEELEvent.Severity;
import org.kie.dmn.feel.runtime.events.InvalidParametersEvent;

/**
* provisional access for DMN14-126
*/
public class RoundHalfUpFunction
extends BaseFEELFunction {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
import org.kie.dmn.api.feel.runtime.events.FEELEvent.Severity;
import org.kie.dmn.feel.runtime.events.InvalidParametersEvent;

/**
* provisional access for DMN14-126
*/
public class RoundUpFunction
extends BaseFEELFunction {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ public FEELFnResult<TemporalAccessor> invoke(@ParameterName("from") String val)
}
}

public FEELFnResult<TemporalAccessor> manageDateTimeException(DateTimeException e, String val) {
return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "from", e));
}

public FEELFnResult<TemporalAccessor> invoke(
@ParameterName("hour") Number hour, @ParameterName("minute") Number minute,
@ParameterName("second") Number seconds) {
Expand Down Expand Up @@ -174,4 +170,8 @@ public FEELFnResult<TemporalAccessor> invoke(@ParameterName("from") TemporalAcce
}
}

protected FEELFnResult<TemporalAccessor> manageDateTimeException(DateTimeException e, String val) {
return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "from", e));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public FEELFnResult<TemporalAccessor> invoke(@ParameterName( "from" ) TemporalAc
}

@Override
public FEELFnResult<TemporalAccessor> manageDateTimeException(DateTimeException e, String val) {
protected FEELFnResult<TemporalAccessor> manageDateTimeException(DateTimeException e, String val) {
// try to parse it as a date time and extract the date component
// NOTE: this is an extension to the standard
return BuiltInFunctions.getFunction(DateAndTimeFunction.class).invoke(val)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public FEELFnResult<TemporalAccessor> invoke(@ParameterName("from") TemporalAcce
}

@Override
public FEELFnResult<TemporalAccessor> manageDateTimeException(DateTimeException e, String val) {
protected FEELFnResult<TemporalAccessor> manageDateTimeException(DateTimeException e, String val) {
// try to parse it as a date time and extract the date component
// NOTE: this is an extension to the standard
return BuiltInFunctions.getFunction(DateAndTimeFunction.class).invoke(val)
Expand Down

0 comments on commit b41ed9f

Please sign in to comment.