• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MappedRecord类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.resource.cci.MappedRecord的典型用法代码示例。如果您正苦于以下问题:Java MappedRecord类的具体用法?Java MappedRecord怎么用?Java MappedRecord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MappedRecord类属于javax.resource.cci包,在下文中一共展示了MappedRecord类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testInflowCCIReuseReleasedEndpoint

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Test
public void testInflowCCIReuseReleasedEndpoint() throws Exception {
    _adapter.fireCreateEndpoint();
    MappedRecord input1 = _recordFactory.createMappedRecord("testInflowCCIReuseReleasedEndpoint input1");
    input1.put("input", "World3");
    Record result1 = _adapter.fireDelivery(input1);
    Assert.assertTrue(result1 instanceof MappedRecord);
    Assert.assertEquals("Hello World3 !", ((MappedRecord)result1).get("input"));
    _adapter.fireRelease();
    
    MappedRecord input2 = _recordFactory.createMappedRecord("testInflowCCIReuseReleasedEndpoint input2");
    input2.put("input", "World4");
    Record result2 = _adapter.fireDelivery(input2);
    Assert.assertTrue(result2 instanceof MappedRecord);
    Assert.assertEquals("Hello World4 !", ((MappedRecord)result2).get("input"));
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:17,代码来源:JCACCIServiceBindingTest.java


示例2: mapFrom

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void mapFrom(MappedRecordBindingData source, Context context) throws Exception {
    super.mapFrom(source, context);

    MappedRecord record = source.getRecord();
    String recordName = record.getRecordName();
    if (recordName != null) {
        context.setProperty(JCAConstants.CCI_RECORD_NAME_KEY, recordName).addLabels(MAPPED_RECORD_LABELS);
    }
    String recordDescription = record.getRecordShortDescription();
    if (recordDescription != null) {
        context.setProperty(JCAConstants.CCI_RECORD_SHORT_DESC_KEY, recordDescription).addLabels(MAPPED_RECORD_LABELS);
    }

    for (Object obj : record.keySet()) {
        if (obj instanceof String) {
            String key = (String) obj;
            if (matches(key, getIncludeRegexes(), new ArrayList<Pattern>())) {
                context.setProperty(key, record.get(key), Scope.EXCHANGE);
            }
        }
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:27,代码来源:MappedRecordContextMapper.java


示例3: mapTo

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public void mapTo(Context context, MappedRecordBindingData target) throws Exception {
    super.mapTo(context, target);

    MappedRecord record = target.getRecord();
    for (Property property : context.getProperties()) {
        String name = property.getName();
        Object value = property.getValue();
        if (value == null) {
            continue;
        }
        if (name.equals(JCAConstants.CCI_RECORD_NAME_KEY)) {
            record.setRecordName(value.toString());
        } else if (name.equals(JCAConstants.CCI_RECORD_SHORT_DESC_KEY)) {
            record.setRecordShortDescription(value.toString());
        } else if (matches(name)) {
            record.put(name, value);
        } else if (matches(name, getIncludeRegexes(), new ArrayList<Pattern>())) {
            record.put(name, value);
        }
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:27,代码来源:MappedRecordContextMapper.java


示例4: onMessage

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Override
public Record onMessage(Record record) {
    SynchronousInOutHandler inOutHandler = new SynchronousInOutHandler();
    MappedRecord sourceRecord = MappedRecord.class.cast(record);
    try {
        MappedRecordBindingData bindingData = new MappedRecordBindingData(sourceRecord);
        String operation = _selector != null ? _selector.selectOperation(bindingData).getLocalPart() : null;
        Exchange exchange = createExchange(operation, inOutHandler);
        exchange.send(_composer.compose(bindingData, exchange));

        exchange = inOutHandler.waitForOut(_waitTimeout);
        MappedRecord returnRecord = _recordFactory.createMappedRecord(_recordName);
        returnRecord.setRecordShortDescription(_description);
        return _composer.decompose(exchange, new MappedRecordBindingData(returnRecord)).getRecord();
    } catch (Exception e) {
        throw new SwitchYardException(e);
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:19,代码来源:CCIEndpoint.java


示例5: mapFunctionMapValuesToMappedRecord

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
public MappedRecord mapFunctionMapValuesToMappedRecord(final String bapiName,
                                                       final RecordFactory recordFactory,
                                                       final Map<String, Object> functionMap) throws ResourceException {
    LOG.debug("mapFunctionMapValuesToMappedRecord() functionMap=" + functionMap);

    MappedRecord mappedInputRecord = recordFactory.createMappedRecord(bapiName);

    final Map<String, Object> importMap = UnsafeCastHelper.castToMap(functionMap.get(BapiConstants.IMPORT));
    mapToMappedRecord(recordFactory, mappedInputRecord, importMap);

    final Map<String, Object> changingMap = UnsafeCastHelper.castToMap(functionMap.get(BapiConstants.CHANGING));
    mapToMappedRecord(recordFactory, mappedInputRecord, changingMap);

    final Map<String, Object> tableMap = UnsafeCastHelper.castToMap(functionMap.get(TABLE));
    mapToMappedRecord(recordFactory, mappedInputRecord, tableMap);

    LOG.debug("mapFunctionMapValuesToMappedRecord() record=" + mappedInputRecord);

    return mappedInputRecord;
}
 
开发者ID:hibersap,项目名称:hibersap,代码行数:21,代码来源:JCAMapper.java


示例6: execute

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
public void execute(final BapiMapping bapiMapping, final Map<String, Object> functionMap) {
    Record result;

    try {
        MappedRecord mappedInputRecord = mapper.mapFunctionMapValuesToMappedRecord(bapiMapping.getBapiName(), recordFactory,
                functionMap);

        LOG.debug("JCA Execute: " + bapiMapping.getBapiName() + ", arguments= " + functionMap + "\ninputRecord = "
                + mappedInputRecord);

        result = connectionProvider.getConnection().createInteraction().execute(null, mappedInputRecord);

        LOG.debug("JCA Execute: " + bapiMapping.getBapiName() + ", result = " + result);

        final Map<String, Object> resultMap = UnsafeCastHelper.castToMap(result);
        mapper.mapRecordToFunctionMap(functionMap, resultMap, bapiMapping);
    } catch (final ResourceException e) {
        throw new HibersapException("Error executing function module " + bapiMapping.getBapiName(), e);
    }
}
 
开发者ID:hibersap,项目名称:hibersap,代码行数:21,代码来源:JCAConnection.java


示例7: testCreateMappedRecord

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Test
public void testCreateMappedRecord() throws ResourceException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	RecordFactory recordFactory = mock(RecordFactory.class);
	MappedRecord mappedRecord = mock(MappedRecord.class);

	given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
	given(recordFactory.createMappedRecord("name")).willReturn(mappedRecord);

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.createMappedRecord("name");

	verify(recordFactory).createMappedRecord("name");
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:15,代码来源:CciTemplateTests.java


示例8: testOutboundCCI

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Test
public void testOutboundCCI() throws Exception {
    _adapter.fireCreateEndpoint();
    MappedRecord input = _recordFactory.createMappedRecord("testOutboundCCI input");
    input.put("name", "Uragasumi");
    Record result = _adapter.fireDelivery(input);
    _adapter.fireRelease();
    Assert.assertTrue(result instanceof MappedRecord);
    Assert.assertEquals("Hello, Uragasumi!", MappedRecord.class.cast(result).get("name"));
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:11,代码来源:JCACCIReferenceBindingTest.java


示例9: testInflowCCI

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Test
public void testInflowCCI() throws Exception {
    _adapter.fireCreateEndpoint();
    MappedRecord input = _recordFactory.createMappedRecord("testInflowCCI input");
    input.put("input", "World");
    Record result = _adapter.fireDelivery(input);
    _adapter.fireRelease();
    
    Assert.assertTrue(result instanceof MappedRecord);
    Assert.assertEquals("Hello World !", ((MappedRecord)result).get("input"));
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:12,代码来源:JCACCIServiceBindingTest.java


示例10: testInflowCCIWithBeforeAfterDelivery

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Test
public void testInflowCCIWithBeforeAfterDelivery() throws Exception {
    _adapter.fireCreateEndpoint();
    _adapter.fireBeforeDelivery();
    MappedRecord input1 = _recordFactory.createMappedRecord("testInflowCCIWithBeforeAfterDelivery input1");
    input1.put("input", "World2");
    Record result1 = _adapter.fireDelivery(input1);
    _adapter.fireAfterDelivery();
    
    Assert.assertTrue(result1 instanceof MappedRecord);
    Assert.assertEquals("Hello World2 !", ((MappedRecord)result1).get("input"));
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:13,代码来源:JCACCIServiceBindingTest.java


示例11: testInflowCCIErrorMultipleDelivery

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Test(expected = RuntimeException.class)
public void testInflowCCIErrorMultipleDelivery() throws Exception {
    _adapter.fireCreateEndpoint();
    _adapter.fireBeforeDelivery();
    MappedRecord input1 = _recordFactory.createMappedRecord("testInflowCCIErrorMultipleDelivery input1");
    input1.put("input", "World5");
    MappedRecord input2 = _recordFactory.createMappedRecord("testInflowCCIErrorMultipleDelivery input2");
    input2.put("input", "World6");
    Record result1 = _adapter.fireDelivery(input1);
    Record result2 = _adapter.fireDelivery(input2);
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:12,代码来源:JCACCIServiceBindingTest.java


示例12: testInflowCCIErrorAfterDeliveryWithoutBefore

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Test(expected = RuntimeException.class)
public void testInflowCCIErrorAfterDeliveryWithoutBefore() throws Exception {
    _adapter.fireCreateEndpoint();
    MappedRecord input1 = _recordFactory.createMappedRecord("testInflowCCIErrorAfterDeliveryWithoutBefore input1");
    input1.put("input", "World7");
    Record result1 = _adapter.fireDelivery(input1);
    _adapter.fireAfterDelivery();
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:9,代码来源:JCACCIServiceBindingTest.java


示例13: testInflowCCIErrorBeforeDeliveryWithoutPreviousAfter

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Test(expected = RuntimeException.class)
public void testInflowCCIErrorBeforeDeliveryWithoutPreviousAfter() throws Exception {
    _adapter.fireCreateEndpoint();
    _adapter.fireBeforeDelivery();
    MappedRecord input1 = _recordFactory.createMappedRecord("testInflowCCIErrorBeforeDeliveryWithoutPreviousAfter input1");
    input1.put("input", "World8");
    Record result1 = _adapter.fireDelivery(input1);
    
    _adapter.fireBeforeDelivery();
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:11,代码来源:JCACCIServiceBindingTest.java


示例14: appendToRecord

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void appendToRecord(final Record record, final String fieldName, final Object value) {
    if (record instanceof IndexedRecord) {
        ((IndexedRecord) record).add(value);
    } else {
        ((MappedRecord) record).put(fieldName, value);
    }
}
 
开发者ID:hibersap,项目名称:hibersap,代码行数:9,代码来源:JCAMapper.java


示例15: mapToMappedRecord

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void mapToMappedRecord(final RecordFactory recordFactory, final Record record, final Map<String, Object> map)
        throws ResourceException {
    for (final String fieldName : map.keySet()) {
        final Object value = map.get(fieldName);

        if (Map.class.isAssignableFrom(value.getClass())) {
            final Map<String, Object> structureMap = UnsafeCastHelper.castToMap(value);
            final Record structure = recordFactory.createMappedRecord(fieldName);

            appendToRecord(record, fieldName, structure);

            mapToMappedRecord(recordFactory, structure, structureMap);
        } else if (Collection.class.isAssignableFrom(value.getClass())) {
            final Collection<Map<String, Object>> tableMap = UnsafeCastHelper.castToCollectionOfMaps(value);
            final IndexedRecord table = recordFactory.createIndexedRecord(fieldName);

            appendToRecord(record, fieldName, table);

            int i = 0;
            for (final Map<String, Object> row : tableMap) {
                MappedRecord rowRecord = recordFactory.createMappedRecord(fieldName + ":row:" + i);
                mapToMappedRecord(recordFactory, rowRecord, row);
                table.add(rowRecord);
                i++;
            }
        } else {
            appendToRecord(record, fieldName, value);
        }
    }
}
 
开发者ID:hibersap,项目名称:hibersap,代码行数:32,代码来源:JCAMapper.java


示例16: mapToMappedRecord

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Test
public void mapToMappedRecord()
        throws Exception {
    // map
    Map<String, Object> functionMap = createFunctionMap();
    MappedRecord record = mapper.mapFunctionMapValuesToMappedRecord("BAPI_NAME", recordFactory, functionMap);

    assertEquals("BAPI_NAME", record.getRecordName());

    // check import parameters
    String importParam1 = (String) record.get("IMPORT_PARAM2");
    assertEquals("importParam2", importParam1);

    int param3 = (Integer) record.get("IMPORT_PARAM3");
    assertEquals(3, param3);

    MappedRecord importStruct = (MappedRecord) record.get("IMPORT_PARAM1");
    assertEquals("IMPORT_PARAM1", importStruct.getRecordName());
    assertEquals(1, importStruct.get("STRUCT_FIELD1"));
    assertEquals("structField2", importStruct.get("STRUCT_FIELD2"));

    // check changing parameters
    assertThat(record.get("CHANGING_PARAM1")).isEqualTo("changingParam1");
    assertThat(record.get("CHANGING_PARAM2")).isEqualTo(2);

    // check table parameters
    IndexedRecord tableParam1 = (IndexedRecord) record.get("TABLE_PARAM1");
    assertEquals("TABLE_PARAM1", tableParam1.getRecordName());

    MappedRecord row1 = (MappedRecord) tableParam1.get(0);
    assertEquals("tableField1", row1.get("TABLE_FIELD1"));
    assertEquals(new Date(1), row1.get("TABLE_FIELD2"));
    assertEquals(1, row1.get("TABLE_FIELD3"));

    MappedRecord row2 = (MappedRecord) tableParam1.get(1);
    assertEquals("tableField2", row2.get("TABLE_FIELD1"));
    assertEquals(new Date(2), row2.get("TABLE_FIELD2"));
    assertEquals(2, row2.get("TABLE_FIELD3"));
}
 
开发者ID:hibersap,项目名称:hibersap,代码行数:40,代码来源:JCAMapperTest.java


示例17: createMappedRecord

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Override
public MappedRecord createMappedRecord(String name) throws ResourceException {
	throw new NotSupportedException("The RecordFactory facility is not supported by the connector");
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:NotSupportedRecordFactory.java


示例18: createMappedRecord

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Override
public MappedRecord createMappedRecord(String arg0) throws ResourceException {
	return new DemoMappedRecord();
}
 
开发者ID:rhulha,项目名称:EclipseLinkNoSQLDemoPlugin,代码行数:5,代码来源:DemoRecordFactory.java


示例19: createMappedRecord

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Override
public MappedRecord createMappedRecord(String recordName) throws ResourceException {
    MappedRecord rec = new MockMappedRecord();
    rec.setRecordName(recordName);
    return rec;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:7,代码来源:MockRecordFactory.java


示例20: extractString

import javax.resource.cci.MappedRecord; //导入依赖的package包/类
@Override
protected String extractString(MappedRecordBindingData binding) throws Exception {
    MappedRecord content = binding.getRecord();
    return String.class.cast(content.get(KEY));
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:6,代码来源:CCIOperationSelector.java



注:本文中的javax.resource.cci.MappedRecord类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Game类代码示例发布时间:2022-05-23
下一篇:
Java MultiblockComponent类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap