本文整理了Java中com.opentext.ia.yaml.core.YamlSequence
类的一些代码示例,展示了YamlSequence
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlSequence
类的具体详情如下:
包路径:com.opentext.ia.yaml.core.YamlSequence
类名称:YamlSequence
暂无
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
@Override
public List<YamlMap> getContentOwnedBy(YamlMap owner) {
return owner.get("content").toList().stream()
.map(Value::toMap)
.collect(Collectors.toList());
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
@Override
public List<Value> subList(int fromIndex, int toIndex) {
return new YamlSequence(data.subList(fromIndex, toIndex));
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
@Override
public Iterator<Value> iterator() {
return listIterator();
}
代码示例来源:origin: com.opentext.ia/infoarchive-sdk-core
Value prefix = resultConfigurationHelper.get(NAMESPACES).toList().get(0);
Value namespaceUri = lookupNamespace("prefix", prefix, "uri");
putTemplated(namespaceUri, RESULT_HELPER_SCHEMA_TEMPLATE, name);
QUERY_RESULT_ROOT_NS_ENABLED_TEMPLATE, "resultRootNsEnabled");
Map<Value, Value> namespaceUriByPrefix = new LinkedHashMap<>();
query.get(NAMESPACES).toList().stream()
.map(Value::toMap)
.forEach(namespace -> {
Value namespaceUri = namespaceUriByPrefix.getOrDefault(prefix, new Value());
putTemplated(namespaceUri, QUERY_XDBPDI_SCHEMA_TEMPLATE, name);
xdbPdiConfigs.get("operands").toList().stream()
.map(Value::toMap)
.forEach(operand -> {
YamlMap aic = aics.get(0).toMap();
put(AIC_NAME, aic.get(NAME));
aic.get("criteria").toList().stream()
.map(Value::toMap)
.forEach(criterion -> {
YamlMap tab = resultMaster.get("panels", 0, "tabs", 0).toMap();
putTemplated(tab.get("exportEnabled"), SEARCH_COMPOSITION_RESULT_MAIN_EXPORT_ENABLED_TEMPLATE, searchName);
tab.get("columns").toList().stream()
.map(Value::toMap)
.forEach(column -> {
searchCompositionName);
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
@Override
public void accept(Visit visit) {
visit.getMap().get("pdiSchemas").toList().stream()
.map(Value::toMap)
.filter(map -> !map.containsKey(NAME) && map.get(NAMESPACES).toList().size() == 1)
.forEach(map -> replaceNamespaceWithName(visit.getRootMap(), map));
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
public Value get(Object... keys) {
YamlMap map = this;
int i = 0;
while (i < keys.length - 1) {
Value value = map.get(keys[i++]);
if (value.isList()) {
int index = toListIndex(keys[i++]);
value = value.toList().get(index);
if (i < keys.length) {
map = value.toMap();
} else {
return value;
}
} else {
map = value.toMap();
}
}
return new Value(map.data.get(keys[keys.length - 1]));
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
private void includeEntry(String key, String type, String collection, Value value, YamlMap target) {
Value targetValue = target.containsKey(type) ? target.get(type) : target.get(collection);
if (targetValue.isEmpty()) {
target.put(key, value);
return;
}
if (!canConfigure(value)) {
return;
}
if (!canConfigure(targetValue)) {
target.remove(type)
.remove(collection)
.put(key, value);
return;
}
if (target.containsKey(type)) {
target.replace(type, collection, Collections.singletonList(targetValue));
}
YamlSequence values = target.get(collection).toList();
if (value.isList()) {
values.addAll(value.toList());
} else {
values.add(value);
}
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
@Override
public void accept(Visit visit) {
YamlMap yaml = visit.getMap();
YamlSequence includeFiles = yaml.get(INCLUDES).toList();
yaml.remove(INCLUDES);
includeFiles.forEach(value -> include(value, yaml));
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
private void replaceNamespaceWithName(YamlMap root, YamlMap pdiSchema) {
pdiSchema.replace(NAMESPACES, NAME, NamespaceUri.byPrefix(root,
pdiSchema.get(NAMESPACES).toList().iterator().next()));
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
@Override
public void accept(Visit visit) {
YamlMap yaml = visit.getMap();
yaml.entries()
.filter(new IsQuery())
.filter(entry -> !entry.getValue().toMap().get(NAMESPACES).toList().isEmpty())
.forEach(entry -> addNamespaceDeclarations(visit.getRootMap(), entry));
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
private void inlineResource(YamlMap yaml, String resourceName) {
List<String> texts = resolver.resolve(resourceName);
if (yaml.containsKey(RESOURCE)) {
switch (texts.size()) {
case 0:
throw new UnknownResourceException(resourceName, null);
case 1:
yaml.replace(RESOURCE, TEXT, texts.get(0));
break;
default:
yaml.replace(RESOURCE, TEXT, texts);
break;
}
} else {
Value current = yaml.get(TEXT);
if (current.isList()) {
current.toList().addAll(texts.stream().map(Value::new).collect(Collectors.toList()));
} else {
texts.add(0, current.toString());
yaml.replace(TEXT, texts);
}
}
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
private void visit(Visitor visitor, Visit visit) {
boolean shouldVisit = visitor.test(visit);
if (shouldVisit) {
visitor.accept(visit);
}
if (visitor.maxNesting() > visit.getLevel()) {
visit.getMap().entries().forEach(entry -> {
String key = entry.getKey();
Value value = entry.getValue();
if (value.isMap()) {
visit(visitor, visit.descend(key));
} else if (isListOfMaps(value)) {
IntStream.range(0, value.toList().size())
.forEach(index -> visit(visitor, visit.descend(key, index)));
}
});
}
if (shouldVisit) {
visitor.afterVisit(visit);
}
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
private boolean canConfigure(Value value) {
YamlMap map = value.isList() ? value.toList().get(0).toMap() : value.toMap();
return ObjectConfiguration.parse(map.get(CONFIGURE).toString()).mayCreateObject();
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
@Override
public void accept(Visit visit) {
YamlMap yaml = visit.getMap();
String path = visit.getPath();
Value resource = yaml.get(RESOURCE);
if (resource.isScalar()) {
processResource(yaml, path, resource.toString());
} else if (resource.isList()) {
resource.toList().forEach(item ->
processResource(yaml, path, item.toString()));
}
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
@Override
void visitContent(Visit visit, YamlMap content) {
content.get("processors").toList().stream()
.map(Value::toMap)
.forEach(this::addNameAndClass);
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
@Override
public ListIterator<Value> listIterator() {
return listIterator(0);
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
@SuppressWarnings("unchecked")
public YamlSequence toList() {
if (!isList()) {
return new YamlSequence(new ArrayList<>());
}
return new YamlSequence((List<Object>)data);
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
private static List<?> toSequence(Entry entry) {
Value value = entry.getValue();
if (value.isList()) {
return value.toList().stream().map(Value::toMap).flatMap(YamlMap::entries).map(Entry::toMap)
.collect(Collectors.toList());
}
return value.toMap().entries().map(Entry::toMap).collect(Collectors.toList());
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
private void substituteValues(Entry entry) {
ListIterator<Value> iterator = entry.getValue().toList().listIterator();
while (iterator.hasNext()) {
String substitutedValue = substituteValue(iterator.next());
iterator.set(new Value(substitutedValue));
}
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
static String byPrefix(YamlMap yaml, String prefix) {
return yaml.get("namespaces").toList().stream()
.map(Value::toMap)
.filter(m -> m.get("prefix").toString().equals(prefix))
.map(m -> m.get("uri").toString())
.findAny()
.orElseThrow(() -> new IllegalArgumentException("Missing namespace with prefix " + prefix));
}
内容来源于网络,如有侵权,请联系作者删除!