- * @designer.publicmethod
- */
- public void setPreventFiltering(boolean preventFiltering) {
- this.preventFiltering = preventFiltering;
- }
-
-
/*
* (non-Javadoc)
*
@@ -323,108 +271,75 @@ public IPickerResult readEntries(final IPickerOptions options) {
* @since org.openntf.domino.xsp 4.5.0
*/
private LinkedHashMap filteredOptions(final String key, final String startKey, final int start, final int searchIndex) {
-
- boolean isPreventFiltering = isPreventFiltering();
- String submittedKey = (null != key)? /*typeAhead submitted*/ key
- : /*PickerListSearch submitted*/startKey;
-
LinkedHashMap retVal = new LinkedHashMap();
-
- // Note, this pickerData is unusual in that most of them
- // do a startsWith filter for typeAheads but this is honoring the searchType option.
- if (!isPreventFiltering && StringUtil.isNotEmpty(submittedKey)) {
-
- // We've got a search key passed in, so search and add all remaining entries
-
- boolean isCaseInsensitive = isCaseInsensitive();
- // Note, for case insensitive matching, it is not safe to do .toLowerCase
- // on the whole string, because of the Turkish dotless-i character.
- // Instead use the algorithm described in String.equalsIgnoreCase and
- // see http://www.i18nguy.com/unicode/turkish-i18n.html
- String computedSearchRange = getSearchRange();
- // note, the org.openntf.domino.xsp implementation defaulted to searchTo, but this defaults to restrictToSearch
- SearchRange searchRangeEnum = SearchRange.SEARCH_JUMPTO.getValue().equals(computedSearchRange)?
- SearchRange.SEARCH_JUMPTO: /*default*/SearchRange.SEARCH_RESTRICTTOSEARCH;
-
- String searchType = getSearchType();
- SearchType searchTypeEnum;
- if( SearchType.SEARCH_EQUALS.getValue().equals(searchType) ){
- searchTypeEnum = SearchType.SEARCH_EQUALS;
- }else if(SearchType.SEARCH_CONTAINS.getValue().equals(searchType)){
- searchTypeEnum = SearchType.SEARCH_CONTAINS;
- }else{ // startsWith (or old startsFrom value)
- searchTypeEnum = SearchType.SEARCH_STARTSWITH;
+ String searchType = getSearchType();
+
+ if (StringUtil.isNotEmpty(key)) {
+ // We've got a typeahead key passed in, filter to entries beginning
+ // with that key
+ String tmpKey = key;
+ if (isCaseInsensitive()) {
+ tmpKey = tmpKey.toLowerCase();
}
-
- boolean doContainsLowerCaseCompare = false;
- String keyLowerCase = null;
- Pattern keyInsensitivePattern = null;
- if( isCaseInsensitive && SearchType.SEARCH_CONTAINS == searchTypeEnum){
- // Note, defaulting to doing the slower Turkish-compliant search,
- // but there's an option to use the faster not-Turkish-compliant lowerCase compare.
- doContainsLowerCaseCompare = "false".equals( //$NON-NLS-1$
- FacesContextEx.getCurrentInstance().getApplicationEx()
- .getProperty("xsp.picker.case_insensitive.locale.aware", /* defaultValue */"true")); //$NON-NLS-1$ //$NON-NLS-2$
- if( doContainsLowerCaseCompare ){
- keyLowerCase = submittedKey.toLowerCase();
- }else{ // default
- String escapedKey = Pattern.quote(submittedKey);
- keyInsensitivePattern = Pattern.compile(escapedKey, Pattern.CASE_INSENSITIVE);
+
+ Iterator it = getOptions().keySet().iterator();
+ while (it.hasNext()) {
+ String mapKey = it.next();
+ String tmpMapKey = mapKey;
+ if (isCaseInsensitive()) {
+ tmpMapKey = tmpMapKey.toLowerCase();
+ }
+ if (tmpMapKey.startsWith(tmpKey)) {
+ retVal.put(mapKey, getOptions().get(mapKey));
}
}
+ } else if (StringUtil.isNotEmpty(startKey)) {
+ // startKey is actually a search key
+ // We've got a search key passed in, so search and add all remaining
+ // entries
+ String tmpSearchKey = startKey;
+ if (isCaseInsensitive()) {
+ tmpSearchKey = tmpSearchKey.toLowerCase();
+ }
- Map computedOptions = getOptionsMap();
- Iterator it = computedOptions.keySet().iterator();
+ Iterator it = getOptions().keySet().iterator();
boolean found = false;
while (it.hasNext()) {
String mapKey = it.next();
+ String tmpMapKey = mapKey;
+ if (isCaseInsensitive()) {
+ tmpMapKey = tmpMapKey.toLowerCase();
+ }
if (found) {
- retVal.put(mapKey, computedOptions.get(mapKey));
+ retVal.put(mapKey, getOptions().get(mapKey));
found = true;
} else {
- boolean match;
- if (SearchType.SEARCH_EQUALS == searchTypeEnum ) {
- match = (!isCaseInsensitive)?StringUtil.equals(mapKey, submittedKey)
- : StringUtil.equalsIgnoreCase(mapKey, submittedKey);
- } else if (SearchType.SEARCH_CONTAINS == searchTypeEnum ) {
- if( !isCaseInsensitive ){
- match = mapKey.contains(submittedKey);
- }else if( doContainsLowerCaseCompare ){
- match = mapKey.toLowerCase().contains(keyLowerCase);
- }else{ // default case insensitive handling that can match the Turkish dotless-i
- match = keyInsensitivePattern.matcher(mapKey).find();
+ if (SearchType.SEARCH_MATCH.getValue().equals(searchType)) {
+ if (StringUtil.equals(tmpMapKey, tmpSearchKey)) {
+ retVal.put(mapKey, getOptions().get(mapKey));
+ if (SearchStyle.SEARCH_JUMPTO.getValue().equals(getSearchStyle())) {
+ found = true;
+ }
}
- } else { // SearchType.SEARCH_STARTFROM == searchTypeEnum
- match = (!isCaseInsensitive)? mapKey.startsWith(submittedKey)
- : mapKey.regionMatches(/* ignoreCase */true,
- 0, submittedKey,0,submittedKey.length());
- }
- if (match) {
- retVal.put(mapKey, computedOptions.get(mapKey));
- if (SearchRange.SEARCH_JUMPTO == searchRangeEnum ) {
- found = true;
+ } else if (SearchType.SEARCH_FTSEARCH.getValue().equals(searchType)) {
+ if (tmpMapKey.contains(tmpSearchKey)) {
+ retVal.put(mapKey, getOptions().get(mapKey));
+ if (SearchStyle.SEARCH_JUMPTO.getValue().equals(getSearchStyle())) {
+ found = true;
+ }
+ }
+ } else {
+ if (tmpMapKey.startsWith(tmpSearchKey)) {
+ retVal.put(mapKey, getOptions().get(mapKey));
+ if (SearchStyle.SEARCH_JUMPTO.getValue().equals(getSearchStyle())) {
+ found = true;
+ }
}
}
}
}
- } else { // initial display without filtering, or filtering disabled
-
- List shadowed = null;
- DataPublisher dataPublisher = null;
- if( isPreventFiltering ){
- // computed options can reference requestScope.startValue to access the submittedKey.
- dataPublisher = FacesContextEx.getCurrentInstance().getDataPublisher();
- shadowed = new ArrayList();
- dataPublisher.pushObject(shadowed, "startValue", /*may be null*/submittedKey); //$NON-NLS-1$
- }
- try{
- Map computedOptions = getOptionsMap();
- retVal.putAll(computedOptions);
- }finally{
- if( isPreventFiltering ){
- dataPublisher.popObjects(shadowed);
- }
- }
+ } else {
+ retVal.putAll(getOptions());
}
return retVal;
}
@@ -443,26 +358,17 @@ private LinkedHashMap filteredOptions(final String key, final St
*/
@Override
public List loadEntries(final Object[] values, final String[] attributes) {
- // Note, this is method used by the PickerValidator,
- // and is checking against the values, not the keys, so it wouldn't be a caseInsensitive search.
- // Initially the list has a null entry for each of the values array,
- // and each index value will be replaced with an Entry if some map value
- // is found that matches that value.
- int length = (null == values)? 0 : values.length;
- List entries = new ArrayList(length);
+ List entries = new ArrayList();
if (null != values) {
- Map computedOptions = getOptionsMap();
for (int i = 0; i < values.length; i++) {
String checkStr = values[i].toString();
- entries.add(i, null);
if (StringUtil.isNotEmpty(checkStr)) {
- Iterator it = computedOptions.keySet().iterator();
+ Iterator it = getOptions().keySet().iterator();
while (it.hasNext()) {
String mapKey = it.next();
- String mapValue = computedOptions.get(mapKey);
- if (StringUtil.equals(checkStr, mapValue)) {
- entries.set(i, new SimplePickerResult.Entry(mapValue, mapKey));
- break; // found for this value, continue the for loop to find for next value
+ if (StringUtil.equals(checkStr, getOptions().get(mapKey))) {
+ entries.add(new SimplePickerResult.Entry(getOptions().get(mapKey), mapKey));
+ break;
}
}
}
@@ -478,16 +384,15 @@ public List loadEntries(final Object[] values, final String[] attr
* com.ibm.xsp.complex.ValueBindingObjectImpl#restoreState(javax.faces.context
* .FacesContext, java.lang.Object)
*/
- @SuppressWarnings("unchecked") //$NON-NLS-1$
+ @SuppressWarnings("unchecked")
@Override
- public void restoreState(final FacesContext context, final Object state) {
- Object values[] = (Object[]) state;
- super.restoreState(context, values[0]);
- options = (Map) values[1];
- searchType = (String) values[2];
- caseInsensitive = (Boolean) values[3];
- searchRange = (String) values[4];
- preventFiltering = (Boolean) values[5];
+ public void restoreState(final FacesContext _context, final Object _state) {
+ Object _values[] = (Object[]) _state;
+ super.restoreState(_context, _values[0]);
+ options = (Map) _values[1];
+ searchType = (String) _values[2];
+ caseInsensitive = (Boolean) _values[3];
+ searchStyle = (String) _values[4];
}
/*
@@ -498,15 +403,14 @@ public void restoreState(final FacesContext context, final Object state) {
* .FacesContext)
*/
@Override
- public Object saveState(final FacesContext context) {
- Object values[] = new Object[6];
- values[0] = super.saveState(context);
- values[1] = options;
- values[2] = searchType;
- values[3] = caseInsensitive;
- values[4] = searchRange;
- values[5] = preventFiltering;
- return values;
+ public Object saveState(final FacesContext _context) {
+ Object _values[] = new Object[5];
+ _values[0] = super.saveState(_context);
+ _values[1] = options;
+ _values[2] = searchType;
+ _values[3] = caseInsensitive;
+ _values[4] = searchStyle;
+ return _values;
}
}
diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/config/extlib-picker.xsp-config b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/config/extlib-picker.xsp-config
index bd75abd..f02ade1 100644
--- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/config/extlib-picker.xsp-config
+++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/config/extlib-picker.xsp-config
@@ -1,7 +1,7 @@
-
+
@@ -402,52 +402,57 @@
pickerValidator
+
- %complex-type.mapValuePicker.descr%
- %complex-type.mapValuePicker.name%
+ %complex-type.mapPicker.descr%
+ %complex-type.mapPicker.name%com.ibm.xsp.extlib.component.picker.data.MapValuePickerDatacom.ibm.xsp.extlib.component.picker.data.MapValuePickerData
- %property.options.descr%
- %property.options.name%
+ %property.map.complex-type.mapPicker.descr%
+ %property.map.complex-type.mapPicker.name%optionsjava.util.Map
- true
- falsecom.ibm.workplace.designer.ide.xfaces.internal.editors.MethodBindingEditor
-
+ %property.searchType.descr%%property.searchType.name%searchTypejava.lang.String
+
+ not-localizable
+ com.ibm.workplace.designer.property.editors.comboParameterEditor
- startsWith
- equals
- contains
-
+ startFrom
+ match
+ ftSearch
+
-
- %property.searchRange.descr%
- %property.searchRange.name%
- searchRange
+
+ %property.searchStyle.descr%
+ %property.searchStyle.name%
+ searchStylejava.lang.String
+
+ not-localizable
+ com.ibm.workplace.designer.property.editors.comboParameterEditor
jumpTo
restrictToSearch
-
+
@@ -456,84 +461,80 @@
%property.caseInsensitive.name%caseInsensitiveboolean
-
-
- %property.preventFiltering.descr%
- %property.preventFiltering.name%
- preventFiltering
- boolean
+ com.ibm.xsp.extlib.component.picker.data.IValuePickerData
- 9.0.1.v00_12mapValuePicker
-
- %complex-type.collectionValuePicker.descr%
- %complex-type.collectionValuePicker.name%
+
+
+
+
+ %complex-type.collectionPicker.descr%
+ %complex-type.collectionPicker.name%com.ibm.xsp.extlib.component.picker.data.CollectionValuePickerDatacom.ibm.xsp.extlib.component.picker.data.CollectionValuePickerData
- %property.collection.descr%
- %property.collection.name%
+ %property.collection.complex-type.collectionPicker.descr%
+ %property.collection.complex-type.collectionPicker.name%collectionjava.util.Collection
- true
- falsecom.ibm.workplace.designer.ide.xfaces.internal.editors.MethodBindingEditor
-
+ %property.searchType.descr%%property.searchType.name%searchTypejava.lang.String
+
+ not-localizable
+ com.ibm.workplace.designer.property.editors.comboParameterEditor
- startsWith
- equals
- contains
-
+ startFrom
+ match
+ ftSearch
+
-
- %property.searchRange.descr%
- %property.searchRange.name%
- searchRange
+
+ %property.searchStyle.descr%
+ %property.searchStyle.name%
+ searchStylejava.lang.String
+
+ not-localizable
+ com.ibm.workplace.designer.property.editors.comboParameterEditor
jumpTo
restrictToSearch
-
+
-
- %property.preventFiltering.descr%
- %property.preventFiltering.name%
- preventFiltering
- boolean
- %property.caseInsensitive.descr%%property.caseInsensitive.name%caseInsensitiveboolean
+ com.ibm.xsp.extlib.component.picker.data.IValuePickerData
- 9.0.1.v00_12collectionValuePicker
-
+
+
\ No newline at end of file
diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/config/extlib-picker_en.properties b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/config/extlib-picker_en.properties
index edd4455..a302f99 100644
--- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/config/extlib-picker_en.properties
+++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/config/extlib-picker_en.properties
@@ -1,6 +1,6 @@
# *****************************************************************
# /*
-# * Copyright IBM Corp. 2010, 2015
+# * Copyright IBM Corp. 2010, 2013
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
# * permissions and limitations under the License.
# */
# *****************************************************************
-
# DO NOT EDIT. THIS FILE IS GENERATED.
# NLS_ENCODING=UNICODE
# NLS_MARKUP=IBMNJDK2
@@ -80,22 +79,16 @@ property.dataProvider.validator.com.ibm.xsp.extlib.validator.PickerValidator.des
property.for.validator.com.ibm.xsp.extlib.validator.PickerValidator.name= Data Picker ID
# The "id" should not be translated, it refers to the id Identifier property
property.for.validator.com.ibm.xsp.extlib.validator.PickerValidator.descr= Points to the ID of a data picker control (value or name picker)
-complex-type.mapValuePicker.name= Map Picker Data Provider
-# "java.util.Map<String,String>" should not be translated
-complex-type.mapValuePicker.descr= A Value Picker Data Provider that takes its content from a java.util.Map. The map has multiple entries, each containing a text label key and a text data value. The key is the label that is displayed to the user, and the data value is saved in the document field if the entry is selected.
-property.options.name= Options Map
-# "java.util.Map" and "LinkedHashMap" should not be translated
-property.options.descr= The map containing the data, an implementation of java.util.Map (e.g. LinkedHashMap). The map keys are labels. The values are data.
-property.searchType.name= Search Type
-# "startsWith" "equals" and "contains" should not be translated
-property.searchType.descr= Defines the type of comparison used when searching for entries whose label matches a submitted search value. The options are "startsWith", which selects entries that begin with the search value, "equals", which selects entries that are the same as the search value or that are considered the same when doing a case insensitive comparison, and "contains", which selects entries that contain the search value within entry label. The default is "startsWith".
-property.searchRange.name= Search Results Range
-property.searchRange.descr= Defines the range of search results to be displayed. The default is "restrictToSearch", showing only those entries that match the search criteria. The other option is "jumpTo", which shows the first entry that matches the search criteria and all remaining entries, even where the remaining entries do not match the search criteria.
-property.preventFiltering.name= Prevent Filtering
-property.preventFiltering.descr= Prevents the filtering of the list of values using the value submitted by the browser. The default value is false.
-complex-type.collectionValuePicker.name= Collection Picker Data Provider
-# Do not translate "java.util.Collection", "List", "Set", "Vector"
-complex-type.collectionValuePicker.descr= A Value Picker Data Provider that takes its content from a java.util.Collection object which contains multiple items, e.g. List, Set, Vector. Each item is a text value that is used as both the label displayed to the user and as the data value that is saved to a document field.
-property.collection.name= Collection
-# Do not translate "java.util.Collection", "java.util.TreeSet" or "java.util.ArrayList"
-property.collection.descr= The java.util.Collection object containing the multiple items to be shown in the Value Picker dialog. For example the object might be a java.util.TreeSet or java.util.ArrayList.
+
+complex-type.mapPicker.name= Map Picker Data Provider
+complex-type.mapPicker.descr= Map Picker Data Provider that takes its content from a Map
+property.map.complex-type.mapPicker.name= Map
+property.map.complex-type.mapPicker.descr= Map for the MapPicker, implementation of Map (e.g. LinkedHashMap)
+property.caseInsensitive.name= Case Insensitive Key
+property.caseInsensitive.descr= Specifies if the key being used should be treated as case insensitive
+property.searchStyle.name= Style of Search
+property.searchStyle.descr= Define the style of search to be used. The default is "jumpTo", working like the Extension Library picker searches - jumping to the first entry matching the search type and showing all remaining entries. The alternative is "restrictToSearch", so showing only those entries that match the search criteria.
+complex-type.collectionPicker.name= Collection Picker Data Provider
+complex-type.collectionPicker.descr= Collection Picker Data Provider that takes its content from a List, Set, Vector etc
+property.collection.complex-type.collectionPicker.name= Collection
+property.collection.complex-type.collectionPicker.descr= Collection for the CollectionPicker, implementation of Set or List (e.g. TreeSet or ArrayList)
\ No newline at end of file
diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/.classpath b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/.classpath
index 1fa3e68..e2a51c8 100644
--- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/.classpath
+++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/.classpath
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/.project b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/.project
index 9d271f9..7cb05a8 100644
--- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/.project
+++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/.project
@@ -19,11 +19,6 @@
org.eclipse.pde.SchemaBuilder
-
-
- org.maven.ide.eclipse.maven2Builder
-
- org.eclipse.m2e.core.maven2Builder
@@ -33,7 +28,6 @@
org.eclipse.m2e.core.maven2Nature
- org.maven.ide.eclipse.maven2Natureorg.eclipse.pde.PluginNatureorg.eclipse.jdt.core.javanature
diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/.settings/org.eclipse.m2e.core.prefs b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..14b697b
--- /dev/null
+++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.classpath b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.classpath
index 1fa3e68..e2a51c8 100644
--- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.classpath
+++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.classpath
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.project b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.project
index f8dd2f5..5da2733 100644
--- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.project
+++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.project
@@ -20,11 +20,6 @@
-
- org.maven.ide.eclipse.maven2Builder
-
-
- org.eclipse.m2e.core.maven2Builder
@@ -33,7 +28,6 @@
org.eclipse.m2e.core.maven2Nature
- org.maven.ide.eclipse.maven2Natureorg.eclipse.pde.PluginNatureorg.eclipse.jdt.core.javanature
diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.settings/org.eclipse.jdt.core.prefs b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.settings/org.eclipse.jdt.core.prefs
index a3b1b50..c37e100 100644
--- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.settings/org.eclipse.jdt.core.prefs
+++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.settings/org.eclipse.jdt.core.prefs
@@ -1,6 +1,9 @@
-#Mon Jul 26 14:47:44 EDT 2010
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -9,6 +12,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
@@ -65,3 +69,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.settings/org.eclipse.m2e.core.prefs b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..14b697b
--- /dev/null
+++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/src/com/ibm/xsp/extlib/component/picker/data/AbstractDominoViewPickerData.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/src/com/ibm/xsp/extlib/component/picker/data/AbstractDominoViewPickerData.java
index 177e2aa..5f41525 100644
--- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/src/com/ibm/xsp/extlib/component/picker/data/AbstractDominoViewPickerData.java
+++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/src/com/ibm/xsp/extlib/component/picker/data/AbstractDominoViewPickerData.java
@@ -30,272 +30,284 @@
import com.ibm.commons.util.StringUtil;
import com.ibm.xsp.FacesExceptionEx;
import com.ibm.xsp.complex.ValueBindingObjectImpl;
-import com.ibm.xsp.context.FacesContextEx;
import com.ibm.xsp.model.domino.DominoUtils;
import com.ibm.xsp.model.domino.wrapped.DominoViewEntry;
-
/**
* Abstract data provider for a picker that reads the data from a Domino view.
*
- * This class does not preclude how the
+ * This class does not preclude how the
*
- * This class implements a set of new functions available to the JavaScript interpreter.
- * They become available to Domino Designer in the category "@JDBC".
+ * This class implements a set of new functions available to the JavaScript
+ * interpreter. They become available to Domino Designer in the category
+ * "@JDBC".
*
*/
public class JdbcFunctions extends FBSDefaultObject {
- // Functions IDs
- private static final int FCT_GETCONNECTION = 1;
- private static final int FCT_DBCOLUMN = 2;
-
- private static final int FCT_EXECUTEQUERY = 3;
- private static final int FCT_INSERT = 4;
- private static final int FCT_UPDATE = 5;
- private static final int FCT_DELETE = 6;
-
- // ============================= CODE COMPLETION ==========================
- //
- // Even though JavaScript is an untyped language, the XPages JavaScript
- // interpreter can make use of symbolic information defining the
- // objects/functions exposed. This is particularly used by Domino Designer
- // to provide the code completion facility and help the user writing code.
- //
- // Each function expose by a library can then have one or multiple
- // "prototypes", defining its parameters and the returned value type. To
- // make this definition as efficient as possible, the parameter definition
- // is compacted within a string, where all the parameters are defined
- // within parenthesis followed by the returned value type.
- // A parameter is defined by its name, followed by a colon and its type.
- // Generally, the type is defined by a single character (see bellow) or a
- // full Java class name. The returned type is defined right after the
- // closing parameter parenthesis.
- //
- // Here is, for example, the definition of the "@Date" function which can
- // take 3 different set of parameters:
- // "(time:Y):Y",
- // "(years:Imonths:Idays:I):Y",
- // "(years:Imonths:Idays:Ihours:Iminutes:Iseconds:I):Y");
- //
- // List of types
- // V void
- // C char
- // B byte
- // S short
- // I int
- // J long
- // F float
- // D double
- // Z boolean
- // T string
- // Y date/time
- // W any (variant)
- // N multiple (...)
- // L; object
- // ex:
- // (entries:[Lcom.ibm.xsp.extlib.MyClass;):V
- //
- // =========================================================================
-
- public JdbcFunctions(JSContext jsContext) {
-
- super(jsContext, null, false);
-
- addFunction(FCT_GETCONNECTION, "@JdbcGetConnection", "(data:T):Ljava.sql.Connection;"); // $NON-NLS-1$ $NON-NLS-2$
- addFunction(FCT_DBCOLUMN, "@JdbcDbColumn", "(connection:Wtable:Tcolumn:T):A", "(connection:Wtable:Tcolumn:Twhere:T):A", "(connection:Wtable:Tcolumn:Twhere:TorderBy:T):A","(connection:Wtable:Tcolumn:Twhere:TorderBy:Tparams:A):A"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ $NON-NLS-4$ $NON-NLS-5$
- addFunction(FCT_EXECUTEQUERY, "@JdbcExecuteQuery", "(connection:Wsql:T):Ljava.sql.ResultSet;", "(connection:Wsql:Tparams:A):Ljava.sql.ResultSet;"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
- addFunction(FCT_INSERT, "@JdbcInsert", "(connection:Wtable:Tvalues:W):I", "(connection:Wtable:Tvalues:WcolumnNames:A):I", "(connection:Wtable:Tvalues:WcolumnNames:AcolToUpperCase:Z):I"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ $NON-NLS-4$
- addFunction(FCT_UPDATE, "@JdbcUpdate", "(connection:Wtable:Tvalues:W):I", "(connection:Wtable:Tvalues:Wwhere:T):I", "(connection:Wtable:Tvalues:Wwhere:Tparams:A):I", "(connection:Wtable:Tvalues:Wwhere:Tparams:AcolToUpperCase:Z):I"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ $NON-NLS-4$ $NON-NLS-5$
- addFunction(FCT_DELETE, "@JdbcDelete", "(connection:Wtable:Twhere:T):I", "(connection:Wtable:Twhere:Tparams:A):I"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
- }
-
- private void addFunction(int index, String functionName, String... params) {
- createMethod(functionName, FBSObject.P_NODELETE | FBSObject.P_READONLY,
- new NotesFunction(getJSContext(), index, functionName,
- params));
- }
-
- @Override
- public boolean hasInstance(FBSValue v) {
- return v instanceof FBSGlobalObject;
- }
-
- @Override
- public boolean isJavaNative() {
- return false;
- }
-
-
- // =================================================================================
- // Functions implementation
- // For optimization reasons, there is one NotesFunction instance per function,
- // instead of one class (this avoids loading to many classes). To then distinguish
- // the actual function, it uses an index member.
- // =================================================================================
-
- public static class NotesFunction extends BuiltinFunction {
-
- private String functionName;
- private int index;
- private String[] params;
-
- NotesFunction(JSContext jsContext, int index,
- String functionName, String[] params) {
-
- super(jsContext);
- this.functionName = functionName;
- this.index = index;
- this.params = params;
- }
-
- /**
- * Index of the function.
- *
- * There must be one instanceof this class per index.
- *
- */
- public int getIndex() {
- return this.index;
- }
-
- /**
- * Return the list of the function parameters.
- *
- * Note that this list is not used at runtime, at least for now, but
- * consumed by Designer code completion.
- * A function can expose multiple parameter sets.
- *
- */
- @Override
- protected String[] getCallParameters() {
- return this.params;
- }
-
- /**
- * Function name, as exposed by Designer and use at runtime.
- *
- * This function is exposed in the JavaScript global namespace, so you
- * should be careful to avoid any name conflict.
- *
- * The JS runtime calls this method when the method is executed within
- * a JavaScript formula.
- *
- * @param context the JavaScript execution context (global variables, function...)
- * @param args the arguments passed to the function
- * @params _this the "this" object when the method is called as a "this" member
- */
- @Override
- public FBSValue call(IExecutionContext context, FBSValueVector args,
- FBSObject _this) throws JavaScriptException {
-
- try {
- // Else execute the formulas
- switch (index) {
-
- case FCT_GETCONNECTION: {
- if(args.size()>=1) {
- String name = args.get(0).stringValue();
- return FBSUtility.wrap(context.getJSContext(), JdbcUtil.createNamedConnection(FacesContext.getCurrentInstance(),name));
- }
- } break;
-
- case FCT_DBCOLUMN: {
- if(args.size()>=3) {
- Connection c = getConnection(args.get(0));
- String tbName = args.get(1).stringValue();
- String colName = args.get(2).stringValue();
- String where = args.size() > 3 && !args.get(3).isNull() ? args.get(3).stringValue() : null;
- String orderBy = args.size() > 4 && !args.get(4).isNull()? args.get(4).stringValue() : null;
- FBSValue params = args.size() > 5 && !args.get(5).isNull()? args.get(5) : null;
-
- String sql = StringUtil.format("SELECT {0} FROM {1}",colName,tbName); // $NON-NLS-1$
- if(StringUtil.isNotEmpty(where)) {
- sql = sql + " WHERE " + where; // $NON-NLS-1$
- }
- if(StringUtil.isNotEmpty(orderBy)) {
- sql = sql + " ORDER BY " + orderBy; // $NON-NLS-1$
- }
- PreparedStatement st = c.prepareStatement(sql);
- try {
- initParameters(st, params);
- ResultSet rs = st.executeQuery();
- try {
- ArrayObject result = new ArrayObject(getJSContext());
- while(rs.next()) {
- Object value = rs.getObject(1);
- result.addArrayValue(FBSUtility.wrap(context.getJSContext(),value));
- }
- // Make the result similar to @DbColumn
- if(result.getArrayLength()==0) {
- return FBSUndefined.undefinedValue;
- } else if(result.getArrayLength()==1) {
- return result.get(0);
- } else {
- return result;
- }
- } finally {
- rs.close();
- }
- } finally {
- st.close();
- }
- }
- } break;
-
- case FCT_EXECUTEQUERY: {
- if(args.size()>=2) {
- Connection c = getConnection(args.get(0));
- String sql = args.get(1).stringValue();
- FBSValue params = args.size() > 2 && !args.get(2).isNull()? args.get(2) : null;
-
- PreparedStatement st = c.prepareStatement(sql);
- initParameters(st, params);
- ResultSet rs = st.executeQuery();
- return FBSUtility.wrap(context.getJSContext(),rs);
- }
- } break;
-
- case FCT_INSERT: {
- final FBSValue retVal_ = doInsert(args, context);
- if (null != retVal_) {
- return retVal_;
- }
- } break;
-
- case FCT_UPDATE: {
- final FBSValue retVal_ = doUpdate(args, context);
- if (null != retVal_) {
- return retVal_;
- }
- } break;
-
- case FCT_DELETE: {
- if(args.size()>=2) {
- Connection c = getConnection(args.get(0));
- String tbName = args.get(1).stringValue();
- String where = args.size() > 2 && !args.get(2).isNull()? args.get(2).stringValue() : null;
- FBSValue params = args.size() > 3 && !args.get(3).isNull()? args.get(3) : null;
-
- StringBuilder b = new StringBuilder();
- b.append("DELETE FROM "); // $NON-NLS-1$
- JdbcUtil.appendTableName(b, tbName);
- if(StringUtil.isNotEmpty(where)) {
- b.append(" WHERE "); // $NON-NLS-1$
- b.append(where);
- }
- String sql = b.toString();
- PreparedStatement st = c.prepareStatement(sql);
- try {
- if(params!=null) {
- initParameters(st, params);
- }
- int count = st.executeUpdate();
- return FBSUtility.wrap(context.getJSContext(),count);
- } finally {
- st.close();
- }
- }
- } break;
-
- default: {
- throw new InterpretException(null, StringUtil.format(
- "Internal error: unknown function \'{0}\'", functionName)); // $NLX-JdbcFunctions.Internalerrorunknownfunction0-1$
- }
-
- }
-
- // } catch (InterpretException e) {
- // throw e;
- // } catch (NotesException e) {
- // // This case covers where a call to session.evaluate() throws a NotesException
- // // We want to continue rendering the page but allow @IsError to pick up on this issue
- // // so we return @Error (NaN / FBSUndefined.undefinedValue)
- // return FBSUndefined.undefinedValue;
- } catch (Exception e) {
- throw new InterpretException(e, StringUtil.format(
- "Error while executing function \'{0}\'", functionName)); // $NLX-JdbcFunctions.Errorwhileexecutingfunction0-1$
- }
- throw new InterpretException(null, StringUtil.format(
- "Cannot evaluate function \'{0}\'", functionName)); // $NLX-JdbcFunctions.Cannotevaluatefunction0-1$
- }
- }
-
- // ============================================================================
- // Utilities
- // ============================================================================
-
- protected static Connection getConnection(FBSValue connection) throws SQLException, InterpretException {
- FBSValue _c = connection;
- if(_c.isString()) {
- return JdbcUtil.createNamedConnection(FacesContext.getCurrentInstance(),_c.stringValue());
- } else {
- return (Connection)_c.toJavaObject(Connection.class);
- }
- }
-
- protected static void initParameters(PreparedStatement st, FBSValue params) throws SQLException, InterpretException {
- initParameters(st, params, 0);
- }
- protected static void initParameters(PreparedStatement st, FBSValue params, int offset) throws SQLException, InterpretException {
- if(params!=null) {
- int count = params.getArrayLength();
- for(int i=0; i namedValues;
- List values;
- // Calculate the parameters
- // If it is an array, then the insert/update will correspond to *
- // If it is a map, then the entry will be the column name/values
- SQLValues(FBSValue params) throws SQLException, InterpretException {
- if(params instanceof ObjectObject) {
- FBSDefaultObject o = (FBSDefaultObject)params;
- namedValues = new HashMap();
- for(Iterator it=o.getPropertyIterator(); it.hasNext(); ) {
- JSProperty p = it.next();
- String name = p.getPropertyName();
- Object value = p.getValue().toJavaObject();
- namedValues.put(name, value);
- }
- } else if(params instanceof ArrayObject) {
- ArrayObject o = (ArrayObject)params;
- int n = o .getArrayLength();
- values = new ArrayList(n);
- for(int i=0; i(n);
- for(int i=0; i initInsertValues(StringBuilder b, FBSValue params, Boolean colToUpperCase) throws SQLException, InterpretException {
- SQLValues sqlValues = new SQLValues(params);
- // In case of an array
- if (sqlValues.values != null) {
- return sqlValues.values;
- }
- if (sqlValues.namedValues != null) {
- boolean first = true;
- sqlValues.values = new ArrayList(sqlValues.namedValues.size());
- b.append(" (");
- for (Map.Entry e : sqlValues.namedValues.entrySet()) {
- if (!first) {
- b.append(',');
- } else {
- first = false;
- }
- JdbcUtil.appendColumnName(b, e.getKey(), colToUpperCase);
- sqlValues.values.add(e.getValue());
- }
- b.append(')');
- return sqlValues.values;
- }
-
- throw new SQLException("No valid values passed to the INSERT statement"); // $NLX-JdbcFunctions.Novalidvaluespassedtothe0statemen-1$
- }
-
- protected static List initUpdateValues(StringBuilder b, FBSValue params, Boolean colToUpperCase) throws SQLException, InterpretException {
- SQLValues sqlValues = new SQLValues(params);
- if (sqlValues.namedValues != null) {
- boolean first = true;
- sqlValues.values = new ArrayList(sqlValues.namedValues.size());
- b.append(" SET "); // $NON-NLS-1$
- for (Map.Entry e : sqlValues.namedValues.entrySet()) {
- if (!first) {
- b.append(',');
- } else {
- first = false;
- }
- JdbcUtil.appendColumnName(b, e.getKey(), colToUpperCase);
- b.append("=?");
- sqlValues.values.add(e.getValue());
- }
- return sqlValues.values;
- }
-
- throw new SQLException("No valid values passed to the UPDATE statement"); // $NLX-JdbcFunctions.Novalidvaluespassedtothe0statemen.1-1$
- }
-
- protected static FBSValue doInsert(FBSValueVector args, IExecutionContext context) throws SQLException, InterpretException {
- if (args.size() >= 2) {
- Connection c = getConnection(args.get(0));
- String tbName = args.get(1).stringValue();
- FBSValue values = args.get(2);
- FBSValue idColumnNames = args.size() > 3 && !args.get(3).isNull() ? args.get(3) : null;
- Boolean colToUpperCase = args.size() > 4 && !args.get(4).isNull() ? args.get(4).booleanValue() : null;
-
- StringBuilder b = new StringBuilder();
- b.append("INSERT INTO "); // $NON-NLS-1$
- JdbcUtil.appendTableName(b, tbName);
- List v = initInsertValues(b, values, colToUpperCase);
- b.append(" VALUES("); // $NON-NLS-1$
- for (int i = 0; i < v.size(); i++) {
- if (i != 0) {
- b.append(',');
- }
- b.append('?');
- }
- b.append(")");
- String sql = b.toString();
- PreparedStatement st = null;
- if (idColumnNames == null) {
- st = c.prepareStatement(sql);
- } else {
- List vNames = initInsertValues(null, idColumnNames, colToUpperCase);
- String[] columnNames = new String[vNames.size()];
- for (int i = 0; i < vNames.size(); i++) {
- columnNames[i] = (String) vNames.get(i);
- }
- st = c.prepareStatement(sql, columnNames);
- }
- try {
- for (int i = 0; i < v.size(); i++) {
- st.setObject(i + 1, v.get(i));
- }
- int count = st.executeUpdate();
- if (idColumnNames != null) {
- ResultSet rs = st.getGeneratedKeys();
- if (rs.next()) {
- Object value = rs.getBigDecimal(1);
- return FBSUtility.wrap(context.getJSContext(), value);
- }
- }
- return FBSUtility.wrap(context.getJSContext(), count);
- } finally {
- st.close();
- }
- }
- return null;
- }
-
- public static FBSValue doUpdate(FBSValueVector args, IExecutionContext context) throws SQLException, InterpretException {
- if (args.size() >= 3) {
- Connection c = getConnection(args.get(0));
- String tbName = args.get(1).stringValue();
- FBSValue values = args.get(2);
- String where = args.size() > 3 && !args.get(3).isNull() ? args.get(3).stringValue() : null;
- FBSValue params = args.size() > 4 && !args.get(4).isNull() ? args.get(4) : null;
- Boolean colToUpperCase = args.size() > 5 && !args.get(5).isNull() ? args.get(5).booleanValue() : true;
-
- StringBuilder b = new StringBuilder();
- b.append("UPDATE "); // $NON-NLS-1$
- JdbcUtil.appendTableName(b, tbName);
- List v = initUpdateValues(b, values, colToUpperCase);
- if (StringUtil.isNotEmpty(where)) {
- b.append(" WHERE "); // $NON-NLS-1$
- b.append(where);
- }
- String sql = b.toString();
- PreparedStatement st = c.prepareStatement(sql);
- try {
- for (int i = 0; i < v.size(); i++) {
- st.setObject(i + 1, v.get(i));
- }
- if (params != null) {
- initParameters(st, params, v.size());
- }
- int count = st.executeUpdate();
- return FBSUtility.wrap(context.getJSContext(), count);
- } finally {
- st.close();
- }
- }
- return null;
- }
+ // Functions IDs
+ private static final int FCT_GETCONNECTION = 1;
+ private static final int FCT_DBCOLUMN = 2;
+
+ private static final int FCT_EXECUTEQUERY = 3;
+ private static final int FCT_INSERT = 4;
+ private static final int FCT_UPDATE = 5;
+ private static final int FCT_DELETE = 6;
+ private static final int FCT_INSERT_EXT = 7;
+ private static final int FCT_UPDATE_EXT = 8;
+
+ // ============================= CODE COMPLETION ==========================
+ //
+ // Even though JavaScript is an untyped language, the XPages JavaScript
+ // interpreter can make use of symbolic information defining the
+ // objects/functions exposed. This is particularly used by Domino Designer
+ // to provide the code completion facility and help the user writing code.
+ //
+ // Each function expose by a library can then have one or multiple
+ // "prototypes", defining its parameters and the returned value type. To
+ // make this definition as efficient as possible, the parameter definition
+ // is compacted within a string, where all the parameters are defined
+ // within parenthesis followed by the returned value type.
+ // A parameter is defined by its name, followed by a colon and its type.
+ // Generally, the type is defined by a single character (see bellow) or a
+ // full Java class name. The returned type is defined right after the
+ // closing parameter parenthesis.
+ //
+ // Here is, for example, the definition of the "@Date" function which can
+ // take 3 different set of parameters:
+ // "(time:Y):Y",
+ // "(years:Imonths:Idays:I):Y",
+ // "(years:Imonths:Idays:Ihours:Iminutes:Iseconds:I):Y");
+ //
+ // List of types
+ // V void
+ // C char
+ // B byte
+ // S short
+ // I int
+ // J long
+ // F float
+ // D double
+ // Z boolean
+ // T string
+ // Y date/time
+ // W any (variant)
+ // N multiple (...)
+ // L; object
+ // ex:
+ // (entries:[Lcom.ibm.xsp.extlib.MyClass;):V
+ //
+ // =========================================================================
+
+ public JdbcFunctions(JSContext jsContext) {
+
+ super(jsContext, null, false);
+
+ addFunction(FCT_GETCONNECTION, "@JdbcGetConnection", "(data:T):Ljava.sql.Connection;"); // $NON-NLS-1$
+ // $NON-NLS-2$
+ addFunction(FCT_DBCOLUMN, "@JdbcDbColumn", "(connection:Wtable:Tcolumn:T):A", "(connection:Wtable:Tcolumn:Twhere:T):A",
+ "(connection:Wtable:Tcolumn:Twhere:TorderBy:T):A", "(connection:Wtable:Tcolumn:Twhere:TorderBy:Tparams:A):A"); // $NON-NLS-1$
+ // $NON-NLS-2$
+ // $NON-NLS-3$
+ // $NON-NLS-4$
+ // $NON-NLS-5$
+ addFunction(FCT_EXECUTEQUERY, "@JdbcExecuteQuery", "(connection:Wsql:T):Ljava.sql.ResultSet;",
+ "(connection:Wsql:Tparams:A):Ljava.sql.ResultSet;"); // $NON-NLS-1$
+ // $NON-NLS-2$
+ // $NON-NLS-3$
+ addFunction(FCT_INSERT, "@JdbcInsert", "(connection:Wtable:Tvalues:W):I", "(connection:Wtable:Tvalues:WcolumnNames:A):I"); // $NON-NLS-1$
+ // $NON-NLS-2$
+ // $NON-NLS-3$
+ addFunction(FCT_UPDATE, "@JdbcUpdate", "(connection:Wtable:Tvalues:W):I", "(connection:Wtable:Tvalues:Wwhere:T):I",
+ "(connection:Wtable:Tvalues:Wwhere:Tparams:A):I"); // $NON-NLS-1$
+ // $NON-NLS-2$
+ // $NON-NLS-3$
+ // $NON-NLS-4$
+ addFunction(FCT_DELETE, "@JdbcDelete", "(connection:Wtable:Twhere:T):I", "(connection:Wtable:Twhere:Tparams:A):I"); // $NON-NLS-1$
+ // $NON-NLS-2$
+ // $NON-NLS-3$
+ addFunction(FCT_INSERT_EXT, "@JdbcInsertExt", "(connection:Wtable:Tvalues:W):I", "(connection:Wtable:Tvalues:WcolumnNames:A):I");
+ addFunction(FCT_UPDATE_EXT, "@JdbcUpdateExt", "(connection:Wtable:Tvalues:W):I", "(connection:Wtable:Tvalues:Wwhere:T):I",
+ "(connection:Wtable:Tvalues:Wwhere:Tparams:A):I");
+ }
+
+ private void addFunction(int index, String functionName, String... params) {
+ createMethod(functionName, FBSObject.P_NODELETE | FBSObject.P_READONLY, new NotesFunction(getJSContext(), index, functionName,
+ params));
+ }
+
+ @Override
+ public boolean hasInstance(FBSValue v) {
+ return v instanceof FBSGlobalObject;
+ }
+
+ @Override
+ public boolean isJavaNative() {
+ return false;
+ }
+
+ // =================================================================================
+ // Functions implementation
+ // For optimization reasons, there is one NotesFunction instance per
+ // function,
+ // instead of one class (this avoids loading to many classes). To then
+ // distinguish
+ // the actual function, it uses an index member.
+ // =================================================================================
+
+ public static class NotesFunction extends BuiltinFunction {
+
+ private String functionName;
+ private int index;
+ private String[] params;
+
+ NotesFunction(JSContext jsContext, int index, String functionName, String[] params) {
+
+ super(jsContext);
+ this.functionName = functionName;
+ this.index = index;
+ this.params = params;
+ }
+
+ /**
+ * Index of the function.
+ *
+ * There must be one instanceof this class per index.
+ *
+ */
+ public int getIndex() {
+ return this.index;
+ }
+
+ /**
+ * Return the list of the function parameters.
+ *
+ * Note that this list is not used at runtime, at least for now, but
+ * consumed by Designer code completion.
+ * A function can expose multiple parameter sets.
+ *
+ */
+ @Override
+ protected String[] getCallParameters() {
+ return this.params;
+ }
+
+ /**
+ * Function name, as exposed by Designer and use at runtime.
+ *
+ * This function is exposed in the JavaScript global namespace, so you
+ * should be careful to avoid any name conflict.
+ *