Page about Mapping Link
Below are some sample java code to generate links connection.
This snippets work with the sample LinkExpression class from the Design API Sdk Sample.
// From the linkFields
Vector<Field> linkFields = getLinkFields();
PortLinkContext portLinkContext = PortLinkContextFactory.getPortLinkContextByPosition( linkFields );
InputSet linkInputSet = new InputSet( dsqRS, portLinkContext );
// Work only if all ports are present in the two sides (for all port, no filter)
Vector<Field> linkFields = getLinkFields();
PortLinkContext portLinkContext = PortLinkContextFactory.getPortLinkContextByName(linkFields);
InputSet linkInputSet = new InputSet( dsqRS, portLinkContext );
Vector<Field> linkFields = getLinkFields();
Map<Field, Field> linkMap = new LinkedHashMap<Field, Field>();
System.out.println("LinkMap:");
Iterator<Field> myOutPutFieldIterartor = linkFields.iterator();
while (myOutPutFieldIterartor.hasNext()) {
Field ToField = myOutPutFieldIterartor.next();
System.out.print(" - ToField:"+ToField.getName());
Field FromField = dsqRS.getField(ToField.getName());
System.out.println(" -> FromField:"+FromField.getName());
linkMap.put(FromField,ToField);
}
PortLinkContext portLinkContext = PortLinkContextFactory.getPortLinkContextByMap(linkMap);
InputSet linkInputSet = new InputSet( dsqRS, portLinkContext );
// excluded fields
String[] arrCols = {"BirthDate", "TitelOfCourtesy", "HireDate", "Address", "City", "Region", "PostalCode"};
PortPropagationContext myPortPropagationContext =
PortPropagationContextFactory.getContextForExcludeColsFromAll(arrCols);
InputSet linkInputSet = new InputSet( dsqRS, myPortPropagationContext );