on 11-04-2013 9:01 PM
All,
I am working on dirapi program to read channel info into an excel. the program works fine. However I see that the password field is coming empty. I know this issue was there in PI 7.0 dirapi but my understanding was that this was fixed in PI 7.1 EHP1 and that we could read the pasword field as well.
any thoughts.
Thanks.
Earlier Version (7.1)
Password attributes are not returned in the Read response and must be supplied in the Change request in order for the password to be set in the channel.
New Version (7.1 EHP1 and above)
Password attributes are not returned in the Read response. But there is delta handling for password attributes in the Change request. This means the Directory API will ensure that existing passwords are kept even if the Change request does not supply any password values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hareesh,
One more question.. (Let me know if you would like me to starta seperate thread).
I have read all channel properties in the excel. My program also reads adapter specific , module specific parameters in name value pair in excel in each cell. for example:
file.sourceFileName::CHASE.txt
file.conversionParameters::Record_Number,INTERNAL_PRODUCT_CODE
file.conversionParameters::2,8
file.adapterStatus::active
and others
Now if I want to set this channel as inactive using dirapi change method...then do i need to read and feed all the downloaded parameters back for a change..or there are some manadatory/optional fields (like password) that are retained anyway.
Thanks.
Hareesh,
I am trying to read the following values from an excel to update the channel:
Can all of these properties be read into:
List<GenericPropertyType> properties = new ArrayList<GenericPropertyType>();
GenericPropertyType property = new GenericPropertyType();
or do I need to use a different method to read each of these values?
Thanks.
Have not really worked on it. But may be the below blog should help you.
Hi Vicky,
for AdapterSpecificAttribute:
List<GenericProperty> asa = cc.getAdapterSpecificAttribute();
for(int j=0;j<asa.size();j++)
{
String name = asa.get(j).getName().getValue();
String value = asa.get(j).getValue().getValue();
//add your logic to write name and value to excelsheet
}
for AdapterSpecificTableAttribute:
List<GenericPropertyTable> channeltablevalues = cc.getAdapterSpecificTableAttribute();
for(int j=0;j<channeltablevalues.size();j++)
{
String name = channeltablevalues.get(j).getName().getValue();
List<GenericTableRow> tablerows = channeltablevalues.get(j).getValueTableRow();
for(int k=0;k<tablerows.size();k++)
{
List<GenericTableRowTableCell> cells = tablerows.get(k).getValueTableCell();
for(int l=0;l<cells.size();l++)
{
String cellval = cells.get(l).getValue().getValue();
//write your logic here to wrtie this cellval to excelsheet
}
}
}
for ModuleProcess:
ModuleProcess mp = cc.getModuleProcess().getValue();
List<ProcessStep> modules = mp.getProcessStep();
for(int j=0;j<modules.size();j++)
{
String modulename = modules.get(j).getModuleName().getValue();
String modulekey = modules.get(j).getParameterGroupID().getValue();
//add your logic to wrtie module name and its key to excelsheet
List<ParameterGroup> allparameters = mp.getParameterGroup();
for(int l=0;l<allparameters.size();l++)
{
if(modulekey.equals(allparameters.get(l).getParameterGroupID().getValue()))
{
List<GenericPropertyRestricted> moduleparameters = allparameters.get(l).getParameter();
for(int k=0;k<moduleparameters.size();k++)
{
String moduleparametername = moduleparameters.get(k).getName().getValue();
String moduleparametervalue = moduleparameters.get(k).getValue().getValue();
//add your logic to write the module parameter names and values to excelsheet
}
break;
}
}
}
in all above, cc is CommunicationChannel object.
Hope it helps.
Thanks,
Anand
Hi Vicky,
will your program update adapter-specific-attributes or adapter-specific-table-attributes or module details of channel?
Keep in mind that even if you want to change just one attribute of a channel you have to pass all other attributes of that channel.
Also tell me know which excel api you are using Jxl or Apache POI.
Thanks,
Anand
will your program update adapter-specific-attributes or adapter-specific-table-attributes or module details of channel?
Do I have a choice? My understanding is that if I want to change even a single field in the channel no matter what field it is....i have to provide all the other details as well. Is my understanding correct.
Also I am using Apache POI.
I am using for AdapterSpecificAttribute:
property1.setName(row.getCell(c).getStringCellValue(a));
property1.setValue(row.getCell(c).getStringCellValue(b));
properties1.add(property1);
for (int j = 0; j < properties1.size(); j++)
{
channel.getAdapterSpecificAttribute().add(properties1.get(j));
}
How to read the ASTA from excel and update the channel?
List<GenericPropertyTableType> propTabs = new ArrayList<GenericPropertyTableType>();
GenericPropertyTableType propTab = new GenericPropertyTableType();
List<GenericTableRowType> propTabRows = new ArrayList<GenericTableRowType>();
GenericTableRowType propTabRow = new GenericTableRowType();
List<GenericTableRowTableCellType> propTabRowCells = new ArrayList<GenericTableRowTableCellType>();
GenericTableRowTableCellType propTabRowCell = new GenericTableRowTableCellType();
int numproperties =0;
while ( row.getCell(c)!= null && row.getCell(c).getStringCellValue().startsWith("ASTA:<Name>"))
{
int pos1 = row.getCell(c).getStringCellValue().indexOf("ASTA:<Name>");
pos1=pos1+ "ASTA:<Name>".length();
int pos2 = row.getCell(c).getStringCellValue().indexOf("</Name><ParamName>");
int pos3 = row.getCell(c).getStringCellValue().indexOf("</ParamName><ParamValue>");
int pos4 = row.getCell(c).getStringCellValue().indexOf("</ParamValue>");
System.out.println(row.getCell(c).getStringCellValue().substring(pos1, pos2));
pos2 = pos2+ "</Name><ParamName>".length();
System.out.println(row.getCell(c).getStringCellValue().substring(pos2, pos3));
pos3 = pos3+ "</ParamName><ParamValue>".length();
System.out.println(row.getCell(c).getStringCellValue().substring(pos3, pos4));
propTabRowCell.setColumnName(row.getCell(c).getStringCellValue().substring(pos2, pos3));
propTabRowCell.setValue(row.getCell(c).getStringCellValue().substring(pos3, pos4));
propTabRowCells.add(propTabRowCell);
propTabRow.getValueTableCell().set(numproperties+1, propTabRowCell);
numproperties++;
propTabRows.add(propTabRow);
propTab.setName(row.getCell(c).getStringCellValue().substring(pos1, pos2));
c++;
}
Here is how values are stored in Excel which I am trying to read.
cell 1 =
ASTA:<Name>file.conversionParameters</Name><ParamName>file.addConvParamName</ParamName><ParamValue>TrackingFFRecord.fieldNames</ParamValue> |
cell 2 =
ASTA:<Name>file.conversionParameters</Name><ParamName>file.addConvParamValue</ParamName><ParamValue>ProgramID,DocType,TradingPartnerID,BTTrackingNumber,</ParamValue> |
Now I am trying to read module parameters from excel and update the channels. My code is working fine...except for one small glitch. In my channel there are two 'ModuleKey' 'ParameterName' and 'ParameterValue' groups under 'Module Configuration' in channel. However when I execute the code below...only the last of the two groups gets created and the 1st group gets removed.
List<ParameterGroupType> PGTypes = new ArrayList<ParameterGroupType>();
ParameterGroupType PGType = new ParameterGroupType();
List<ProcessStepType> PSTypes = new ArrayList<ProcessStepType>();
ProcessStepType PSType = new ProcessStepType();
List<RestrictedGenericPropertyType> RGPTypes = new ArrayList<RestrictedGenericPropertyType>();
RestrictedGenericPropertyType RGPType = new RestrictedGenericPropertyType();
ModuleProcessType module = new ModuleProcessType();
int pgSize = 0;
while (row.getCell(c) != null && row.getCell(c).getStringCellValue().startsWith("MCPG:<PGName>"))
{
int pos1 = row.getCell(c).getStringCellValue().indexOf("MCPG:<PGName>") + "MCPG:<PGName>".length();
PGType.setParameterGroupID(row.getCell(c).getStringCellValue().substring(row.getCell(c).getStringCellValue().indexOf("</PGValue><PGID>")+"</PGValue><PGID>".length(),row.getCell(c).getStringCellValue().indexOf("</PGID>")));
RGPType.setName(row.getCell(c).getStringCellValue().substring(pos1,row.getCell(c).getStringCellValue().indexOf("</PGName><PGValue>")));
RGPType.setValue(row.getCell(c).getStringCellValue().substring(row.getCell(c).getStringCellValue().indexOf("</PGName><PGValue>")+"</PGName><PGValue>".length(),row.getCell(c).getStringCellValue().indexOf("</PGValue><PGID>")));
RGPTypes.add(RGPType);
PGType.getParameter().add(RGPTypes.get(pgSize));
PGTypes.add(PGType);
RGPType = new RestrictedGenericPropertyType();
PGType = new ParameterGroupType();
pgSize++;
c++;
}
for (int j = 0; j < PGTypes.size(); j++) {
module.getParameterGroup().add(PGTypes.get(j));
channel.setModuleProcess(module);
}
Please advice.
Now I am trying to read module parameters from excel and update the channels. My code is working fine...except for one small glitch. In my channel there are two 'ModuleKey' 'ParameterName' and 'ParameterValue' groups under 'Module Configuration' in channel. However when I execute the code below...only the last of the two groups gets created and the 1st group gets removed.
List<ParameterGroupType> PGTypes = new ArrayList<ParameterGroupType>();
ParameterGroupType PGType = new ParameterGroupType();
List<ProcessStepType> PSTypes = new ArrayList<ProcessStepType>();
ProcessStepType PSType = new ProcessStepType();
List<RestrictedGenericPropertyType> RGPTypes = new ArrayList<RestrictedGenericPropertyType>();
RestrictedGenericPropertyType RGPType = new RestrictedGenericPropertyType();
ModuleProcessType module = new ModuleProcessType();
int pgSize = 0;
while (row.getCell(c) != null && row.getCell(c).getStringCellValue().startsWith("MCPG:<PGName>"))
{
int pos1 = row.getCell(c).getStringCellValue().indexOf("MCPG:<PGName>") + "MCPG:<PGName>".length();
PGType.setParameterGroupID(row.getCell(c).getStringCellValue().substring(row.getCell(c).getStringCellValue().indexOf("</PGValue><PGID>")+"</PGValue><PGID>".length(),row.getCell(c).getStringCellValue().indexOf("</PGID>")));
RGPType.setName(row.getCell(c).getStringCellValue().substring(pos1,row.getCell(c).getStringCellValue().indexOf("</PGName><PGValue>")));
RGPType.setValue(row.getCell(c).getStringCellValue().substring(row.getCell(c).getStringCellValue().indexOf("</PGName><PGValue>")+"</PGName><PGValue>".length(),row.getCell(c).getStringCellValue().indexOf("</PGValue><PGID>")));
RGPTypes.add(RGPType);
PGType.getParameter().add(RGPTypes.get(pgSize));
PGTypes.add(PGType);
RGPType = new RestrictedGenericPropertyType();
PGType = new ParameterGroupType();
pgSize++;
c++;
}
for (int j = 0; j < PGTypes.size(); j++) {
module.getParameterGroup().add(PGTypes.get(j));
channel.setModuleProcess(module);
}
Please advice.
send an email to me at anand.dabrabad@gmail.com
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.