use of org.eclipse.persistence.tools.oracleddl.metadata.visit.DatabaseTypeVisitor in project eclipselink by eclipse-ee4j.
the class OracleHelper method buildDbArtifacts.
@Override
public void buildDbArtifacts() {
super.buildDbArtifacts();
// list of all directly-referenced packages
Set<PLSQLPackageType> directPackages = new HashSet<PLSQLPackageType>();
for (ProcedureType procedureType : dbStoredProcedures) {
for (ArgumentType argumentType : procedureType.getArguments()) {
DatabaseType argumentDataType = argumentType.getEnclosedType();
if (argumentDataType.isPLSQLType()) {
PLSQLType plsqlType = (PLSQLType) argumentDataType;
directPackages.add(plsqlType.getParentType());
}
}
}
// any indirectly-referenced packages?
final Set<PLSQLPackageType> indirectPackages = new HashSet<PLSQLPackageType>();
DatabaseTypeVisitor indirectVisitor = new BaseDatabaseTypeVisitor() {
@Override
public void beginVisit(PLSQLPackageType databaseType) {
indirectPackages.add(databaseType);
}
};
for (PLSQLPackageType pckage : directPackages) {
pckage.accept(indirectVisitor);
}
Set<PLSQLPackageType> packages = new HashSet<PLSQLPackageType>();
packages.addAll(directPackages);
packages.addAll(indirectPackages);
for (PLSQLPackageType pckage : packages) {
ShadowDDLGenerator ddlGenerator = new ShadowDDLGenerator(pckage);
dbwsBuilder.getTypeDDL().addAll(ddlGenerator.getAllCreateDDLs());
dbwsBuilder.getTypeDropDDL().addAll(ddlGenerator.getAllDropDDLs());
}
}
Aggregations