private DataNode fetchDataNodeFromDmiRegistryForCmHandle(final String cmHandle) {
final String xpathForDmiRegistryToFetchCmHandle = "/dmi-registry/cm-handles[@id='" + cmHandle + "']";
- final var dataNode = cpsDataService.getDataNode(NCMP_DATASPACE_NAME,
+ return cpsDataService.getDataNode(NCMP_DATASPACE_NAME,
NCMP_DMI_REGISTRY_ANCHOR,
xpathForDmiRegistryToFetchCmHandle,
FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS);
- return dataNode;
}
private String prepareOperationBody(final GenericRequestBody requestBodyObject) {
}
private Map<String, String> getCmHandlePropertiesAsMap(final Collection<DataNode> cmHandlePropertiesList) {
- if (cmHandlePropertiesList == null || cmHandlePropertiesList.size() == 0) {
+ if (cmHandlePropertiesList == null || cmHandlePropertiesList.isEmpty()) {
return null;
}
final Map<String, String> cmHandlePropertiesMap = new LinkedHashMap<>();
persistenceCmHandle.setDmiServiceName(dmiPluginService);
persistenceCmHandle.setId(cmHandle.getCmHandleID());
if (cmHandle.getCmHandleProperties() == null) {
- persistenceCmHandle.setAdditionalProperties(Collections.EMPTY_MAP);
+ persistenceCmHandle.setAdditionalProperties(Collections.emptyMap());
} else {
persistenceCmHandle.setAdditionalProperties(cmHandle.getCmHandleProperties());
}
private static final Gson GSON = new GsonBuilder().create();
private static final String REG_EX_FOR_OPTIONAL_LIST_INDEX = "(\\[@[\\s\\S]+?]){0,1})";
- private static final String REG_EX_FOR_LIST_NODE_KEY = "\\[(\\@([^/]*?))+( and)*\\]$";
+ private static final String REG_EX_FOR_LIST_NODE_KEY = "\\[(\\@([^/]*?)){0,99}( and)*\\]$";
@Override
public void addChildDataNode(final String dataspaceName, final String anchorName, final String parentXpath,
final Matcher descendantNodeHasListNodeKey = Pattern.compile(REG_EX_FOR_LIST_NODE_KEY).matcher(descendantNode);
final boolean xpathPointsToAValidChildNodeWithKey = parentEntity.getChildFragments().stream().anyMatch(
- (fragment) -> fragment.getXpath().equals(listNodeXpath));
+ fragment -> fragment.getXpath().equals(listNodeXpath));
final boolean xpathPointsToAValidChildNodeWithoutKey = parentEntity.getChildFragments().stream().anyMatch(
- (fragment) -> fragment.getXpath().replaceAll(REG_EX_FOR_LIST_NODE_KEY, "").equals(listNodeXpath));
+ fragment -> fragment.getXpath().replaceAll(REG_EX_FOR_LIST_NODE_KEY, "").equals(listNodeXpath));
if ((descendantNodeHasListNodeKey.find() && xpathPointsToAValidChildNodeWithKey)
||