use of com.salesforce.soap.partner.DescribeLayout in project tdi-studio-se by Talend.
the class PartnerSamples method describeLayoutSample.
private void describeLayoutSample() {
if (!loggedIn) {
if (!login()) {
return;
}
}
String objectToDescribe = getUserInput("Enter the name of an object to describe the layout of: ");
try {
DescribeLayoutResult dlr = binding.describeLayout(objectToDescribe, null);
System.out.println("There are " + dlr.getLayouts().length + " layouts for the " + objectToDescribe + " object.");
for (int i = 0; i < dlr.getLayouts().length; i++) {
DescribeLayout layout = dlr.getLayouts(i);
System.out.println(" There are " + layout.getDetailLayoutSections().length + " detail layout sections");
for (int j = 0; j < layout.getDetailLayoutSections().length; j++) {
DescribeLayoutSection dls = layout.getDetailLayoutSections(j);
System.out.println(new Integer(j).toString() + " This section has a heading of " + dls.getHeading());
}
if (layout.getEditLayoutSections() != null) {
System.out.println(" There are " + layout.getEditLayoutSections().length + " edit layout sections");
for (int j = 0; j < layout.getEditLayoutSections().length; j++) {
DescribeLayoutSection els = layout.getEditLayoutSections(j);
System.out.println(new Integer(j).toString() + " This section has a heading of " + els.getHeading());
System.out.println("This section has " + els.getLayoutRows().length + " layout rows.");
for (int k = 0; k < els.getLayoutRows().length; k++) {
DescribeLayoutRow lr = els.getLayoutRows(k);
System.out.println(" This row has " + lr.getNumItems() + " items.");
for (int h = 0; h < lr.getLayoutItems().length; h++) {
DescribeLayoutItem li = lr.getLayoutItems(h);
if (li.getLayoutComponents() != null) {
System.out.println(" " + new Integer(h).toString() + " " + li.getLayoutComponents(0).getValue());
} else {
System.out.println(" " + new Integer(h).toString());
}
}
}
}
}
}
if (dlr.getRecordTypeMappings() != null) {
System.out.println("There are " + dlr.getRecordTypeMappings().length + " record type mappings for the " + objectToDescribe + " object");
} else {
System.out.println("There are not record type mappings for the " + objectToDescribe + " object.");
}
getUserInput("\nHit return to continue...");
} catch (ApiFault af) {
System.out.println("\nFailed to describe layout for: " + objectToDescribe + ", error message was: \n" + af.getExceptionMessage());
getUserInput("\nHit return to continue...");
} catch (Exception ex) {
System.out.println("\nFailed to describe layout for: " + objectToDescribe + ", error message was: \n" + ex.getMessage());
getUserInput("\nHit return to continue...");
}
}
Aggregations