SUMMARY: It is possible to extract only the ID Attribute elements for a particular attribute even if that attribute form is not configured to be a display form. In the same code the user will need to changes the ID of the Attribute to be retrieved. The following sample code assumes that a connection has already been created.
try {
WebObjectSource webObjectSource = webIServerSession.getFactory().getObjectSource();
WebElementSource webElementSource = webIServerSession.getFactory().getElementSourceObject();
WebAttribute webAttribute = (WebAttribute)webObjectSource.getObject("8D679D4B11D3E4981000E787EC6DE8A4",EnumDSSXMLObjectTypes.DssXmlTypeAttribute,true);
WebAttributeForms webAttributeForms = webAttribute.getForms();
WebAttributeForm webAttributeForm = null;
String attributesXML = "";
for (int x= 0 ; x < webAttributeForms.size(); x++){
webAttributeForm = webAttributeForms.get(x);
if(webAttributeForm.getUseName().equals("ID"))
attributesXML += "<oi did=\"" + webAttributeForm.getID() + "\"/>";
}
attributesXML = "<fct>" + attributesXML + "</fct>";
webElementSource.setObject(webAttribute);
webElementSource.setAttributeFormsXML(attributesXML);
WebElements webElements = webElementSource.getElements();
Enumeration enumeration = webElements.elements();
while(enumeration.hasMoreElements()){
System.out.println(((WebElement)enumeration.nextElement()).getDisplayName());
}
}catch(Exception e){
e.printStackTrace();
}