use of com.salesforce.soap.partner.DescribeGlobalSObjectResult in project tdi-studio-se by Talend.
the class SObjectsToSchema method generateSchema.
void generateSchema(String inputFileName, String outputFileName) throws IOException {
File inputFile = new File(inputFileName);
File outputFile = new File(outputFileName);
StringBuffer inputContent = new StringBuffer();
// StringBuffer deleteContent = new StringBuffer();
StringBuffer insertContent = new StringBuffer();
StringBuffer updateContent = new StringBuffer();
StringBuffer upsertContent = new StringBuffer();
DescribeGlobalResult describeGlobalResult = null;
describeGlobalResult = binding.describeGlobal();
DescribeGlobalSObjectResult[] sobjectResults = describeGlobalResult.getSobjects();
for (int i = 0; i < sobjectResults.length; i++) {
String moduleName = sobjectResults[i].getName();
DescribeSObjectResult descSObjectRslt;
descSObjectRslt = binding.describeSObject(moduleName);
if (descSObjectRslt != null) {
// Report object level information
if (!descSObjectRslt.isCustom()) {
// if (descSObjectRslt.isQueryable()) {
//mark
inputContent.append(generateInputTable(moduleName, descSObjectRslt));
// }
// if (descSObjectRslt.isCreateable()) {
insertContent.append(generateOutputTable(moduleName, descSObjectRslt, INSERT));
// }
// if (descSObjectRslt.isUpdateable()) {
updateContent.append(generateOutputTable(moduleName, descSObjectRslt, UPDATE));
// }
// if(descSObjectRslt.isUpdateable()&&descSObjectRslt.isCreateable()){
upsertContent.append(generateOutputTable(moduleName, descSObjectRslt, UPSERT));
// }
// if (descSObjectRslt.isDeletable()) {
//
// }
}
}
}
BufferedWriter inOutput = new BufferedWriter(new FileWriter(inputFile));
inOutput.write(inputContent.toString());
inOutput.close();
String sepLint = "<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->";
BufferedWriter OuOutput = new BufferedWriter(new FileWriter(outputFile));
OuOutput.write(insertContent.toString() + "\r\n" + sepLint + "\r\n" + updateContent.toString() + "\r\n" + sepLint + "\r\n" + upsertContent.toString());
OuOutput.close();
}
use of com.salesforce.soap.partner.DescribeGlobalSObjectResult in project tdi-studio-se by Talend.
the class SObjectsToSchema method generateModuleName.
private void generateModuleName(String fileName) throws IOException {
File f = new File(fileName);
StringBuffer content = new StringBuffer();
DescribeGlobalResult describeGlobalResult = null;
describeGlobalResult = binding.describeGlobal();
DescribeGlobalSObjectResult[] sobjectResults = describeGlobalResult.getSobjects();
for (int i = 0; i < sobjectResults.length; i++) {
if (!sobjectResults[i].isCustom()) {
String moduleName = sobjectResults[i].getName();
// System.out.println(sobjectResults[i].getName());
content.append("<ITEM NAME=\"");
content.append(moduleName);
content.append("\" VALUE=\"");
content.append(moduleName);
content.append("\" />");
content.append("\r\n");
}
}
BufferedWriter output = new BufferedWriter(new FileWriter(f));
output.write(content.toString());
output.close();
}
Aggregations