Skip to content

Conversation

@gapra-msft
Copy link
Member

No description provided.

this.objectReplicationSourcePolicies = null;
if (blobItemInternal.getObjectReplicationMetadata() != null) {
this.objectReplicationSourcePolicies = new HashMap<>();
for (String orString : blobItemInternal.getObjectReplicationMetadata().keySet()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CI will tell you this, but we should use entrySet instead of keySet so we don't have to index into the map

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@gapra-msft gapra-msft marked this pull request as ready for review June 3, 2020 22:33
Copy link
Member

@alzimmermsft alzimmermsft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add another parameter to the BlobRequestConditions model for ifTags? There will need to be a Swagger transform to remove the following from the $.parameters.IfTags.

"x-ms-parameter-grouping": {
    "name": "modified-access-conditions"
},

Comment on lines 292 to 295
String ifTags = null;
if (modifiedAccessConditions != null) {
ifTags = modifiedAccessConditions.getIfTags();
}
Copy link
Member

@alzimmermsft alzimmermsft Jun 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add another property to the BlobRequestConditions class?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ifTags generated code stuff wasnt meant to be part of this PR but someone had already changed swagger so I havent implemented it yet. That will come in a future PR.

Bute you're right, I think we need to remove the grouping and add it to BlobRequestCondiitons like the other params.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this PR, we want to just focus on the listBlobs changes

Copy link
Contributor

@kasobol-msft kasobol-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 53 to 70
if (blobItemInternal.getObjectReplicationMetadata() != null) {
this.objectReplicationSourcePolicies = new HashMap<>();
for (Map.Entry<String, String> p : blobItemInternal.getObjectReplicationMetadata().entrySet()) {
String orString = p.getKey();
String str = orString.startsWith("or-") ? orString.substring(3) : orString;
String[] split = str.split("_");
String policyId = split[0];
String ruleId = split[1];
if (objectReplicationSourcePolicies.containsKey(policyId)) {
objectReplicationSourcePolicies.get(policyId)
.putRuleAndStatus(ruleId, p.getValue());
} else {
ObjectReplicationPolicy policy = new ObjectReplicationPolicy(policyId);
policy.putRuleAndStatus(ruleId, p.getValue());
objectReplicationSourcePolicies.put(policyId, policy);
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to find new home. We need to decouple model from "implementation model" per APIView feedback.
Anyway, it's a good practice to NOT place such logic inside constructors. BlobItem should ideally be plain data structure and this logic should move to some "transformer/mapper".

@gapra-msft gapra-msft closed this Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants