com.microsoft.bingads.v13.internal.bulk.EntityExtractor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of microsoft.bingads Show documentation
Show all versions of microsoft.bingads Show documentation
The Bing Ads Java SDK is a library improving developer experience when working with the Bing Ads services by providing high-level access to features such as Bulk API, OAuth Authorization and SOAP API.
package com.microsoft.bingads.v13.internal.bulk;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.microsoft.bingads.v13.bulk.entities.BulkEntity;
import com.microsoft.bingads.v13.internal.bulk.entities.MultiRecordBulkEntity;
class EntityExtractor {
/**
* Reserved for internal use.
* @param entity
* @return
*/
public static Iterator extractChildEntitiesIfNeeded(BulkEntity entity) {
MultiRecordBulkEntity multirecordEntity = null;
if (MultiRecordBulkEntity.class.isInstance(entity)) {
multirecordEntity = MultiRecordBulkEntity.class.cast(entity);
}
// If the entity is a multiline entity and it has all child objects (delete all row was present), just return it
if (multirecordEntity == null || multirecordEntity.allChildrenPresent()) {
List entities = new ArrayList();
entities.add(entity);
return entities.iterator();
} else {
// If not all child objects are present (there was no delete all row and we only have part of the multiline entity), return child object individually
return new ExtractChildEntitiesIterator(multirecordEntity.getChildEntities().iterator());
}
}
}