You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
9.0 KiB
21 lines
9.0 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("../../../Graphic ../support/errorsupport ../support/FeatureSet ../support/IdSet ../support/shared ../../../rest/support/RelationshipQuery".split(" "),function(q,m,r,l,n,p){class t extends r{constructor(a){super(a);this.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated";this._findObjectId=-1;this._removeGeometry=this._requestStandardised=!1;this.featureObjectId=this._overrideFields=null;a.spatialReference&&(this.spatialReference=a.spatialReference);this._transparent=!0;this._maxProcessing= |
|
1E3;this._layer=a.layer;this._wset=null;this.featureObjectId=this._findObjectId=a.objectId;this.relationship=a.relationship;this._relatedLayer=a.relatedLayer;void 0!==a.outFields&&(this._overrideFields=a.outFields);void 0!==a.includeGeometry&&(this._removeGeometry=!1===a.includeGeometry)}_maxQueryRate(){return n.defaultMaxRecords}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){await Promise.all([this._layer.load(),this._relatedLayer?.load()]);this._initialiseFeatureSet(); |
|
return this}nativeCapabilities(){return this._relatedLayer.nativeCapabilities()}_initialiseFeatureSet(){null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference);this.geometryType=this._relatedLayer.geometryType;this.fields=this._relatedLayer.fields.slice(0);this.hasZ=this._relatedLayer.hasZ;this.hasM=this._relatedLayer.hasM;if(null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{var a=[];const d=[];for(const c of this.fields)if("oid"=== |
|
c.type)a.push(c),d.push(c.name);else for(const b of this._overrideFields)if(b.toLowerCase()===c.name.toLowerCase()){a.push(c);d.push(c.name);break}this.fields=a;this._overrideFields=d}if(a=this._layer.nativeCapabilities())this._databaseType=a.databaseType,this._requestStandardised=a.requestStandardised;this.objectIdField=this._relatedLayer.objectIdField;this.globalIdField=this._relatedLayer.globalIdField;this.hasM=this._relatedLayer.supportsM;this.hasZ=this._relatedLayer.supportsZ;this.typeIdField= |
|
this._relatedLayer.typeIdField;this.types=this._relatedLayer.types;this.subtypeField=this._relatedLayer.subtypeField;this.subtypes=this._relatedLayer.subtypes}async databaseType(){await this._relatedLayer.databaseType();return this._databaseType=this._relatedLayer._databaseType}isTable(){return this._relatedLayer.isTable()}_isInFeatureSet(){return n.IdState.InFeatureSet}_candidateIdTransform(a){return a}async _getSet(a){return null===this._wset?(await this._ensureLoaded(),this._wset=a=await this._getFilteredSet("", |
|
null,null,null,a)):this._wset}_changeFeature(a){const d={};for(const c of this.fields)d[c.name]=a.attributes[c.name];return new q({geometry:!0===this._removeGeometry?null:a.geometry,attributes:d})}async _getFilteredSet(a,d,c,b,f){await this.databaseType();if(this.isTable()&&d&&null!==a&&""!==a)return new l([],[],!0,null);var e=this._layer.nativeCapabilities();if(!1===e.canQueryRelated)return new l([],[],!0,null);if(e.capabilities?.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(a, |
|
d,c,b,f);var g="";let h=!1;null!==b&&!0===e.capabilities?.queryRelated.supportsOrderBy&&(g=b.constructClause(),h=!0);b=new p;b.objectIds=[this._findObjectId];var k=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map(u=>u.name):["*"]);b.outFields=k;b.relationshipId=this.relationship.id;b.where="1\x3d1";k=!0;!0===this._removeGeometry&&(k=!1);b.returnGeometry=k;this._requestStandardised&&(b.sqlFormat="standard");b.outSpatialReference= |
|
this.spatialReference;b.orderByFields=""!==g?g.split(","):null;e=await e.source.queryRelatedFeatures(b);this._checkCancelled(f);e=e[this._findObjectId]?e[this._findObjectId].features:[];f=[];for(g=0;g<e.length;g++)this._featureCache[e[g].attributes[this._relatedLayer.objectIdField]]=e[g],f.push(e[g].attributes[this._relatedLayer.objectIdField]);a=d&&null!==a&&""!==a;c=null!==c&&void 0!==c;return new l(a||c?f:[],a||c?[]:f,h,null)}_fieldsIncludingObjectId(a){if(null===a)return[this.objectIdField];a= |
|
a.slice(0);if(a.includes("*"))return a;let d=!1;for(const c of a)if(c.toUpperCase()===this.objectIdField.toUpperCase()){d=!0;break}!1===d&&a.push(this.objectIdField);return a}async _getFilteredSetUsingPaging(a,d,c,b,f){let e="",g=!1;var h=this._layer.nativeCapabilities();null!==b&&!0===h.capabilities?.queryRelated.supportsOrderBy&&(e=b.constructClause(),g=!0);await this.databaseType();b=this._maxQueryRate();h=h.capabilities?.query.maxRecordCount;null!=h&&h<b&&(b=h);a=d&&null!==a&&""!==a;c=null!== |
|
c&&void 0!==c;d=null;d=!0;!0===this._removeGeometry&&(d=!1);h=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map(k=>k.name):["*"]);d=new l(a||c?["GETPAGES"]:[],a||c?[]:["GETPAGES"],g,{outFields:h.join(","),resultRecordCount:b,resultOffset:0,objectIds:[this._findObjectId],where:"1\x3d1",orderByFields:e,returnGeometry:d,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});await this._expandPagedSet(d, |
|
b,0,0,f);return d}_expandPagedSet(a,d,c,b,f){return this._expandPagedSetFeatureSet(a,d,c,b,f)}_clonePageDefinition(a){return null===a?null:!0!==a.groupbypage?{groupbypage:!1,outFields:a.outFields,resultRecordCount:a.resultRecordCount,resultOffset:a.resultOffset,where:a.where,objectIds:a.objectIds,orderByFields:a.orderByFields,returnGeometry:a.returnGeometry,returnIdsOnly:a.returnIdsOnly,internal:a.internal}:{groupbypage:!0,outFields:a.outFields,resultRecordCount:a.resultRecordCount,useOIDpagination:a.useOIDpagination, |
|
generatedOid:a.generatedOid,groupByFieldsForStatistics:a.groupByFieldsForStatistics,resultOffset:a.resultOffset,outStatistics:a.outStatistics,geometry:a.geometry,where:a.where,objectIds:a.objectIds,orderByFields:a.orderByFields,returnGeometry:a.returnGeometry,returnIdsOnly:a.returnIdsOnly,internal:a.internal}}async _getPhysicalPage(a,d,c){d=a.pagesDefinition.internal.lastRetrieved;var b=a.pagesDefinition.internal.lastPage,f=this._layer.nativeCapabilities();const e=new p;!0===this._requestStandardised&& |
|
(e.sqlFormat="standard");e.relationshipId=this.relationship.id;e.objectIds=a.pagesDefinition.objectIds;e.resultOffset=a.pagesDefinition.internal.lastPage;e.resultRecordCount=a.pagesDefinition.resultRecordCount;e.outFields=a.pagesDefinition.outFields.split(",");e.where=a.pagesDefinition.where;e.orderByFields=""!==a.pagesDefinition.orderByFields?a.pagesDefinition.orderByFields.split(","):null;e.returnGeometry=a.pagesDefinition.returnGeometry;e.outSpatialReference=this.spatialReference;f=await f.source.queryRelatedFeatures(e); |
|
this._checkCancelled(c);if(a.pagesDefinition.internal.lastPage!==b)return 0;c=f[this._findObjectId]?f[this._findObjectId].features:[];for(b=0;b<c.length;b++)a.pagesDefinition.internal.set[d+b]=c[b].attributes[this._relatedLayer.objectIdField];for(b=0;b<c.length;b++)this._featureCache[c[b].attributes[this._relatedLayer.objectIdField]]=c[b];f=f[this._findObjectId]?!1===f[this._findObjectId].exceededTransferLimit:!0;c.length!==a.pagesDefinition.resultRecordCount&&f&&(a.pagesDefinition.internal.fullyResolved= |
|
!0);a.pagesDefinition.internal.lastRetrieved=d+c.length;a.pagesDefinition.internal.lastPage+=a.pagesDefinition.resultRecordCount;return c.length}async _getFeatures(a,d,c,b){const f=[];-1!==d&&void 0===this._featureCache[d]&&f.push(d);var e=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(a,e))return await this._expandPagedSet(a,e,0,0,b),this._getFeatures(a,d,c,b);b=0;for(e=a._lastFetchedIndex;e<a._known.length;e++){b++;b<=c&&(a._lastFetchedIndex+=1);if("GETPAGES"!==a._known[e]&&void 0=== |
|
this._featureCache[a._known[e]]&&(a._known[e]!==d&&f.push(a._known[e]),f.length>c))break;if(b>=c&&0===f.length)break}if(0===f.length)return"success";throw new m.FeatureSetError(m.FeatureSetErrorCodes.MissingFeatures);}async _refineSetBlock(a,d,c){return a}async _stat(a,d,c,b,f,e,g){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(a,d,c,b,f){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(a, |
|
d,c,b,f){return this._relatedLayer.queryAttachments(a,d,c,b,f)}getFeatureByObjectId(a,d){return this._relatedLayer.getFeatureByObjectId(a,d)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){return this._relatedLayer?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._relatedLayer?.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._relatedLayer?.datesInUnknownTimezone}get editFieldsInfo(){return this._relatedLayer?.editFieldsInfo?? |
|
null}get timeInfo(){return this._relatedLayer?.timeInfo??null}async getFeatureSetInfo(){return this.fsetInfo??this._layer.featureSetInfo}}return t}); |