@Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { List<DescribeSObjectResult> filteredResult = new ArrayList<DescribeSObjectResult>(); for (DescribeSObjectResult dsr : dsrs) { // include => objectNames.contains(name) // exclude => !objectNames.contains(name) if (include == objectNames.contains(dsr.getName())) { filteredResult.add(dsr); } } return filteredResult; }
private void getRelationships(DescribeSObjectResult objectMetadata) { ChildRelationship[] children = objectMetadata.getChildRelationships(); if(children != null && children.length > 0) { this.relationships.put(objectMetadata.getName(), children); } }
@Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { for (DescribeSObjectResult dsr : dsrs) { objectMap.put(dsr.getName(), dsr); } filterObjectAndReferences(objectNames); return filteredResult; }
/** * Constructs a valid Java name from a Force.com {@code DescribeSObjectResult} object name. * * @param dsr a Force.com {@code DescribeSObjectResult} object whose name is to * to converted to a Java name * @param firstCharLowerCase indicates if the first character in the constructed Java * name should be lower case * @return a non {@code null} {@code String} which conforms * to Java naming standards */ public static String renderJavaName(DescribeSObjectResult dsr, boolean firstCharLowerCase) { return renderJavaName(dsr.getName(), "Entity", firstCharLowerCase); }
private void filterObjectAndReferences(Set<String> objectNameSet) { // Subtract any objects that we've already fetched objectNameSet.removeAll(filteredResultNames); if (objectNameSet.isEmpty()) return; Set<String> objectReferencesSet = new HashSet<String>(); for (String objectName : objectNameSet) { DescribeSObjectResult dsr; if ((dsr = objectMap.get(objectName)) != null) { // Gather all the references for this object for (Field field : dsr.getFields()) { if (field.getType() == FieldType.reference) { objectReferencesSet.addAll(Arrays.asList(field.getReferenceTo())); } } filteredResultNames.add(dsr.getName()); filteredResult.add(dsr); } } // Here, we'll recursively fetch all the object references we found. filterObjectAndReferences(objectReferencesSet); } }
private String renderClassAnnotation(DescribeSObjectResult dsr) { JPAAnnotationBuilder builder = new JPAAnnotationBuilder(0 /*numIndents*/); builder.add(Generated.class, Collections.<String, String>singletonMap("value", "\"" + ForceJPAClassGenerator.class.getName() + "\"")); builder.add(Table.class, Collections.<String, String>singletonMap("name", "\"" + dsr.getName() + "\"")); builder.add(Entity.class, Collections.<String, String>singletonMap("name", "\"" + toString(dsr, "className") + "\"")); // We're generating the class off of already existing schema // so there won't be a need to create it. builder.add(CustomObject.class, Collections.<String, String>singletonMap("readOnlySchema", "true")); return builder.toString(); }
private void getColumnsAndRelationships(List<String> names) throws TranslatorException { DescribeSObjectResult objectMetadatas[] = connection.getObjectMetaData(names.toArray(new String[names.size()])); for (DescribeSObjectResult objectMetadata : objectMetadatas) { getRelationships(objectMetadata); Table table = this.tableMap.get(objectMetadata.getName()); boolean hasUpdateableColumn = addColumns(objectMetadata, table); // Some SF objects return true for isUpdateable() but have no updateable columns. if(objectMetadata.isDeletable() || (hasUpdateableColumn && (objectMetadata.isUpdateable() || objectMetadata.isCreateable()))) { table.setSupportsUpdate(true); } } names.clear(); }
this.layoutable == other.isLayoutable() && this.mergeable == other.isMergeable() && ((this.name == null && other.getName() == null) || (this.name != null && this.name.equals(other.getName()))) && this.queryable == other.isQueryable() && ((this.recordTypeInfos == null && other.getRecordTypeInfos() == null) ||
return Schema.createRecord(in.getName(), null, null, false, fields);
return Schema.createRecord(in.getName(), null, null, false, fields);
return Schema.createRecord(in.getName(), null, null, false, fields);
return Schema.createRecord(in.getName(), null, null, false, fields);
return Schema.createRecord(in.getName(), null, null, false, fields);