Search in sources :

Example 1 with BaseDatabaseTypeVisitor

use of org.eclipse.persistence.tools.oracleddl.metadata.visit.BaseDatabaseTypeVisitor 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());
    }
}
Also used : BaseDatabaseTypeVisitor(org.eclipse.persistence.tools.oracleddl.metadata.visit.BaseDatabaseTypeVisitor) ProcedureType(org.eclipse.persistence.tools.oracleddl.metadata.ProcedureType) PLSQLPackageType(org.eclipse.persistence.tools.oracleddl.metadata.PLSQLPackageType) CompositeDatabaseType(org.eclipse.persistence.tools.oracleddl.metadata.CompositeDatabaseType) ComplexDatabaseType(org.eclipse.persistence.internal.helper.ComplexDatabaseType) DatabaseType(org.eclipse.persistence.tools.oracleddl.metadata.DatabaseType) Util.getAttributeClassForDatabaseType(org.eclipse.persistence.tools.dbws.Util.getAttributeClassForDatabaseType) BaseDatabaseTypeVisitor(org.eclipse.persistence.tools.oracleddl.metadata.visit.BaseDatabaseTypeVisitor) DatabaseTypeVisitor(org.eclipse.persistence.tools.oracleddl.metadata.visit.DatabaseTypeVisitor) ArgumentType(org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType) PLSQLType(org.eclipse.persistence.tools.oracleddl.metadata.PLSQLType) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 ComplexDatabaseType (org.eclipse.persistence.internal.helper.ComplexDatabaseType)1 Util.getAttributeClassForDatabaseType (org.eclipse.persistence.tools.dbws.Util.getAttributeClassForDatabaseType)1 ArgumentType (org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType)1 CompositeDatabaseType (org.eclipse.persistence.tools.oracleddl.metadata.CompositeDatabaseType)1 DatabaseType (org.eclipse.persistence.tools.oracleddl.metadata.DatabaseType)1 PLSQLPackageType (org.eclipse.persistence.tools.oracleddl.metadata.PLSQLPackageType)1 PLSQLType (org.eclipse.persistence.tools.oracleddl.metadata.PLSQLType)1 ProcedureType (org.eclipse.persistence.tools.oracleddl.metadata.ProcedureType)1 BaseDatabaseTypeVisitor (org.eclipse.persistence.tools.oracleddl.metadata.visit.BaseDatabaseTypeVisitor)1 DatabaseTypeVisitor (org.eclipse.persistence.tools.oracleddl.metadata.visit.DatabaseTypeVisitor)1