use of com.developmentontheedge.be5.operation.OperationContext in project be5 by DevelopmentOnTheEdge.
the class OperationExecutorImpl method create.
@Override
public Operation create(String entityName, String queryName, String operationName, String[] selectedRows, Map<String, String> operationParams) {
OperationInfo operationInfo = userAwareMeta.getOperation(entityName, operationName);
OperationContext operationContext = new OperationContext(selectedRows, queryName, operationParams);
return create(operationInfo, operationContext);
}
use of com.developmentontheedge.be5.operation.OperationContext in project be5 by DevelopmentOnTheEdge.
the class OperationExecutorImpl method create.
@Override
public Operation create(OperationInfo operationInfo, OperationContext operationContext) {
Operation operation;
switch(operationInfo.getType()) {
case OPERATION_TYPE_GROOVY:
try {
Class aClass = groovyOperationLoader.get(operationInfo);
if (aClass != null) {
operation = (Operation) aClass.newInstance();
} else {
throw Be5Exception.internalInOperation(new Error("Class " + operationInfo.getCode() + " is null."), operationInfo.getModel());
}
} catch (NoClassDefFoundError | IllegalAccessException | InstantiationException e) {
throw new UnsupportedOperationException("Groovy feature has been excluded", e);
} catch (Throwable e) {
throw Be5Exception.internalInOperation(e, operationInfo.getModel());
}
break;
case OPERATION_TYPE_JAVA:
try {
operation = (Operation) Class.forName(operationInfo.getCode()).newInstance();
break;
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
throw Be5Exception.internalInOperation(new RuntimeException("It is possible to use the 'file:' instead of the 'code:' " + "in the yaml file. \n\t" + e.getMessage(), e), operationInfo.getModel());
}
case OPERATION_TYPE_JAVAFUNCTION:
case OPERATION_TYPE_SQL:
case OPERATION_TYPE_JAVASCRIPT:
case OPERATION_TYPE_JSSERVER:
case OPERATION_TYPE_DOTNET:
case OPERATION_TYPE_JAVADOTNET:
throw Be5Exception.internal("Not support operation type: " + operationInfo.getType());
default:
throw Be5Exception.internal("Unknown action type '" + operationInfo.getType() + "'");
}
operation.initialize(operationInfo, operationContext, OperationResult.create());
injector.injectAnnotatedFields(operation);
return operation;
}
Aggregations