in src/main/java/com/aliyun/oss/internal/ResponseParsers.java [3287:3385]
private static InventoryConfiguration parseInventoryConfigurationElem(Element configElem) {
InventoryConfiguration inventoryConfiguration = new InventoryConfiguration();
if (configElem.getChildText("Id") != null) {
inventoryConfiguration.setInventoryId(configElem.getChildText("Id"));
}
if (configElem.getChildText("IncludedObjectVersions") != null) {
inventoryConfiguration.setIncludedObjectVersions(configElem.getChildText("IncludedObjectVersions"));
}
if (configElem.getChildText("IsEnabled") != null) {
inventoryConfiguration.setEnabled(Boolean.valueOf(configElem.getChildText("IsEnabled")));
}
if (configElem.getChild("Filter") != null) {
Element elem = configElem.getChild("Filter");
InventoryFilter filter = new InventoryFilter();
if (elem.getChildText("Prefix") != null) {
filter = new InventoryFilter().withPrefix(elem.getChildText("Prefix"));
}
if (elem.getChildText("LastModifyBeginTimeStamp") != null) {
filter.setLastModifyBeginTimeStamp(Long.valueOf(elem.getChildText("LastModifyBeginTimeStamp")));
}
if (elem.getChildText("LastModifyEndTimeStamp") != null) {
filter.setLastModifyEndTimeStamp(Long.valueOf(elem.getChildText("LastModifyEndTimeStamp")));
}
if (elem.getChildText("LowerSizeBound") != null) {
filter.setLowerSizeBound(Long.valueOf(elem.getChildText("LowerSizeBound")));
}
if (elem.getChildText("UpperSizeBound") != null) {
filter.setUpperSizeBound(Long.valueOf(elem.getChildText("UpperSizeBound")));
}
if (elem.getChildText("StorageClass") != null) {
filter.setStorageClass(elem.getChildText("StorageClass"));
}
inventoryConfiguration.setInventoryFilter(filter);
}
if (configElem.getChild("Schedule") != null) {
InventorySchedule schedule = new InventorySchedule();
Element elem = configElem.getChild("Schedule");
if (elem.getChild("Frequency") != null) {
schedule.setFrequency(elem.getChildText("Frequency"));
inventoryConfiguration.setSchedule(schedule);
}
}
if (configElem.getChild("OptionalFields") != null) {
Element OptionalFieldsElem = configElem.getChild("OptionalFields");
List<String> optionalFields = new ArrayList<String>();
List<Element> fieldElems = OptionalFieldsElem.getChildren("Field");
for (Element e : fieldElems) {
optionalFields.add(e.getText());
}
inventoryConfiguration.setOptionalFields(optionalFields);
}
if (configElem.getChild("Destination") != null) {
InventoryDestination destination = new InventoryDestination();
Element destinElem = configElem.getChild("Destination");
if (destinElem.getChild("OSSBucketDestination") != null) {
InventoryOSSBucketDestination ossBucketDestion = new InventoryOSSBucketDestination();
Element bucketDistinElem = destinElem.getChild("OSSBucketDestination");
if (bucketDistinElem.getChildText("Format") != null) {
ossBucketDestion.setFormat(bucketDistinElem.getChildText("Format"));
}
if (bucketDistinElem.getChildText("AccountId") != null) {
ossBucketDestion.setAccountId(bucketDistinElem.getChildText("AccountId"));
}
if (bucketDistinElem.getChildText("RoleArn") != null) {
ossBucketDestion.setRoleArn(bucketDistinElem.getChildText("RoleArn"));
}
if (bucketDistinElem.getChildText("Bucket") != null) {
String tmpBucket = bucketDistinElem.getChildText("Bucket");
String bucket = tmpBucket.replaceFirst("acs:oss:::", "");
ossBucketDestion.setBucket(bucket);
}
if (bucketDistinElem.getChildText("Prefix") != null) {
ossBucketDestion.setPrefix(bucketDistinElem.getChildText("Prefix"));
}
if (bucketDistinElem.getChild("Encryption") != null) {
InventoryEncryption inventoryEncryption = new InventoryEncryption();
if (bucketDistinElem.getChild("Encryption").getChild("SSE-KMS") != null) {
String keyId = bucketDistinElem.getChild("Encryption").getChild("SSE-KMS").getChildText("KeyId");
inventoryEncryption.setServerSideKmsEncryption(new InventoryServerSideEncryptionKMS().withKeyId(keyId));
} else if (bucketDistinElem.getChild("Encryption").getChild("SSE-OSS") != null) {
inventoryEncryption.setServerSideOssEncryption(new InventoryServerSideEncryptionOSS());
}
ossBucketDestion.setEncryption(inventoryEncryption);
}
destination.setOssBucketDestination(ossBucketDestion);
}
inventoryConfiguration.setDestination(destination);
}
return inventoryConfiguration;
}