use of org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType in project eclipselink by eclipse-ee4j.
the class BaseDBWSBuilderHelper method buildTypesList.
/**
* Uses a custom visitor to traverse each procedure/function argument and build
* a list of required Types. Only on instance of a given type will exist in
* the list.
*/
public List<CompositeDatabaseType> buildTypesList(List<OperationModel> operations) {
EnclosedTypeVisitor etVisitor = new EnclosedTypeVisitor();
for (OperationModel opModel : operations) {
if (opModel.isProcedureOperation()) {
ProcedureOperationModel procedureOperation = (ProcedureOperationModel) opModel;
if (procedureOperation.isPLSQLProcedureOperation() || procedureOperation.isAdvancedJDBCProcedureOperation()) {
for (ProcedureType procType : procedureOperation.getDbStoredProcedures()) {
// build list of arguments to process (i.e. build descriptors for)
List<ArgumentType> args = new ArrayList<ArgumentType>();
// return argument
if (procType.isFunctionType()) {
// assumes that a function MUST have a return type
args.add(((FunctionType) procType).getReturnArgument());
}
args.addAll(procType.getArguments());
// now visit each argument
for (ArgumentType arg : args) {
// handle ROWTYPETypes
if (arg.getEnclosedType().isROWTYPEType()) {
ROWTYPEType rType = (ROWTYPEType) arg.getEnclosedType();
TableType tableType = (TableType) rType.getEnclosedType();
PLSQLRecordType plsqlRec = new PLSQLRecordType(rType.getTypeName());
plsqlRec.setParentType(new PLSQLPackageType());
for (FieldType col : tableType.getColumns()) {
FieldType ft = new FieldType(col.getFieldName());
ft.setEnclosedType(col.getEnclosedType());
plsqlRec.addField(ft);
}
arg.setEnclosedType(plsqlRec);
}
// now visit each, adding types (only one instance of each) to the list
if (arg.isComposite()) {
etVisitor.visit((CompositeDatabaseType) arg);
}
}
}
}
}
}
// gather Complex types to hand into XMLEntityMappingsGenerator
List<CompositeDatabaseType> types = etVisitor.getCompositeDatabaseTypes();
for (CompositeDatabaseType type : types) {
complextypes.add(type);
}
return etVisitor.getCompositeDatabaseTypes();
}
use of org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType in project eclipselink by eclipse-ee4j.
the class JPAMetadataGenerator method processPLSQLProcedureType.
/**
* Generate a PL/SQL stored procedure query based on the given ProcedureType.
*/
protected NamedPLSQLStoredProcedureQueryMetadata processPLSQLProcedureType(ProcedureType pType, PLSQLPackageType pkgType) {
NamedPLSQLStoredProcedureQueryMetadata storedProc = new NamedPLSQLStoredProcedureQueryMetadata();
storedProc.setName(getQueryNameForProcedureType(pType));
storedProc.setProcedureName(pkgType.getPackageName() + DOT + pType.getProcedureName());
// process the procedure's arguments
if (pType.getArguments().size() > 0) {
List<PLSQLParameterMetadata> params = new ArrayList<PLSQLParameterMetadata>();
for (ArgumentType arg : pType.getArguments()) {
params.add(processPLSQLArgument(arg));
}
storedProc.setParameters(params);
}
return storedProc;
}
use of org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType in project eclipselink by eclipse-ee4j.
the class JPAMetadataGenerator method processPLSQLFunctionType.
/**
* Generate a PL/SQL stored function query based on the given FunctionType.
*/
protected NamedPLSQLStoredFunctionQueryMetadata processPLSQLFunctionType(FunctionType fType, PLSQLPackageType pkgType) {
NamedPLSQLStoredFunctionQueryMetadata storedFunc = new NamedPLSQLStoredFunctionQueryMetadata();
storedFunc.setName(getQueryNameForProcedureType(fType));
storedFunc.setProcedureName(pkgType.getPackageName() + DOT + fType.getProcedureName());
List<PLSQLParameterMetadata> params = new ArrayList<PLSQLParameterMetadata>();
// set the return parameter
storedFunc.setReturnParameter(processPLSQLArgument(fType.getReturnArgument()));
// process the function's arguments
if (fType.getArguments().size() > 0) {
for (ArgumentType arg : fType.getArguments()) {
params.add(processPLSQLArgument(arg));
}
}
storedFunc.setParameters(params);
return storedFunc;
}
use of org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType in project eclipselink by eclipse-ee4j.
the class JPAMetadataGenerator method processFunctionType.
/**
* Generate a stored function query based on the given FunctionType.
*/
protected NamedStoredFunctionQueryMetadata processFunctionType(FunctionType fType) {
NamedStoredFunctionQueryMetadata storedFunc = new NamedStoredFunctionQueryMetadata();
storedFunc.setName(getQueryNameForProcedureType(fType));
storedFunc.setProcedureName(fType.getProcedureName());
// set the return parameter
storedFunc.setReturnParameter(processArgument(fType.getReturnArgument()));
// process the function's arguments
if (fType.getArguments().size() > 0) {
List<StoredProcedureParameterMetadata> params = new ArrayList<StoredProcedureParameterMetadata>();
for (ArgumentType arg : fType.getArguments()) {
params.add(processArgument(arg));
}
storedFunc.setParameters(params);
}
return storedFunc;
}
use of org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType in project eclipselink by eclipse-ee4j.
the class JPAMetadataGenerator method processProcedureType.
/**
* Generate a stored procedure query based on the given ProcedureType.
*/
protected NamedStoredProcedureQueryMetadata processProcedureType(ProcedureType pType) {
NamedStoredProcedureQueryMetadata storedProc = new NamedStoredProcedureQueryMetadata();
storedProc.setName(getQueryNameForProcedureType(pType));
storedProc.setProcedureName(pType.getProcedureName());
storedProc.setReturnsResultSet(false);
// process the procedure's arguments
if (pType.getArguments().size() > 0) {
List<StoredProcedureParameterMetadata> params = new ArrayList<StoredProcedureParameterMetadata>();
for (ArgumentType arg : pType.getArguments()) {
params.add(processArgument(arg));
}
storedProc.setParameters(params);
}
return storedProc;
}
Aggregations