Search in sources :

Example 1 with SortingNullprecedence

use of com.servoy.j2db.persistence.SortingNullprecedence in project servoy-client by Servoy.

the class FoundSetManager method getSortOptions.

@Override
public SortOptions getSortOptions(IColumn column) {
    boolean ignoreCase = false;
    SortingNullprecedence sortingNullprecedence = SortingNullprecedence.databaseDefault;
    if (column != null) {
        try {
            // First defined at server level
            IServer server = application.getSolution().getServer(column.getTable().getServerName());
            if (server != null) {
                ignoreCase = server.getSettings().isSortIgnorecase();
                sortingNullprecedence = server.getSettings().getSortingNullprecedence();
            }
        } catch (RepositoryException | RemoteException e) {
            Debug.error("Exception getting server settings", e);
        }
        ColumnInfo columnInfo = column.getColumnInfo();
        if (columnInfo != null) {
            // Can be overridden at column level
            if (columnInfo.getSortIgnorecase() != null) {
                ignoreCase = columnInfo.getSortIgnorecase().booleanValue();
            }
            if (columnInfo.getSortingNullprecedence() != null && columnInfo.getSortingNullprecedence() != SortingNullprecedence.databaseDefault) {
                sortingNullprecedence = columnInfo.getSortingNullprecedence();
            }
        }
    }
    return SortOptions.NONE.withIgnoreCase(ignoreCase).withNullprecedence(sortingNullprecedence);
}
Also used : IServer(com.servoy.j2db.persistence.IServer) SortingNullprecedence(com.servoy.j2db.persistence.SortingNullprecedence) ColumnInfo(com.servoy.j2db.persistence.ColumnInfo) RepositoryException(com.servoy.j2db.persistence.RepositoryException) RemoteException(java.rmi.RemoteException)

Aggregations

ColumnInfo (com.servoy.j2db.persistence.ColumnInfo)1 IServer (com.servoy.j2db.persistence.IServer)1 RepositoryException (com.servoy.j2db.persistence.RepositoryException)1 SortingNullprecedence (com.servoy.j2db.persistence.SortingNullprecedence)1 RemoteException (java.rmi.RemoteException)1