Search in sources :

Example 1 with IJoinQueryString

use of org.apereo.portal.jdbc.IJoinQueryString in project uPortal by Jasig.

the class RDBMUserLayoutStore method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    if (this.databaseMetadata.supportsOuterJoins()) {
        final IJoinQueryString joinQuery = this.databaseMetadata.getJoinQuery();
        if (joinQuery instanceof DatabaseMetaDataImpl.JdbcDb) {
            joinQuery.addQuery("layout", "{oj UP_LAYOUT_STRUCT ULS LEFT OUTER JOIN UP_LAYOUT_PARAM USP ON ULS.USER_ID = USP.USER_ID AND ULS.STRUCT_ID = USP.STRUCT_ID} WHERE");
            joinQuery.addQuery("ss_struct", "{oj UP_SS_STRUCT USS LEFT OUTER JOIN UP_SS_STRUCT_PAR USP ON USS.SS_ID=USP.SS_ID} WHERE");
            joinQuery.addQuery("ss_theme", "{oj UP_SS_THEME UTS LEFT OUTER JOIN UP_SS_THEME_PARM UTP ON UTS.SS_ID=UTP.SS_ID} WHERE");
        } else if (joinQuery instanceof DatabaseMetaDataImpl.PostgreSQLDb) {
            joinQuery.addQuery("layout", "UP_LAYOUT_STRUCT ULS LEFT OUTER JOIN UP_LAYOUT_PARAM USP ON ULS.USER_ID = USP.USER_ID AND ULS.STRUCT_ID = USP.STRUCT_ID WHERE");
            joinQuery.addQuery("ss_struct", "UP_SS_STRUCT USS LEFT OUTER JOIN UP_SS_STRUCT_PAR USP ON USS.SS_ID=USP.SS_ID WHERE");
            joinQuery.addQuery("ss_theme", "UP_SS_THEME UTS LEFT OUTER JOIN UP_SS_THEME_PARM UTP ON UTS.SS_ID=UTP.SS_ID WHERE");
        } else if (joinQuery instanceof DatabaseMetaDataImpl.OracleDb) {
            joinQuery.addQuery("layout", "UP_LAYOUT_STRUCT ULS, UP_LAYOUT_PARAM USP WHERE ULS.STRUCT_ID = USP.STRUCT_ID(+) AND ULS.USER_ID = USP.USER_ID(+) AND");
            joinQuery.addQuery("ss_struct", "UP_SS_STRUCT USS, UP_SS_STRUCT_PAR USP WHERE USS.SS_ID=USP.SS_ID(+) AND");
            joinQuery.addQuery("ss_theme", "UP_SS_THEME UTS, UP_SS_THEME_PARM UTP WHERE UTS.SS_ID=UTP.SS_ID(+) AND");
        } else {
            throw new RuntimeException("Unknown database driver");
        }
    }
}
Also used : IJoinQueryString(org.apereo.portal.jdbc.IJoinQueryString) DatabaseMetaDataImpl(org.apereo.portal.jdbc.DatabaseMetaDataImpl)

Aggregations

DatabaseMetaDataImpl (org.apereo.portal.jdbc.DatabaseMetaDataImpl)1 IJoinQueryString (org.apereo.portal.jdbc.IJoinQueryString)1