_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 52
373k
| language
stringclasses 1
value | meta_information
dict |
|---|---|---|---|---|---|
q18700
|
train
|
function(sName) {
if (this._oDimensionSet[sName]) { // the easy case
return this._oDimensionSet[sName];
}
for ( var sDimensionName in this._oDimensionSet) {
var oDimension = this._oDimensionSet[sDimensionName];
var oTextProperty = oDimension.getTextProperty();
if (oTextProperty && oTextProperty.name == sName) {
return oDimension;
}
if (oDimension.findAttributeByName(sName)) {
return oDimension;
}
}
return null;
}
|
javascript
|
{
"resource": ""
}
|
|
q18701
|
train
|
function(sName) {
if (this._oMeasureSet[sName]) { // the easy case
return this._oMeasureSet[sName];
}
for ( var sMeasureName in this._oMeasureSet) {
var oMeasure = this._oMeasureSet[sMeasureName];
var oFormattedValueProperty = oMeasure.getFormattedValueProperty();
if (oFormattedValueProperty && oFormattedValueProperty.name == sName) {
return oMeasure;
}
}
return null;
}
|
javascript
|
{
"resource": ""
}
|
|
q18702
|
train
|
function(oQueryResult, oAssociation) {
this._oQueryResult = oQueryResult;
var sQAssocName = this._oEntityType.getSchema().namespace + "." + oAssociation.name;
var aNavProp = this._oEntityType.getTypeDescription().navigationProperty;
if (!aNavProp) {
throw "Invalid consumption model: Parameters entity type lacks navigation property for association to query result entity type";
}
for (var i = -1, oNavProp; (oNavProp = aNavProp[++i]) !== undefined;) {
if (oNavProp.relationship == sQAssocName) {
this._oNavPropToQueryResult = oNavProp.name;
}
}
if (!this._oNavPropToQueryResult) {
throw "Invalid consumption model: Parameters entity type lacks navigation property for association to query result entity type";
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18703
|
train
|
function() {
if (this._aParameterNames) {
return this._aParameterNames;
}
this._aParameterNames = [];
for ( var sName in this._oParameterSet) {
this._aParameterNames.push(this._oParameterSet[sName].getName());
}
return this._aParameterNames;
}
|
javascript
|
{
"resource": ""
}
|
|
q18704
|
train
|
function() {
var sPeerParamPropName = null;
if (this._oLowerIntervalBoundaryParameterProperty) {
sPeerParamPropName = this._oLowerIntervalBoundaryParameterProperty.name;
} else {
sPeerParamPropName = this._oUpperIntervalBoundaryParameterProperty.name;
}
if (!sPeerParamPropName) {
throw "Parameter is not an interval boundary";
}
return this._oParameterization.findParameterByName(sPeerParamPropName);
}
|
javascript
|
{
"resource": ""
}
|
|
q18705
|
train
|
function() {
if (!this._sSuperOrdinateDimension) {
var oSuperOrdProperty = this._oQueryResult.getEntityType().getSuperOrdinatePropertyOfProperty(this.getName());
if (oSuperOrdProperty) {
this._sSuperOrdinateDimension = this._oQueryResult.findDimensionByName(oSuperOrdProperty.name);
}
}
return this._sSuperOrdinateDimension;
}
|
javascript
|
{
"resource": ""
}
|
|
q18706
|
train
|
function() {
if (this._aAttributeNames) {
return this._aAttributeNames;
}
this._aAttributeNames = [];
for ( var sName in this._oAttributeSet) {
this._aAttributeNames.push(this._oAttributeSet[sName].getName());
}
return this._aAttributeNames;
}
|
javascript
|
{
"resource": ""
}
|
|
q18707
|
train
|
function() {
if (this._bIsUpdatable != null) {
return this._bIsUpdatable;
}
var oUpdatablePropertyNameSet = this._oQueryResult.getEntitySet().getUpdatablePropertyNameSet();
return (oUpdatablePropertyNameSet[this.getName()] != undefined);
}
|
javascript
|
{
"resource": ""
}
|
|
q18708
|
train
|
function() {
if (this._oUpdatablePropertyNames) {
return this._oUpdatablePropertyNames;
}
this._oUpdatablePropertyNames = {};
var bSetIsUpdatable = true;
if (this._oEntitySet.extensions != undefined) {
for (var j = -1, oExtension; (oExtension = this._oEntitySet.extensions[++j]) !== undefined;) {
if (oExtension.namespace == odata4analytics.constants.SAP_NAMESPACE && oExtension.name == "updatable") {
if (oExtension.value == "false") {
bSetIsUpdatable = false;
break;
}
}
}
}
if (!bSetIsUpdatable) { // set not updatable cascades to all properties
return this._oUpdatablePropertyNames;
}
var aProperty = this._oEntityType.getTypeDescription().property;
for (var i = -1, oProperty; (oProperty = aProperty[++i]) !== undefined;) {
var bPropertyIsUpdatable = true;
if (oProperty.extensions == undefined) {
continue;
}
for (var k = -1, oExtension2; (oExtension2 = oProperty.extensions[++k]) !== undefined;) {
if (oExtension2.namespace != odata4analytics.constants.SAP_NAMESPACE) {
continue;
}
if (oExtension2.name == "updatable") {
if (oExtension2.value == "false") {
bPropertyIsUpdatable = false;
break;
}
}
}
if (bPropertyIsUpdatable) {
this._oUpdatablePropertyNames[oProperty.name] = true;
}
}
return this._oUpdatablePropertyNames;
}
|
javascript
|
{
"resource": ""
}
|
|
q18709
|
getOrCreateHierarchy
|
train
|
function getOrCreateHierarchy(sKey) {
var oResult = oRecursiveHierarchies[sKey];
if (!oResult) {
oResult = oRecursiveHierarchies[sKey] = {};
}
return oResult;
}
|
javascript
|
{
"resource": ""
}
|
q18710
|
train
|
function() {
if (this._aHierarchyPropertyNames) {
return this._aHierarchyPropertyNames;
}
this._aHierarchyPropertyNames = [];
for ( var sName in this._oRecursiveHierarchySet) {
this._aHierarchyPropertyNames.push(this._oRecursiveHierarchySet[sName].getNodeValueProperty().name);
}
return this._aHierarchyPropertyNames;
}
|
javascript
|
{
"resource": ""
}
|
|
q18711
|
train
|
function(sPropertyName, sOperator, oValue, oValue2) {
var oProperty = this._oEntityType.findPropertyByName(sPropertyName);
if (oProperty == null) {
throw "Cannot add filter condition for unknown property name " + sPropertyName; // TODO
}
var aFilterablePropertyNames = this._oEntityType.getFilterablePropertyNames();
if (((aFilterablePropertyNames ? Array.prototype.indexOf.call(aFilterablePropertyNames, sPropertyName) : -1)) === -1) {
throw "Cannot add filter condition for not filterable property name " + sPropertyName; // TODO
}
this._addCondition(sPropertyName, sOperator, oValue, oValue2);
return this;
}
|
javascript
|
{
"resource": ""
}
|
|
q18712
|
train
|
function(sPropertyName) {
var oProperty = this._oEntityType.findPropertyByName(sPropertyName);
if (oProperty == null) {
throw "Cannot remove filter conditions for unknown property name " + sPropertyName; // TODO
}
for (var i = 0; i < this._aConditionUI5Filter.length; i++) {
var oUI5Filter = this._aConditionUI5Filter[i];
if (oUI5Filter.sPath == sPropertyName) {
this._aConditionUI5Filter.splice(i--, 1);
}
}
return this;
}
|
javascript
|
{
"resource": ""
}
|
|
q18713
|
train
|
function(sPropertyName, aValues) {
var oProperty = this._oEntityType.findPropertyByName(sPropertyName);
if (oProperty == null) {
throw "Cannot add filter condition for unknown property name " + sPropertyName; // TODO
}
var aFilterablePropertyNames = this._oEntityType.getFilterablePropertyNames();
if (((aFilterablePropertyNames ? Array.prototype.indexOf.call(aFilterablePropertyNames, sPropertyName) : -1)) === -1) {
throw "Cannot add filter condition for not filterable property name " + sPropertyName; // TODO
}
for ( var i = -1, oValue; (oValue = aValues[++i]) !== undefined;) {
this._addCondition(sPropertyName, FilterOperator.EQ, oValue);
}
return this;
}
|
javascript
|
{
"resource": ""
}
|
|
q18714
|
train
|
function(aUI5Filter) {
if (!Array.isArray(aUI5Filter)) {
throw "Argument is not an array";
}
if (aUI5Filter.length == 0) {
return this;
}
// check if a multi filter is included; otherwise every element simply represents a single condition
var bHasMultiFilter = false;
for (var i = 0; i < aUI5Filter.length; i++) {
if (aUI5Filter[i].aFilters != undefined) {
bHasMultiFilter = true;
break;
}
}
if (bHasMultiFilter) {
this._addUI5FilterArray(aUI5Filter);
} else {
for (var j = 0; j < aUI5Filter.length; j++) {
this.addCondition(aUI5Filter[j].sPath, aUI5Filter[j].sOperator, aUI5Filter[j].oValue1, aUI5Filter[j].oValue2);
}
}
return this;
}
|
javascript
|
{
"resource": ""
}
|
|
q18715
|
train
|
function() {
var aFilterObjects = this._aConditionUI5Filter.concat([]);
for ( var i = -1, aFilter; (aFilter = this._aUI5FilterArray[++i]) !== undefined;) {
for ( var j = -1, oFilter; (oFilter = aFilter[++j]) !== undefined;) {
aFilterObjects.push(oFilter);
}
}
return aFilterObjects;
}
|
javascript
|
{
"resource": ""
}
|
|
q18716
|
train
|
function() {
var oReferencedProperties = {};
for ( var i = -1, oUI5Filter; (oUI5Filter = this._aConditionUI5Filter[++i]) !== undefined;) {
if (oReferencedProperties[oUI5Filter.sPath] == undefined) {
oReferencedProperties[oUI5Filter.sPath] = [];
}
oReferencedProperties[oUI5Filter.sPath].push(oUI5Filter);
}
for ( var j = -1, aUI5Filter; (aUI5Filter = this._aUI5FilterArray[++j]) !== undefined;) {
this.getPropertiesReferencedByUI5FilterArray(aUI5Filter, oReferencedProperties);
}
return oReferencedProperties;
}
|
javascript
|
{
"resource": ""
}
|
|
q18717
|
train
|
function(oUI5Filter) {
var sFilterExpression = null,
oProperty = this._oEntityType.findPropertyByName(oUI5Filter.sPath);
if (oProperty == null) {
throw "Cannot add filter condition for unknown property name " + oUI5Filter.sPath; // TODO
}
switch (oUI5Filter.sOperator) {
case FilterOperator.BT:
sFilterExpression = "(" + oUI5Filter.sPath + " ge "
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, oProperty.type)
+ " and " + oUI5Filter.sPath + " le "
+ this._renderPropertyFilterValue(oUI5Filter.oValue2, oProperty.type)
+ ")";
break;
case FilterOperator.NB:
sFilterExpression = "(" + oUI5Filter.sPath + " lt "
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, oProperty.type)
+ " or " + oUI5Filter.sPath + " gt "
+ this._renderPropertyFilterValue(oUI5Filter.oValue2, oProperty.type)
+ ")";
break;
case FilterOperator.Contains:
case FilterOperator.NotContains:
sFilterExpression = (oUI5Filter.sOperator[0] === "N" ? "not " : "") + "substringof("
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, "Edm.String")
+ "," + oUI5Filter.sPath + ")";
break;
case FilterOperator.StartsWith:
case FilterOperator.EndsWith:
case FilterOperator.NotStartsWith:
case FilterOperator.NotEndsWith:
sFilterExpression = oUI5Filter.sOperator.toLowerCase().replace("not", "not ") + "("
+ oUI5Filter.sPath + ","
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, "Edm.String") + ")";
break;
default:
sFilterExpression = oUI5Filter.sPath + " " + oUI5Filter.sOperator.toLowerCase()
+ " " + this._renderPropertyFilterValue(oUI5Filter.oValue1, oProperty.type);
}
return sFilterExpression;
}
|
javascript
|
{
"resource": ""
}
|
|
q18718
|
train
|
function(sPropertyName) {
var oResult = null;
for (var i = -1, oCurrentSorter; (oCurrentSorter = this._aSortCondition[++i]) !== undefined;) {
if (oCurrentSorter.property.name === sPropertyName) {
oResult = {
sorter : oCurrentSorter,
index : i
};
break;
}
}
return oResult;
}
|
javascript
|
{
"resource": ""
}
|
|
q18719
|
train
|
function(sPropertyName, sSortOrder) {
var oProperty = this._oEntityType.findPropertyByName(sPropertyName);
if (oProperty == null) {
throw "Cannot add sort condition for unknown property name " + sPropertyName; // TODO
}
var oExistingSorterEntry = this._containsSorter(sPropertyName);
if (oExistingSorterEntry != null) {
oExistingSorterEntry.sorter.order = sSortOrder;
return this;
}
var aSortablePropertyNames = this._oEntityType.getSortablePropertyNames();
if (((aSortablePropertyNames ? Array.prototype.indexOf.call(aSortablePropertyNames, sPropertyName) : -1)) === -1) {
throw "Cannot add sort condition for not sortable property name " + sPropertyName; // TODO
}
this._aSortCondition.push({
property : oProperty,
order : sSortOrder
});
return this;
}
|
javascript
|
{
"resource": ""
}
|
|
q18720
|
train
|
function(sPropertyName) {
if (!sPropertyName) {
return;
}
var oSorter = this._containsSorter(sPropertyName);
if (oSorter) {
this._removeFromArray(this._aSortCondition, oSorter.index);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18721
|
train
|
function() {
var aSorterObjects = [];
for (var i = -1, oCondition; (oCondition = this._aSortCondition[++i]) !== undefined;) {
aSorterObjects.push(new Sorter(oCondition.property.name,
oCondition.order == odata4analytics.SortOrder.Descending));
}
return aSorterObjects;
}
|
javascript
|
{
"resource": ""
}
|
|
q18722
|
train
|
function(sParameterName, sValue, sToValue) {
var oParameter = this._oParameterization.findParameterByName(sParameterName);
if (!oParameter) {
throw "Invalid parameter name " + sParameterName; // TODO improve
}
// error handling
if (sToValue != null) {
if (!oParameter.isIntervalBoundary()) {
// TODO improve error handling
throw "Range value cannot be applied to parameter " + sParameterName + " accepting only single values"; // TODO
}
if (!oParameter.isLowerIntervalBoundary()) {
// TODO improve error handling
throw "Range value given, but parameter " + sParameterName + " does not hold the lower boundary"; // TODO
}
}
if (!oParameter.isIntervalBoundary()) {
if (sValue == null) {
delete this._oParameterValueAssignment[sParameterName];
} else {
this._oParameterValueAssignment[sParameterName] = sValue;
}
} else {
if (sValue == null && sToValue != null) {
throw "Parameter " + sParameterName + ": An upper boundary cannot be given without the lower boundary"; // TODO
}
if (sValue == null) {
delete this._oParameterValueAssignment[sParameterName];
sToValue = null;
} else {
this._oParameterValueAssignment[sParameterName] = sValue;
}
var oUpperBoundaryParameter = oParameter.getPeerIntervalBoundaryParameter();
if (sToValue == null) {
sToValue = sValue;
}
if (sValue == null) {
delete this._oParameterValueAssignment[oUpperBoundaryParameter.getName()];
} else {
this._oParameterValueAssignment[oUpperBoundaryParameter.getName()] = sToValue;
}
}
return;
}
|
javascript
|
{
"resource": ""
}
|
|
q18723
|
train
|
function(sServiceRootURI) {
var oDefinedParameters = this._oParameterization.getAllParameters();
for ( var sDefinedParameterName in oDefinedParameters) {
// check that all parameters have a value assigned. This is also
// true for those marked as optional, because the
// omitted value is conveyed by some default value, e.g. as empty
// string.
if (this._oParameterValueAssignment[sDefinedParameterName] == undefined) {
throw "Parameter " + sDefinedParameterName + " has no value assigned"; // TODO
}
}
var sKeyIdentification = "", bFirst = true;
for ( var sParameterName in this._oParameterValueAssignment) {
sKeyIdentification += (bFirst ? "" : ",")
+ sParameterName
+ "="
+ this._renderParameterKeyValue(this._oParameterValueAssignment[sParameterName],
oDefinedParameters[sParameterName].getProperty().type);
bFirst = false;
}
return (sServiceRootURI ? sServiceRootURI : "") + "/" + this._oParameterization.getEntitySet().getQName() + "("
+ sKeyIdentification + ")";
}
|
javascript
|
{
"resource": ""
}
|
|
q18724
|
train
|
function (sHierarchyDimensionName, bIncludeExternalKey,
bIncludeText) {
var oDimension;
if (!sHierarchyDimensionName) {
return;
}
// sHierarchyDimensionName is the name of a dimension property (and not e.g. of a
// dimension's text property), findDimensionByName can be used instead of
// findDimensionByPropertyName
oDimension = this._oQueryResult.findDimensionByName(sHierarchyDimensionName);
if (!oDimension) {
throw new Error("'" + sHierarchyDimensionName + "' is not a dimension property");
}
if (!oDimension.getHierarchy()) {
throw new Error("Dimension '" + sHierarchyDimensionName
+ "' does not have a hierarchy");
}
// reset previously compiled list of selected properties
this._oSelectedPropertyNames = null;
this._oDimensionHierarchies[sHierarchyDimensionName] = {
externalKey : bIncludeExternalKey,
id: true,
text : bIncludeText
};
}
|
javascript
|
{
"resource": ""
}
|
|
q18725
|
train
|
function(sResourcePath) {
this._sResourcePath = sResourcePath;
if (this._sResourcePath.indexOf("/") != 0) {
throw "Missing leading / (slash) for resource path";
}
if (this._oQueryResult.getParameterization()) {
var iLastPathSep = sResourcePath.lastIndexOf("/");
if (iLastPathSep == -1) {
throw "Missing navigation from parameter entity set to query result in resource path";
}
var sNavPropName = sResourcePath.substring(iLastPathSep + 1);
if (sNavPropName != this._oQueryResult.getParameterization().getNavigationPropertyToQueryResult()) {
throw "Invalid navigation property from parameter entity set to query result in resource path";
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18726
|
train
|
function(aDimensionName) {
this._oAggregationLevel = {};
if (!aDimensionName) {
aDimensionName = this._oQueryResult.getAllDimensionNames();
}
this.addToAggregationLevel(aDimensionName);
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
}
|
javascript
|
{
"resource": ""
}
|
|
q18727
|
train
|
function(aDimensionName) {
if (!aDimensionName) {
return;
}
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
for (var i = -1, sDimName; (sDimName = aDimensionName[++i]) !== undefined;) {
if (!this._oQueryResult.findDimensionByName(sDimName)) {
throw sDimName + " is not a valid dimension name"; // TODO
}
this._oAggregationLevel[sDimName] = {
key : true,
text : false,
attributes : null
};
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18728
|
train
|
function(aDimensionName) {
if (!aDimensionName) {
return;
}
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
for (var i = -1, sDimName; (sDimName = aDimensionName[++i]) !== undefined;) {
if (!this._oQueryResult.findDimensionByName(sDimName)) {
throw sDimName + " is not a valid dimension name"; // TODO
}
if (this._oAggregationLevel[sDimName] != undefined) {
delete this._oAggregationLevel[sDimName];
// remove potential sort expression on this dimension
this.getSortExpression().removeSorter(sDimName);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18729
|
train
|
function(aMeasureName) {
if (!aMeasureName) {
aMeasureName = this._oQueryResult.getAllMeasureNames();
}
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
this._oMeasures = {};
for (var i = -1, sMeasName; (sMeasName = aMeasureName[++i]) !== undefined;) {
if (!this._oQueryResult.findMeasureByName(sMeasName)) {
throw sMeasName + " is not a valid measure name"; // TODO
}
this._oMeasures[sMeasName] = {
value : true,
text : false,
unit : false
};
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18730
|
train
|
function(sDimensionName, bIncludeKey, bIncludeText, aAttributeName) {
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
var aDimName = [];
if (sDimensionName) {
if (this._oAggregationLevel[sDimensionName] == undefined) {
throw sDimensionName + " is not included in the aggregation level";
}
aDimName.push(sDimensionName);
} else {
for ( var sName in this._oAggregationLevel) {
aDimName.push(sName);
}
aAttributeName = null;
}
for (var i = -1, sDimName; (sDimName = aDimName[++i]) !== undefined;) {
if (bIncludeKey != null) {
this._oAggregationLevel[sDimName].key = bIncludeKey;
}
if (bIncludeText != null) {
this._oAggregationLevel[sDimName].text = bIncludeText;
}
if (aAttributeName != null) {
this._oAggregationLevel[sDimName].attributes = aAttributeName;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18731
|
train
|
function(sMeasureName, bIncludeRawValue, bIncludeFormattedValue, bIncludeUnit) {
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
var aMeasName = [];
if (sMeasureName) {
if (this._oMeasures[sMeasureName] == undefined) {
throw sMeasureName + " is not part of the query result";
}
aMeasName.push(sMeasureName);
} else {
for ( var sName in this._oMeasures) {
aMeasName.push(sName);
}
}
for (var i = -1, sMeasName; (sMeasName = aMeasName[++i]) !== undefined;) {
if (bIncludeRawValue != null) {
this._oMeasures[sMeasName].value = bIncludeRawValue;
}
if (bIncludeFormattedValue != null) {
this._oMeasures[sMeasName].text = bIncludeFormattedValue;
}
if (bIncludeUnit != null) {
this._oMeasures[sMeasName].unit = bIncludeUnit;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18732
|
train
|
function(bIncludeEntityKey, bIncludeCount, bReturnNoEntities) {
if (bIncludeEntityKey != null) {
this._bIncludeEntityKey = bIncludeEntityKey;
}
if (bIncludeCount != null) {
this._bIncludeCount = bIncludeCount;
}
if (bReturnNoEntities != null) {
this._bReturnNoEntities = bReturnNoEntities;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18733
|
train
|
function(start, end) {
if (start != null && typeof start !== "number") {
throw "Start value must be null or numeric"; // TODO
}
if (end !== null && typeof end !== "number") {
throw "End value must be null or numeric"; // TODO
}
if (start == null) {
start = 1;
}
if (start < 1 || start > (end == null ? start : end)) {
throw "Invalid values for requested page boundaries"; // TODO
}
this._iSkipRequestOption = (start > 1) ? start - 1 : null;
this._iTopRequestOption = (end != null) ? (end - start + 1) : null;
}
|
javascript
|
{
"resource": ""
}
|
|
q18734
|
train
|
function(sServiceRootURI) {
var sURI = null;
if (this._sResourcePath != null) {
sURI = (sServiceRootURI ? sServiceRootURI : "") + this._sResourcePath;
} else if (this._oQueryResult.getParameterization()) {
if (!this._oParameterizationRequest) {
throw "Missing parameterization request";
} else {
sURI = this._oParameterizationRequest.getURIToParameterizationEntry(sServiceRootURI) + "/"
+ this._oQueryResult.getParameterization().getNavigationPropertyToQueryResult();
}
} else {
sURI = (sServiceRootURI ? sServiceRootURI : "") + "/" + this._oQueryResult.getEntitySet().getQName();
}
return sURI;
}
|
javascript
|
{
"resource": ""
}
|
|
q18735
|
train
|
function(sServiceRootURI) {
// construct resource path
var sResourcePath = null;
sResourcePath = (sServiceRootURI ? sServiceRootURI : "") + "/"
+ this._oParameter.getContainingParameterization().getEntitySet().getQName();
// check if request is compliant with filter constraints expressed in
// metadata
this.getFilterExpression().checkValidity();
// construct query options
var sSelectOption = this.getURIQueryOptionValue("$select");
var sFilterOption = this.getURIQueryOptionValue("$filter");
var sSortOption = this.getURIQueryOptionValue("$orderby");
var sURI = sResourcePath;
var bQuestionmark = false;
if (sSelectOption) {
sURI += "?$select=" + sSelectOption;
bQuestionmark = true;
}
if (this._oFilterExpression && sFilterOption) {
if (!bQuestionmark) {
sURI += "?";
bQuestionmark = true;
} else {
sURI += "&";
}
sURI += "$filter=" + sFilterOption;
}
if (this._oSortExpression && sSortOption) {
if (!bQuestionmark) {
sURI += "?";
bQuestionmark = true;
} else {
sURI += "&";
}
sURI += "$orderby=" + sSortOption;
}
return sURI;
}
|
javascript
|
{
"resource": ""
}
|
|
q18736
|
train
|
function(bIncludeText, bIncludeAttributes) {
this._oValueSetResult.text = {
text : false,
attributes : false
};
if (bIncludeText == true) {
this._oValueSetResult.text = true;
}
if (bIncludeAttributes == true) {
this._oValueSetResult.attributes = true;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18737
|
train
|
function(sServiceRootURI) {
var sResourcePath = null;
if (!this._bUseMasterData && this._oParameterizationRequest) {
sResourcePath = this._oParameterizationRequest.getURIToParameterizationEntry(sServiceRootURI) + "/"
+ this._oDimension.getContainingQueryResult().getParameterization().getNavigationPropertyToQueryResult();
} else {
sResourcePath = (sServiceRootURI ? sServiceRootURI : "") + "/" + this._oEntitySet.getQName();
}
return sResourcePath;
}
|
javascript
|
{
"resource": ""
}
|
|
q18738
|
train
|
function(sServiceRootURI) {
// construct resource path
var sResourcePath = this.getURIToDimensionMemberEntitySet(sServiceRootURI);
// check if request is compliant with filter constraints expressed in
// metadata
this.getFilterExpression().checkValidity();
// construct query options
var sSelectOption = this.getURIQueryOptionValue("$select");
var sFilterOption = this.getURIQueryOptionValue("$filter");
var sSortOption = this.getURIQueryOptionValue("$orderby");
var sTopOption = this.getURIQueryOptionValue("$top");
var sSkipOption = this.getURIQueryOptionValue("$skip");
var sInlineCountOption = this.getURIQueryOptionValue("$inlinecount");
var sURI = sResourcePath;
var bQuestionmark = false;
if (sSelectOption) {
sURI += "?$select=" + sSelectOption;
bQuestionmark = true;
}
if (this._oFilterExpression && sFilterOption) {
if (!bQuestionmark) {
sURI += "?";
bQuestionmark = true;
} else {
sURI += "&";
}
sURI += "$filter=" + sFilterOption;
}
if (this._oSortExpression && sSortOption) {
if (!bQuestionmark) {
sURI += "?";
bQuestionmark = true;
} else {
sURI += "&";
}
sURI += "$orderby=" + sSortOption;
}
if (this._iTopRequestOption && sTopOption) {
if (!bQuestionmark) {
sURI += "?";
bQuestionmark = true;
} else {
sURI += "&";
}
sURI += "$top=" + sTopOption;
}
if (this._iSkipRequestOption && sSkipOption) {
if (!bQuestionmark) {
sURI += "?";
bQuestionmark = true;
} else {
sURI += "&";
}
sURI += "$skip=" + sSkipOption;
}
if (this._bIncludeCount && sInlineCountOption) {
if (!bQuestionmark) {
sURI += "?";
bQuestionmark = true;
} else {
sURI += "&";
}
sURI += "$inlinecount=" + sInlineCountOption;
}
return sURI;
}
|
javascript
|
{
"resource": ""
}
|
|
q18739
|
flattenBindings
|
train
|
function flattenBindings(oBinding, oParentDefaultModel) {
var aBindings = [];
var sModelName = oBinding.getMetadata().getName();
if (sModelName === "sap.ui.model.CompositeBinding") {
oBinding.getBindings().forEach(function (oBinding) {
aBindings = aBindings.concat(flattenBindings(oBinding, oParentDefaultModel));
});
} else if (
(
sModelName === "sap.ui.model.odata.ODataPropertyBinding"
|| sModelName === "sap.ui.model.odata.v2.ODataPropertyBinding"
|| sModelName === "sap.ui.model.odata.v4.ODataPropertyBinding"
|| sModelName === "sap.ui.model.json.JSONPropertyBinding"
|| sModelName === "sap.ui.model.json.XMLPropertyBinding"
|| sModelName === "sap.ui.model.resource.ResourcePropertyBinding"
)
&& oBinding.getModel() === oParentDefaultModel
&& oBinding.isRelative()
&& jQuery.isFunction(oBinding.getPath)
&& oBinding.getPath()
) {
aBindings.push(oBinding);
}
return aBindings;
}
|
javascript
|
{
"resource": ""
}
|
q18740
|
flattenBindingsFromTemplate
|
train
|
function flattenBindingsFromTemplate(mBinding) {
var aBindings = [];
var aParts = mBinding.parts;
// TODO: check if we need to filter bindings by modelName, relative indicator ("/")
aParts.forEach(function (mPart) {
aBindings.push({
parts: [mPart]
});
});
return aBindings;
}
|
javascript
|
{
"resource": ""
}
|
q18741
|
getBindingsFromProperties
|
train
|
function getBindingsFromProperties(oElement, oParentDefaultModel) {
var aPropertiesKeys = Object.keys(oElement.getMetadata().getAllProperties());
return aPropertiesKeys
// filter properties which are not bound
.filter(oElement.getBinding.bind(oElement))
.reduce(function (aBindings, sPropertyName) {
return aBindings.concat(
flattenBindings(
oElement.getBinding(sPropertyName),
oParentDefaultModel
)
);
}, []);
}
|
javascript
|
{
"resource": ""
}
|
q18742
|
getBindingsFromTemplateProperties
|
train
|
function getBindingsFromTemplateProperties(oElement) {
var aPropertiesKeys = Object.keys(oElement.getMetadata().getAllProperties());
return aPropertiesKeys
.filter(function (sPropertyName) {
return sPropertyName in oElement.mBindingInfos;
})
.reduce(function (aBindings, sPropertyName) {
return aBindings.concat(
flattenBindingsFromTemplate(
oElement.mBindingInfos[sPropertyName]
)
);
}, []);
}
|
javascript
|
{
"resource": ""
}
|
q18743
|
getBindingContextPath
|
train
|
function getBindingContextPath(oElement) {
if (oElement.getBindingContext() && oElement.getBindingContext().getPath) {
return oElement.getBindingContext().getPath();
}
return undefined;
}
|
javascript
|
{
"resource": ""
}
|
q18744
|
train
|
function (sVersionA, sVersionB) {
var oVA = Version(sVersionA),
oVB = Version(sVersionB);
return (oVA.getMajor() + "." + oVA.getMinor()) === (oVB.getMajor() + "." + oVB.getMinor());
}
|
javascript
|
{
"resource": ""
}
|
|
q18745
|
addStyleClass
|
train
|
function addStyleClass(oElement, sStyleClass) {
if (!oElement) {
return;
}
if (oElement.addStyleClass) {
oElement.addStyleClass(sStyleClass);
} else {
oElement.$().addClass(sStyleClass);
}
}
|
javascript
|
{
"resource": ""
}
|
q18746
|
train
|
function(sFilter) {
var oModel = this._getTable().getModel();
if (oModel) {
if (sFilter.length > 0) {
// As UI5 does not support filtering on first level, we have to do it on our own
var aData = this.getData();
var aFilteredData = aData.children.filter(function(oEntry) {
if (sFilter.indexOf("status=") != -1) {
return oEntry.status.value == sFilter.substring(sFilter.indexOf("=") + 1);
} else {
return oEntry.name.toLowerCase().indexOf(sFilter.toLowerCase()) != -1;
}
});
oModel.setData(aFilteredData);
} else {
oModel.setData(this.getData());
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18747
|
train
|
function(isRule) {
var elements, e, index = i, option, extendList, extend;
if (!(isRule ? $re(/^&:extend\(/) : $re(/^:extend\(/))) { return; }
do {
option = null;
elements = null;
while (! (option = $re(/^(all)(?=\s*(\)|,))/))) {
e = this.element();
if (!e) { break; }
if (elements) { elements.push(e); } else { elements = [ e ]; }
}
option = option && option[1];
extend = new(tree.Extend)(new(tree.Selector)(elements), option, index);
if (extendList) { extendList.push(extend); } else { extendList = [ extend ]; }
} while($char(","));
expect(/^\)/);
if (isRule) {
expect(/^;/);
}
return extendList;
}
|
javascript
|
{
"resource": ""
}
|
|
q18748
|
train
|
function () {
var entities = [], e, delim;
do {
e = this.addition() || this.entity();
if (e) {
entities.push(e);
// operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here
if (!peek(/^\/[\/*]/)) {
delim = $char('/');
if (delim) {
entities.push(new(tree.Anonymous)(delim));
}
}
}
} while (e);
if (entities.length > 0) {
return new(tree.Expression)(entities);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18749
|
train
|
function (env, op, other) {
/*jshint noempty:false */
var value = tree.operate(env, op, this.value, other.value),
unit = this.unit.clone();
if (op === '+' || op === '-') {
if (unit.numerator.length === 0 && unit.denominator.length === 0) {
unit.numerator = other.unit.numerator.slice(0);
unit.denominator = other.unit.denominator.slice(0);
} else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) {
// do nothing
} else {
other = other.convertTo(this.unit.usedUnits());
if(env.strictUnits && other.unit.toString() !== unit.toString()) {
throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '" + unit.toString() +
"' and '" + other.unit.toString() + "'.");
}
value = tree.operate(env, op, this.value, other.value);
}
} else if (op === '*') {
unit.numerator = unit.numerator.concat(other.unit.numerator).sort();
unit.denominator = unit.denominator.concat(other.unit.denominator).sort();
unit.cancel();
} else if (op === '/') {
unit.numerator = unit.numerator.concat(other.unit.denominator).sort();
unit.denominator = unit.denominator.concat(other.unit.numerator).sort();
unit.cancel();
}
return new(tree.Dimension)(value, unit);
}
|
javascript
|
{
"resource": ""
}
|
|
q18750
|
train
|
function (args, env) {
var lastSelector = this.selectors[this.selectors.length-1];
if (!lastSelector.evaldCondition) {
return false;
}
if (lastSelector.condition &&
!lastSelector.condition.eval(
new(tree.evalEnv)(env,
env.frames))) {
return false;
}
return true;
}
|
javascript
|
{
"resource": ""
}
|
|
q18751
|
getErrorMessage
|
train
|
function getErrorMessage(oType) {
return sap.ui.getCore().getLibraryResourceBundle().getText("EnterTime",
[oType.formatValue(oDemoTime, "string")]);
}
|
javascript
|
{
"resource": ""
}
|
q18752
|
toDate
|
train
|
function toDate(oTime) {
if (!isTime(oTime)) {
throw new FormatException("Illegal sap.ui.model.odata.type.Time value: "
+ toString(oTime));
}
return new Date(oTime.ms);
}
|
javascript
|
{
"resource": ""
}
|
q18753
|
toModel
|
train
|
function toModel(oDate) {
return {
__edmType : "Edm.Time",
ms : ((oDate.getUTCHours() * 60 + oDate.getUTCMinutes()) * 60 + oDate.getUTCSeconds())
* 1000 + oDate.getUTCMilliseconds()
};
}
|
javascript
|
{
"resource": ""
}
|
q18754
|
train
|
function() {
this._oDialog.close();
this._oDialog.destroy();
this._oDialog = null;
if (this._oAssistantPopover) {
this._oAssistantPopover.destroy();
this._oAssistantPopover = null;
}
if (this._oDebugPopover) {
this._oDebugPopover.destroy();
this._oDebugPopover = null;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18755
|
train
|
function () {
var oModel = this._oDialog.getModel("view"),
oTree = oModel.getProperty("/DebugModules")[0],
sString = "sap-ui-debug=" + this._treeHelper.toDebugInfo(oTree);
this._copyToClipboard(sString, "TechInfo.DebugModulesCopyToClipboard");
}
|
javascript
|
{
"resource": ""
}
|
|
q18756
|
train
|
function () {
var oModel = this._oDialog.getModel("view"),
oTreeResults;
// early out if already open
if (this._oDebugPopover && this._oDebugPopover.isOpen()) {
return;
}
// fill and bind the tree structure from the currently loaded modules
oTreeResults = this._treeHelper.toTreeModel(this._oModuleSystemInfo);
oModel.setProperty("/DebugModules", [oTreeResults.tree]);
this._updateTreeInfos();
// create dialog lazily
if (!this._oDebugPopover) {
this._oDebugPopover = sap.ui.xmlfragment(this._DEBUG_MODULES_ID, "sap.ui.core.support.techinfo.TechnicalInfoDebugDialog", this);
this._oDialog.addDependent(this._oDebugPopover);
syncStyleClass(this._getContentDensityClass(), this._oDialog, this._oDebugPopover);
var oControl = this._getControl("customDebugValue", this._DEBUG_MODULES_ID);
try {
this._validateCustomDebugValue(oControl.getValue());
} catch (oException) {
this._showError(oControl, oException.message);
return;
}
}
// adopt tree depth to the deepest currently selected module
this._getControl("tree", this._DEBUG_MODULES_ID).expandToLevel(Math.max(this._MIN_EXPAND_LEVEL_DEBUG_MODULES, oTreeResults.depth));
// open dialog
this._oDebugPopover.open();
}
|
javascript
|
{
"resource": ""
}
|
|
q18757
|
train
|
function () {
var oModel = this._oDialog.getModel("view"),
oControl = this._getControl("customDebugValue", this._DEBUG_MODULES_ID),
oTreeResults;
try {
this._validateCustomDebugValue(oControl.getValue());
} catch (oException) {
this._showError(oControl, oException.message);
return;
}
// convert boolean string to boolean value
if (oModel.getProperty("/CustomDebugMode") === "true") {
oModel.setProperty("/CustomDebugMode", true);
}
if (oModel.getProperty("/CustomDebugMode") === "false") {
oModel.setProperty("/CustomDebugMode", false);
}
// set validated value and update tree accordingly
window["sap-ui-debug"] = oModel.getProperty("/CustomDebugMode");
oTreeResults = this._treeHelper.toTreeModel(this._oModuleSystemInfo);
oModel.setProperty("/DebugModules", [oTreeResults.tree]);
// adopt tree depth to the deepest currently selected module
this._getControl("tree", this._DEBUG_MODULES_ID).expandToLevel(Math.max(this._MIN_EXPAND_LEVEL_DEBUG_MODULES, oTreeResults.depth));
this._updateTreeInfos();
}
|
javascript
|
{
"resource": ""
}
|
|
q18758
|
train
|
function () {
var oModel = this._oDialog.getModel("view"),
oTreeData = oModel.getProperty("/DebugModules")[0];
this._treeHelper.recursiveSelect(oTreeData, false);
this._updateTreeInfos();
}
|
javascript
|
{
"resource": ""
}
|
|
q18759
|
train
|
function () {
var oSupport = Support.getStub();
if (oSupport.getType() != Support.StubType.APPLICATION) {
return;
}
oSupport.openSupportTool();
this.close();
}
|
javascript
|
{
"resource": ""
}
|
|
q18760
|
train
|
function () {
var oModel = this._oDialog.getModel("view"),
sSelectedLocation = oModel.getProperty("/SelectedLocation"),
sStandardUrl = oModel.getProperty("/StandardBootstrapURL"),
sCustomUrl = oModel.getProperty("/CustomBootstrapURL"),
aSupportedUrls = [],
sBootstrapURL;
oModel.getProperty("/SupportAssistantPopoverURLs").forEach(function (element) {
aSupportedUrls.push(element.Value);
});
if (aSupportedUrls.indexOf(sStandardUrl) === -1 && sSelectedLocation === "standard") {
sSelectedLocation = "custom";
sCustomUrl = sStandardUrl;
oModel.setProperty("/SelectedLocation", sSelectedLocation);
this._storage.put(this._LOCAL_STORAGE_KEYS.STANDARD_URL, aSupportedUrls[0]);
oModel.setProperty("/StandardBootstrapURL", this._storage.get(this._LOCAL_STORAGE_KEYS.STANDARD_URL));
}
if (sSelectedLocation === "standard") {
sBootstrapURL = sStandardUrl;
} else if (sCustomUrl) {
// this checks if selected location is custom and CustomBootstrapURL is filed
if (!sCustomUrl.match(/\/$/)) {
// checks if custom URL is missing / at the end and adds it if missing
sCustomUrl += "/";
}
this._storage.put(this._LOCAL_STORAGE_KEYS.CUSTOM_URL, sCustomUrl);
oModel.setProperty("/CustomBootstrapURL", this._storage.get(this._LOCAL_STORAGE_KEYS.CUSTOM_URL));
sBootstrapURL = sCustomUrl;
}
this._startAssistant(sBootstrapURL);
}
|
javascript
|
{
"resource": ""
}
|
|
q18761
|
train
|
function (oEvent) {
var sValue = oEvent.getParameter("selectedItem").getKey(),
oControl = oEvent.getSource();
this._storage.put(this._LOCAL_STORAGE_KEYS.STANDARD_URL, sValue);
this._resetValueState(oControl);
this._pingUrl(sValue, oControl)
.then(function success() {
oControl.setValueState("Success");
}, function error() {
var sMessage = this._getText("TechInfo.SupportAssistantConfigPopup.NotAvailableAtTheMoment");
this._showError(oControl, sMessage);
Log.error("Support Assistant could not be loaded from the URL you entered");
});
}
|
javascript
|
{
"resource": ""
}
|
|
q18762
|
train
|
function (oEvent) {
var sValue = oEvent.getParameter("value"),
oControl = oEvent.getSource();
this._storage.put(this._LOCAL_STORAGE_KEYS.CUSTOM_URL, sValue);
try {
this._validateValue(oControl.getValue());
this._resetValueState(oControl);
} catch (oException) {
this._showError(oControl, oException.message);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18763
|
train
|
function (oEvent) {
// early out if already open
if (this._oAssistantPopover && this._oAssistantPopover.isOpen()) {
return;
}
// create dialog lazily
if (!this._oAssistantPopover) {
this._oAssistantPopover = sap.ui.xmlfragment(this._SUPPORT_ASSISTANT_POPOVER_ID, "sap.ui.core.support.techinfo.TechnicalInfoAssistantPopover", this);
this._oAssistantPopover.attachAfterOpen(this._onAssistantPopoverOpened, this);
this._oDialog.addDependent(this._oAssistantPopover);
syncStyleClass(this._getContentDensityClass(), this._oDialog, this._oAssistantPopover);
// register message validation and trigger it once to validate the value coming from local storage
var oCustomBootstrapURL = this._getControl("customBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID);
sap.ui.getCore().getMessageManager().registerObject(oCustomBootstrapURL, true);
}
// enable or disable default option for version >= 1.48
var oCurrentItem = this._getControl("standardBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID).getItems()[0];
if (this._isVersionBiggerThanMinSupported()) {
var sAppVersion = sap.ui.getCore().getConfiguration().getVersion().toString();
oCurrentItem.setText(oCurrentItem.getText().replace("[[version]]", sAppVersion));
oCurrentItem.setEnabled(true);
} else {
oCurrentItem.setText(oCurrentItem.getText().replace("[[version]]", "not supported"));
oCurrentItem.setEnabled(false);
}
var oModel = this._oDialog.getModel("view"),
sSelectedLocation = oModel.getProperty("/SelectedLocation");
this._setActiveLocations(sSelectedLocation);
var oSupportAssistantSettingsButton = this._getControl("supportAssistantSettingsButton", this._TECHNICAL_INFO_DIALOG_ID);
this._oAssistantPopover.openBy(oSupportAssistantSettingsButton);
}
|
javascript
|
{
"resource": ""
}
|
|
q18764
|
train
|
function (sBootstrapURL) {
var oModel = this._oDialog.getModel("view"),
oSettings = {
// start the application in support mode
support: "true",
// open in new window
window: oModel.getProperty("/OpenSupportAssistantInNewWindow")
};
this._loadAssistant(sBootstrapURL, oSettings);
}
|
javascript
|
{
"resource": ""
}
|
|
q18765
|
train
|
function (sUrl, oSettings) {
this._pingUrl(sUrl)
.then(function success() {
this.close();
var aSettings = [oSettings.support];
sap.ui.getCore().loadLibrary("sap.ui.support", { async: true, url: sUrl })
.then(function () {
if (oSettings.window) {
aSettings.push("window");
}
if (aSettings[0].toLowerCase() === "true" || aSettings[0].toLowerCase() === "silent") {
sap.ui.require(["sap/ui/support/Bootstrap"], function (oBootstrap) {
oBootstrap.initSupportRules(aSettings);
});
}
});
}, function error(jqXHR, exception) {
var msg = this._getText("TechInfo.SupportAssistantConfigPopup.SupportAssistantNotFound");
if (jqXHR.status === 0) {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorTryingToGetRecourse");
} else if (jqXHR.status === 404) {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorNotFound");
} else if (jqXHR.status === 500) {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.InternalServerError");
} else if (exception === 'parsererror') {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorOnJsonParse");
} else if (exception === 'timeout') {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorOnTimeout");
} else if (exception === 'abort') {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorWhenAborted");
} else {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.UncaughtError") + jqXHR.responseText;
}
this._sErrorMessage = msg;
this.onConfigureAssistantBootstrap();
Log.error("Support Assistant could not be loaded from the URL you entered");
});
}
|
javascript
|
{
"resource": ""
}
|
|
q18766
|
train
|
function () {
// create i18n model
var oI18nModel = new ResourceModel({
bundleName: "sap.ui.core.messagebundle"
});
this._oDialog.setModel(oI18nModel, "i18n");
this._oDialog.setModel(this._createViewModel(), "view");
// set compact/cozy style class
this._oDialog.addStyleClass(this._getContentDensityClass());
}
|
javascript
|
{
"resource": ""
}
|
|
q18767
|
train
|
function () {
var oVersion = sap.ui.getCore().getConfiguration().getVersion();
if (oVersion && oVersion.compareTo(this._MIN_UI5VERSION_SUPPORT_ASSISTANT) >= 0) {
return true;
}
return false;
}
|
javascript
|
{
"resource": ""
}
|
|
q18768
|
train
|
function (sBuildTimestamp) {
var oDateFormat = sap.ui.core.format.DateFormat.getDateInstance({pattern: "dd.MM.yyyy HH:mm:ss"}),
sBuildDate = oDateFormat.format(this._convertBuildDate(sBuildTimestamp));
return this._getText("TechInfo.VersionBuildTime.Text", sBuildDate);
}
|
javascript
|
{
"resource": ""
}
|
|
q18769
|
train
|
function (sValue) {
var oModel = this._oDialog.getModel("view"),
oRadioBtnStandart = this._getControl("standard", this._SUPPORT_ASSISTANT_POPOVER_ID),
oRadioBtnCustom = this._getControl("custom", this._SUPPORT_ASSISTANT_POPOVER_ID),
oCustom = this._getControl("customBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID),
oStandard = this._getControl("standardBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID),
bStandardLocationEnabled;
this._resetValueState(oCustom);
this._resetValueState(oStandard);
if (sValue === "standard") {
bStandardLocationEnabled = true;
oModel.setProperty("/StandardBootstrapURL", this._storage.get(this._LOCAL_STORAGE_KEYS.STANDARD_URL));
oStandard.setSelectedKey(oModel.getProperty("/StandardBootstrapURL"));
} else {
bStandardLocationEnabled = false;
}
oStandard.setEnabled(bStandardLocationEnabled);
oRadioBtnStandart.setSelected(bStandardLocationEnabled);
oCustom.setEnabled(!bStandardLocationEnabled);
oRadioBtnCustom.setSelected(!bStandardLocationEnabled);
this._storage.put(this._LOCAL_STORAGE_KEYS.LOCATION, sValue);
oModel.setProperty("/SelectedLocation", this._storage.get(this._LOCAL_STORAGE_KEYS.LOCATION));
}
|
javascript
|
{
"resource": ""
}
|
|
q18770
|
train
|
function (fnConfirm, fnCancel) {
MessageBox.confirm(
this._getText("TechInfo.DebugSources.ConfirmMessage"), {
title: this._getText("TechInfo.DebugSources.ConfirmTitle"),
onClose: function (oAction) {
if (oAction === MessageBox.Action.OK) {
fnConfirm();
} else if (fnCancel) {
fnCancel();
}
}
}
);
}
|
javascript
|
{
"resource": ""
}
|
|
q18771
|
train
|
function () {
var oModel = this._oDialog.getModel("view"),
sSelectedLocation = oModel.getProperty("/SelectedLocation"),
oControl;
if (sSelectedLocation === "custom") {
oControl = this._getControl("customBootstrapURL",this._SUPPORT_ASSISTANT_POPOVER_ID);
var sValue = oControl.getValue();
try {
this._validateValue(sValue);
} catch (oException) {
this._showError(oControl, oException.message);
if (this._sErrorMessage) {
this._sErrorMessage = null;
}
return;
}
} else {
oControl = this._getControl("standardBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID);
}
if (this._sErrorMessage) {
this._showError(oControl, this._sErrorMessage);
this._sErrorMessage = null;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18772
|
train
|
function (sControlId, sFragmentId) {
if (sFragmentId) {
return sap.ui.getCore().byId(sFragmentId + "--" + sControlId);
}
return sap.ui.getCore().byId(sControlId);
}
|
javascript
|
{
"resource": ""
}
|
|
q18773
|
train
|
function(sParameter, vValue) {
// fetch current parameters from URL
var sSearch = window.location.search,
sURLParameter = sParameter + "=" + vValue;
/// replace or append the new URL parameter
if (sSearch && sSearch !== "?") {
var oRegExp = new RegExp("(?:^|\\?|&)" + sParameter + "=[^&]+");
if (sSearch.match(oRegExp)) {
sSearch = sSearch.replace(oRegExp, sURLParameter);
} else {
sSearch += "&" + sURLParameter;
}
} else {
sSearch = "?" + sURLParameter;
}
// reload the page by setting the new parameters
window.location.search = sSearch;
}
|
javascript
|
{
"resource": ""
}
|
|
q18774
|
train
|
function () {
var oModel = this._oDialog.getModel("view"),
oTreeData = oModel.getProperty("/DebugModules")[0],
sDisplayCount;
oModel.setProperty("/CustomDebugMode", this._treeHelper.toDebugInfo(oTreeData));
oModel.setProperty("/DebugModuleSelectionCount", this._treeHelper.getSelectionCount(oTreeData));
sDisplayCount = oModel.getProperty("/DebugModuleSelectionCount").toString();
oModel.setProperty("/DebugModulesTitle", this._getText("TechInfo.DebugModulesConfigPopup.SelectionCounter", sDisplayCount));
}
|
javascript
|
{
"resource": ""
}
|
|
q18775
|
_preventTextSelection
|
train
|
function _preventTextSelection(bTouch) {
var fnPreventSelection = function(oEvent) {
oEvent.preventDefault();
};
var fnAllowSelection = null;
fnAllowSelection = function() {
document.removeEventListener("touchend", fnAllowSelection);
document.removeEventListener("touchmove", fnPreventSelection);
document.removeEventListener("mouseup", fnAllowSelection);
document.removeEventListener("mousemove", fnPreventSelection);
};
if (bTouch) {
this._ignoreMouse = true; // Ignore mouse-events until touch is done
document.addEventListener("touchend", fnAllowSelection);
document.addEventListener("touchmove", fnPreventSelection);
} else {
document.addEventListener("mouseup", fnAllowSelection);
document.addEventListener("mousemove", fnPreventSelection);
}
}
|
javascript
|
{
"resource": ""
}
|
q18776
|
_ensureLayoutData
|
train
|
function _ensureLayoutData(oContent) {
var oLd = oContent.getLayoutData();
// Make sure LayoutData is set on the content
// But this approach has the advantage that "compatible" LayoutData can be used.
if (oLd && (!oLd.getResizable || !oLd.getSize || !oLd.getMinSize)) {
Log.warning(
"Content \"" + oContent.getId() + "\" for the Splitter contained wrong LayoutData. " +
"The LayoutData has been replaced with default values."
);
oLd = null;
}
if (!oLd) {
oContent.setLayoutData(new sap.ui.layout.SplitterLayoutData());
}
}
|
javascript
|
{
"resource": ""
}
|
q18777
|
train
|
function (vValue1, vValue2, vEdmType) {
if (vEdmType === true || vEdmType === "Decimal") {
return BaseODataUtils.compare(vValue1, vValue2, true);
}
if (vEdmType === "DateTime") {
return BaseODataUtils.compare(
ODataUtils.parseDateTimeOffset(vValue1),
ODataUtils.parseDateTimeOffset(vValue2));
}
return BaseODataUtils.compare(vValue1, vValue2);
}
|
javascript
|
{
"resource": ""
}
|
|
q18778
|
train
|
function (context, sDropPosition, oDraggedControl, oDroppedControl, bIgnoreRTL) {
var iBeginDragIndex = context.indexOfItem(oDraggedControl),
iDropIndex = context.indexOfItem(oDroppedControl),
$DraggedControl = oDraggedControl.$(),
$DroppedControl = oDroppedControl.$(),
iAggregationDropIndex = 0,
bRtl = sap.ui.getCore().getConfiguration().getRTL(),
bIsDropPositionBefore = sDropPosition === INSERT_POSITION_BEFORE;
if (bRtl && !bIgnoreRTL) {
if (bIsDropPositionBefore) {
iAggregationDropIndex = iBeginDragIndex < iDropIndex ? iDropIndex : iDropIndex + 1;
sInsertAfterBeforePosition = INSERT_AFTER;
} else {
iAggregationDropIndex = iBeginDragIndex < iDropIndex ? iDropIndex - 1 : iDropIndex;
sInsertAfterBeforePosition = INSERT_BEFORE;
}
} else {
if (bIsDropPositionBefore) {
iAggregationDropIndex = iBeginDragIndex < iDropIndex ? iDropIndex - 1 : iDropIndex;
sInsertAfterBeforePosition = INSERT_BEFORE;
} else {
iAggregationDropIndex = iBeginDragIndex < iDropIndex ? iDropIndex : iDropIndex + 1;
sInsertAfterBeforePosition = INSERT_AFTER;
}
}
IconTabBarDragAndDropUtil._insertControl(sInsertAfterBeforePosition, $DraggedControl, $DroppedControl);
IconTabBarDragAndDropUtil._handleConfigurationAfterDragAndDrop.call(context, oDraggedControl, iAggregationDropIndex);
}
|
javascript
|
{
"resource": ""
}
|
|
q18779
|
train
|
function () {
var oIconTabHeaderItems = this.getItems(),
iAriaPointSet = 1,
oItemDom;
oIconTabHeaderItems.forEach(function (oItem) {
oItemDom = oItem.getDomRef();
if (oItemDom && oItemDom.getAttribute("aria-posinset") !== null) {
oItemDom.setAttribute("aria-posinset", iAriaPointSet++);
}
});
}
|
javascript
|
{
"resource": ""
}
|
|
q18780
|
train
|
function (oDraggedControl, iDropIndex) {
this.removeAggregation('items', oDraggedControl, true);
this.insertAggregation('items', oDraggedControl, iDropIndex, true);
IconTabBarDragAndDropUtil._updateAccessibilityInfo.call(this);
}
|
javascript
|
{
"resource": ""
}
|
|
q18781
|
train
|
function (iBeginDragIndex, iControlCount) {
if (iBeginDragIndex === iControlCount - 1) {
sInsertAfterBeforePosition = INSERT_BEFORE;
return iBeginDragIndex;
}
sInsertAfterBeforePosition = INSERT_AFTER;
return iBeginDragIndex + 1;
}
|
javascript
|
{
"resource": ""
}
|
|
q18782
|
train
|
function (oDraggedControl, iKeyCode) {
var $DraggedControl = oDraggedControl.$(),
aItems = this.getItems(),
iBeginDragIndex = this.indexOfItem(oDraggedControl),
bRtl = sap.ui.getCore().getConfiguration().getRTL(),
iNewDropIndex,
$DroppedControl,
oKeyCodes = KeyCodes;
switch (iKeyCode) {
//Handles Ctrl + Home
case oKeyCodes.HOME:
iNewDropIndex = 0;
sInsertAfterBeforePosition = INSERT_BEFORE;
break;
//Handles Ctrl + End
case oKeyCodes.END:
iNewDropIndex = aItems.length - 1;
sInsertAfterBeforePosition = INSERT_AFTER;
break;
// Handles Ctrl + Left Arrow
case oKeyCodes.ARROW_LEFT:
if (bRtl) {
iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length);
} else {
iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex);
}
break;
// Handles Ctrl + Right Arrow
case oKeyCodes.ARROW_RIGHT:
if (bRtl) {
iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex);
} else {
iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length);
}
break;
// Handles Ctrl + Arrow Down
case oKeyCodes.ARROW_DOWN:
iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length);
break;
// Handles Ctrl + Arrow Up
case oKeyCodes.ARROW_UP:
iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex);
break;
default:
return;
}
$DroppedControl = aItems[iNewDropIndex].$();
IconTabBarDragAndDropUtil._insertControl(sInsertAfterBeforePosition, $DraggedControl, $DroppedControl);
IconTabBarDragAndDropUtil._handleConfigurationAfterDragAndDrop.call(this, oDraggedControl, iNewDropIndex);
return true;
}
|
javascript
|
{
"resource": ""
}
|
|
q18783
|
train
|
function (aItems, oDraggedControl, oDroppedControl) {
var oDroppedListControl,
oDraggedListControl,
sItemId,
sDroppedControlId,
sDraggedControlId;
sDraggedControlId = oDraggedControl._tabFilter ? oDraggedControl._tabFilter.getId() : oDraggedControl.getId();
sDroppedControlId = oDroppedControl._tabFilter ? oDroppedControl._tabFilter.getId() : oDroppedControl.getId();
if (!aItems && !oDraggedControl && !oDroppedControl) {
return;
}
aItems.forEach(function (oItem) {
sItemId = oItem._tabFilter.getId();
if (!sItemId) {
return;
}
if (sItemId === sDroppedControlId) {
oDroppedListControl = oItem;
}
if (sItemId === sDraggedControlId) {
oDraggedListControl = oItem;
}
});
return {oDraggedControlFromList: oDraggedListControl, oDroppedControlFromList: oDroppedListControl};
}
|
javascript
|
{
"resource": ""
}
|
|
q18784
|
train
|
function (context, sDropLayout) {
var oIconTabHeader = context._iconTabHeader ? context._iconTabHeader : context;
var sIconTabHeaderId = oIconTabHeader.getId();
//Adding Drag&Drop configuration to the dragDropConfig aggregation if needed
context.addDragDropConfig(new DragInfo({
sourceAggregation: "items",
groupName: DRAG_DROP_GROUP_NAME + sIconTabHeaderId
}));
context.addDragDropConfig(new DropInfo({
targetAggregation: "items",
dropPosition: "Between",
dropLayout: sDropLayout,
drop: context._handleDragAndDrop.bind(context),
groupName: DRAG_DROP_GROUP_NAME + sIconTabHeaderId
}));
}
|
javascript
|
{
"resource": ""
}
|
|
q18785
|
train
|
function (oControl) {
return oControl instanceof this._oWindow.sap.ui.core.mvc.View && oControl !== that._oView;
}
|
javascript
|
{
"resource": ""
}
|
|
q18786
|
train
|
function (oInterface, oPathValue, iIndex, sEdmType) {
var oParameter = Basics.descend(oPathValue, iIndex),
oResult;
oParameter.asExpression = true;
oResult = Expression.expression(oInterface, oParameter);
if (sEdmType && sEdmType !== oResult.type) {
Basics.error(oParameter,
"Expected " + sEdmType + " but instead saw " + oResult.type);
}
return oResult;
}
|
javascript
|
{
"resource": ""
}
|
|
q18787
|
train
|
function (sValue) {
return DateFormat.getDateInstance({
pattern : "yyyy-MM-dd",
strictParsing : true,
UTC : true
}).parse(sValue);
}
|
javascript
|
{
"resource": ""
}
|
|
q18788
|
train
|
function (sValue) {
var aMatches = mEdmType2RegExp.DateTimeOffset.exec(sValue);
if (aMatches && aMatches[1] && aMatches[1].length > 4) {
// "round" to millis, BEWARE of the dot!
sValue = sValue.replace(aMatches[1], aMatches[1].slice(0, 4));
}
return DateFormat.getDateTimeInstance({
pattern : "yyyy-MM-dd'T'HH:mm:ss.SSSX",
strictParsing : true
}).parse(sValue.toUpperCase());
}
|
javascript
|
{
"resource": ""
}
|
|
q18789
|
train
|
function (sValue) {
if (sValue.length > 12) {
// "round" to millis: "HH:mm:ss.SSS"
sValue = sValue.slice(0, 12);
}
return DateFormat.getTimeInstance({
pattern : "HH:mm:ss.SSS",
strictParsing : true,
UTC : true
}).parse(sValue);
}
|
javascript
|
{
"resource": ""
}
|
|
q18790
|
train
|
function(sClassName, oClassInfo) {
assert(typeof sClassName === "string" && sClassName, "Metadata: sClassName must be a non-empty string");
assert(typeof oClassInfo === "object", "Metadata: oClassInfo must be empty or an object");
// support for old usage of Metadata
if ( !oClassInfo || typeof oClassInfo.metadata !== "object" ) {
oClassInfo = {
metadata : oClassInfo || {},
// retrieve class by its name. Using a lookup costs time but avoids the need for redundant arguments to this function
constructor : ObjectPath.get(sClassName)
};
oClassInfo.metadata.__version = 1.0;
}
oClassInfo.metadata.__version = oClassInfo.metadata.__version || 2.0;
if ( typeof oClassInfo.constructor !== "function" ) {
throw Error("constructor for class " + sClassName + " must have been declared before creating metadata for it");
}
// invariant: oClassInfo exists, oClassInfo.metadata exists, oClassInfo.constructor exists
this._sClassName = sClassName;
this._oClass = oClassInfo.constructor;
this.extend(oClassInfo);
}
|
javascript
|
{
"resource": ""
}
|
|
q18791
|
train
|
function (oEvent) {
oEvent.getParameters().itemsBinding.filter([
new Filter("name", FilterOperator.Contains, oEvent.getParameters().value)
]);
}
|
javascript
|
{
"resource": ""
}
|
|
q18792
|
train
|
function (oData, sFileType) {
// code extension and properties files do not need formation
if ((sFileType === "js") || (sFileType === "properties")) {
return oData;
}
// other files should be formatted to JSON
try {
oData = JSON.parse(oData);
return JSON.stringify(oData, null, '\t');
} catch (oError){
var ErrorUtils = sap.ui.require("sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils");
ErrorUtils.displayError("Error", oError.name, oError.message);
return oData;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q18793
|
train
|
function (oGroup) {
var sTitle = "{i18n>systemData}";
if (oGroup.key === "custom") {
sTitle = "{i18n>externalReferences}";
}
return new GroupHeaderListItem({
title: sTitle,
upperCase: false
});
}
|
javascript
|
{
"resource": ""
}
|
|
q18794
|
train
|
function (oContentItem) {
var bNotBlacklisted = true;
jQuery.each(this.aBlacklist, function (index, mBlacklistedElement) {
var bAllPropertiesMatched = true;
jQuery.each(mBlacklistedElement, function (sProperty, sValue) {
bAllPropertiesMatched = bAllPropertiesMatched && oContentItem[sProperty] === sValue;
});
if (bAllPropertiesMatched) {
bNotBlacklisted = false;
return false; // break each
}
});
return bNotBlacklisted;
}
|
javascript
|
{
"resource": ""
}
|
|
q18795
|
train
|
function (sNamespace) {
if (!sNamespace) {
return "";
}
if (sNamespace[0] === "/") {
var sNamespaceWithoutLeadingSlash = sNamespace.substring(1, sNamespace.length);
return this.cleanLeadingAndTrailingSlashes(sNamespaceWithoutLeadingSlash);
}
if (sNamespace[sNamespace.length - 1] === "/") {
var sNamespaceWithoutTrailingSlash = sNamespace.substring(0, sNamespace.length - 1);
return this.cleanLeadingAndTrailingSlashes(sNamespaceWithoutTrailingSlash);
}
return sNamespace;
}
|
javascript
|
{
"resource": ""
}
|
|
q18796
|
train
|
function(key, type, callback) {
return function(value) {
try {
if ( value != null || type === 'string' ) {
if (value) {
localStorage.setItem(key, type === 'boolean' ? 'X' : value);
} else {
localStorage.removeItem(key);
}
callback(value);
}
value = localStorage.getItem(key);
return type === 'boolean' ? value === 'X' : value;
} catch (e) {
Log.warning("Could not access localStorage while accessing '" + key + "' (value: '" + value + "', are cookies disabled?): " + e.message);
}
};
}
|
javascript
|
{
"resource": ""
}
|
|
q18797
|
train
|
function(sCodeRef, sViewId) {
var oFlexSettings = oRta.getFlexSettings();
if (!oFlexSettings.developerMode) {
throw DtUtil.createError("service.ControllerExtension#add", "code extensions can only be created in developer mode", "sap.ui.rta");
}
if (!sCodeRef) {
throw DtUtil.createError("service.ControllerExtension#add", "can't create controller extension without codeRef", "sap.ui.rta");
}
if (!sCodeRef.endsWith(".js")) {
throw DtUtil.createError("service.ControllerExtension#add", "codeRef has to end with 'js'");
}
var oFlexController = oRta._getFlexController();
var oView = sap.ui.getCore().byId(sViewId);
var oAppComponent = FlexUtils.getAppComponentForControl(oView);
var sControllerName = oView.getControllerName && oView.getControllerName() || oView.getController() && oView.getController().getMetadata().getName();
var oChangeSpecificData = {
content: {
codeRef: sCodeRef
},
selector: {
controllerName: sControllerName
},
changeType: "codeExt",
namespace: oFlexSettings.namespace,
developerMode: oFlexSettings.developerMode,
scenario: oFlexSettings.scenario
};
var oPreparedChange = oFlexController.createBaseChange(oChangeSpecificData, oAppComponent);
oFlexController.addPreparedChange(oPreparedChange, oAppComponent);
return oPreparedChange.getDefinition();
}
|
javascript
|
{
"resource": ""
}
|
|
q18798
|
train
|
function(sViewId) {
var oViewOverlay = OverlayRegistry.getOverlay(sViewId);
if (!oViewOverlay) {
throw DtUtil.createError("service.ControllerExtension#getTemplate", "no overlay found for the given view ID", "sap.ui.rta");
}
var sControllerExtensionTemplatePath = oViewOverlay.getDesignTimeMetadata().getControllerExtensionTemplate();
return makeAjaxCall(sControllerExtensionTemplatePath + "-dbg")
.catch(function() {
return makeAjaxCall(sControllerExtensionTemplatePath);
});
}
|
javascript
|
{
"resource": ""
}
|
|
q18799
|
findFocusableDomRef
|
train
|
function findFocusableDomRef(oContainer, bForward) {
var oChild = bForward ? oContainer.firstChild : oContainer.lastChild,
oFocusableDescendant;
while (oChild) {
if ( oChild.nodeType == 1 && !isHidden(oChild) ) {
if ( jQuery(oChild).hasTabIndex() ) {
return oChild;
}
oFocusableDescendant = findFocusableDomRef(oChild, bForward);
if (oFocusableDescendant) {
return oFocusableDescendant;
}
}
oChild = bForward ? oChild.nextSibling : oChild.previousSibling;
}
return null;
}
|
javascript
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.