use of com.developmentontheedge.be5.metadata.model.GroovyOperation in project be5 by DevelopmentOnTheEdge.
the class GroovyOperationLoader method get.
public Class get(OperationInfo operationInfo) {
preloadSuperOperation(operationInfo);
GroovyOperation groovyOperation = (GroovyOperation) operationInfo.getModel();
String fileName = groovyOperation.getFileName();
String canonicalName = fileName.replace("/", ".");
String simpleName = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length() - ".groovy".length()).trim();
return groovyRegister.getClass(canonicalName, operationInfo.getCode(), simpleName + ".groovy");
}
use of com.developmentontheedge.be5.metadata.model.GroovyOperation in project be5 by DevelopmentOnTheEdge.
the class GroovyOperationLoader method getSimpleSuperClassName.
public String getSimpleSuperClassName(OperationInfo operationInfo) {
GroovyOperation groovyOperation = (GroovyOperation) operationInfo.getModel();
String fileName = groovyOperation.getFileName();
String className = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length() - ".groovy".length()).trim();
String classBegin = "class " + className + " extends ";
String code = operationInfo.getCode();
int superClassBeginPos = code.indexOf(classBegin);
if (superClassBeginPos == -1)
return null;
superClassBeginPos += classBegin.length();
int superClassEndPos = Math.min(code.indexOf(" ", superClassBeginPos) != -1 ? code.indexOf(" ", superClassBeginPos) : 999999999, code.indexOf("\n", superClassBeginPos));
return code.substring(superClassBeginPos, superClassEndPos).trim();
}
use of com.developmentontheedge.be5.metadata.model.GroovyOperation in project be5 by DevelopmentOnTheEdge.
the class GroovyOperationLoader method initOperationMap.
void initOperationMap() {
Map<String, com.developmentontheedge.be5.metadata.model.Operation> newOperationMap = new HashMap<>();
List<Entity> entities = meta.getOrderedEntities("ru");
for (Entity entity : entities) {
List<String> operationNames = meta.getOperationNames(entity);
for (String operationName : operationNames) {
com.developmentontheedge.be5.metadata.model.Operation operation = meta.getOperationIgnoringRoles(entity, operationName);
if (operation.getType().equals(OPERATION_TYPE_GROOVY)) {
GroovyOperation groovyOperation = (GroovyOperation) operation;
String fileName = groovyOperation.getFileName().replace("/", ".");
newOperationMap.put(fileName, operation);
}
}
}
groovyOperationsMap = newOperationMap;
}
Aggregations