Package org.apache.oodt.xmlps.mapping.funcs

Examples of org.apache.oodt.xmlps.mapping.funcs.MappingFunc


    private GenericCDEObjectFactory() throws InstantiationException {
        throw new InstantiationException("Don't construct object factories!");
    }

    public static MappingFunc getMappingFuncFromClassName(String className) {
        MappingFunc func = null;
        Class funcClazz;
        try {
            funcClazz = Class.forName(className);
            func = (MappingFunc) funcClazz.newInstance();
            return func;
View Full Code Here


                                + litElem.getRole() + " instead!");
                    }

                    for (Iterator<MappingFunc> j = fld.getFuncs().iterator(); j
                            .hasNext();) {
                        MappingFunc func = j.next();
                        CDEValue origVal = new CDEValue(fld.getName(),
                                litElem.getValue());
                        CDEValue newVal = func.translate(origVal);
                        litElem.setValue(newVal.getVal());
                    }

                }
View Full Code Here

    return funcs;
  }

  private static MappingFunc getFunc(Element funcElem) {
    String funcClass = funcElem.getAttribute(FUNC_ATTR_CLASS);
    MappingFunc func = GenericCDEObjectFactory
        .getMappingFuncFromClassName(funcClass);

    if (func != null) {
      func.configure(getPropsFromElementAttrs(funcElem.getAttributes()));
    }

    return func;
  }
View Full Code Here

          // go ahead and add it in
          try {
            String elemDbVal = rs.getString(retName);
            for (Iterator<MappingFunc> j = fld.getFuncs().iterator(); j
                .hasNext();) {
              MappingFunc func = j.next();
              CDEValue origVal = new CDEValue(fld.getName(), elemDbVal);
              CDEValue newVal = func.inverseTranslate(origVal);
              elemDbVal = newVal.getVal();
            }

            row.getVals().add(new CDEValue(fld.getName(), elemDbVal));
          } catch (SQLException e) {
View Full Code Here

        assertNotNull(funcField);

        assertNotNull(funcField.getFuncs());
        assertEquals(funcField.getFuncs().size(), 1);

        MappingFunc func = funcField.getFuncs().get(0);
        CDEValue val = new CDEValue("test", "16");
        CDEValue result = func.translate(val);
        assertNotNull(result);
        assertEquals(result.getVal(), "1");
        val.setVal("235");
        result = func.translate(val);
        assertEquals(result.getVal(), "235");
    }
View Full Code Here

        if (fld.getType().equals(FieldType.CONSTANT)) {
          elem.getValues().add(fld.getConstantValue());
        } else {
          String elemDbVal = rs.getString(fld.getDbName());
          for (Iterator<MappingFunc> j = fld.getFuncs().iterator(); j.hasNext();) {
            MappingFunc func = j.next();
            CDEValue origVal = new CDEValue(fld.getName(), elemDbVal);
            CDEValue newVal = func.inverseTranslate(origVal);
            elemDbVal = newVal.getVal();
          }

          elem.getValues().add(elemDbVal);
        }
View Full Code Here

    if (funcs == null || (funcs != null && funcs.size() == 0)) {
      return "";
    } else {
      for (Iterator<MappingFunc> i = funcs.iterator(); i.hasNext();) {
        MappingFunc func = i.next();
        buf.append(func.getClass().getName());
        buf.append(",");
      }

      buf.deleteCharAt(buf.length() - 1);
View Full Code Here

        assertNotNull(funcField);

        assertNotNull(funcField.getFuncs());
        assertEquals(funcField.getFuncs().size(), 1);

        MappingFunc func = funcField.getFuncs().get(0);
        CDEValue val = new CDEValue("test", "16");
        CDEValue result = func.translate(val);
        assertNotNull(result);
        assertEquals(result.getVal(), "1");
        val.setVal("235");
        result = func.translate(val);
        assertEquals(result.getVal(), "235");
    }
View Full Code Here

                                + litElem.getRole() + " instead!");
                    }

                    for (Iterator<MappingFunc> j = fld.getFuncs().iterator(); j
                            .hasNext();) {
                        MappingFunc func = j.next();
                        CDEValue origVal = new CDEValue(fld.getName(),
                                litElem.getValue());
                        CDEValue newVal = func.inverseTranslate(origVal);
                        litElem.setValue(newVal.getVal());
                    }

                }
View Full Code Here

    return funcs;
  }

  private static MappingFunc getFunc(Element funcElem) {
    String funcClass = funcElem.getAttribute(FUNC_ATTR_CLASS);
    MappingFunc func = GenericCDEObjectFactory
        .getMappingFuncFromClassName(funcClass);

    if (func != null) {
      func.configure(getPropsFromElementAttrs(funcElem.getAttributes()));
    }

    return func;
  }
View Full Code Here

TOP

Related Classes of org.apache.oodt.xmlps.mapping.funcs.MappingFunc

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.