cancel
Showing results for 
Search instead for 
Did you mean: 

Dir API.... am able to read the channels in excel...But how to update the channels

Former Member
0 Kudos

All,

I have completed my program in NWDS to read all the channels in an excel...Now I want to take it a step further....how to update the channels...ie read from the excel and update the channels. More so...how to identify the mandatory fields that needs to be provided during the update process for each channel as their is a common method change() for all of them.

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Vicky,

There are no delta updates with the API, so you need to submit a complete object.  I handled this by reading the object first and then only changed the fields I wanted to change.  This way you don't have to worry about which fields are required.  Everything stays the same except for what you explicitly change.  You will need to convert the object to a RestrictedCommunicationChannel object since that's what CommunicationChannelCreateChangeIn expects.   I included a method below to help with this part.  There is, of course, more to it, but here are the basic steps:

CommunicationChannel cc = << object you read using the API >>

RestrictedCommunicationChannel rcc = createRestricted(cc);

CommunicationChannelCreateChangeIn createIn = new CommunicationChannelCreateChangeIn();

createIn.setChangeListID(changeList.getChangeListID().getChangeListID());        

createIn.getCommunicationChannel().add(rcc);

ConfigurationObjectModifyOut out = port.change(createIn);

public static RestrictedCommunicationChannel createRestricted(CommunicationChannel ch) {

      RestrictedCommunicationChannel rch = new RestrictedCommunicationChannel();

      rch.setAdapterEngineName(ch.getAdapterEngineName());

      rch.setAdapterMetadata(ch.getAdapterMetadata()); 

      RestrictedObjectAdministrativeData radmin = new RestrictedObjectAdministrativeData();

      //radmin.setFolderPathID(ch.getAdministrativeData().getFolderPathID());

      radmin.setResponsibleUserAccountID(ch.getAdministrativeData().getResponsibleUserAccountID());

      rch.setAdministrativeData(radmin);

      rch.setCommunicationChannelID(ch.getCommunicationChannelID());

      rch.setDirection(ch.getDirection());

      rch.setMasterLanguage(ch.getMasterLanguage());

      rch.setMessageProtocol(ch.getMessageProtocol());

      rch.setMessageProtocolVersion(ch.getMessageProtocolVersion());

      rch.setModuleProcess(ch.getModuleProcess());

      rch.setReceiverIdentifier(ch.getReceiverIdentifier());

      rch.setSenderIdentifier(ch.getSenderIdentifier());

      rch.setTransportProtocol(ch.getTransportProtocol());

      rch.setTransportProtocolVersion(ch.getTransportProtocolVersion());

      rch.getAdapterSpecificAttribute().addAll(ch.getAdapterSpecificAttribute());

      rch.getAdapterSpecificTableAttribute().addAll(ch.getAdapterSpecificTableAttribute());

      rch.getDescription().addAll(ch.getDescription());

      return rch;

}

Thanks,

-Russ

former_member184720
Active Contributor
0 Kudos

may be you can close this..

former_member184720
Active Contributor
0 Kudos