本文整理汇总了Java中com.wm.data.IDataUtil类的典型用法代码示例。如果您正苦于以下问题:Java IDataUtil类的具体用法?Java IDataUtil怎么用?Java IDataUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDataUtil类属于com.wm.data包,在下文中一共展示了IDataUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterSample
import com.wm.data.IDataUtil; //导入依赖的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.IDataUtil; //导入依赖的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: listEncryptionAlgorithms
import com.wm.data.IDataUtil; //导入依赖的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>> ---
}
示例4: listKeyExchangeAlgorithms
import com.wm.data.IDataUtil; //导入依赖的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>> ---
}
示例5: listSignatureAlgorithms
import com.wm.data.IDataUtil; //导入依赖的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>> ---
}
示例6: testRemoveFailed
import com.wm.data.IDataUtil; //导入依赖的package包/类
@Test
public void testRemoveFailed() {
IData idata = newIDataWithValue("anyValue");
Document document = docFactory.wrap(idata);
assertEquals(1, IDataUtil.size(document.getIData().getCursor()));
try {
document.entry("nonExistingKey").remove();
fail();
} catch (InexistentEntryException e) {
// success
}
// confirm no value has been removed
assertEquals(1, IDataUtil.size(document.getIData().getCursor()));
}
示例7: testRemoveFailedExplicitParam
import com.wm.data.IDataUtil; //导入依赖的package包/类
@Test
public void testRemoveFailedExplicitParam() {
IData idata = newIDataWithValue("anyValue");
Document document = docFactory.wrap(idata);
assertEquals(1, IDataUtil.size(document.getIData().getCursor()));
try {
document.entry("nonExistingKey").remove(RemoveEntryOption.STRICT);
fail();
} catch (InexistentEntryException e) {
// success
}
// confirm no value has been removed
assertEquals(1, IDataUtil.size(document.getIData().getCursor()));
}
示例8: testNestedDoc
import com.wm.data.IDataUtil; //导入依赖的package包/类
@Test
public void testNestedDoc() {
// setup
Document nested = docFactory.create();
nested.stringEntry("a1").put("val-a1");
nested.stringEntry("a2").put("val-a2");
Document top = docFactory.create();
top.docEntry("nested").put(nested);
// verify
IData topIDataObj = top.getIData();
IData topIData = (IData) topIDataObj;
Object nestedObj = IDataUtil.get(topIData.getCursor(), "nested");
assertTrue("Actual type was" + nestedObj.getClass(), nestedObj instanceof IData);
IData nestedIData = (IData) nestedObj;
assertEquals("val-a1", IDataUtil.get(nestedIData.getCursor(), "a1"));
assertEquals("val-a2", IDataUtil.get(nestedIData.getCursor(), "a2"));
}
示例9: testPut
import com.wm.data.IDataUtil; //导入依赖的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());
}
示例10: testRemoveFailed
import com.wm.data.IDataUtil; //导入依赖的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()));
}
示例11: testRemoveFailedIgnore
import com.wm.data.IDataUtil; //导入依赖的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()));
}
示例12: intercept
import com.wm.data.IDataUtil; //导入依赖的package包/类
@Override
public InterceptResult intercept(FlowPosition flowPosition, IData idata) {
invokeCount++;
MatchResult result = evaluator.match(idata);
logger.info("Evaluated " + result);
if (result != null) {
logger.info("Merging response " + result.getId());
IDataUtil.merge(responses.get(result.getId()), idata);
return InterceptResult.TRUE;
} else if (defaultResponse != null) {
logger.info("Merging default response " + defaultId);
IDataUtil.merge(defaultResponse, idata);
return InterceptResult.TRUE;
}
if (ignoreNoMatch) {
return InterceptResult.TRUE;
}
throw new InterceptionException("No conditions match pipeline state");
}
示例13: sendPost
import com.wm.data.IDataUtil; //导入依赖的package包/类
private void sendPost(IData idata) {
try {
URL url = new URL(destinationUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", APPLICATION_XML);
IDataXMLCoder idxc = new IDataXMLCoder();
OutputStream os = conn.getOutputStream();
idxc.encode(os, idata);
os.flush();
IDataUtil.merge(idxc.decode(conn.getInputStream()), idata);
conn.disconnect();
} catch (IOException e) {
throw new InterceptionException("Error while forwarding request", e);
}
}
示例14: enableInterception
import com.wm.data.IDataUtil; //导入依赖的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();
}
示例15: getRemit
import com.wm.data.IDataUtil; //导入依赖的package包/类
public Remit getRemit(IData pipeline) throws ServiceException {
IDataCursor pipelineCursor = pipeline.getCursor();
String requiredScope = IDataUtil.getString(pipelineCursor, SCOPE);
if (requiredScope == null) {
return new UserRemit();
}
Remit remit;
switch (Scope.valueOf(requiredScope.toUpperCase())) {
case GLOBAL:
remit = new GlobalRemit();
break;
case SESSION:
remit = new SessionRemit();
break;
case USER:
String username = IDataUtil.getString(pipelineCursor, USERNAME);
remit = (username == null || username.length() == 0) ? new UserRemit() : new UserRemit(username);
break;
default:
throw new ServiceException("Inapplicable scope: " + requiredScope);
}
return remit;
}