@ -17,384 +17,389 @@ import com.beanit.iec61850bean.internal.mms.asn1.AlternateAccessSelection;
import com.beanit.iec61850bean.internal.mms.asn1.ObjectName ;
import com.beanit.iec61850bean.internal.mms.asn1.ObjectName.DomainSpecific ;
import com.beanit.iec61850bean.internal.mms.asn1.VariableDefs ;
import java.util.ArrayList ;
import java.util.Collection ;
import java.util.HashMap ;
import java.util.Iterator ;
import java.util.LinkedHashMap ;
import java.util.List ;
import java.util.Map ;
import java.util.* ;
public final class ServerModel extends ModelNode {
private final Map < String , DataSet > dataSets = new LinkedHashMap < > ( ) ;
private final Map < String , DataSet > dataSets = new LinkedHashMap < > ( ) ;
private final Map < String , Urcb > urcbs = new HashMap < > ( ) ;
private final Map < String , Brcb > brcbs = new HashMap < > ( ) ;
private final Map < String , Urcb > urcbs = new HashMap < > ( ) ;
private final Map < String , Brcb > brcbs = new HashMap < > ( ) ;
public ServerModel ( List < LogicalDevice > logicalDevices , Collection < DataSet > dataSets ) {
children = new LinkedHashMap < > ( ) ;
objectReference = null ;
for ( LogicalDevice logicalDevice : logicalDevices ) {
children . put ( logicalDevice . getReference ( ) . getName ( ) , logicalDevice ) ;
logicalDevice . setParent ( this ) ;
}
private ConnectionParam connectionParam ;
if ( dataSets ! = null ) {
addDataSets ( dataSets ) ;
}
public ServerModel ( List < LogicalDevice > logicalDevices , Collection < DataSet > dataSets ) {
children = new LinkedHashMap < > ( ) ;
objectReference = null ;
for ( LogicalDevice logicalDevice : logicalDevices ) {
children . put ( logicalDevice . getReference ( ) . getName ( ) , logicalDevice ) ;
logicalDevice . setParent ( this ) ;
}
for ( LogicalDevice ld : logicalDevices ) {
for ( ModelNode ln : ld . getChildren ( ) ) {
for ( Urcb urcb : ( ( LogicalNode ) ln ) . getUrcbs ( ) ) {
urcbs . put ( urcb . getReference ( ) . toString ( ) , urcb ) ;
urcb . dataSet = getDataSet ( urcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
if ( dataSets ! = null ) {
addDataSets ( dataSets ) ;
}
for ( Brcb brcb : ( ( LogicalNode ) ln ) . getBrcbs ( ) ) {
brcbs . put ( brcb . getReference ( ) . toString ( ) , brcb ) ;
brcb . dataSet = getDataSet ( brcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
for ( LogicalDevice ld : logicalDevices ) {
for ( ModelNode ln : ld . getChildren ( ) ) {
for ( Urcb urcb : ( ( LogicalNode ) ln ) . getUrcbs ( ) ) {
urcbs . put ( urcb . getReference ( ) . toString ( ) , urcb ) ;
urcb . dataSet = getDataSet ( urcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
}
for ( Brcb brcb : ( ( LogicalNode ) ln ) . getBrcbs ( ) ) {
brcbs . put ( brcb . getReference ( ) . toString ( ) , brcb ) ;
brcb . dataSet = getDataSet ( brcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
}
}
}
}
}
}
@Override
public ServerModel copy ( ) {
List < LogicalDevice > childCopies = new ArrayList < > ( children . size ( ) ) ;
for ( ModelNode childNode : children . values ( ) ) {
childCopies . add ( ( LogicalDevice ) childNode . copy ( ) ) ;
@Override
public ServerModel copy ( ) {
List < LogicalDevice > childCopies = new ArrayList < > ( children . size ( ) ) ;
for ( ModelNode childNode : children . values ( ) ) {
childCopies . add ( ( LogicalDevice ) childNode . copy ( ) ) ;
}
List < DataSet > dataSetCopies = new ArrayList < > ( dataSets . size ( ) ) ;
for ( DataSet dataSet : dataSets . values ( ) ) {
dataSetCopies . add ( dataSet ) ;
}
return new ServerModel ( childCopies , dataSetCopies ) ;
}
List < DataSet > dataSetCopies = new ArrayList < > ( dataSets . size ( ) ) ;
for ( DataSet dataSet : dataSets . values ( ) ) {
dataSetCopies . add ( dataSet ) ;
/ * *
* Get the data set with the given reference . Return null if none is found .
*
* @param reference the reference of the requested data set .
* @return the data set with the given reference .
* /
public DataSet getDataSet ( String reference ) {
return dataSets . get ( reference ) ;
}
return new ServerModel ( childCopies , dataSetCopies ) ;
}
/ * *
* Get the data set with the given reference . Return null if none is found .
*
* @param reference the reference of the requested data set .
* @return the data set with the given reference .
* /
public DataSet getDataSet ( String reference ) {
return dataSets . get ( reference ) ;
}
void addDataSet ( DataSet dataSet ) {
dataSets . put ( dataSet . getReferenceStr ( ) . replace ( '$' , '.' ) , dataSet ) ;
for ( ModelNode ld : children . values ( ) ) {
for ( ModelNode ln : ld . getChildren ( ) ) {
for ( Urcb urcb : ( ( LogicalNode ) ln ) . getUrcbs ( ) ) {
urcb . dataSet = getDataSet ( urcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
void addDataSet ( DataSet dataSet ) {
dataSets . put ( dataSet . getReferenceStr ( ) . replace ( '$' , '.' ) , dataSet ) ;
for ( ModelNode ld : children . values ( ) ) {
for ( ModelNode ln : ld . getChildren ( ) ) {
for ( Urcb urcb : ( ( LogicalNode ) ln ) . getUrcbs ( ) ) {
urcb . dataSet = getDataSet ( urcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
}
for ( Brcb brcb : ( ( LogicalNode ) ln ) . getBrcbs ( ) ) {
brcb . dataSet = getDataSet ( brcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
}
}
}
for ( Brcb brcb : ( ( LogicalNode ) ln ) . getBrcbs ( ) ) {
brcb . dataSet = getDataSet ( brcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
}
}
}
}
void addDataSets ( Collection < DataSet > dataSets ) {
for ( DataSet dataSet : dataSets ) {
addDataSet ( dataSet ) ;
}
for ( ModelNode ld : children . values ( ) ) {
for ( ModelNode ln : ld . getChildren ( ) ) {
for ( Urcb urcb : ( ( LogicalNode ) ln ) . getUrcbs ( ) ) {
urcb . dataSet = getDataSet ( urcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
void addDataSets ( Collection < DataSet > dataSets ) {
for ( DataSet dataSet : dataSets ) {
addDataSet ( dataSet ) ;
}
for ( Brcb brcb : ( ( LogicalNode ) ln ) . getBrcbs ( ) ) {
brcb . dataSet = getDataSet ( brcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
for ( ModelNode ld : children . values ( ) ) {
for ( ModelNode ln : ld . getChildren ( ) ) {
for ( Urcb urcb : ( ( LogicalNode ) ln ) . getUrcbs ( ) ) {
urcb . dataSet = getDataSet ( urcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
}
for ( Brcb brcb : ( ( LogicalNode ) ln ) . getBrcbs ( ) ) {
brcb . dataSet = getDataSet ( brcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
}
}
}
}
}
}
List < String > getDataSetNames ( String ldName ) {
// TODO make thread save
List < String > dataSetNames = new ArrayList < > ( ) ;
for ( String dataSetRef : dataSets . keySet ( ) ) {
if ( dataSetRef . startsWith ( ldName ) ) {
dataSetNames . add ( dataSetRef . substring ( dataSetRef . indexOf ( '/' ) + 1 ) . replace ( '.' , '$' ) ) ;
}
List < String > getDataSetNames ( String ldName ) {
// TODO make thread save
List < String > dataSetNames = new ArrayList < > ( ) ;
for ( String dataSetRef : dataSets . keySet ( ) ) {
if ( dataSetRef . startsWith ( ldName ) ) {
dataSetNames . add ( dataSetRef . substring ( dataSetRef . indexOf ( '/' ) + 1 ) . replace ( '.' , '$' ) ) ;
}
}
return dataSetNames ;
}
return dataSetNames ;
}
/ * *
* Get a collection of all data sets that exist in this model .
*
* @return a collection of all data sets
* /
public Collection < DataSet > getDataSets ( ) {
return dataSets . values ( ) ;
}
/ * *
* @param dataSetReference the data set reference
* @return returns the DataSet that was removed , null if no DataSet with the given reference was
* found or the data set is not deletable .
* /
DataSet removeDataSet ( String dataSetReference ) {
DataSet dataSet = dataSets . get ( dataSetReference ) ;
if ( dataSet = = null | | ! dataSet . isDeletable ( ) ) {
return null ;
/ * *
* Get a collection of all data sets that exist in this model .
*
* @return a collection of all data sets
* /
public Collection < DataSet > getDataSets ( ) {
return dataSets . values ( ) ;
}
DataSet removedDataSet = dataSets . remove ( dataSetReference ) ;
for ( ModelNode ld : children . values ( ) ) {
for ( ModelNode ln : ld . getChildren ( ) ) {
for ( Urcb urcb : ( ( LogicalNode ) ln ) . getUrcbs ( ) ) {
urcb . dataSet = getDataSet ( urcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
/ * *
* @param dataSetReference the data set reference
* @return returns the DataSet that was removed , null if no DataSet with the given reference was
* found or the data set is not deletable .
* /
DataSet removeDataSet ( String dataSetReference ) {
DataSet dataSet = dataSets . get ( dataSetReference ) ;
if ( dataSet = = null | | ! dataSet . isDeletable ( ) ) {
return null ;
}
for ( Brcb brcb : ( ( LogicalNode ) ln ) . getBrcbs ( ) ) {
brcb . dataSet = getDataSet ( brcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
DataSet removedDataSet = dataSets . remove ( dataSetReference ) ;
for ( ModelNode ld : children . values ( ) ) {
for ( ModelNode ln : ld . getChildren ( ) ) {
for ( Urcb urcb : ( ( LogicalNode ) ln ) . getUrcbs ( ) ) {
urcb . dataSet = getDataSet ( urcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
}
for ( Brcb brcb : ( ( LogicalNode ) ln ) . getBrcbs ( ) ) {
brcb . dataSet = getDataSet ( brcb . getDatSet ( ) . getStringValue ( ) . replace ( '$' , '.' ) ) ;
}
}
}
}
}
return removedDataSet ;
}
void addUrcb ( Urcb urcb ) {
urcbs . put ( urcb . getReference ( ) . getName ( ) , urcb ) ;
}
/ * *
* Get the unbuffered report control block ( URCB ) with the given reference .
*
* @param reference the reference of the requested URCB .
* @return the reference to the requested URCB or null if none with the given reference is found .
* /
public Urcb getUrcb ( String reference ) {
return urcbs . get ( reference ) ;
}
/ * *
* Get a collection of all unbuffered report control blocks ( URCB ) that exist in this model .
*
* @return a collection of all unbuffered report control blocks ( URCB )
* /
public Collection < Urcb > getUrcbs ( ) {
return urcbs . values ( ) ;
}
/ * *
* Get the buffered report control block ( BRCB ) with the given reference .
*
* @param reference the reference of the requested BRCB .
* @return the reference to the requested BRCB or null if none with the given reference is found .
* /
public Brcb getBrcb ( String reference ) {
return brcbs . get ( reference ) ;
}
/ * *
* Get a collection of all buffered report control blocks ( BRCB ) that exist in this model .
*
* @return a collection of all buffered report control blocks ( BRCB )
* /
public Collection < Brcb > getBrcbs ( ) {
return brcbs . values ( ) ;
}
@Override
public String toString ( ) {
StringBuilder sb = new StringBuilder ( ) ;
for ( ModelNode logicalDevice : children . values ( ) ) {
sb . append ( logicalDevice . toString ( ) ) ;
return removedDataSet ;
}
sb . append ( "\n\n\n---------------------\nURCBs:" ) ;
for ( Urcb urcb : getUrcbs ( ) ) {
sb . append ( "\n\n" ) . append ( urcb ) ;
void addUrcb ( Urcb urcb ) {
urcbs . put ( urcb . getReference ( ) . getName ( ) , urcb ) ;
}
sb . append ( "\n\n\n---------------------\nBRCBs:" ) ;
for ( Brcb brcb : getBrcbs ( ) ) {
sb . append ( "\n\n" ) . append ( brcb ) ;
/ * *
* Get the unbuffered report control block ( URCB ) with the given reference .
*
* @param reference the reference of the requested URCB .
* @return the reference to the requested URCB or null if none with the given reference is found .
* /
public Urcb getUrcb ( String reference ) {
return urcbs . get ( reference ) ;
}
sb . append ( "\n\n\n---------------------\nData sets:" ) ;
for ( DataSet dataSet : getDataSets ( ) ) {
sb . append ( "\n\n" ) . append ( dataSet ) ;
/ * *
* Get a collection of all unbuffered report control blocks ( URCB ) that exist in this model .
*
* @return a collection of all unbuffered report control blocks ( URCB )
* /
public Collection < Urcb > getUrcbs ( ) {
return urcbs . values ( ) ;
}
return sb . toString ( ) ;
}
/ * *
* Searches and returns the model node with the given object reference and FC . If searching for
* Logical Devices and Logical Nodes the given fc parameter may be < code > null < / code > .
*
* @param objectReference the object reference of the node that is being searched for . It has a
* syntax like "ldname/ln.do...." .
* @param fc the functional constraint of the requested model node . May be null for Logical Device
* and Logical Node references .
* @return the model node if it was found or null otherwise
* /
public ModelNode findModelNode ( ObjectReference objectReference , Fc fc ) {
ModelNode currentNode = this ;
Iterator < String > searchedNodeReferenceIterator = objectReference . iterator ( ) ;
while ( searchedNodeReferenceIterator . hasNext ( ) ) {
currentNode = currentNode . getChild ( searchedNodeReferenceIterator . next ( ) , fc ) ;
if ( currentNode = = null ) {
return null ;
}
/ * *
* Get the buffered report control block ( BRCB ) with the given reference .
*
* @param reference the reference of the requested BRCB .
* @return the reference to the requested BRCB or null if none with the given reference is found .
* /
public Brcb getBrcb ( String reference ) {
return brcbs . get ( reference ) ;
}
return currentNode ;
}
/ * *
* Searches and returns the model node with the given object reference and FC . If searching for
* Logical Devices and Logical Nodes the given fc parameter may be < code > null < / code > .
*
* @param objectReference the object reference of the node that is being searched for . It has a
* syntax like "ldname/ln.do...." .
* @param fc the functional constraint of the requested model node . May be null for Logical Device
* and Logical Node references .
* @return the model node if it was found or null otherwise
* /
public ModelNode findModelNode ( String objectReference , Fc fc ) {
return findModelNode ( new ObjectReference ( objectReference ) , fc ) ;
}
/ * *
* Returns the subModelNode that is referenced by the given VariableDef . Return null in case the
* referenced ModelNode is not found .
*
* @param variableDef the variableDef
* @return the subModelNode that is referenced by the given VariableDef
* @throws ServiceError if an error occurs
* /
FcModelNode getNodeFromVariableDef ( VariableDefs . SEQUENCE variableDef ) throws ServiceError {
ObjectName objectName = variableDef . getVariableSpecification ( ) . getName ( ) ;
if ( objectName = = null ) {
throw new ServiceError (
ServiceError . FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT ,
"name in objectName is not selected" ) ;
/ * *
* Get a collection of all buffered report control blocks ( BRCB ) that exist in this model .
*
* @return a collection of all buffered report control blocks ( BRCB )
* /
public Collection < Brcb > getBrcbs ( ) {
return brcbs . values ( ) ;
}
DomainSpecific domainSpecific = objectName . getDomainSpecific ( ) ;
@Override
public String toString ( ) {
StringBuilder sb = new StringBuilder ( ) ;
for ( ModelNode logicalDevice : children . values ( ) ) {
sb . append ( logicalDevice . toString ( ) ) ;
}
sb . append ( "\n\n\n---------------------\nURCBs:" ) ;
for ( Urcb urcb : getUrcbs ( ) ) {
sb . append ( "\n\n" ) . append ( urcb ) ;
}
if ( domainSpecific = = null ) {
throw new ServiceError (
ServiceError . FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT ,
"domain_specific in name is not selected" ) ;
}
sb . append ( "\n\n\n---------------------\nBRCBs:" ) ;
for ( Brcb brcb : getBrcbs ( ) ) {
sb . append ( "\n\n" ) . append ( brcb ) ;
}
ModelNode modelNode = getChild ( domainSpecific . getDomainID ( ) . toString ( ) ) ;
sb . append ( "\n\n\n---------------------\nData sets:" ) ;
for ( DataSet dataSet : getDataSets ( ) ) {
sb . append ( "\n\n" ) . append ( dataSet ) ;
}
if ( modelNode = = null ) {
return null ;
return sb . toString ( ) ;
}
String mmsItemId = domainSpecific . getItemID ( ) . toString ( ) ;
int index1 = mmsItemId . indexOf ( '$' ) ;
/ * *
* Searches and returns the model node with the given object reference and FC . If searching for
* Logical Devices and Logical Nodes the given fc parameter may be < code > null < / code > .
*
* @param objectReference the object reference of the node that is being searched for . It has a
* syntax like "ldname/ln.do...." .
* @param fc the functional constraint of the requested model node . May be null for Logical Device
* and Logical Node references .
* @return the model node if it was found or null otherwise
* /
public ModelNode findModelNode ( ObjectReference objectReference , Fc fc ) {
ModelNode currentNode = this ;
Iterator < String > searchedNodeReferenceIterator = objectReference . iterator ( ) ;
while ( searchedNodeReferenceIterator . hasNext ( ) ) {
currentNode = currentNode . getChild ( searchedNodeReferenceIterator . next ( ) , fc ) ;
if ( currentNode = = null ) {
return null ;
}
}
return currentNode ;
}
if ( index1 = = - 1 ) {
throw new ServiceError (
ServiceError . FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT ,
"invalid mms item id: " + domainSpecific . getItemID ( ) ) ;
/ * *
* Searches and returns the model node with the given object reference and FC . If searching for
* Logical Devices and Logical Nodes the given fc parameter may be < code > null < / code > .
*
* @param objectReference the object reference of the node that is being searched for . It has a
* syntax like "ldname/ln.do...." .
* @param fc the functional constraint of the requested model node . May be null for Logical Device
* and Logical Node references .
* @return the model node if it was found or null otherwise
* /
public ModelNode findModelNode ( String objectReference , Fc fc ) {
return findModelNode ( new ObjectReference ( objectReference ) , fc ) ;
}
LogicalNode ln = ( LogicalNode ) modelNode . getChild ( mmsItemId . substring ( 0 , index1 ) ) ;
/ * *
* Returns the subModelNode that is referenced by the given VariableDef . Return null in case the
* referenced ModelNode is not found .
*
* @param variableDef the variableDef
* @return the subModelNode that is referenced by the given VariableDef
* @throws ServiceError if an error occurs
* /
FcModelNode getNodeFromVariableDef ( VariableDefs . SEQUENCE variableDef ) throws ServiceError {
ObjectName objectName = variableDef . getVariableSpecification ( ) . getName ( ) ;
if ( objectName = = null ) {
throw new ServiceError (
ServiceError . FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT ,
"name in objectName is not selected" ) ;
}
if ( ln = = null ) {
return null ;
}
DomainSpecific domainSpecific = objectName . getDomainSpecific ( ) ;
if ( domainSpecific = = null ) {
throw new ServiceError (
ServiceError . FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT ,
"domain_specific in name is not selected" ) ;
}
int index2 = mmsItemId . indexOf ( '$' , index1 + 1 ) ;
ModelNode modelNode = getChild ( domainSpecific . getDomainID ( ) . toString ( ) ) ;
if ( index2 = = - 1 ) {
throw new ServiceError (
ServiceError . FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT , "invalid mms item id" ) ;
}
if ( modelNode = = null ) {
return null ;
}
Fc fc = Fc . fromString ( mmsItemId . substring ( index1 + 1 , index2 ) ) ;
String mmsItemId = domainSpecific . getItemID ( ) . toString ( ) ;
int index1 = mmsItemId . indexOf ( '$' ) ;
if ( fc = = null ) {
throw new ServiceError (
ServiceError . FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT ,
"unknown functional constraint: " + mmsItemId . substring ( index1 + 1 , index2 ) ) ;
}
if ( index1 = = - 1 ) {
throw new ServiceError (
ServiceError . FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT ,
"invalid mms item id: " + domainSpecific . getItemID ( ) ) ;
}
index1 = index2 ;
LogicalNode ln = ( LogicalNode ) modelNode . getChild ( mmsItemId . substring ( 0 , index1 ) ) ;
index2 = mmsItemId . indexOf ( '$' , index1 + 1 ) ;
if ( ln = = null ) {
return null ;
}
if ( index2 = = - 1 ) {
if ( fc = = Fc . RP ) {
return ln . getUrcb ( mmsItemId . substring ( index1 + 1 ) ) ;
}
if ( fc = = Fc . BR ) {
return ln . getBrcb ( mmsItemId . substring ( index1 + 1 ) ) ;
}
return ( FcModelNode ) ln . getChild ( mmsItemId . substring ( index1 + 1 ) , fc ) ;
}
int index2 = mmsItemId . indexOf ( '$' , index1 + 1 ) ;
if ( fc = = Fc . RP ) {
modelNode = ln . getUrcb ( mmsItemId . substring ( index1 + 1 , index2 ) ) ;
} else if ( fc = = Fc . BR ) {
modelNode = ln . getBrcb ( mmsItemId . substring ( index1 + 1 , index2 ) ) ;
} else {
modelNode = ln . getChild ( mmsItemId . substring ( index1 + 1 , index2 ) , fc ) ;
}
if ( index2 = = - 1 ) {
throw new ServiceError (
ServiceError . FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT , "invalid mms item id" ) ;
}
index1 = index2 ;
index2 = mmsItemId . indexOf ( '$' , index1 + 1 ) ;
while ( index2 ! = - 1 ) {
modelNode = modelNode . getChild ( mmsItemId . substring ( index1 + 1 , index2 ) ) ;
index1 = index2 ;
index2 = mmsItemId . indexOf ( '$' , index1 + 1 ) ;
}
Fc fc = Fc . fromString ( mmsItemId . substring ( index1 + 1 , index2 ) ) ;
modelNode = modelNode . getChild ( mmsItemId . substring ( index1 + 1 ) ) ;
if ( fc = = null ) {
throw new ServiceError (
ServiceError . FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT ,
"unknown functional constraint: " + mmsItemId . substring ( index1 + 1 , index2 ) ) ;
}
if ( variableDef . getAlternateAccess ( ) = = null ) {
// no array is in this node path
return ( FcModelNode ) modelNode ;
}
index1 = index2 ;
index2 = mmsItemId . indexOf ( '$' , index1 + 1 ) ;
if ( index2 = = - 1 ) {
if ( fc = = Fc . RP ) {
return ln . getUrcb ( mmsItemId . substring ( index1 + 1 ) ) ;
}
if ( fc = = Fc . BR ) {
return ln . getBrcb ( mmsItemId . substring ( index1 + 1 ) ) ;
}
return ( FcModelNode ) ln . getChild ( mmsItemId . substring ( index1 + 1 ) , fc ) ;
}
if ( fc = = Fc . RP ) {
modelNode = ln . getUrcb ( mmsItemId . substring ( index1 + 1 , index2 ) ) ;
} else if ( fc = = Fc . BR ) {
modelNode = ln . getBrcb ( mmsItemId . substring ( index1 + 1 , index2 ) ) ;
} else {
modelNode = ln . getChild ( mmsItemId . substring ( index1 + 1 , index2 ) , fc ) ;
}
AlternateAccessSelection altAccIt =
variableDef . getAlternateAccess ( ) . getCHOICE ( ) . get ( 0 ) . getUnnamed ( ) ;
if ( altAccIt . getSelectAlternateAccess ( ) ! = null ) {
// path to node below an array element
modelNode =
( ( Array ) modelNode )
. getChild (
altAccIt . getSelectAlternateAccess ( ) . getAccessSelection ( ) . getIndex ( ) . intValue ( ) ) ;
String mmsSubArrayItemId =
altAccIt
. getSelectAlternateAccess ( )
. getAlternateAccess ( )
. getCHOICE ( )
. get ( 0 )
. getUnnamed ( )
. getSelectAccess ( )
. getComponent ( )
. getBasic ( )
. toString ( ) ;
index1 = - 1 ;
index2 = mmsSubArrayItemId . indexOf ( '$' ) ;
while ( index2 ! = - 1 ) {
modelNode = modelNode . getChild ( mmsSubArrayItemId . substring ( index1 + 1 , index2 ) ) ;
index1 = index2 ;
index2 = mmsItemId . indexOf ( '$' , index1 + 1 ) ;
}
while ( index2 ! = - 1 ) {
modelNode = modelNode . getChild ( mmsItemId . substring ( index1 + 1 , index2 ) ) ;
index1 = index2 ;
index2 = mmsItemId . indexOf ( '$' , index1 + 1 ) ;
}
modelNode = modelNode . getChild ( mmsItemId . substring ( index1 + 1 ) ) ;
if ( variableDef . getAlternateAccess ( ) = = null ) {
// no array is in this node path
return ( FcModelNode ) modelNode ;
}
AlternateAccessSelection altAccIt =
variableDef . getAlternateAccess ( ) . getCHOICE ( ) . get ( 0 ) . getUnnamed ( ) ;
if ( altAccIt . getSelectAlternateAccess ( ) ! = null ) {
// path to node below an array element
modelNode =
( ( Array ) modelNode )
. getChild (
altAccIt . getSelectAlternateAccess ( ) . getAccessSelection ( ) . getIndex ( ) . intValue ( ) ) ;
String mmsSubArrayItemId =
altAccIt
. getSelectAlternateAccess ( )
. getAlternateAccess ( )
. getCHOICE ( )
. get ( 0 )
. getUnnamed ( )
. getSelectAccess ( )
. getComponent ( )
. getBasic ( )
. toString ( ) ;
index1 = - 1 ;
index2 = mmsSubArrayItemId . indexOf ( '$' ) ;
while ( index2 ! = - 1 ) {
modelNode = modelNode . getChild ( mmsSubArrayItemId . substring ( index1 + 1 , index2 ) ) ;
index1 = index2 ;
index2 = mmsItemId . indexOf ( '$' , index1 + 1 ) ;
}
return ( FcModelNode ) modelNode . getChild ( mmsSubArrayItemId . substring ( index1 + 1 ) ) ;
} else {
// path to an array element
return ( FcModelNode )
( ( Array ) modelNode ) . getChild ( altAccIt . getSelectAccess ( ) . getIndex ( ) . intValue ( ) ) ;
}
}
public ConnectionParam getConnectionParam ( ) {
return connectionParam ;
}
return ( FcModelNode ) modelNode . getChild ( mmsSubArrayItemId . substring ( index1 + 1 ) ) ;
} else {
// path to an array element
return ( FcModelNode )
( ( Array ) modelNode ) . getChild ( altAccIt . getSelectAccess ( ) . getIndex ( ) . intValue ( ) ) ;
public void setConnectionParam ( ConnectionParam connectionParam ) {
this . connectionParam = connectionParam ;
}
}
}
}