本文整理汇总了Java中com.wm.data.IDataCursor类的典型用法代码示例。如果您正苦于以下问题:Java IDataCursor类的具体用法?Java IDataCursor怎么用?Java IDataCursor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDataCursor类属于com.wm.data包,在下文中一共展示了IDataCursor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterSample
import com.wm.data.IDataCursor; //导入依赖的package包/类
public static final void filterSample(IData pipeline) throws ServiceException {
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
// indocs
IData[] indocs = IDataUtil.getIDataArray( pipelineCursor, "indocs" );
pipelineCursor.destroy();
java.util.List<IData> idataList = (java.util.List) Arrays.asList(indocs);
java.util.List<IData> result = idataList.stream()
.filter( idata -> idata.toString().indexOf("street=ABCStreet 42") > -1)
.collect(Collectors.toList());
result.stream()
.forEach(System.out::println);
// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
// outdocs
IDataUtil.put( pipelineCursor_1, "outdocs", result.toArray() );
pipelineCursor_1.destroy();
}
开发者ID:ThomasToepperwien,项目名称:webmethods-integrationserver-java8-stream-filtering,代码行数:27,代码来源:Java8Streaming.java
示例2: testGetTopLevelKeys
import com.wm.data.IDataCursor; //导入依赖的package包/类
@Test
public void testGetTopLevelKeys() {
List<String> expected = Lists.newArrayList("value1", "value2");
IData idata = IDataFactory.create();
IDataCursor cursor = idata.getCursor();
IDataUtil.put(cursor, "value1", "something");
IDataUtil.put(cursor, "value2", "another one");
cursor.destroy();
Document document = docFactory.wrap(idata);
CollectionUtils.isEqualCollection(expected, document.getKeys());
}
示例3: testGetAllDocValuesForKey
import com.wm.data.IDataCursor; //导入依赖的package包/类
@Test
public void testGetAllDocValuesForKey() {
IData idata = IDataFactory.create();
IDataCursor cursor = idata.getCursor();
cursor.insertAfter("something", newIDataWithValue("x"));
cursor.insertAfter("item", newIDataWithValue("a"));
cursor.insertAfter("item", newIDataWithValue("b"));
cursor.insertAfter("somethingElse", newIDataWithValue("y"));
cursor.insertAfter("item", newIDataWithValue("c"));
cursor.insertAfter("somethingDifferent", newIDataWithValue("z"));
Document res = docFactory.wrap(idata);
Collection<Document> actual = res.docsSplitEntry("item").getValOrEmpty();
List<Document> actualList = Lists.newArrayList(actual);
assertEquals(3, actual.size());
assertEquals("a", actualList.get(0).entry("value1").getVal());
assertEquals("b", actualList.get(1).entry("value1").getVal());
assertEquals("c", actualList.get(2).entry("value1").getVal());
}
示例4: listEncryptionAlgorithms
import com.wm.data.IDataCursor; //导入依赖的package包/类
public static final void listEncryptionAlgorithms (IData pipeline)
throws ServiceException
{
// --- <<IS-START(listEncryptionAlgorithms)>> ---
// @specification pgp.specifications:listAlgorithmsSpec
// @subtype unknown
// @sigtype java 3.5
// Return values
IDataCursor pc = pipeline.getCursor();
IDataUtil.put(pc, "algorithms",
PGPInit.listEncryptionAlgorithms().toArray(new String[0]));
pc.destroy();
// --- <<IS-END>> ---
}
示例5: listKeyExchangeAlgorithms
import com.wm.data.IDataCursor; //导入依赖的package包/类
public static final void listKeyExchangeAlgorithms (IData pipeline)
throws ServiceException
{
// --- <<IS-START(listKeyExchangeAlgorithms)>> ---
// @specification pgp.specifications:listAlgorithmsSpec
// @subtype unknown
// @sigtype java 3.5
// Return values
IDataCursor pc = pipeline.getCursor();
IDataUtil.put(pc, "algorithms",
PGPInit.listKeyExchangeAlgorithms().toArray(new String[0]));
pc.destroy();
// --- <<IS-END>> ---
}
示例6: listSignatureAlgorithms
import com.wm.data.IDataCursor; //导入依赖的package包/类
public static final void listSignatureAlgorithms (IData pipeline)
throws ServiceException
{
// --- <<IS-START(listSignatureAlgorithms)>> ---
// @specification pgp.specifications:listAlgorithmsSpec
// @subtype unknown
// @sigtype java 3.5
// Return values
IDataCursor pc = pipeline.getCursor();
IDataUtil.put(pc, "algorithms",
PGPInit.listSignatureAlgorithms().toArray(new String[0]));
pc.destroy();
// --- <<IS-END>> ---
}
示例7: remove
import com.wm.data.IDataCursor; //导入依赖的package包/类
public final void remove(RemoveEntryOption removeOption) {
Preconditions.checkNotNull(removeOption, "Remove option cannot be null");
IDataCursorResource cursorRes = newCursorResource();
try {
IDataCursor cursor = cursorRes.getCursor();
boolean exists = cursor.first(getKey());
if (!exists && RemoveEntryOption.STRICT.equals(removeOption)) {
throw new InexistentEntryException(
"Entry with key '" + getKey() + "' doesn't exist and can't be removed");
}
deleteCurrentEntry(cursor);
} finally {
cursorRes.close();
}
}
示例8: getKeys
import com.wm.data.IDataCursor; //导入依赖的package包/类
public Collection<String> getKeys() {
// Using LinkedHashSet to preserve insertion order
Set<String> keys = new LinkedHashSet<String>();
IDataCursorResource cursorRes = newCursorResource();
try {
IDataCursor cursor = cursorRes.getCursor();
boolean hasMore = cursor.first();
while (hasMore) {
keys.add(cursor.getKey());
hasMore = cursor.next();
}
return Collections.unmodifiableSet(keys);
}
finally {
cursorRes.close();
}
}
示例9: testGetAllValuesForKey
import com.wm.data.IDataCursor; //导入依赖的package包/类
@Test
public void testGetAllValuesForKey() {
List<String> expected = Lists.newArrayList("a", "b", "c");
IData idata = IDataFactory.create();
IDataCursor cursor = idata.getCursor();
cursor.insertAfter("something", "x");
cursor.insertAfter("item", "a");
cursor.insertAfter("item", "b");
cursor.insertAfter("somethingElse", "y");
cursor.insertAfter("item", "c");
cursor.insertAfter("somethingDifferent", "z");
Document res = docFactory.wrap(idata);
Collection<String> actual = res.stringsSplitEntry("item").getValOrEmpty();
assertTrue(CollectionUtils.isEqualCollection(expected, actual));
}
示例10: testGetNonEmptyVal_WithValue
import com.wm.data.IDataCursor; //导入依赖的package包/类
@Test
public void testGetNonEmptyVal_WithValue() {
IData idata = IDataFactory.create();
IDataCursor cursor = idata.getCursor();
cursor.insertAfter("something", newIDataWithValue("x"));
cursor.insertAfter("item", newIDataWithValue("a"));
cursor.insertAfter("item", newIDataWithValue("b"));
cursor.insertAfter("somethingElse", newIDataWithValue("y"));
cursor.insertAfter("item", newIDataWithValue("c"));
cursor.insertAfter("somethingDifferent", newIDataWithValue("z"));
Document res = docFactory.wrap(idata);
Collection<Document> actual = res.docsSplitEntry("item").getNonEmptyVal();
List<Document> actualList = Lists.newArrayList(actual);
assertEquals(3, actual.size());
assertEquals("a", actualList.get(0).entry("value1").getVal());
assertEquals("b", actualList.get(1).entry("value1").getVal());
assertEquals("c", actualList.get(2).entry("value1").getVal());
}
示例11: testGetNonEmptyVal_WithoutValue
import com.wm.data.IDataCursor; //导入依赖的package包/类
@Test
public void testGetNonEmptyVal_WithoutValue() {
IData idata = IDataFactory.create();
IDataCursor cursor = idata.getCursor();
cursor.insertAfter("something", newIDataWithValue("x"));
Document res = docFactory.wrap(idata);
try {
res.docsSplitEntry("item").getNonEmptyVal();
fail();
}
catch (InexistentEntryException e) {
// success
}
}
示例12: testPut
import com.wm.data.IDataCursor; //导入依赖的package包/类
@Test
public void testPut() {
List<String> list = Lists.newArrayList("Hello", "World");
Document doc = docFactory.create();
doc.stringsSplitEntry("words").put(list);
IData iData = doc.getIData();
IDataCursor cursor = iData.getCursor();
assertEquals(2, IDataUtil.size(cursor));
cursor.first();
assertEquals("words", cursor.getKey());
assertEquals("Hello", cursor.getValue());
cursor.next();
assertEquals("words", cursor.getKey());
assertEquals("World", cursor.getValue());
}
示例13: testRemoveFailed
import com.wm.data.IDataCursor; //导入依赖的package包/类
@Test
public void testRemoveFailed() {
IData iData = IDataFactory.create();
{
IDataCursor cursor = iData.getCursor();
cursor.insertAfter("first", "A");
cursor.insertAfter("words", "Word to replace");
cursor.insertAfter("middle", "M");
cursor.insertAfter("words", "Another word to replace");
cursor.insertAfter("last", "Z");
}
Document document = docFactory.wrap(iData);
try {
document.splitEntry("nonExistingKey").remove();
fail();
} catch (InexistentEntryException e) {
// success
}
assertEquals(5, IDataUtil.size(document.getIData().getCursor()));
}
示例14: testRemoveFailedIgnore
import com.wm.data.IDataCursor; //导入依赖的package包/类
@Test
public void testRemoveFailedIgnore() {
IData iData = IDataFactory.create();
{
IDataCursor cursor = iData.getCursor();
cursor.insertAfter("first", "A");
cursor.insertAfter("words", "Word to replace");
cursor.insertAfter("middle", "M");
cursor.insertAfter("words", "Another word to replace");
cursor.insertAfter("last", "Z");
}
Document document = docFactory.wrap(iData);
document.entry("nonExistingKey").remove(RemoveEntryOption.LENIENT);
// confirm no value has been removed
assertEquals(5, IDataUtil.size(document.getIData().getCursor()));
}
示例15: enableInterception
import com.wm.data.IDataCursor; //导入依赖的package包/类
public void enableInterception(IData pipeline) {
IDataCursor pipelineCursor = pipeline.getCursor();
String resourceID = IDataUtil.getString( pipelineCursor, ENABLED );
boolean enabled;
if (resourceID == null || resourceID.length() == 0) {
enabled = AOPChainProcessor.getInstance().isEnabled();
} else {
enabled = Boolean.valueOf(resourceID);
AOPChainProcessor.getInstance().setEnabled(enabled);
}
// pipeline
IDataUtil.put( pipelineCursor, ENABLED, Boolean.toString(enabled) );
pipelineCursor.destroy();
}