Search in sources :

Example 1 with IDataServer

use of com.servoy.j2db.dataprocessing.IDataServer in project servoy-client by Servoy.

the class ClientState method getDataServerProxy.

public synchronized DataServerProxy getDataServerProxy() {
    IDataServer ds = getDataServer();
    if (ds != null && !(ds instanceof DataServerProxy)) {
        dataServer = new DataServerProxy(ds);
        ds = dataServer;
    }
    return (DataServerProxy) ds;
}
Also used : IDataServer(com.servoy.j2db.dataprocessing.IDataServer) DataServerProxy(com.servoy.j2db.dataprocessing.DataServerProxy)

Example 2 with IDataServer

use of com.servoy.j2db.dataprocessing.IDataServer in project servoy-client by Servoy.

the class Column method getNewRecordValue.

// NOTE also called for duplicate
public Object getNewRecordValue(IServiceProvider application) throws Exception {
    ColumnInfo ci = getColumnInfo();
    if (ci != null) {
        int autoEnterType = ci.getAutoEnterType();
        int autoEnterSubType = ci.getAutoEnterSubType();
        switch(autoEnterType) {
            case ColumnInfo.SYSTEM_VALUE_AUTO_ENTER:
                switch(autoEnterSubType) {
                    case ColumnInfo.SYSTEM_VALUE_CREATION_SERVER_DATETIME:
                        return new Timestamp(application.getClientHost().getServerTime(application.getClientID()).getTime());
                    case ColumnInfo.SYSTEM_VALUE_CREATION_DATETIME:
                        // case ColumnInfo.SYSTEM_VALUE_MODIFICATION_DATETIME://makes it possible to search for non modified records
                        return new Timestamp(TimezoneUtils.getClientDate(application).getTime());
                    case ColumnInfo.SYSTEM_VALUE_CREATION_USERNAME:
                        // case ColumnInfo.SYSTEM_VALUE_MODIFICATION_NAME://makes it possible to search for non modified records
                        return application.getUserName();
                    case ColumnInfo.SYSTEM_VALUE_CREATION_USERUID:
                        // case ColumnInfo.SYSTEM_VALUE_MODIFICATION_USERID://makes it possible to search for non modified records
                        {
                            String user_uid = application.getUserUID();
                            // $NON-NLS-1$
                            if (user_uid == null)
                                user_uid = "";
                            switch(getDataProviderType()) {
                                case NUMBER:
                                    return new Double(Utils.getAsDouble(user_uid));
                                case INTEGER:
                                    return new Integer(Utils.getAsInteger(user_uid));
                                case TEXT:
                                default:
                                    return user_uid;
                            }
                        }
                    default:
                        return null;
                }
            case ColumnInfo.SEQUENCE_AUTO_ENTER:
                if (autoEnterSubType != ColumnInfo.NO_SEQUENCE_SELECTED) {
                    IDataServer ds = application.getDataServer();
                    if (ds != null) {
                        return ds.getNextSequence(getTable().getServerName(), getTable().getName(), getName(), ci.getID(), getTable().getServerName());
                    }
                    return Integer.valueOf(0);
                }
            // $FALL-THROUGH$
            case ColumnInfo.CUSTOM_VALUE_AUTO_ENTER:
                String val = ci.getDefaultValue();
                switch(getDataProviderType()) {
                    case NUMBER:
                        return new Double(Utils.getAsDouble(val));
                    case INTEGER:
                        return new Integer(Utils.getAsInteger(val));
                    case TEXT:
                        return val;
                }
                return val;
            case ColumnInfo.NO_AUTO_ENTER:
            // }
            default:
                if (ci.hasFlag(IBaseColumn.TENANT_COLUMN)) {
                    Object[] tenantValue = application.getTenantValue();
                    if (tenantValue != null && tenantValue.length > 0) {
                        return tenantValue[0];
                    }
                }
                return null;
        }
    }
    return null;
}
Also used : IDataServer(com.servoy.j2db.dataprocessing.IDataServer) Timestamp(java.sql.Timestamp)

Example 3 with IDataServer

use of com.servoy.j2db.dataprocessing.IDataServer in project servoy-client by Servoy.

the class TestNGClient method createDataServer.

@Override
protected IDataServer createDataServer() {
    return new IDataServer() {

        private final HashMap<String, IDataSet> dataSetMap = new HashMap<String, IDataSet>();

        @Override
        public void setServerMaintenanceMode(boolean maintenanceMode) throws RemoteException {
        }

        @Override
        public void logMessage(String msg) throws RemoteException {
        }

        @Override
        public boolean isInServerMaintenanceMode() throws RemoteException {
            return false;
        }

        @Override
        public boolean releaseLocks(String client_id, String server_name, String table_name, Set<Object> pkhashkeys) throws RemoteException, RepositoryException {
            return false;
        }

        @Override
        public IDataSet acquireLocks(String client_id, String server_name, String table_name, Set<Object> pkhashkeys, QuerySelect lockSelect, String transaction_id, ArrayList<TableFilter> filters, int chunkSize) throws RemoteException, RepositoryException {
            return null;
        }

        @Override
        public String startTransaction(String clientId, String server_name) throws RepositoryException, RemoteException {
            return null;
        }

        @Override
        public Object[] performUpdates(String clientId, ISQLStatement[] statements) throws ServoyException, RemoteException {
            return statements;
        }

        @Override
        public IDataSet[] performQuery(String client_id, String server_name, String transaction_id, QueryData[] array) throws ServoyException, RemoteException {
            if (array.length > 0) {
                String ds = array[0].getSqlSelect().getTable().getDataSource();
                if ("mem:relatedtest".equals(ds)) {
                    IDataSet set = dataSetMap.get(ds);
                    IDataSet[] returnDataSet = new IDataSet[array.length];
                    for (int i = 0; i < array.length; i++) {
                        returnDataSet[i] = new BufferedDataSet();
                        for (int k = 0; k < set.getRowCount(); k++) {
                            Object[][] value = (Object[][]) ((Placeholder) ((SetCondition) ((QuerySelect) array[i].getSqlSelect()).getConditions().values().iterator().next().getConditions().get(0)).getValues()).getValue();
                            if (set.getRow(k)[1].equals(value[0][0])) {
                                returnDataSet[i].addRow(new Object[] { set.getRow(k)[0], set.getRow(k)[1], set.getRow(k)[2], set.getRow(k)[3] });
                            }
                        }
                    }
                    return returnDataSet;
                }
            }
            return null;
        }

        @Override
        public IDataSet performQuery(String client_id, String server_name, String driverTableName, String transaction_id, String sql, Object[] questiondata, int startRow, int rowsToRetrieve, boolean updateIdleTimestamp) throws ServoyException, RemoteException {
            // don't know the
            return dataSetMap.values().iterator().next();
        // datasource,
        // just return
        // the first
        // dataset
        }

        @Override
        public IDataSet performQuery(String client_id, String server_name, String transaction_id, ISQLSelect sqlSelect, ColumnType[] resultTypes, ArrayList<TableFilter> filters, boolean distinctInMemory, int startRow, int rowsToRetrieve, boolean updateIdleTimestamp) throws ServoyException, RemoteException {
            return dataSetMap.get(sqlSelect.getTable().getDataSource());
        }

        @Override
        public IDataSet performQuery(String client_id, String server_name, String driverTableName, String transaction_id, String sql, Object[] questiondata, int startRow, int rowsToRetrieve, int type) throws ServoyException, RemoteException {
            // don't know the
            return dataSetMap.values().iterator().next();
        // datasource,
        // just return
        // the first
        // dataset
        }

        @Override
        public IDataSet performQuery(String client_id, String server_name, String transaction_id, ISQLSelect sqlSelect, ColumnType[] resultTypes, ArrayList<TableFilter> filters, boolean distinctInMemory, int startRow, int rowsToRetrieve, int type, ITrackingSQLStatement trackingInfo) throws ServoyException, RemoteException {
            return dataSetMap.get(sqlSelect.getTable().getDataSource());
        }

        @Override
        public IDataSet performQuery(String client_id, String server_name, String transaction_id, ISQLSelect sqlSelect, ColumnType[] resultTypes, ArrayList<TableFilter> filters, boolean distinctInMemory, int startRow, int rowsToRetrieve, int type) throws ServoyException, RemoteException {
            IDataSet set = dataSetMap.get(sqlSelect.getTable().getDataSource());
            if (sqlSelect instanceof QuerySelect && ((QuerySelect) sqlSelect).getColumns().size() == 1) {
                // pk select
                int lastRow = Math.min(set.getRowCount(), startRow + rowsToRetrieve);
                BufferedDataSet ds = BufferedDataSetInternal.createBufferedDataSet(null, null, new SafeArrayList<Object[]>(0), lastRow < set.getRowCount());
                for (int i = startRow; i < lastRow; i++) {
                    ds.addRow(new Object[] { set.getRow(i)[0] });
                }
                return ds;
            }
            return set;
        }

        @Override
        public IDataSet performQuery(String client_id, String server_name, String driverTableName, String transaction_id, String sql, Object[] questiondata, int startRow, int rowsToRetrieve) throws ServoyException, RemoteException {
            // don't know the
            return dataSetMap.values().iterator().next();
        // datasource,
        // just return
        // the first
        // dataset
        }

        @Override
        public IDataSet performQuery(String client_id, String server_name, String transaction_id, ISQLSelect sqlSelect, ColumnType[] resultTypes, ArrayList<TableFilter> filters, boolean distinctInMemory, int startRow, int rowsToRetrieve) throws ServoyException, RemoteException {
            return dataSetMap.get(sqlSelect.getTable().getDataSource());
        }

        @Override
        public IDataSet performCustomQuery(String client_id, String server_name, String driverTableName, String transaction_id, ISQLSelect sqlSelect, ArrayList<TableFilter> filters, int startRow, int rowsToRetrieve) throws ServoyException, RemoteException {
            return dataSetMap.get(sqlSelect.getTable().getDataSource());
        }

        @Override
        public boolean notifyDataChange(String client_id, String server_name, String tableName, IDataSet pks, int action, String transaction_id) throws RemoteException {
            return false;
        }

        @Override
        public ITable insertQueryResult(String client_id, String queryServerName, String queryTid, ISQLSelect sqlSelect, ArrayList<TableFilter> filters, boolean distinctInMemory, int startRow, int rowsToRetrieve, int type, String dataSource, String targetServerName, String targetTableName, String targetTid, ColumnType[] columnTypes, String[] pkNames) throws ServoyException, RemoteException {
            return null;
        }

        @Override
        public InsertResult insertDataSet(String client_id, IDataSet set, final String dataSource, String serverName, String tableName, String tid, ColumnType[] columnTypes, String[] pkNames, HashMap<String, ColumnInfoDef> columnInfoDefinitions) throws ServoyException, RemoteException {
            dataSetMap.put(dataSource, set);
            Table table = new Table(serverName, serverName, true, ITable.TABLE, null, null);
            table.setDataSource(dataSource);
            for (int i = 0; i < set.getColumnCount(); i++) {
                Column col = new Column(table, set.getColumnNames()[i], set.getColumnTypes()[i], 50, 50, true);
                table.addColumn(col);
                if (Arrays.binarySearch(pkNames, col.getName()) >= 0) {
                    col.setDatabasePK(true);
                }
            }
            return new InsertResult(table, new Object[0]);
        }

        @Override
        public QuerySet getSQLQuerySet(String serverName, ISQLQuery sqlQuery, ArrayList<TableFilter> filters, int startRow, int rowsToRetrieve, boolean forceQualifyColumns, boolean disableUseArrayForIn) throws RepositoryException, RemoteException {
            QuerySet qs = new QuerySet();
            qs.setSelect(new QueryString("select from test", false));
            return qs;
        }

        @Override
        public Object getNextSequence(String serverName, String tableName, String columnName, int columnInfoID, String columnInfoServer) throws RepositoryException, RemoteException {
            return null;
        }

        @Override
        public Blob getBlob(String clientId, String serverName, ISQLSelect blobSelect, ArrayList<TableFilter> filters, String tid) throws RepositoryException, RemoteException {
            return null;
        }

        @Override
        public boolean endTransactions(String client_id, String[] transaction_id, boolean commit) throws RepositoryException, RemoteException {
            return false;
        }

        @Override
        public void dropTemporaryTable(String client_id, String serverName, String tableName) throws RemoteException, RepositoryException {
        }

        @Override
        public ISQLStatement createSQLStatement(int action, String server_name, String tableName, Object[] pkColumnData, String tid, ISQLUpdate sqlUpdate, ArrayList<TableFilter> filters) throws RemoteException {
            return null;
        }

        @Override
        public ISQLStatement createSQLStatement(int action, String server_name, String tableName, Object[] pkColumnData, String tid, String sql, Object[] questiondata) throws RemoteException, RepositoryException {
            return null;
        }

        @Override
        public void addClientAsTableUser(String client_id, String serverName, String tableName) throws RemoteException, RepositoryException {
        }

        @Override
        public IDataSet[] executeProcedure(String clientId, String server_name, String tid, Procedure procedure, Object[] arguments) throws RepositoryException, RemoteException {
            return null;
        }
    };
}
Also used : Set(java.util.Set) QuerySet(com.servoy.j2db.persistence.QuerySet) IDataSet(com.servoy.j2db.dataprocessing.IDataSet) BufferedDataSet(com.servoy.j2db.dataprocessing.BufferedDataSet) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SafeArrayList(com.servoy.j2db.util.SafeArrayList) QuerySet(com.servoy.j2db.persistence.QuerySet) QueryString(com.servoy.j2db.persistence.QueryString) SetCondition(com.servoy.j2db.query.SetCondition) BufferedDataSet(com.servoy.j2db.dataprocessing.BufferedDataSet) Column(com.servoy.j2db.persistence.Column) Procedure(com.servoy.j2db.persistence.Procedure) ITable(com.servoy.j2db.persistence.ITable) Table(com.servoy.j2db.persistence.Table) IDataServer(com.servoy.j2db.dataprocessing.IDataServer) QueryString(com.servoy.j2db.persistence.QueryString) QuerySelect(com.servoy.j2db.query.QuerySelect) ISQLUpdate(com.servoy.j2db.query.ISQLUpdate) ITrackingSQLStatement(com.servoy.j2db.dataprocessing.ITrackingSQLStatement) ISQLQuery(com.servoy.j2db.query.ISQLQuery) IDataSet(com.servoy.j2db.dataprocessing.IDataSet) ISQLSelect(com.servoy.j2db.query.ISQLSelect)

Example 4 with IDataServer

use of com.servoy.j2db.dataprocessing.IDataServer in project servoy-client by Servoy.

the class PartNode method process.

public List<DataRendererDefinition> process(FormPreviewPanel fpp, FoundSet fs, Table table, QuerySelect sqlString) throws Exception {
    // Selection model must be in print mode to be able to set the selection to -1  . Otherwise is not allowed by the selectionModel
    ((ISwingFoundSet) fs).getSelectionModel().hideSelectionForPrinting();
    // this is needed because we must keep sql the same in foundset during printing
    FoundSet rootSet = (FoundSet) fs.copy(false);
    foundSets.add(rootSet);
    IApplication app = fpp.getApplication();
    // retval
    List<DataRendererDefinition> list = new ArrayList<DataRendererDefinition>();
    if (part != null && (part.getPartType() == Part.LEADING_SUBSUMMARY || part.getPartType() == Part.TRAILING_SUBSUMMARY || isLeadingAndTrailingSubsummary)) {
        QuerySelect newSQLString = AbstractBaseQuery.deepClone(sqlString);
        IDataServer server = app.getDataServer();
        // build the sql parts  based on sort columns
        ArrayList<IQuerySelectValue> selectCols = new ArrayList<IQuerySelectValue>();
        ArrayList<QueryColumn> groupbyCols = new ArrayList<QueryColumn>();
        ArrayList<QuerySort> sortbyCols = new ArrayList<QuerySort>();
        for (SortColumn element : sortColumns) {
            BaseQueryTable queryTable = sqlString.getTable();
            Relation[] relations = element.getRelations();
            if (relations != null) {
                for (Relation relation : relations) {
                    ISQLTableJoin join = (ISQLTableJoin) sqlString.getJoin(queryTable, relation.getName());
                    if (join == null) {
                        // $NON-NLS-1$ //$NON-NLS-2$
                        Debug.log("Missing relation " + relation.getName() + " in join condition for form on table " + table.getName());
                    } else {
                        queryTable = join.getForeignTable();
                    }
                }
            }
            Column column = (Column) element.getColumn();
            QueryColumn queryColumn = column.queryColumn(queryTable);
            selectCols.add(queryColumn);
            groupbyCols.add(queryColumn);
            sortbyCols.add(new QuerySort(queryColumn, element.getSortOrder() == SortColumn.ASCENDING, fs.getFoundSetManager().getSortOptions(column)));
        }
        // make sql
        for (AggregateVariable ag : allAggregates) {
            selectCols.add(new QueryAggregate(ag.getType(), new QueryColumn(newSQLString.getTable(), -1, ag.getColumnNameToAggregate(), ag.getDataProviderType(), ag.getLength(), 0, null, ag.getFlags()), ag.getName()));
        }
        newSQLString.setColumns(selectCols);
        newSQLString.setGroupBy(groupbyCols);
        ArrayList<IQuerySort> oldSort = newSQLString.getSorts();
        // fix the sort (if columns not are selected of used in groupby they cannot be used in sort)
        newSQLString.setSorts(sortbyCols);
        FoundSetManager foundSetManager = ((FoundSetManager) app.getFoundSetManager());
        String transaction_id = foundSetManager.getTransactionID(table.getServerName());
        IDataSet data = server.performQuery(app.getClientID(), table.getServerName(), transaction_id, newSQLString, null, foundSetManager.getTableFilterParams(table.getServerName(), newSQLString), false, 0, foundSetManager.config.pkChunkSize() * 4, IDataServer.PRINT_QUERY);
        // create a new FoundSet with 'data' and with right 'table', 'where','whereArgs'
        SubSummaryFoundSet newSet = new SubSummaryFoundSet(app.getFoundSetManager(), rootSet, sortColumns, allAggregates, data, table);
        // restore the sort for child body parts
        newSQLString.setSorts(oldSort);
        // make new where for use in sub queries
        for (QuerySort sortbyCol : sortbyCols) {
            QueryColumn sc = (QueryColumn) (sortbyCol).getColumn();
            newSQLString.addCondition(SQLGenerator.CONDITION_SEARCH, new CompareCondition(IBaseSQLCondition.EQUALS_OPERATOR, sc, new Placeholder(new TablePlaceholderKey(sc.getTable(), '#' + sc.getName()))));
        }
        int count = newSet.getSize();
        for (int ii = 0; ii < count; ii++) {
            // make copy for setting sort column
            QuerySelect newSQLStringCopy = AbstractBaseQuery.deepClone(newSQLString);
            // handle the child first, this puts the rootset in the right state! for use of related(!) fields in the subsums
            // THIS is EXTREMELY important for correct printing, see also SubSummaryFoundSet.queryForRelatedFoundSet
            List<DataRendererDefinition> childRetval = null;
            IFoundSetInternal curLeafFoundSet = null;
            if (child != null) {
                for (int i = 0; i < sortbyCols.size(); i++) {
                    QueryColumn sc = (QueryColumn) (sortbyCols.get(i)).getColumn();
                    TablePlaceholderKey placeholderKey = new TablePlaceholderKey(sc.getTable(), '#' + sc.getName());
                    if (!newSQLStringCopy.setPlaceholderValue(placeholderKey, data.getRow(ii)[i])) {
                        Debug.error(// $NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
                        new RuntimeException("Could not set placeholder " + placeholderKey + " in query " + newSQLStringCopy + "-- continuing"));
                    }
                }
                childRetval = child.process(fpp, rootSet, table, newSQLStringCopy);
                curLeafFoundSet = child.getCurrentLeafFoundSet();
            }
            SubSummaryFoundSet.PrintState state = (SubSummaryFoundSet.PrintState) newSet.getRecord(ii);
            state.setDelegate(curLeafFoundSet);
            if (part.getPartType() == Part.LEADING_SUBSUMMARY) {
                state.doAggregatesLookup();
                list.add(new DataRendererDefinition(fpp, renderParent, part, renderer, state));
            }
            if (childRetval != null) {
                list.addAll(childRetval);
            }
            if (isLeadingAndTrailingSubsummary) {
                state.doAggregatesLookup();
                list.add(new DataRendererDefinition(fpp, renderParent, second_part, second_renderer, state));
            } else if (part.getPartType() == Part.TRAILING_SUBSUMMARY) {
                state.doAggregatesLookup();
                list.add(new DataRendererDefinition(fpp, renderParent, part, renderer, state));
            }
        }
    } else // for handeling (virtual) body part
    {
        rootSet.browseAll(sqlString);
        int count = app.getFoundSetManager().getFoundSetCount(rootSet);
        for (int ii = 0; ii < count; ii++) {
            currentLeafFoundSet = rootSet;
            list.add(new DataRendererDefinition(fpp, renderParent, part, renderer, rootSet, ii));
        }
    }
    return list;
}
Also used : Placeholder(com.servoy.j2db.query.Placeholder) IFoundSetInternal(com.servoy.j2db.dataprocessing.IFoundSetInternal) ArrayList(java.util.ArrayList) SortColumn(com.servoy.j2db.dataprocessing.SortColumn) IQuerySort(com.servoy.j2db.query.IQuerySort) Relation(com.servoy.j2db.persistence.Relation) ISQLTableJoin(com.servoy.j2db.query.ISQLTableJoin) QueryColumn(com.servoy.j2db.query.QueryColumn) SortColumn(com.servoy.j2db.dataprocessing.SortColumn) Column(com.servoy.j2db.persistence.Column) IQuerySort(com.servoy.j2db.query.IQuerySort) QuerySort(com.servoy.j2db.query.QuerySort) CompareCondition(com.servoy.j2db.query.CompareCondition) QueryAggregate(com.servoy.j2db.query.QueryAggregate) FoundSetManager(com.servoy.j2db.dataprocessing.FoundSetManager) TablePlaceholderKey(com.servoy.j2db.query.TablePlaceholderKey) IDataServer(com.servoy.j2db.dataprocessing.IDataServer) SubSummaryFoundSet(com.servoy.j2db.dataprocessing.SubSummaryFoundSet) ISwingFoundSet(com.servoy.j2db.dataprocessing.ISwingFoundSet) FoundSet(com.servoy.j2db.dataprocessing.FoundSet) QuerySelect(com.servoy.j2db.query.QuerySelect) AggregateVariable(com.servoy.j2db.persistence.AggregateVariable) IApplication(com.servoy.j2db.IApplication) BaseQueryTable(com.servoy.base.query.BaseQueryTable) QueryColumn(com.servoy.j2db.query.QueryColumn) SubSummaryFoundSet(com.servoy.j2db.dataprocessing.SubSummaryFoundSet) IDataSet(com.servoy.j2db.dataprocessing.IDataSet) IQuerySelectValue(com.servoy.j2db.query.IQuerySelectValue)

Example 5 with IDataServer

use of com.servoy.j2db.dataprocessing.IDataServer in project servoy-client by Servoy.

the class I18NPanel method createOrUpdateKey.

/**
 * @param newKey
 * @param string
 * @param string2
 */
private boolean createOrUpdateKey(String newKey, String referenceValue, String localeValue) {
    boolean operationPerformed = false;
    if (// $NON-NLS-1$
    Messages.invalidConnection || Messages.noConnection || referenceValue == null || "".equals(referenceValue))
        // false
        return operationPerformed;
    String i18nDataSource = DataSourceUtils.getI18NDataSource(application.getSolution(), application.getSettings());
    if (i18nDataSource == null) {
        // $NON-NLS-1$
        throw new IllegalStateException("Can't create key when there is no (valid) servername/tablename for messages");
    }
    String serverName = DataSourceUtils.getDataSourceServerName(i18nDataSource);
    String tableName = DataSourceUtils.getDataSourceTableName(i18nDataSource);
    String filterName = null;
    String[] filterValue = null;
    if (application instanceof IMessagesCallback) {
        filterName = ((IMessagesCallback) application).getI18NColumnNameFilter();
        filterValue = ((IMessagesCallback) application).getI18NColumnValueFilter();
    }
    if (Messages.customMessageLoader != null) {
        try {
            TreeMap<String, MessageEntry> messages = Messages.customMessageLoader.readMessages(serverName, tableName);
            adjustMessagesMap(newKey, referenceValue, localeValue, messages);
            Messages.customMessageLoader.save(serverName, tableName, messages);
            operationPerformed = true;
        } catch (Exception e) {
            Debug.error("exception when inserting/updating i18n key: " + newKey);
            Debug.error(e);
        // throw new RuntimeException(e);
        }
    } else {
        IDataServer dataServer = application.getDataServer();
        IRepository repository = application.getRepository();
        try {
            TreeMap<String, MessageEntry> repositoryMessages = I18NUtil.loadSortedMessagesFromRepository(repository, dataServer, application.getClientID(), serverName, tableName, filterName, filterValue, application.getFoundSetManager());
            TreeMap<String, MessageEntry> messages = new TreeMap<String, I18NUtil.MessageEntry>(repositoryMessages);
            adjustMessagesMap(newKey, referenceValue, localeValue, messages);
            I18NUtil.writeMessagesToRepository(serverName, tableName, repository, dataServer, application.getClientID(), messages, false, false, repositoryMessages, filterName, filterValue, application.getFoundSetManager());
            operationPerformed = true;
        } catch (Exception e) {
            Debug.error("exception when inserting new i18n key: " + newKey);
            Debug.error(e);
        // throw new RuntimeException(e);
        }
    }
    return operationPerformed;
}
Also used : IDataServer(com.servoy.j2db.dataprocessing.IDataServer) MessageEntry(com.servoy.j2db.persistence.I18NUtil.MessageEntry) IMessagesCallback(com.servoy.j2db.IMessagesCallback) I18NUtil(com.servoy.j2db.persistence.I18NUtil) IRepository(com.servoy.j2db.persistence.IRepository) TreeMap(java.util.TreeMap)

Aggregations

IDataServer (com.servoy.j2db.dataprocessing.IDataServer)7 DataServerProxy (com.servoy.j2db.dataprocessing.DataServerProxy)3 IDataSet (com.servoy.j2db.dataprocessing.IDataSet)3 FoundSetManager (com.servoy.j2db.dataprocessing.FoundSetManager)2 Column (com.servoy.j2db.persistence.Column)2 QuerySelect (com.servoy.j2db.query.QuerySelect)2 ArrayList (java.util.ArrayList)2 BaseQueryTable (com.servoy.base.query.BaseQueryTable)1 IApplication (com.servoy.j2db.IApplication)1 IMessagesCallback (com.servoy.j2db.IMessagesCallback)1 BufferedDataSet (com.servoy.j2db.dataprocessing.BufferedDataSet)1 FoundSet (com.servoy.j2db.dataprocessing.FoundSet)1 IClientHost (com.servoy.j2db.dataprocessing.IClientHost)1 IFoundSetInternal (com.servoy.j2db.dataprocessing.IFoundSetInternal)1 ISwingFoundSet (com.servoy.j2db.dataprocessing.ISwingFoundSet)1 ITrackingSQLStatement (com.servoy.j2db.dataprocessing.ITrackingSQLStatement)1 SortColumn (com.servoy.j2db.dataprocessing.SortColumn)1 SubSummaryFoundSet (com.servoy.j2db.dataprocessing.SubSummaryFoundSet)1 AggregateVariable (com.servoy.j2db.persistence.AggregateVariable)1 I18NUtil (com.servoy.j2db.persistence.I18NUtil)1