private JArray LoadItemData(IMetadataItem item) { // prepare the requirements of the data provider IDataLocation dataLocation = ((IDataSourceItemMetadata)item).DataLocation; IList <ISchemaColumn> schema = this._metadataLayerService.GetSchema(dataLocation); var dataRequest = new ConnectorsDataRequest(dataLocation) { RequestSettings = new DataRequestSettings { CacheMode = CacheUsageMode.DefaultMode } }; var builder = new ConnectorsTableBuilder(); var requirements = new ConnectorsDataRequirements() { DataProvider = this._dataProvider, DataRequest = dataRequest, Retrieve = new ConnectorsRetrieve(dataLocation, schema, MaxRowsLimit) }; // load data in table this._dataProvider.LoadData(requirements, builder); // convert table to json object return(builder.ResultAsJson(schema)); }
public ConnectorsDataRequest(IDataLocation dataLocation) { this._dataLocation = dataLocation; // Workaround: Recreate the request settings as the CacheMode property is null by default and doesn't have a setter. // CacheMode is used by DataProviders and we need to provide a default value. this.RequestSettings = new DataRequestSettings { CacheMode = CacheUsageMode.DefaultMode }; }
public ConnectorsRetrieve(IDataLocation dataLocation, IList <ISchemaColumn> schema, int?maxRowsLimit) { this.Compute = new List <IDataComputation>(); this.FormatAs = new List <IDataFormatter>(); this.FilterBy = new List <IDataFilter>(); this.Hide = new List <ITableColumn>(); this.OrderBy = new List <IDataSorting>(); this.DataLocation = dataLocation; this.OriginalSchema = schema; this.SourceSchema = schema.Cast <ITableColumn>().ToList(); this.RequiredColumns = schema.Cast <ITableColumn>().ToList(); this.MaxRowsLimit = maxRowsLimit; }
/// <summary> /// Copies data from a place to an entity at the data path's specified index /// </summary> /// <param name="toSelector">The entity to copy the data to</param> /// <param name="toDataPath">The data path to copy to</param> /// <param name="dataLocation">The place to copy the data from</param> /// <param name="index">the index to copy to</param> public void Copy(BaseSelector toSelector, string toDataPath, IDataLocation dataLocation, int index) { toSelector.LimitSelector(); ForFunction.AddCommand(new DataModifyInsertLocationCommand(new EntityDataLocation(toSelector, toDataPath), index, dataLocation)); }
/// <summary> /// Copies data from a place to an entity /// </summary> /// <param name="toSelector">The entity to copy the data to</param> /// <param name="toDataPath">The data path to copy to</param> /// <param name="dataLocation">The place to copy the data from</param> /// <param name="modifierType">The way to add the data</param> public void Copy(BaseSelector toSelector, string toDataPath, ID.EntityDataModifierType modifierType, IDataLocation dataLocation) { toSelector.LimitSelector(); ForFunction.AddCommand(new DataModifyWithLocationCommand(new EntityDataLocation(toSelector, toDataPath), modifierType, dataLocation)); }
/// <summary> /// Stores the command's success output inside the <see cref="Entity"/> /// </summary> /// <param name="dataLocation">the location to store the result at</param> /// <param name="dataType">the path to the place to store the score</param> /// <param name="scale">the number the output should be multiplied with before being inserted</param> /// <param name="storeSuccess">true if it only should store if the command was successfull</param> /// <returns>The function running the command</returns> public Function Store(IDataLocation dataLocation, ID.StoreTypes dataType, double scale = 1, bool storeSuccess = false) { ForFunction.AddCommand(new ExecuteStoreData(dataLocation, dataType, scale, !storeSuccess)); return(ForFunction); }
/// <summary> /// Intializes a new <see cref="ExecuteStoreData"/> command /// </summary> /// <param name="dataLocation">The location to store the result in</param> /// <param name="valueType">The type of number to store the result as</param> /// <param name="scale">A number to multiply the result by before storing it</param> /// <param name="storeResult">True if it should store the result. False if it should store success</param> public ExecuteStoreData(IDataLocation dataLocation, ID.StoreTypes valueType, double scale, bool storeResult = true) : base(storeResult) { DataLocation = dataLocation; ValueType = valueType; Scale = scale; }
/// <summary> /// Copies data into the block at the given location /// </summary> /// <param name="storage">the <see cref="Storage"/> to copy the data to</param> /// <param name="toDataPath">the datapath to copy to</param> /// <param name="index">The index to copy the data to</param> /// <param name="dataLocation">The place to copy the data from</param> public void Copy(Storage storage, string toDataPath, int index, IDataLocation dataLocation) { function.AddCommand(new DataModifyInsertLocationCommand(new StorageDataLocation(storage, toDataPath), index, dataLocation)); }
/// <summary> /// Copies data into the block at given location /// </summary> /// <param name="storage">the <see cref="Storage"/> to copy the data to</param> /// <param name="toDataPath">the datapath to copy to</param> /// <param name="modifierType">The way to data should be copied in</param> /// <param name="dataLocation">The place to copy the data from</param> public void Copy(Storage storage, string toDataPath, ID.EntityDataModifierType modifierType, IDataLocation dataLocation) { function.AddCommand(new DataModifyWithLocationCommand(new StorageDataLocation(storage, toDataPath), modifierType, dataLocation)); }
/// <summary> /// Intializes a new <see cref="ExecuteIfData"/> command /// </summary> /// <param name="executeIf">True to use execute if and false to use execute unless the given thing is true</param> /// <param name="dataLocation">The location and datapath to check for</param> public ExecuteIfData(IDataLocation dataLocation, bool executeIf = true) : base(executeIf) { DataLocation = dataLocation; }
/// <summary> /// Intializes a new <see cref="DataGetCommand"/> /// </summary> /// <param name="dataLocation">The place to get the data from</param> /// <param name="scale">A number to multiply the data with</param> public DataGetCommand(IDataLocation dataLocation, double?scale) { DataLocation = dataLocation; Scale = scale; }
/// <summary> /// Copies data into the block at the given location /// </summary> /// <param name="toBlock">the coords of the <see cref="SharpCraft.Block"/> to copy the data to</param> /// <param name="toDataPath">the datapath to copy to</param> /// <param name="index">The index to copy the data to</param> /// <param name="dataLocation">The place to copy the data from</param> public void Copy(Vector toBlock, string toDataPath, int index, IDataLocation dataLocation) { ForFunction.AddCommand(new DataModifyInsertLocationCommand(new BlockDataLocation(toBlock, toDataPath), index, dataLocation)); }
/// <summary> /// Copies data into the block at given location /// </summary> /// <param name="toBlock">the coords of the <see cref="SharpCraft.Block"/> to copy the data to</param> /// <param name="toDataPath">the datapath to copy to</param> /// <param name="modifierType">The way to data should be copied in</param> /// <param name="dataLocation">The place to copy the data from</param> public void Copy(Vector toBlock, string toDataPath, ID.EntityDataModifierType modifierType, IDataLocation dataLocation) { ForFunction.AddCommand(new DataModifyWithLocationCommand(new BlockDataLocation(toBlock, toDataPath), modifierType, dataLocation)); }