Package hu.sztaki.ilab.longneck

Examples of hu.sztaki.ilab.longneck.Field


        return false;
    }

    @Override
    public Object getValue(String fieldName) throws IllegalArgumentException {
      Field f = record.get(DatabaseUtils.revertReplacedBindVariableDashes(fieldName));
      if (f == null) {
        return null;
      }
      return f.getValue();
    }
View Full Code Here


            }
            // Create record instance
            Record r = recordClass.newInstance();
            // Read fields
            for (int i = 0; i < columns.size(); ++i) {
                r.add(new Field(columns.get(i), resultSet.getString(i + 1)));
            }
           
            return r;
           
        } catch (SQLException ex) {
View Full Code Here

                         " (process definition) vs. " + values.length + " (CSV file line): \n" +
                         csvReader.getRawRecord() );
                values = getNextRecordValues() ;
            }
            for (int i = 0; i < values.length; ++i) {
                result.add(new Field(columns[i], values[i]));
            }

        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
View Full Code Here

           
            for (Record record : records) {
                Map<String, Field> fields = record.getFields();
                for (String fname : headerFieldMapping.values()) {
                   
                    Field f = fields.get(fname);
                    String val = (f == null) ? emptyValue : f.getValue();
                    writer.write(val);  
                }
                writer.endRecord();
            }
        } catch (FileNotFoundException e) {
View Full Code Here

            Map<String, String> alias = mapping.getNames();
            for (Map.Entry<String, String> entry : alias.entrySet()) {
                String key = entry.getKey();
                String value = entry.getValue();
                if(parent.has(value)) {
                    fields.put(key, new Field(key, parent.get(value).getValue()));
                }
            }
        }
    }
View Full Code Here

                        // Assign value to existsing field
                        parent.get(value).setValue(this.get(key).getValue());

                    } catch (NullPointerException ex) {
                        // Create new field with specified value
                        parent.add(new Field(value, this.get(key).getValue()));
                    }
                } else if (parent.has(value)) {
                    // Questioned: Not neccesary to remove.
                    parent.remove(value);
                } else {
View Full Code Here

               
                List<Field> cacheValue = new ArrayList<Field>(caching.getOutputFields().size());
               
                for (String s : caching.getOutputFields()) {

                    Field f = record.get(s);
                    if (f == null) {
                        f = new Field(s);
                    }
                    cacheValue.add(f);
                }
               
                caching.putCacheElement(cacheKey, cacheValue);
View Full Code Here

                // Assign value to existsing field
                record.get(name).setValue(value);
               
            } catch (NullPointerException ex) {
                // Create new field with specified value
                record.add(new Field(name, value));
            }
           
        } else {
                scope.setVariable(name.substring(1), value);
        }
View Full Code Here

    public void apply(Record record, VariableSpace parentScope) {
        for (String fname : applyTo) {
            try {
                BlockUtils.setValue(fname, null, record, parentScope);
            } catch (NullPointerException ex) {
                record.add(new Field(fname));
                record.get(fname).setValue(null);
            }
        }
    }
View Full Code Here

        // Set test cases

        TestCase testCase = new TestCase();
        RecordImplForTest sourceRecord = new RecordImplForTest();
        sourceRecord.setRole("source");
        sourceRecord.add(new Field("id", "42"));
        testCase.addRecord(sourceRecord);
        RecordImplForTest targetRecord = new RecordImplForTest();
        targetRecord.setRole("target");
        targetRecord.add(new Field("id", null));
        testCase.addRecord(targetRecord);

        List<TestCase> testCases = new ArrayList<TestCase>();
        testCases.add(testCase);
        process.setTestCases(testCases);

        CompactProcess cProcess = new CompactProcess(process, repository,
            frameAddressResolver, runtimeProperties);

        ProcessTester tester = new ProcessTester(cProcess, true);

        assertTrue(tester.testAll());

        // Add a test that fails

        TestCase testCase2 = new TestCase();
        RecordImplForTest sourceRecord2 = new RecordImplForTest();
        sourceRecord2.setRole("source");
        sourceRecord2.add(new Field("id", "42"));
        testCase2.addRecord(sourceRecord2);
        RecordImplForTest targetRecord2 = new RecordImplForTest();
        targetRecord2.setRole("target");
        targetRecord2.add(new Field("id", "42"));
        testCase2.addRecord(targetRecord2);

        testCases.add(testCase2);

        assertFalse(tester.testAll());
View Full Code Here

TOP

Related Classes of hu.sztaki.ilab.longneck.Field

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.