![JAR search and dependency download from the Maven repository](/logo.png)
com.microsoft.azure.toolkit.lib.cosmos.ICosmosDocument Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
package com.microsoft.azure.toolkit.lib.cosmos;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.microsoft.azure.toolkit.lib.Azure;
import com.microsoft.azure.toolkit.lib.common.model.AzResource;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Optional;
public interface ICosmosDocument extends AzResource {
@Nullable
ObjectNode getDocument();
@Nullable
Object getDocumentId();
void updateDocument(ObjectNode document);
default String getDocumentDisplayName() {
final List labels = Azure.az().config().getDocumentsLabelFields();
final ObjectNode document = getDocument();
for (final String label : labels) {
if (document != null && document.has(label)) {
return document.get(label).asText();
}
}
return Optional.ofNullable(getDocumentId()).map(Object::toString).orElse("Unknown");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy