Namespace: OpenEdge.DataAdmin.Binding.Query
Type: Class FilteredContext
Parent Classes:
Inherits: OpenEdge.DataAdmin.Binding.Query.AbstractFilteredContext


/* Copyright (c) 2010-2013 by Progress Software Corporation.
/*
/* All rights reserved. No part of this program or document
/* may be reproduced in any form or by any means without
/* permission in writing from Progress Software Corporation.
File:FilteredContext
Purpose:Provide filtered access to another context
Author(s):hdaniels
Created:Aug 2010
Notes:FilteredContext is a buffer and query used to
control and limit access to the Parent DataAdminContext,
which really is a temp-table.
It has the same interface so that the collection
that uses it doesn't need to know the difference.
Note: It stores instance specific context info like filter
and is unique for a collection and its entitites in difference
from the non query context classes
/* NOTE: the public ParentUrl and ParentSerializeName for join
is NOT related to the protected Parent context, which is the unfiltered data



Method Summary
  Options Name Purpose
  LOGICAL AddJoinTable (IDataAdminContext) /** add join buffer - called from columnSource overrides when parent columns are added to query not very robust - assumes BaseQuery and Tables is set */
  LOGICAL CanFind (character)
  CHARACTER ColumnSortSource (character)
  CHARACTER ColumnSource (character) /* qualify columns for QueryString parsing */
  LOGICAL CompareValues (character[], character[])
  Copy (IDataAdminContext) /*** methods ****************************************/
  HANDLE CreateBeforeNavQuery (character, handle, handle)
  HANDLE CreateBeforeUpdQuery (character, handle)
  CreateRow (IDataAdminElement)
  LOGICAL Delete (character)
  LOGICAL Find (character)
  ForeignKeyChanged (IRowChange)
  CHARACTER GetBeforeQueryString (character, handle)
  HANDLE GetBufferHandles ()
  CHARACTER GetJoinFields ()
  CHARACTER GetKeyValues (character) /* convert collection single key to parent context multiple key values using parent query join info */
  OpenEdge.DataAdmin.Binding.IRow GetParentRow ()
  OpenEdge.DataAdmin.Message.IFetchRequest GetQueryRequest () /* override if message needs to override to add additional/different tables for join */
  OpenEdge.DataAdmin.Message.IFetchRequest GetRequest ()
  Import (character, character) /* single table import of the entity (flat - no tree) NOTE: not generic - must have overrides for readForParent and readNewForParent with foreign key not in json all records will be imported with blank foreign key and seen as new records. We cannot copy these as-is to the existing since all values may not be present */
  Import (JsonObject, character) /* single table import of the entity (flat - no tree) NOTE: not generic - must have overrides for readForParent and readNewForParent with foreign key not in json all records will be imported with blank foreign key and seen as new records. We cannot copy these as-is to the existing since all values may not be present - The parentserializeName cases would also find root and read children if present - same as importTree There seems to be no reason to keep import and importTree behavior different */
  ImportForParent (character)
  ImportForParent (JsonObject)
  ImportNewForParent (character)
  ImportNewForParent (JsonObject)
  ImportRow (character, character) /* single row import of the entity (flat no tree) */
  ImportRow (character, integer) /* single row import of the entity (flat no tree) */
  ImportTree (character, character) /* single table import of the entity (flat - no tree) NOTE: not generic - must have overrides for readForParent and readNewForParent with foreign key not in json all records will be imported with blank foreign key and seen as new records. We cannot copy these as-is to the existing since all values may not be present */
  ImportTree (JsonObject, character) /* import of the entity in a tree (will ) NOTE: not generic - must have overrides for readForParent and readNewForParent with foreign key not in json all records will be imported with blank foreign key and seen as new records. We cannot copy these as-is to the existing since all values may not be present - This handles all cases import() handles (the only diference is that this would not give error if root exists - seems unimportant) */
  InitFilter (character) /** sets Filter and LocalFilter from an external filter ) */
  InitParent (character, character) /** sets ParentSerializeName, ParentUrl, ParentValue, Filter and LocalFilter uses TableHandle Parent */
  InitParent (character, character[]) /** sets ParentSerializeName, ParentUrl, ParentValues, Filter and LocalFilter uses TableHandle Parent */
  InitParent (IRow) /* allow override for cases that need more info than keyfields sets ParentSerializeName, ParentUrl, ParentValue or ParentValues, Filter and LocalFilter uses TableHandle Parent */
  InitParentFilter (IRow)
  InitRequest (IRequestInfo) /** init filter from the passed request if necessary (batch criteria is handled in getRequest() */
  LOGICAL InvokeInParent (character, character) /* converts a single key operation to multiple key call based on KeyFields and the filter parentjoin */
  ReadChild (IRow, JSONObject) /* method public override void ImportTree(pcfile as char). Parent:ImportTree(pcfile). end method. */
  RowCreated () /*** protected methods ****************************************/
  RowDeleted ()
  SearchRequest (IRequestInfo, character, character[], IDataAdminContext)
  TableRefreshed (ITableResponse) /** TableRefreshed **/
  UpdateParentKey () /* /* qualify columns for QueryString parsing */ method public override character ColumnSource(pcColumn as char): /* define variable cntxt as IDataAdminContext no-undo.*/ /* define variable cCollection as character no-undo. */ /* define variable cColumn as character no-undo. */ /* */ /* @TODO inner join of parent if num-entries(pcColumn,".") > 1 then do: ccollection = entry(1,pccolumn,"."). cntxt = Parent:GetChild(ccollection). ccolumn = entry(2,pccolumn,"."). return cntxt:ColumnSource(ccolumn). end. */ return super:ColumnSource(pccolumn). end method. */
  ValidateChanges (handle)

Constructor Summary
  Options Name Purpose
  FilteredContext (IDataAdminModel) /*** constructors ****************************************/
  FilteredContext (IDataAdminModel, character) /** The filter is an expression of properties and values and operators. It can also be a parent url of form serializename/key or a serializename.property/value expression. Note that this context have no information about the parent and CANNOT transform an external key to an internal key. The context must be able to use the value as is **/
  FilteredContext (IDataAdminModel, character, character)
  FilteredContext (IDataAdminModel, character, character, IRequestInfo)
  FilteredContext (IDataAdminModel, character, character[], IRequestInfo)
  FilteredContext (IDataAdminModel, IRequestInfo)
  FilteredContext (IDataAdminModel, IRow, IRequestInfo)
  FilteredContext (IDataAdminModel, IRow, IRequestInfo, log)

Property Summary
  Options Name Purpose
  CHARACTER LocalFilter
  OpenEdge.DataAdmin.Binding.IRow ParentRow
  CHARACTER ParentSerializeName
  CHARACTER ParentUrl
  CHARACTER ParentValue
  CHARACTER ParentValues


Method Detail
Top

LOGICAL AddJoinTable (IDataAdminContext)

Purpose: add join buffer - called from columnSource overrides when parent columns
are added to query
not very robust - assumes BaseQuery and Tables is set
Parameters:
pcntxt OpenEdge.DataAdmin.Binding.IDataAdminContext
 
Returns LOGICAL
 
Top

LOGICAL CanFind (character)

Parameters:
c CHARACTER
 
Returns LOGICAL
 
Top

CHARACTER ColumnSortSource (character)

Parameters:
pcColumn CHARACTER
 
Returns CHARACTER
 
Top

CHARACTER ColumnSource (character)

/* qualify columns for QueryString parsing
Parameters:
pcColumn CHARACTER
 
Returns CHARACTER
 
Top

LOGICAL CompareValues (character[], character[])

Parameters:
pcValues1 CHARACTER
 
pcValues2 CHARACTER
 
Returns LOGICAL
 
Top

Copy (IDataAdminContext)

Parameters:
cntxt OpenEdge.DataAdmin.Binding.IDataAdminContext
 
Top

HANDLE CreateBeforeNavQuery (character, handle, handle)

Parameters:
pcParentTable CHARACTER
 
phBefore HANDLE
 
phOrigQuery HANDLE
 
Returns HANDLE
 
Top

HANDLE CreateBeforeUpdQuery (character, handle)

Parameters:
pcParentTable CHARACTER
 
phBefore HANDLE
 
Returns HANDLE
 
Top

CreateRow (IDataAdminElement)

Parameters:
entity OpenEdge.DataAdmin.IDataAdminElement
 
Top

LOGICAL Delete (character)

Parameters:
c CHARACTER
 
Returns LOGICAL
 
Top

LOGICAL Find (character)

Parameters:
c CHARACTER
 
Returns LOGICAL
 
Top

ForeignKeyChanged (IRowChange)

Parameters:
pParentChange OpenEdge.DataAdmin.Binding.IRowChange
 
Top

CHARACTER GetBeforeQueryString (character, handle)

Parameters:
pcParentTable CHARACTER
 
phOrigQuery HANDLE
 
Returns CHARACTER
 
Top

HANDLE GetBufferHandles ()

Returns HANDLE
 
Top

CHARACTER GetJoinFields ()

Returns CHARACTER
 
Top

CHARACTER GetKeyValues (character)

/* convert collection single key to parent context multiple key values using parent query join info
Parameters:
pKey CHARACTER
 
Returns CHARACTER
 
Top

OpenEdge.DataAdmin.Binding.IRow GetParentRow ()

Returns OpenEdge.DataAdmin.Binding.IRow
 
Top

OpenEdge.DataAdmin.Message.IFetchRequest GetQueryRequest ()

/* override if message needs to override to add additional/different tables for join
Returns OpenEdge.DataAdmin.Message.IFetchRequest
 
Top

OpenEdge.DataAdmin.Message.IFetchRequest GetRequest ()

Returns OpenEdge.DataAdmin.Message.IFetchRequest
 
Top

Import (character, character)

/* single table import of the entity (flat - no tree)
NOTE: not generic - must have overrides for readForParent and readNewForParent
with foreign key not in json all records will be imported with
blank foreign key and seen as new records. We cannot copy these
as-is to the existing since all values may not be present
Parameters:
pcfile CHARACTER
 
pcMode CHARACTER
 
Top

Import (JsonObject, character)

/* single table import of the entity (flat - no tree)
NOTE: not generic - must have overrides for readForParent and readNewForParent
with foreign key not in json all records will be imported with
blank foreign key and seen as new records. We cannot copy these
as-is to the existing since all values may not be present
- The parentserializeName cases would also find root and read children if present - same as importTree
There seems to be no reason to keep import and importTree behavior different
Parameters:
pJson Progress.Json.ObjectModel.JsonObject
 
pcMode CHARACTER
 
Top

ImportForParent (character)

Parameters:
pcfile CHARACTER
 
Top

ImportForParent (JsonObject)

Parameters:
pJson Progress.Json.ObjectModel.JsonObject
 
Top

ImportNewForParent (character)

Parameters:
pcfile CHARACTER
 
Top

ImportNewForParent (JsonObject)

Parameters:
pJson Progress.Json.ObjectModel.JsonObject
 
Top

ImportRow (character, character)

/* single row import of the entity (flat no tree)
Parameters:
pcfile CHARACTER
 
c CHARACTER
 
Top

ImportRow (character, integer)

/* single row import of the entity (flat no tree)
Parameters:
pcfile CHARACTER
 
i INTEGER
 
Top

ImportTree (character, character)

/* single table import of the entity (flat - no tree)
NOTE: not generic - must have overrides for readForParent and readNewForParent
with foreign key not in json all records will be imported with
blank foreign key and seen as new records. We cannot copy these
as-is to the existing since all values may not be present
Parameters:
pcfile CHARACTER
 
pcMode CHARACTER
 
Top

ImportTree (JsonObject, character)

/* import of the entity in a tree (will )
NOTE: not generic - must have overrides for readForParent and readNewForParent
with foreign key not in json all records will be imported with
blank foreign key and seen as new records. We cannot copy these
as-is to the existing since all values may not be present
- This handles all cases import() handles (the only diference is that this would not
give error if root exists - seems unimportant)
Parameters:
pJson Progress.Json.ObjectModel.JsonObject
 
pcMode CHARACTER
 
Top

InitFilter (character)

Purpose:
sets Filter and LocalFilter from an external filter )
Parameters:
pFilter CHARACTER
 
Top

InitParent (character, character)

Purpose:
sets ParentSerializeName, ParentUrl, ParentValue, Filter and LocalFilter
uses TableHandle Parent
Parameters:
pcParent CHARACTER
 
pckeyValue CHARACTER
 
Top

InitParent (character, character[])

Purpose:
sets ParentSerializeName, ParentUrl, ParentValues, Filter and LocalFilter
uses TableHandle Parent
Parameters:
pcparent CHARACTER
 
pckeyValues CHARACTER
 
Top

InitParent (IRow)

/* allow override for cases that need more info than keyfields
sets ParentSerializeName, ParentUrl, ParentValue or ParentValues, Filter and LocalFilter
uses TableHandle Parent
Parameters:
pParentRow OpenEdge.DataAdmin.Binding.IRow
 
Top

InitParentFilter (IRow)

Parameters:
pParent OpenEdge.DataAdmin.Binding.IRow
 
Top

InitRequest (IRequestInfo)

Purpose: init filter from the passed request if necessary
(batch criteria is handled in getRequest()
Parameters:
pReq OpenEdge.DataAdmin.IRequestInfo
 
Top

LOGICAL InvokeInParent (character, character)

/* converts a single key operation to multiple key call based on KeyFields and
the filter parentjoin
Parameters:
pcCall CHARACTER
 
pKey CHARACTER
 
Returns LOGICAL
 
Top

ReadChild (IRow, JSONObject)

/*
method public override void ImportTree(pcfile as char).
Parent:ImportTree(pcfile). ImportTree(pcfile).
end method.
Parameters:
parentRow OpenEdge.DataAdmin.Binding.IRow
 
pjson Progress.Json.ObjectModel.JsonObject
 
Top

RowCreated ()

Top

RowDeleted ()

Top

SearchRequest (IRequestInfo, character, character[], IDataAdminContext)

Parameters:
pRequestInfo OpenEdge.DataAdmin.IRequestInfo
 
pcParent CHARACTER
 
pcKeys CHARACTER
 
pqueryContext OpenEdge.DataAdmin.Binding.IDataAdminContext
 
Top

TableRefreshed (ITableResponse)

Purpose: TableRefreshed
Parameters:
msg OpenEdge.DataAdmin.Message.ITableResponse
 
Top

UpdateParentKey ()

/*
/* qualify columns for QueryString parsing
method public override character ColumnSource(pcColumn as char):
/* define variable cntxt as IDataAdminContext no-undo.
/* define variable cCollection as character no-undo.
/* define variable cColumn as character no-undo.
/*
/*
@TODO inner join of parent
if num-entries(pcColumn,".") > 1 then
do:
ccollection = entry(1,pccolumn,".").
cntxt = Parent:GetChild(ccollection).
ccolumn = entry(2,pccolumn,".").
return cntxt:ColumnSource(ccolumn).
end.
return super:ColumnSource(pccolumn).
end method.
Top

ValidateChanges (handle)

Parameters:
phDsOrRel HANDLE
 


Constructor Detail
Top

FilteredContext (IDataAdminModel)

Parameters:
sourcecntxt OpenEdge.DataAdmin.Binding.IDataAdminModel
 
Top

FilteredContext (IDataAdminModel, character)

Purpose: The filter is an expression of properties and values and operators.
It can also be a parent url of form serializename/key or
a serializename.property/value expression.
Note that this context have no information about the parent and CANNOT transform
an external key to an internal key. The context must be able to use the value as is
Parameters:
sourcecntxt OpenEdge.DataAdmin.Binding.IDataAdminModel
 
pfilter CHARACTER
 
Top

FilteredContext (IDataAdminModel, character, character)

Parameters:
sourcecntxt OpenEdge.DataAdmin.Binding.IDataAdminModel
 
pcparent CHARACTER
 
pcKeyvalue CHARACTER
 
Top

FilteredContext (IDataAdminModel, character, character, IRequestInfo)

Parameters:
sourcecntxt OpenEdge.DataAdmin.Binding.IDataAdminModel
 
pcparent CHARACTER
 
pcKeyValue CHARACTER
 
pReq OpenEdge.DataAdmin.IRequestInfo
 
Top

FilteredContext (IDataAdminModel, character, character[], IRequestInfo)

Parameters:
sourcecntxt OpenEdge.DataAdmin.Binding.IDataAdminModel
 
pcparent CHARACTER
 
pcKeyvalues CHARACTER
 
pReq OpenEdge.DataAdmin.IRequestInfo
 
Top

FilteredContext (IDataAdminModel, IRequestInfo)

Parameters:
sourcecntxt OpenEdge.DataAdmin.Binding.IDataAdminModel
 
pReq OpenEdge.DataAdmin.IRequestInfo
 
Top

FilteredContext (IDataAdminModel, IRow, IRequestInfo)

Parameters:
sourcecntxt OpenEdge.DataAdmin.Binding.IDataAdminModel
 
pParentRow OpenEdge.DataAdmin.Binding.IRow
 
pReq OpenEdge.DataAdmin.IRequestInfo
 
Top

FilteredContext (IDataAdminModel, IRow, IRequestInfo, log)

Parameters:
sourcecntxt OpenEdge.DataAdmin.Binding.IDataAdminModel
 
pParentRow OpenEdge.DataAdmin.Binding.IRow
 
pReq OpenEdge.DataAdmin.IRequestInfo
 
pCreate LOGICAL
 


Property Detail
Top

CHARACTER LocalFilter

Returns CHARACTER
 
Top

OpenEdge.DataAdmin.Binding.IRow ParentRow

Returns OpenEdge.DataAdmin.Binding.IRow
 
Top

CHARACTER ParentSerializeName

Returns CHARACTER
 
Top

CHARACTER ParentUrl

Returns CHARACTER
 
Top

CHARACTER ParentValue

Returns CHARACTER
 
Top

CHARACTER ParentValues

Returns CHARACTER