}
}
}
}
if (writeORProject && !isNullStream(dbwsOrStream)) {
XMLContext context = new XMLContext(new ObjectPersistenceWorkbenchXMLProject());
context.getSession(orProject).getEventManager().addListener(new MissingDescriptorListener());
XMLMarshaller marshaller = context.createMarshaller();
marshaller.marshal(orProject, new OutputStreamWriter(dbwsOrStream));
}
if (!isNullStream(dbwsOxStream)) {
boolean writeOXProject = false;
if (dbTables.size() > 0 || hasBuildSqlOperations()) {
writeOXProject = true;
}
else if (dbStoredProcedures.size() > 0) {
for (DbStoredProcedure storedProcedure : dbStoredProcedures) {
for (DbStoredArgument storedArgument : storedProcedure.getArguments()) {
if (storedArgument instanceof PLSQLStoredArgument) {
writeOXProject = true;
break;
}
}
if (writeOXProject) {
break;
}
}
if (!writeOXProject) {
// check for any named queries - SimpleXMLFormatProject's sometimes need them
if (orProject.getQueries().size() > 0) {
writeOXProject = true;
}
// check for ObjectRelationalDataTypeDescriptor's - Advanced JDBC object/varray types
else if (orProject.getDescriptors().size() > 0) {
Collection<ClassDescriptor> descriptors = orProject.getDescriptors().values();
for (ClassDescriptor desc : descriptors) {
if (desc.isObjectRelationalDataTypeDescriptor()) {
writeOXProject = true;
break;
}
}
}
}
}
if (writeOXProject) {
XMLContext context = new XMLContext(new ObjectPersistenceWorkbenchXMLProject());
context.getSession(oxProject).getEventManager().addListener(new MissingDescriptorListener());
XMLMarshaller marshaller = context.createMarshaller();
marshaller.marshal(oxProject, new OutputStreamWriter(dbwsOxStream));
}
}
packager.closeOrStream(dbwsOrStream);
packager.closeOxStream(dbwsOxStream);