Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/refactor' into feature/r…
Browse files Browse the repository at this point in the history
…efactor
  • Loading branch information
benfortuna committed Jan 5, 2024
2 parents 4566a25 + 9127b1a commit dabb2f0
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ public Map<String, DavPropertySet> getCollections(List<ResourceType> types) thro
DavProperty<?> property = iNames.nextProperty();
if (property != null) {
_properties.add(property);
ResourceType resourceType = getResourceType(property);
if (resourceType != null && types.contains(resourceType)) {
isCollection = true;
List<ResourceType> resourceTypes = getResourceTypes(property);
for (ResourceType resourceType : resourceTypes) {
if (types.contains(resourceType)) {
isCollection = true;
}
}
}
}
Expand All @@ -113,21 +115,22 @@ public Map<String, DavPropertySet> getCollections(List<ResourceType> types) thro
return collections;
}

private ResourceType getResourceType(DavProperty property) {
private List<ResourceType> getResourceTypes(DavProperty property) {
List<ResourceType> resourceTypes = new ArrayList<>();
if ((DavConstants.PROPERTY_RESOURCETYPE.equals(property.getName().getName())) && (DavConstants.NAMESPACE.equals(property.getName().getNamespace()))) {
Object value = property.getValue();
if (value instanceof ArrayList) {
for (Node child : (ArrayList<Node>) value) {
if (child instanceof Element) {
String nameNode = child.getLocalName();
if (nameNode != null) {
return ResourceType.findByDescription(nameNode);
resourceTypes.add(ResourceType.findByDescription(nameNode));
}
}
}
}
}
return null;
return resourceTypes;
}

public String getDavPropertyUri(DavPropertyName type) throws DavException {
Expand Down

0 comments on commit dabb2f0

Please sign in to comment.