本文整理汇总了Java中com.sap.conn.jco.JCoField类的典型用法代码示例。如果您正苦于以下问题:Java JCoField类的具体用法?Java JCoField怎么用?Java JCoField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JCoField类属于com.sap.conn.jco包,在下文中一共展示了JCoField类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTableParameter
import com.sap.conn.jco.JCoField; //导入依赖的package包/类
private LinkedList getTableParameter(JCoField table)
{
LinkedList l = new LinkedList();
JCoTable t = table.getTable();
for (int i = 0; i < t.getNumRows(); i++)
{
t.setRow(i);
JCoFieldIterator iter = t.getFieldIterator();
LinkedHashMap m = new LinkedHashMap();
while(iter.hasNextField())
{
JCoField f = iter.nextField();
m.put(f.getName(), t.getValue(f.getName()));
}
l.add(m);
}
return l;
}
示例2: mapFields
import com.sap.conn.jco.JCoField; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void mapFields(final Set<? extends ParameterMapping> set, final JCoParameterList jcoParams) {
if (jcoParams == null) {
return;
}
JCoParameterFieldIterator iter = jcoParams.getParameterFieldIterator();
while (iter.hasNextField()) {
JCoField field = iter.nextField();
ParameterMapping param = getParameterMapping(field);
if (ParameterMapping.ParamType.FIELD == param.getParamType()) {
((Set<FieldMapping>) set).add((FieldMapping) param);
} else if (ParameterMapping.ParamType.STRUCTURE == param.getParamType()) {
((Set<StructureMapping>) set).add((StructureMapping) param);
} else if (ParameterMapping.ParamType.TABLE == param.getParamType()) {
((Set<TableMapping>) set).add((TableMapping) param);
}
}
}
示例3: getFields
import com.sap.conn.jco.JCoField; //导入依赖的package包/类
private void getFields(JCoFieldIterator iter,LinkedHashMap resultList)
{
while(iter.hasNextField())
{
JCoField f = iter.nextField();
LinkedHashMap map = new LinkedHashMap();
map.put(f.getName(), f.getValue());
if(f.isTable())
{
resultList.put(f.getName(),getTableParameter(f));
}
else if (f.isStructure())
{
resultList.put(f.getName(),getStructureParameter(f));
}
else
{
resultList.put(f.getName(),f.getValue());
}
}
}
示例4: setStructureParameter
import com.sap.conn.jco.JCoField; //导入依赖的package包/类
/**
* Sets a single Importing or Changing parameter that is a structure
* @param name the name of the parameter
* @param map the value of the parameter
*/
public void setStructureParameter(String name, LinkedHashMap map)
{
//Find structure parameter with this name and set the appropriate values
JCoFieldIterator iter = function.getImportParameterList().getFieldIterator();
while(iter.hasNextField())
{
JCoField f = iter.nextField();
if(f.getName().equals(name) & f.isStructure())
{
Iterator fieldIter = map.entrySet().iterator();
JCoStructure structure = f.getStructure();
while(fieldIter.hasNext())
{
Entry field = (Map.Entry)fieldIter.next();
structure.setValue(field.getKey().toString(), field.getValue().toString());
}
}
}
}
示例5: Item
import com.sap.conn.jco.JCoField; //导入依赖的package包/类
public Item(JCoTable agt) throws ParserConfigurationException, TransformerException {
Document doc = loader.newDocument();
Element mainRootElement = doc.createElementNS("", ITEM_NAME);
doc.appendChild(mainRootElement);
Iterator<JCoField> iter = agt.iterator();
while (iter.hasNext()) {
JCoField field = iter.next();
Element node = doc.createElement(field.getName());
node.appendChild(doc.createTextNode(field.getString()));
mainRootElement.appendChild(node);
values.put(field.getName(), field.getString());
}
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new StringWriter());
transformer.transform(source, result);
this.data = result.getWriter().toString();
}
示例6: getAssociatedClass
import com.sap.conn.jco.JCoField; //导入依赖的package包/类
/**
* Determins the Java type of the JCoField's value, i.e. of the value that is created by JCo when mapping
* a parameter of a certain ABAP data type to the corresponding Java type.
* The JCoField interface returns the canonical class name of the Java type, which is in the given context
* mostly the same as the type returned by Class.getName(), however, the ABAP types X (raw byte field) and
* XSTRING (variable length byte field) are mapped to byte[], where the canonical name ("byte[]") differs
* from the class name ("[B").
*
* @param field The JCoField.
* @return The class representing the field type.
*/
private Class<?> getAssociatedClass(final JCoField field) {
String canonicalClassName = field.getClassNameOfValue();
if (byte[].class.getCanonicalName().equals(canonicalClassName)) {
return byte[].class;
}
try {
return Class.forName(canonicalClassName);
} catch (ClassNotFoundException e) {
throw new InternalHiberSapException("Can not get class for class name " + canonicalClassName, e);
}
}
示例7: mapToMap
import com.sap.conn.jco.JCoField; //导入依赖的package包/类
private Map<String, Object> mapToMap(final JCoRecord record) {
final Map<String, Object> map = new HashMap<String, Object>();
if (record == null) {
return map;
}
final JCoFieldIterator iter = record.getFieldIterator();
while (iter.hasNextField()) {
final JCoField jcoField = iter.nextField();
final String sapFieldName = jcoField.getName();
if (jcoField.isStructure()) {
map.put(sapFieldName, mapToMap(jcoField.getStructure()));
} else if (jcoField.isTable()) {
final List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
final JCoTable table = jcoField.getTable();
for (int j = 0; j < table.getNumRows(); j++) {
table.setRow(j);
list.add(mapToMap(table));
}
map.put(sapFieldName, list);
} else {
final Object value = jcoField.getValue();
map.put(sapFieldName, value);
}
}
return map;
}
示例8: getStructureParameter
import com.sap.conn.jco.JCoField; //导入依赖的package包/类
private LinkedHashMap getStructureParameter(JCoField structure)
{
JCoFieldIterator iter = structure.getStructure().getFieldIterator();
LinkedHashMap m = new LinkedHashMap();
while(iter.hasNextField())
{
JCoField f = iter.nextField();
m.put(f.getName(), structure.getStructure().getValue(f.getName()));
}
return m;
}
示例9: setSimpleParameterValue
import com.sap.conn.jco.JCoField; //导入依赖的package包/类
private void setSimpleParameterValue(JCoFieldIterator iter,String name, Object value)
{
while(iter.hasNextField())
{
JCoField f = iter.nextField();
if(f.getName().equals(name) &!f.isStructure() &!f.isTable())
{
f.setValue(value);
}
}
}
示例10: setTableParameter
import com.sap.conn.jco.JCoField; //导入依赖的package包/类
/**
* Sets a single Table parameter that is a structure
* @param name the name of the parameter
* @param list The value of the parameter (A LinkedList of LinkedHashmaps)
*/
public void setTableParameter(String name, LinkedList list)
{
//Find table parameter with this name and set the appropriate valies
JCoFieldIterator iter = function.getTableParameterList().getFieldIterator();
while(iter.hasNextField())
{
JCoField f = iter.nextField();
if(f.getName().equals(name) & f.isTable() )
{
Iterator recordIter = list.listIterator();
JCoTable table = f.getTable();
while(recordIter.hasNext())
{
table.appendRow();
LinkedHashMap fields = (LinkedHashMap)recordIter.next();
Iterator fieldIter = fields.entrySet().iterator();
while(fieldIter.hasNext())
{
Entry field = (Map.Entry)fieldIter.next();
table.setValue(field.getKey().toString(), field.getValue().toString());
}
}
}
}
}