Search in sources :

Example 1 with FoundsetTypeSabloValue

use of com.servoy.j2db.server.ngclient.property.FoundsetTypeSabloValue in project servoy-client by Servoy.

the class RecordPropertyType method fromJSON.

@Override
public IRecordInternal fromJSON(Object newJSONValue, IRecordInternal previousSabloValue, PropertyDescription pd, IBrowserConverterContext dataConverterContext, ValueReference<Boolean> returnValueAdjustedIncommingValue) {
    IRecordInternal record = null;
    if (newJSONValue instanceof JSONObject) {
        JSONObject jsonRecord = (JSONObject) newJSONValue;
        BaseWebObject webObject = dataConverterContext.getWebObject();
        if (webObject != null && jsonRecord.has(FoundsetTypeSabloValue.ROW_ID_COL_KEY)) {
            String rowIDValue = jsonRecord.optString(FoundsetTypeSabloValue.ROW_ID_COL_KEY);
            Pair<String, Integer> splitHashAndIndex = FoundsetTypeSabloValue.splitPKHashAndIndex(rowIDValue);
            if (jsonRecord.has(FoundsetTypeSabloValue.FOUNDSET_ID)) {
                int foundsetID = Utils.getAsInteger(jsonRecord.get(FoundsetTypeSabloValue.FOUNDSET_ID));
                if (foundsetID >= 0 && webObject instanceof IContextProvider) {
                    IFoundSetInternal foundset = ((IContextProvider) webObject).getDataConverterContext().getApplication().getFoundSetManager().findFoundset(foundsetID);
                    if (foundset != null) {
                        int recordIndex = foundset.getRecordIndex(splitHashAndIndex.getLeft(), splitHashAndIndex.getRight().intValue());
                        if (recordIndex != -1) {
                            return foundset.getRecord(recordIndex);
                        }
                    }
                }
            }
            Collection<PropertyDescription> properties = webObject.getSpecification().getProperties(FoundsetPropertyType.INSTANCE);
            for (PropertyDescription foundsetPd : properties) {
                FoundsetTypeSabloValue fsSablo = (FoundsetTypeSabloValue) webObject.getProperty(foundsetPd.getName());
                int recordIndex = fsSablo.getFoundset().getRecordIndex(splitHashAndIndex.getLeft(), splitHashAndIndex.getRight().intValue());
                if (recordIndex != -1) {
                    record = fsSablo.getFoundset().getRecord(recordIndex);
                    break;
                }
            }
        }
        if (// $NON-NLS-1$
        record == null && jsonRecord.has("recordhash")) {
            // $NON-NLS-1$
            record = getReference(jsonRecord.optString("recordhash"));
        }
    }
    return record;
}
Also used : PropertyDescription(org.sablo.specification.PropertyDescription) IRecordInternal(com.servoy.j2db.dataprocessing.IRecordInternal) JSONObject(org.json.JSONObject) IContextProvider(com.servoy.j2db.server.ngclient.IContextProvider) FoundsetTypeSabloValue(com.servoy.j2db.server.ngclient.property.FoundsetTypeSabloValue) IFoundSetInternal(com.servoy.j2db.dataprocessing.IFoundSetInternal) BaseWebObject(org.sablo.BaseWebObject)

Example 2 with FoundsetTypeSabloValue

use of com.servoy.j2db.server.ngclient.property.FoundsetTypeSabloValue in project servoy-client by Servoy.

the class NGFoundSetManager method executeMethod.

@SuppressWarnings("nls")
@Override
public Object executeMethod(String methodName, JSONObject args) throws Exception {
    if ("getFoundSet".equals(methodName)) {
        IFoundSetInternal foundset = FoundsetReferencePropertyTypeOld.INSTANCE.fromJSON(args, null, null, null, null);
        String sort = args.optString("sort");
        if (!"".equals(sort)) {
            foundset.setSort(sort);
        }
        FoundsetTypeSabloValue value = getFoundsetTypeSabloValue(foundset, args.optJSONObject("dataproviders"));
        ChangeAwareList<ChangeAwareMap<String, Object>, Object> foundsets = (ChangeAwareList<ChangeAwareMap<String, Object>, Object>) ((NGClient) getApplication()).getWebsocketSession().getClientService("foundset_manager").getProperty("foundsets");
        if (foundsets == null) {
            foundsets = new ChangeAwareList<ChangeAwareMap<String, Object>, Object>(new ArrayList<ChangeAwareMap<String, Object>>());
            ((NGClient) getApplication()).getWebsocketSession().getClientService("foundset_manager").setProperty("foundsets", foundsets);
        }
        boolean newFoundsetInfo = true;
        for (ChangeAwareMap<String, Object> foundsetInfoMap : foundsets) {
            if (foundsetInfoMap.containsValue(value)) {
                newFoundsetInfo = false;
                break;
            }
        }
        if (newFoundsetInfo) {
            HashMap<String, Object> foundsetinfoMap = new HashMap<String, Object>();
            foundsetinfoMap.put("foundset", value);
            foundsetinfoMap.put("foundsethash", args.optString("foundsethash"));
            String childrelation = args.optString("childrelation");
            if (childrelation != null) {
                JSONObject childrelationinfo = new JSONObject();
                childrelationinfo.put("name", childrelation);
                for (int i = 0; i < foundset.getSize(); i++) {
                    IRecordInternal record = foundset.getRecord(i);
                    Object o = record.getValue(childrelation);
                    if (o instanceof IFoundSetInternal) {
                        childrelationinfo.put(record.getPKHashKey() + "_" + record.getParentFoundSet().getRecordIndex(record), ((IFoundSetInternal) o).getSize());
                    }
                }
                foundsetinfoMap.put("childrelationinfo", childrelationinfo);
            }
            CustomJSONObjectType dummyCustomObjectTypeForChildRelationInfo = (CustomJSONObjectType) TypesRegistry.createNewType(CustomJSONObjectType.TYPE_NAME, "svy__dummyCustomObjectTypeForDeprecatedFMServiceChildRelationInfo");
            PropertyDescription dummyPD = new PropertyDescriptionBuilder().withType(dummyCustomObjectTypeForChildRelationInfo).build();
            dummyCustomObjectTypeForChildRelationInfo.setCustomJSONDefinition(dummyPD);
            foundsets.add(new ChangeAwareMap(foundsetinfoMap, null, dummyPD));
        }
    } else if ("getRelatedFoundSetHash".equals(methodName)) {
        IFoundSetInternal foundset = FoundsetReferencePropertyTypeOld.INSTANCE.fromJSON(args, null, null, null, null);
        String rowid = args.optString("rowid");
        String relation = args.optString("relation");
        Pair<String, Integer> splitHashAndIndex = FoundsetTypeSabloValue.splitPKHashAndIndex(rowid);
        int recordIndex = foundset.getRecordIndex(splitHashAndIndex.getLeft(), splitHashAndIndex.getRight().intValue());
        if (recordIndex != -1) {
            IRecordInternal record = foundset.getRecord(recordIndex);
            Object o = record.getValue(relation);
            if (o instanceof IFoundSetInternal) {
                IFoundSetInternal relatedFoundset = (IFoundSetInternal) o;
                PropertyDescription foundsetRefProperty = new PropertyDescriptionBuilder().withType(FoundsetReferencePropertyTypeOld.INSTANCE).build();
                return new TypedData<IFoundSetInternal>(relatedFoundset, foundsetRefProperty);
            }
        }
    } else if ("updateFoundSetRow".equals(methodName)) {
        IFoundSetInternal foundset = FoundsetReferencePropertyTypeOld.INSTANCE.fromJSON(args, null, null, null, null);
        String rowid = args.optString("rowid");
        String dataproviderid = args.optString("dataproviderid");
        Object value = args.get("value");
        Pair<String, Integer> splitHashAndIndex = FoundsetTypeSabloValue.splitPKHashAndIndex(rowid);
        int recordIndex = foundset.getRecordIndex(splitHashAndIndex.getLeft(), splitHashAndIndex.getRight().intValue());
        if (recordIndex != -1) {
            IRecordInternal record = foundset.getRecord(recordIndex);
            if (record.startEditing()) {
                record.setValue(dataproviderid, value);
                return Boolean.TRUE;
            }
        }
    } else if ("removeFoundSetFromCache".equals(methodName)) {
        IFoundSetInternal foundset = FoundsetReferencePropertyTypeOld.INSTANCE.fromJSON(args, null, null, null, null);
        removeFoundSetTypeSabloValue(foundset);
    } else if ("removeFoundSetsFromCache".equals(methodName)) {
        ChangeAwareList<ChangeAwareMap<String, Object>, Object> foundsets = (ChangeAwareList<ChangeAwareMap<String, Object>, Object>) ((NGClient) getApplication()).getWebsocketSession().getClientService("foundset_manager").getProperty("foundsets");
        if (foundsets != null) {
            foundsets.clear();
        }
        foundsetTypeSabloValueMap.clear();
    }
    return null;
}
Also used : IRecordInternal(com.servoy.j2db.dataprocessing.IRecordInternal) HashMap(java.util.HashMap) WeakHashMap(java.util.WeakHashMap) IFoundSetInternal(com.servoy.j2db.dataprocessing.IFoundSetInternal) PropertyDescriptionBuilder(org.sablo.specification.PropertyDescriptionBuilder) ArrayList(java.util.ArrayList) ChangeAwareList(org.sablo.specification.property.ChangeAwareList) PropertyDescription(org.sablo.specification.PropertyDescription) FoundsetTypeSabloValue(com.servoy.j2db.server.ngclient.property.FoundsetTypeSabloValue) JSONObject(org.json.JSONObject) CustomJSONObjectType(org.sablo.specification.property.CustomJSONObjectType) ChangeAwareMap(org.sablo.specification.property.ChangeAwareMap) JSONObject(org.json.JSONObject) Pair(com.servoy.j2db.util.Pair)

Example 3 with FoundsetTypeSabloValue

use of com.servoy.j2db.server.ngclient.property.FoundsetTypeSabloValue in project servoy-client by Servoy.

the class NGFoundSetManager method removeFoundSetTypeSabloValue.

public void removeFoundSetTypeSabloValue(IFoundSetInternal foundset) {
    if (foundset != null) {
        FoundsetTypeSabloValue value = foundsetTypeSabloValueMap.remove(foundset);
        ChangeAwareList<ChangeAwareMap<String, Object>, Object> foundsets = (ChangeAwareList<ChangeAwareMap<String, Object>, Object>) ((NGClient) getApplication()).getWebsocketSession().getClientService("foundset_manager").getProperty("foundsets");
        if (foundsets != null) {
            int i = 0;
            for (; i < foundsets.size(); i++) {
                ChangeAwareMap<String, Object> foundsetInfoMap = foundsets.get(i);
                if (foundsetInfoMap.containsValue(value))
                    break;
            }
            if (i < foundsets.size()) {
                foundsets.remove(i);
            }
        }
    }
}
Also used : FoundsetTypeSabloValue(com.servoy.j2db.server.ngclient.property.FoundsetTypeSabloValue) ChangeAwareMap(org.sablo.specification.property.ChangeAwareMap) JSONObject(org.json.JSONObject) ChangeAwareList(org.sablo.specification.property.ChangeAwareList)

Example 4 with FoundsetTypeSabloValue

use of com.servoy.j2db.server.ngclient.property.FoundsetTypeSabloValue in project servoy-client by Servoy.

the class ValueListTypeSabloValue method initializeIfPossibleAndNeeded.

private void initializeIfPossibleAndNeeded() {
    // some dependent property has changed
    // get the new values
    String newDataproviderID = null;
    String newFormatString = null;
    FoundsetTypeSabloValue newFoundsetPropertySabloValue = null;
    ITable newFoundsetPropertyTable = null;
    if (propertyDependencies.foundsetPropertyName != null) {
        newFoundsetPropertySabloValue = (FoundsetTypeSabloValue) webObjectContext.getProperty(propertyDependencies.foundsetPropertyName);
        if (newFoundsetPropertySabloValue != null) {
            // this won't add it twice if it's already added (see javadoc of this call)
            newFoundsetPropertySabloValue.addStateChangeListener(this);
            if (newFoundsetPropertySabloValue.getFoundset() != null) {
                newFoundsetPropertyTable = newFoundsetPropertySabloValue.getFoundset().getTable();
            } else {
                newFoundsetPropertyTable = FoundsetTypeSabloValue.getTableBasedOfFoundsetPropertyFromFoundsetIdentifier(newFoundsetPropertySabloValue.getFoundsetSelector(), dataAdapterListToUse.getApplication(), ((IContextProvider) webObjectContext.getUnderlyingWebObject()).getDataConverterContext().getForm().getForm());
            }
        }
    }
    if (propertyDependencies.formatPropertyName != null) {
        FormatTypeSabloValue formatSabloValue = ((FormatTypeSabloValue) webObjectContext.getProperty(propertyDependencies.formatPropertyName));
        ComponentFormat componentFormat = (formatSabloValue != null ? formatSabloValue.getComponentFormat() : null);
        newFormatString = ((componentFormat != null && componentFormat.parsedFormat != null) ? componentFormat.parsedFormat.getFormatString() : null);
        // this won't add it twice if it's already added (see javadoc of this call)
        if (formatSabloValue != null)
            formatSabloValue.addStateChangeListener(this);
    }
    if (propertyDependencies.dataproviderPropertyName != null) {
        Object dataproviderValue = webObjectContext.getProperty(propertyDependencies.dataproviderPropertyName);
        if (// if it's foundset linked; otherwise this will be false
        dataproviderValue instanceof IHasUnderlyingState) {
            // this won't add it twice if it's already added (see javadoc of this call)
            ((IHasUnderlyingState) dataproviderValue).addStateChangeListener(this);
        }
        // this will only return non-null if dataproviderValue != null && it is initialized (so foundset is already operational)
        newDataproviderID = DataAdapterList.getDataProviderID(dataproviderValue);
    }
    // see if anything we are interested in changed, of if it's not yet initialized (a detach + attach could happen where everything is still equal, but the detach did clear the vl/format and set initialized to false; for example a table column remove and then add back)
    if (!Utils.stringSafeEquals(newDataproviderID, dataproviderID) || !Utils.stringSafeEquals(newFormatString, formatParsedString) || newFoundsetPropertySabloValue != foundsetPropertySabloValue || !Utils.safeEquals(foundsetPropertyTable, newFoundsetPropertyTable) || !initialized) {
        // so something did change
        dataproviderID = newDataproviderID;
        foundsetPropertySabloValue = newFoundsetPropertySabloValue;
        foundsetPropertyTable = newFoundsetPropertyTable;
        formatParsedString = newFormatString;
        if ((!waitForDataproviderIfNull || dataproviderID != null) && (!waitForFormatIfNull || newFormatString != null) && (propertyDependencies.foundsetPropertyName == null || (newFoundsetPropertySabloValue != null && newFoundsetPropertyTable != null))) {
            // see if all we need is here
            // we don't have a "waitForFoundsetIfNull" because if we really have a foundset-linked-dataprovider, then that one is not initialized until the foundset != null anyway; so we won't get to this place becauuse the dataprovider property would not be ready
            // in case we previously already had an operational valuelist, clear it up as we have new dependency values
            clearUpRuntimeValuelistAndFormat();
            // initialize now
            initializeValuelistAndFormat();
            if (valueList != null) {
                valueList.addListDataListener(this);
                // register data link and find mode listeners as needed
                TargetDataLinks dataLinks = getDataLinks();
                dataAdapterListToUse.addDataLinkedProperty(this, dataLinks);
                // reset the initial wait for flags as we have the initial value; any other change in dependent properties has to be treated right away without additional waiting (even if they change to null)
                waitForDataproviderIfNull = false;
                waitForFormatIfNull = false;
                initialized = true;
            } else {
                Debug.error("Cannot instantiate valuelist (does it exist in the solution?) '" + valuelistIdentifier + "' for property " + vlPD + " of " + webObjectContext, new RuntimeException());
                clearUpRuntimeValuelistAndFormat();
            }
            changeMonitor.markFullyChanged(true);
        } else if (initialized) {
            // so we don't have yet all we need
            // make sure value is cleared/uninitialized (just in case something became unavailable that was available before)
            clearUpRuntimeValuelistAndFormat();
            changeMonitor.markFullyChanged(true);
        }
    }
}
Also used : FoundsetTypeSabloValue(com.servoy.j2db.server.ngclient.property.FoundsetTypeSabloValue) IContextProvider(com.servoy.j2db.server.ngclient.IContextProvider) ITable(com.servoy.j2db.persistence.ITable) JSONObject(org.json.JSONObject) TargetDataLinks(com.servoy.j2db.server.ngclient.property.types.IDataLinkedType.TargetDataLinks) ComponentFormat(com.servoy.j2db.component.ComponentFormat) IHasUnderlyingState(com.servoy.j2db.server.ngclient.property.IHasUnderlyingState)

Example 5 with FoundsetTypeSabloValue

use of com.servoy.j2db.server.ngclient.property.FoundsetTypeSabloValue in project servoy-client by Servoy.

the class FormatTypeSabloValue method getSabloValue.

protected ComponentFormat getSabloValue(String formatValue, String dataproviderId, Object valuelistId, String foundsetId, IWebObjectContext webObjectCntxt) {
    INGApplication application = ((WebFormComponent) webObjectCntxt.getUnderlyingWebObject()).getDataConverterContext().getApplication();
    IDataProviderLookup dataProviderLookup = null;
    // IMPORTANT: here we use the for: configs in .spec file
    // 
    // if you have for: [valuelist, dataprovider] then 2 things can happen:
    // - valuelist if it has both real and display values - forces the type; it is either TEXT (custom vl., global method vl.) or the 'display' column type in case it's a DB valuelist
    // - valuelist if not real/display but only one kind of values: here it is required in docs in the spec file that the valuelist property also defines "for": dataprovider if format
    // defines both "for" valuelist and dataprovider => valuelist doesn't force the type and then the dataprovider will decide the type
    // 
    // if you have just for: dataprovider the the dataprovider property determines the type
    // if you have just for: valuelist (TODO) - this is currently not properly supported - as here we should get the type always from the VL (for both display and real values) - as we don't have a dataprovider to fall back on
    isValuelistFormatSet = false;
    if (valuelistId != null) {
        // if we have a "for" valuelist, see if this valuelist forces the format type due to display values (when they are separate from real values)
        // otherwise it will do nothing and loop/fallback to the other if clause below which checks the "for" dataprovider
        ValueList valuelistPersist = ValueListTypeSabloValue.getValuelistPersist(valuelistId, application);
        if (valuelistPersist != null) {
            IDataProvider dataProvider = null;
            ITable table;
            try {
                if (valuelistPersist.getRelationName() != null) {
                    Relation[] relations = application.getFlattenedSolution().getRelationSequence(valuelistPersist.getRelationName());
                    table = application.getFlattenedSolution().getTable(relations[relations.length - 1].getForeignDataSource());
                } else {
                    table = application.getFlattenedSolution().getTable(valuelistPersist.getDataSource());
                }
                if (table != null) {
                    // if the format is for a table valuelist - the type to be used is the one of the dp chosen as 'display' in the valuelist
                    String dp = null;
                    // if show == real then we can use show anyway cause there is only one value for both real and display; if show != real we care about show
                    int showDataProviders = valuelistPersist.getShowDataProviders();
                    if ((showDataProviders & 1) != 0) {
                        dp = valuelistPersist.getDataProviderID1();
                    }
                    if ((showDataProviders & 2) != 0) {
                        // display value is a concat of multiple columns, so a string; not even sure if format property makes sense, but it is for a String then
                        if (dp != null)
                            return ComponentFormat.getComponentFormat(formatValue, IColumnTypes.TEXT, application);
                        dp = valuelistPersist.getDataProviderID2();
                    }
                    if ((showDataProviders & 4) != 0) {
                        // display value is a concat of multiple columns, so a string; not even sure if format property makes sense, but it is for a String then
                        if (dp != null)
                            return ComponentFormat.getComponentFormat(formatValue, IColumnTypes.TEXT, application);
                        dp = valuelistPersist.getDataProviderID3();
                    }
                    if (dp != null) {
                        dataProvider = application.getFlattenedSolution().getDataProviderForTable(table, dp);
                    }
                    isValuelistFormatSet = true;
                    return ComponentFormat.getComponentFormat(formatValue, dataProvider, application, true);
                } else if (valuelistPersist.getValueListType() == IValueListConstants.CUSTOM_VALUES) {
                    IValueList realValuelist = null;
                    ValueListTypeSabloValue valuelistSabloValue = (ValueListTypeSabloValue) FoundsetLinkedTypeSabloValue.unwrapIfNeeded(webObjectContext.getProperty(propertyDependencies.valueListPropertyName));
                    if (valuelistSabloValue != null) {
                        // take it from property, may not be the shared instance in case setvaluelistitems on component was used
                        realValuelist = valuelistSabloValue.getValueList();
                    }
                    if (realValuelist == null) {
                        realValuelist = com.servoy.j2db.component.ComponentFactory.getRealValueList(application, valuelistPersist, true, Types.OTHER, ComponentFormat.getComponentFormat(formatValue, dataproviderId, null, application, true).parsedFormat, null, true);
                    }
                    if (realValuelist.hasRealValues()) {
                        // if custom vl has both real and display values, the display values are TEXT (format is for those)
                        // of if it has displayValueType set, use that
                        isValuelistFormatSet = true;
                        int realValueDisplayType = realValuelist.getValueList().getDisplayValueType();
                        return ComponentFormat.getComponentFormat(formatValue, realValueDisplayType != 0 ? realValueDisplayType : IColumnTypes.TEXT, application);
                    }
                } else if (valuelistPersist.getValueListType() == IValueListConstants.GLOBAL_METHOD_VALUES) {
                    PropertyDescription vlPD = webObjectCntxt.getPropertyDescription(propertyDependencies.valueListPropertyName);
                    Object vlPDConfig = null;
                    if (vlPD != null) {
                        vlPDConfig = vlPD.getConfig();
                        if (vlPDConfig instanceof FoundsetLinkedConfig)
                            vlPDConfig = ((FoundsetLinkedConfig) vlPDConfig).getWrappedConfig();
                    }
                    boolean lazyLoad = valuelistPersist.getLazyLoading() && vlPDConfig instanceof ValueListConfig && ((ValueListConfig) vlPDConfig).getLazyLoading();
                    if (!lazyLoad) {
                        IValueList realValuelist = com.servoy.j2db.component.ComponentFactory.getRealValueList(application, valuelistPersist, true, Types.OTHER, null, null, true);
                        if (realValuelist instanceof GlobalMethodValueList) {
                            ((GlobalMethodValueList) realValuelist).fill(null, "", null);
                            if (realValuelist.hasRealValues() || realValuelist.getSize() == 0 || (realValuelist.getSize() == 1 && valuelistPersist.getAddEmptyValue() == IValueListConstants.EMPTY_VALUE_ALWAYS)) {
                                // if global method vl has both real and display values, the display values are TEXT (format is for those)
                                // of if it has displayValueType set, use that
                                isValuelistFormatSet = true;
                                int realValueDisplayType = realValuelist.getValueList().getDisplayValueType();
                                return ComponentFormat.getComponentFormat(formatValue, realValueDisplayType != 0 ? realValueDisplayType : IColumnTypes.TEXT, application);
                            }
                        }
                    }
                }
            } catch (Exception ex) {
                Debug.error(ex);
            }
        }
    // here - we want to fall back to the dataprovider if available in for: [ ..., dataprovider] if valuelist didn't force a certain display type on the format
    }
    if (dataproviderId != null && foundsetId != null) {
        ITable table = null;
        Form form = ((IContextProvider) webObjectCntxt.getUnderlyingWebObject()).getDataConverterContext().getForm().getForm();
        // always assume now that the the properties has the foundset property name.
        FoundsetTypeSabloValue runtimeValOfFoundset = (FoundsetTypeSabloValue) webObjectCntxt.getUnderlyingWebObject().getProperty(this.propertyDependencies.foundsetPropertyName);
        if (runtimeValOfFoundset != null && runtimeValOfFoundset.getFoundset() != null && runtimeValOfFoundset.getFoundset().getDataSource().equals(foundsetId)) {
            table = runtimeValOfFoundset.getFoundset().getTable();
        }
        if (table == null)
            table = FoundsetTypeSabloValue.getTableBasedOfFoundsetPropertyFromFoundsetIdentifier(foundsetId, application, form);
        if (table != null) {
            dataProviderLookup = new FormAndTableDataProviderLookup(application.getFlattenedSolution(), form, table);
        }
    // else it will be searched for in form's context and table as below
    }
    if (dataProviderLookup == null) {
        WebObjectSpecification spec = ((WebFormComponent) webObjectCntxt.getUnderlyingWebObject()).getParent().getSpecification();
        if (spec != null) {
            Collection<PropertyDescription> formComponentProperties = spec.getProperties(FormComponentPropertyType.INSTANCE);
            if (formComponentProperties != null) {
                for (PropertyDescription property : formComponentProperties) {
                    if (property.getConfig() instanceof ComponentTypeConfig && ((ComponentTypeConfig) property.getConfig()).forFoundset != null) {
                        FoundsetTypeSabloValue runtimeValOfFoundset = (FoundsetTypeSabloValue) ((WebFormComponent) webObjectCntxt.getUnderlyingWebObject()).getParent().getProperty(((ComponentTypeConfig) property.getConfig()).forFoundset);
                        ITable table = null;
                        Form form = ((IContextProvider) webObjectCntxt.getUnderlyingWebObject()).getDataConverterContext().getForm().getForm();
                        if (runtimeValOfFoundset.getFoundset() != null)
                            table = runtimeValOfFoundset.getFoundset().getTable();
                        if (table == null)
                            table = FoundsetTypeSabloValue.getTableBasedOfFoundsetPropertyFromFoundsetIdentifier(runtimeValOfFoundset.getFoundsetSelector(), application, form);
                        if (table != null) {
                            dataProviderLookup = new FormAndTableDataProviderLookup(application.getFlattenedSolution(), form, table);
                        }
                        break;
                    }
                }
            }
        }
    }
    if (dataProviderLookup == null && application != null)
        dataProviderLookup = application.getFlattenedSolution().getDataproviderLookup(application.getFoundSetManager(), ((IContextProvider) webObjectCntxt.getUnderlyingWebObject()).getDataConverterContext().getForm().getForm());
    ComponentFormat format = ComponentFormat.getComponentFormat(formatValue, dataproviderId, dataProviderLookup, application, true);
    return format;
}
Also used : WebObjectSpecification(org.sablo.specification.WebObjectSpecification) ValueList(com.servoy.j2db.persistence.ValueList) GlobalMethodValueList(com.servoy.j2db.dataprocessing.GlobalMethodValueList) IValueList(com.servoy.j2db.dataprocessing.IValueList) Form(com.servoy.j2db.persistence.Form) WebFormComponent(com.servoy.j2db.server.ngclient.WebFormComponent) FoundsetLinkedConfig(com.servoy.j2db.server.ngclient.property.FoundsetLinkedConfig) GlobalMethodValueList(com.servoy.j2db.dataprocessing.GlobalMethodValueList) IDataProvider(com.servoy.j2db.persistence.IDataProvider) Relation(com.servoy.j2db.persistence.Relation) INGApplication(com.servoy.j2db.server.ngclient.INGApplication) IContextProvider(com.servoy.j2db.server.ngclient.IContextProvider) FormAndTableDataProviderLookup(com.servoy.j2db.FormAndTableDataProviderLookup) ITable(com.servoy.j2db.persistence.ITable) ComponentTypeConfig(com.servoy.j2db.server.ngclient.property.ComponentTypeConfig) IValueList(com.servoy.j2db.dataprocessing.IValueList) ComponentFormat(com.servoy.j2db.component.ComponentFormat) ValueListConfig(com.servoy.j2db.server.ngclient.property.ValueListConfig) PropertyDescription(org.sablo.specification.PropertyDescription) FoundsetTypeSabloValue(com.servoy.j2db.server.ngclient.property.FoundsetTypeSabloValue) IDataProviderLookup(com.servoy.j2db.persistence.IDataProviderLookup)

Aggregations

FoundsetTypeSabloValue (com.servoy.j2db.server.ngclient.property.FoundsetTypeSabloValue)7 JSONObject (org.json.JSONObject)5 IRecordInternal (com.servoy.j2db.dataprocessing.IRecordInternal)3 IContextProvider (com.servoy.j2db.server.ngclient.IContextProvider)3 PropertyDescription (org.sablo.specification.PropertyDescription)3 ComponentFormat (com.servoy.j2db.component.ComponentFormat)2 IFoundSetInternal (com.servoy.j2db.dataprocessing.IFoundSetInternal)2 ITable (com.servoy.j2db.persistence.ITable)2 IHasUnderlyingState (com.servoy.j2db.server.ngclient.property.IHasUnderlyingState)2 ChangeAwareList (org.sablo.specification.property.ChangeAwareList)2 ChangeAwareMap (org.sablo.specification.property.ChangeAwareMap)2 FormAndTableDataProviderLookup (com.servoy.j2db.FormAndTableDataProviderLookup)1 GlobalMethodValueList (com.servoy.j2db.dataprocessing.GlobalMethodValueList)1 IValueList (com.servoy.j2db.dataprocessing.IValueList)1 Form (com.servoy.j2db.persistence.Form)1 IDataProvider (com.servoy.j2db.persistence.IDataProvider)1 IDataProviderLookup (com.servoy.j2db.persistence.IDataProviderLookup)1 Relation (com.servoy.j2db.persistence.Relation)1 ValueList (com.servoy.j2db.persistence.ValueList)1 INGApplication (com.servoy.j2db.server.ngclient.INGApplication)1