Package com.progress.open4gl
Class ProDataGraph
java.lang.Object
com.progress.open4gl.ProDataGraph
- All Implemented Interfaces:
commonj.sdo.DataGraph
,Externalizable
,Serializable
,org.eclipse.emf.common.notify.Adapter
public class ProDataGraph
extends Object
implements commonj.sdo.DataGraph, org.eclipse.emf.common.notify.Adapter, Externalizable
Maps to either a 4GL DataSet, DataSet-Handle, Temp-Table, or Table-Handle
parameter in a Java client. It implements the Java SDO DataGraph interface.
We made a number of changes to the ProDataGraph class to enable java
serialization.
1) Previously, this class extended DataGraphImpl. However, because of the way
java serialization is implemented in DataGraphImpl, it is not intended to be
used as a base class. Rather than extending DataGraphImpl, we instead
implement the DataGraph interfaces and have an instance of DataGraphImpl as a
member that we delegate to. This allows successful serialization of the
DataGraphImpl as it has not been extended.
2) We now provide implementations of readObject() and writeObject() to
control the java serialization of this class.
3) Serialization of the ProDataGraphMetaData is done separately from the
serialization of the DataGraphImpl. This is because the type information from
the metadata is needed to be able to deserialize the DataGraphImpl. As a
result, on deserialization, the metadata information is read first, then
creation of the types is done with the method createTypesFromMetadata(), and
finally the datagraph can be recreated.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorCreates a copy of the specified ProDataGraph object, without the dataProDataGraph
(ProDataGraphMetaData metadata) Creates a ProDataGraph object based on the specified metadata.ProDataGraph
(commonj.sdo.DataGraph dg, String dgName, ProDataRelationMetaData[] dataRelList) Converts the specified DataGraph object into a ProDataGraph object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears out the change list in the ProChangeSummary.void
addProDataObject
(int index, ProDataObject dataObj) Adds ProDataObject instance at specified index in its ProDataObject collection within ProDataGraph.void
addProDataObject
(ProDataObject dataObj) Adds ProDataObject instance to end of its ProDataObject collection within ProDataGraph.createProDataObject
(String tableName) Returns a new ProDataObjectcommonj.sdo.DataObject
createRootObject
(commonj.sdo.Type type) commonj.sdo.DataObject
createRootObject
(String namespaceURI, String typeName) commonj.sdo.ChangeSummary
commonj.sdo.DataGraph
org.eclipse.emf.ecore.resource.Resource
int
getProDataObjects
(int tableIdx) Get the list of rows in a tablegetProDataObjects
(String tableName) Get the list of rows in a tableorg.eclipse.emf.ecore.resource.ResourceSet
commonj.sdo.DataObject
int
getTableIndex
(String tableName) String[]
org.eclipse.emf.common.notify.Notifier
commonj.sdo.Type
boolean
hasError()
boolean
isAdapterForType
(Object type) void
notifyChanged
(org.eclipse.emf.common.notify.Notification message) void
Deserialize a ProDataGraphvoid
readFromStream
(InputStream stream) Populate a datagraph from a stream This method is used by BPMvoid
readXML() copies data from file into a temp file.void
readXMLUnsafe
(String fileName) readXMLUnsafe() copies data from file into a temp file.void
Use this to build ProDataGraph object with data relations.void
setChildTableReferences
(int parentIx) Use this to build ProDataGraph object with data relations.void
setChildTableReferences
(String tableName) Use this to build ProDataGraph object with data relations.void
setResourceSet
(org.eclipse.emf.ecore.resource.ResourceSet newResourceSet) void
setTarget
(org.eclipse.emf.common.notify.Notifier target) void
Serialize a ProDataGraphvoid
writeToStream
(OutputStream stream) Write a representation of the dataset to a stream This method is used by BPMvoid
Serialize a ProDataGraph in XMLvoid
writeXML
(StringBuilder builder) Serialize a ProDataGraph into XML and sends output to StringBuilder.
-
Field Details
-
DATASET_TYPE_NAME
- See Also:
-
-
Constructor Details
-
ProDataGraph
public ProDataGraph()Default constructor -
ProDataGraph
Creates a ProDataGraph object based on the specified metadata.- Parameters:
metadata
- metadata used to create ProDataGraph- Throws:
ProDataException
-
ProDataGraph
public ProDataGraph(commonj.sdo.DataGraph dg, String dgName, ProDataRelationMetaData[] dataRelList) throws Exception, ProDataException, Open4GLException Converts the specified DataGraph object into a ProDataGraph object. In the DataGraph's DataObject hierarchy, if a parent-child relationship exists between 2 DataObjects (or temp-tables), a ProDataRelationMetaData object must be provided in the ProDataRelationMetaData array that describes that relationship.- Parameters:
dg
- Input DataGraph objectdgName
- Name for newly created ProDataGraphdataRelList
- List of parent-child relationships- Throws:
Exception
ProDataException
Open4GLException
-
ProDataGraph
Creates a copy of the specified ProDataGraph object, without the data- Parameters:
dg
- ProDataGraph object to copy- Throws:
ProDataException
Exception
Open4GLException
-
-
Method Details
-
getProChangeSummary
- Returns:
- ProChangeSummary object associated with this ProDataGraph.
-
getProDataGraphName
- Returns:
- Name of ProDataGraph
-
getNumTables
public int getNumTables()- Returns:
- The number of ProDataObject collections (temp-tables) in this ProDataGraph object.
-
getMetaData
- Returns:
- The ProDataGraphMetaData object
-
acceptChanges
public void acceptChanges()Clears out the change list in the ProChangeSummary. Same behavior as the ChangeSummary.beginLogging(). -
hasError
public boolean hasError()- Returns:
- True if AppServer returned error message for ProDataGraph, else False - returned from AppServer.
-
createProDataObject
Returns a new ProDataObject- Parameters:
tableName
- Specified table within the ProDataGraph- Returns:
- Newly created ProDataObject instance (row) for tableName.
- Throws:
Open4GLException
-
addProDataObject
Adds ProDataObject instance to end of its ProDataObject collection within ProDataGraph.- Parameters:
dataObj
- ProDataObject to add- Throws:
Open4GLException
-
addProDataObject
Adds ProDataObject instance at specified index in its ProDataObject collection within ProDataGraph.- Parameters:
index
- 0-based locationdataObj
- ProDataObject to add- Throws:
Open4GLException
-
getProDataObjects
Get the list of rows in a table- Parameters:
tableIdx
- 0-based table index within ProDataGraph- Returns:
- List of ProDataObject objects (instance data) for the specified tableIdx
- Throws:
Exception
-
getProDataObjects
Get the list of rows in a table- Parameters:
tableName
-- Returns:
- List of ProDataObject objects (instance data) for specified tableName
- Throws:
Exception
Open4GLException
-
getTableIndex
- Parameters:
tableName
-- Returns:
- Throws:
Open4GLException
-
getTableNames
- Returns:
- String array of the table names of the ProDataObject collections in this ProDataGraph object.
-
setChildTableReferences
Use this to build ProDataGraph object with data relations. It creates all the references (or relationship info) for each ProDataRelationMetaData. Once done, ProDataObject methods getChildRows() and getParentRow() can be used.- Throws:
Exception
-
setChildTableReferences
Use this to build ProDataGraph object with data relations. It creates all the references (or relationship info) for each ProDataRelationMetaData where tableName is parent table. Once done, ProDataObject methods getChildRows() and getParentRow() can be used.- Parameters:
tableName
- the parent's table name- Throws:
Open4GLException
Exception
-
setChildTableReferences
Use this to build ProDataGraph object with data relations. It creates all the references (or relationship info) for each ProDataRelationMetaData where the specified table is parent table. Once this is done, ProDataObject methods getChildRows() and getParentRow() can be used.- Parameters:
parentIx
- 0-based parent table index- Throws:
Open4GLException
Exception
-
getDataGraph
public commonj.sdo.DataGraph getDataGraph()- Returns:
-
getResourceSet
public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()- Returns:
-
setResourceSet
public void setResourceSet(org.eclipse.emf.ecore.resource.ResourceSet newResourceSet) - Parameters:
newResourceSet
-
-
getDataGraphResource
public org.eclipse.emf.ecore.resource.Resource getDataGraphResource()- Returns:
-
getTarget
public org.eclipse.emf.common.notify.Notifier getTarget()- Specified by:
getTarget
in interfaceorg.eclipse.emf.common.notify.Adapter
-
isAdapterForType
- Specified by:
isAdapterForType
in interfaceorg.eclipse.emf.common.notify.Adapter
-
notifyChanged
public void notifyChanged(org.eclipse.emf.common.notify.Notification message) - Specified by:
notifyChanged
in interfaceorg.eclipse.emf.common.notify.Adapter
-
setTarget
public void setTarget(org.eclipse.emf.common.notify.Notifier target) - Specified by:
setTarget
in interfaceorg.eclipse.emf.common.notify.Adapter
-
createRootObject
public commonj.sdo.DataObject createRootObject(commonj.sdo.Type type) - Specified by:
createRootObject
in interfacecommonj.sdo.DataGraph
-
createRootObject
- Specified by:
createRootObject
in interfacecommonj.sdo.DataGraph
-
getChangeSummary
public commonj.sdo.ChangeSummary getChangeSummary()- Specified by:
getChangeSummary
in interfacecommonj.sdo.DataGraph
-
getType
- Specified by:
getType
in interfacecommonj.sdo.DataGraph
-
getRootObject
public commonj.sdo.DataObject getRootObject()- Specified by:
getRootObject
in interfacecommonj.sdo.DataGraph
-
writeXML
Serialize a ProDataGraph in XML- Parameters:
fileName
-- Throws:
IOException
- Writes the ProDataGraph's data into a temp file. Then creates the file specified by fileName and merges into it the contents of the temp file along with the schemaProDataException
-
writeXML
Serialize a ProDataGraph into XML and sends output to StringBuilder.- Throws:
ProDataException
IOException
-
readXMLUnsafe
public void readXMLUnsafe(String fileName) throws FileNotFoundException, ProDataException, IOException readXMLUnsafe() copies data from file into a temp file. This is so that we can comment out the schema element after we read it. We do this because SDOUtil.loadDataGraph() throws an exception when it encounters the schema element. This perform an unsafe read of the XML document potentially exposing the user to exploits. This allows external DTD and external schema. Don't use this, this is here as a backdoor in case you absolutely are relying on external schema elements. -
readXML
readXML() copies data from file into a temp file. This is so that we can comment out the schema element after we read it. We do this because SDOUtil.loadDataGraph() throws an exception when it encounters the schema element. -
readExternal
Deserialize a ProDataGraph- Specified by:
readExternal
in interfaceExternalizable
- Parameters:
in
-- Throws:
IOException
-
readFromStream
Populate a datagraph from a stream This method is used by BPM- Parameters:
stream
-- Throws:
IOException
-
writeExternal
Serialize a ProDataGraph- Specified by:
writeExternal
in interfaceExternalizable
- Parameters:
out
-- Throws:
IOException
-
writeToStream
Write a representation of the dataset to a stream This method is used by BPM- Parameters:
stream
-- Throws:
IOException
-