src/main/java/org/efaps/ui/wicket/models/objects/UITable.java
private void initialise()
        throws EFapsException
    {

        final AbstractCommand command = getCommand();
        if (command == null) {
            setShowCheckBoxes(false);
        } else {
            // set target table
            if (command.getTargetTable() != null) {
                setTableUUID(command.getTargetTable().getUUID());
                if (Context.getThreadContext().containsSessionAttribute(getCacheKey(UITable.UserCacheKey.FILTER))) {
                    @SuppressWarnings("unchecked")
                    final Map<String, TableFilter> sessfilter = (Map<String, TableFilter>) Context.getThreadContext()
                        .getSessionAttribute(getCacheKey(UITable.UserCacheKey.FILTER));
                    for (final Field field : command.getTargetTable().getFields()) {
                        if (sessfilter.containsKey(field.getName())) {
                            final TableFilter filter = sessfilter.get(field.getName());
                            filter.setHeaderFieldId(field.getId());
                            this.filters.put(field.getName(), filter);
                        }
                    }
                } else {
                    // add the filter here, if it is a required filter or a default value is set, that must be
                    // applied against the database
                    for (final Field field : command.getTargetTable().getFields()) {
                        if (field.hasAccess(getMode(), getInstance(), getCommand(), getInstance())
                                        && (field.getFilter().isRequired()
                                        || field.getFilter().getDefaultValue() != null
                                            && !field.getFilter().getDefaultValue().isEmpty())
                                        && field.getFilter().getBase().equals(FilterBase.DATABASE)) {
                            this.filters.put(field.getName(), new TableFilter(field.getId()));
                        }
                    }
                }
            }
            // set default sort
            if (command.getTargetTableSortKey() != null) {
                setSortKeyInternal(command.getTargetTableSortKey());
                setSortDirection(command.getTargetTableSortDirection());
            }
            setEnforceSorted("true".equalsIgnoreCase(command.getProperty("TargetEnforceSorted")));

            setShowCheckBoxes(command.isTargetShowCheckBoxes());
            // get the User specific Attributes if exist overwrite the defaults
            try {
                if (Context.getThreadContext().containsUserAttribute(
                                getCacheKey(UITable.UserCacheKey.SORTKEY))) {
                    setSortKeyInternal(Context.getThreadContext().getUserAttribute(
                                    getCacheKey(UITable.UserCacheKey.SORTKEY)));
                }
                if (Context.getThreadContext().containsUserAttribute(
                                getCacheKey(UITable.UserCacheKey.SORTDIRECTION))) {
                    setSortDirection(SortDirection.getEnum(Context.getThreadContext()
                                    .getUserAttribute(getCacheKey(UITable.UserCacheKey.SORTDIRECTION))));
                }
            } catch (final EFapsException e) {
                // we don't throw an error because this are only Usersettings
                UITable.LOG.error("error during the retrieve of UserAttributes", e);
            }
        }
    }
private void initialise()
        throws EFapsException
    {

        final AbstractCommand command = getCommand();
        if (command == null) {
            setShowCheckBoxes(false);
        } else {
            // set target table
            if (command.getTargetTable() != null) {
                setTableUUID(command.getTargetTable().getUUID());
                if (Context.getThreadContext().containsSessionAttribute(getCacheKey(UITable.UserCacheKey.FILTER))) {
                    @SuppressWarnings("unchecked")
                    final Map<String, TableFilter> sessfilter = (Map<String, TableFilter>) Context.getThreadContext()
                        .getSessionAttribute(getCacheKey(UITable.UserCacheKey.FILTER));
                    for (final Field field : command.getTargetTable().getFields()) {
                        if (sessfilter.containsKey(field.getName())) {
                            final TableFilter filter = sessfilter.get(field.getName());
                            filter.setHeaderFieldId(field.getId());
                            this.filters.put(field.getName(), filter);
                        }
                    }
                } else {
                    // add the filter here, if it is a required filter or a default value is set, that must be
                    // applied against the database
                    for (final Field field : command.getTargetTable().getFields()) {
                        if (field.hasAccess(getMode(), getInstance(), getCommand(), getInstance())
                                        && (field.getFilter().isRequired()
                                        || field.getFilter().getDefaultValue() != null
                                            && !field.getFilter().getDefaultValue().isEmpty())
                                        && field.getFilter().getBase().equals(FilterBase.DATABASE)) {
                            this.filters.put(field.getName(), new TableFilter(field.getId()));
                        }
                    }
                }
            }
            // set default sort
            if (command.getTargetTableSortKey() != null) {
                setSortKeyInternal(command.getTargetTableSortKey());
                setSortDirection(command.getTargetTableSortDirection());
            }
            setEnforceSorted("true".equalsIgnoreCase(command.getProperty("TargetEnforceSorted")));

            setShowCheckBoxes(command.isTargetShowCheckBoxes());
            // get the User specific Attributes if exist overwrite the defaults
            try {
                if (Context.getThreadContext().containsUserAttribute(
                                getCacheKey(UITable.UserCacheKey.SORTKEY))) {
                    setSortKeyInternal(Context.getThreadContext().getUserAttribute(
                                    getCacheKey(UITable.UserCacheKey.SORTKEY)));
                }
                if (Context.getThreadContext().containsUserAttribute(
                                getCacheKey(UITable.UserCacheKey.SORTDIRECTION))) {
                    setSortDirection(SortDirection.getEnum(Context.getThreadContext()
                                    .getUserAttribute(getCacheKey(UITable.UserCacheKey.SORTDIRECTION))));
                }
            } catch (final EFapsException e) {
                // we don't throw an error because this are only Usersettings
                UITable.LOG.error("error during the retrieve of UserAttributes", e);
            }
        }
    }
Method that initializes the TableModel.

@throws EFapsException on error