Ejemplo n.º 1
0
  public static Object translateOutputAnhXa(BaseModel<?> oldModel) {
    Thread currentThread = Thread.currentThread();

    ClassLoader contextClassLoader = currentThread.getContextClassLoader();

    try {
      currentThread.setContextClassLoader(_classLoader);

      try {
        AnhXaClp newModel = new AnhXaClp();

        Class<?> oldModelClass = oldModel.getClass();

        Method method0 = oldModelClass.getMethod("getId");

        Long value0 = (Long) method0.invoke(oldModel, (Object[]) null);

        newModel.setId(value0);

        Method method1 = oldModelClass.getMethod("getMaDNG");

        String value1 = (String) method1.invoke(oldModel, (Object[]) null);

        newModel.setMaDNG(value1);

        Method method2 = oldModelClass.getMethod("getTenDNG");

        String value2 = (String) method2.invoke(oldModel, (Object[]) null);

        newModel.setTenDNG(value2);

        Method method3 = oldModelClass.getMethod("getMaKhac");

        String value3 = (String) method3.invoke(oldModel, (Object[]) null);

        newModel.setMaKhac(value3);

        Method method4 = oldModelClass.getMethod("getTenKhac");

        String value4 = (String) method4.invoke(oldModel, (Object[]) null);

        newModel.setTenKhac(value4);

        Method method5 = oldModelClass.getMethod("getTenBang");

        String value5 = (String) method5.invoke(oldModel, (Object[]) null);

        newModel.setTenBang(value5);

        Method method6 = oldModelClass.getMethod("getUngDungId");

        Long value6 = (Long) method6.invoke(oldModel, (Object[]) null);

        newModel.setUngDungId(value6);

        Method method7 = oldModelClass.getMethod("getNgayTao");

        Date value7 = (Date) method7.invoke(oldModel, (Object[]) null);

        newModel.setNgayTao(value7);

        Method method8 = oldModelClass.getMethod("getNguoiTao");

        String value8 = (String) method8.invoke(oldModel, (Object[]) null);

        newModel.setNguoiTao(value8);

        Method method9 = oldModelClass.getMethod("getNgaySua");

        Date value9 = (Date) method9.invoke(oldModel, (Object[]) null);

        newModel.setNgaySua(value9);

        Method method10 = oldModelClass.getMethod("getNguoiSua");

        String value10 = (String) method10.invoke(oldModel, (Object[]) null);

        newModel.setNguoiSua(value10);

        Method method11 = oldModelClass.getMethod("getDaXoa");

        Integer value11 = (Integer) method11.invoke(oldModel, (Object[]) null);

        newModel.setDaXoa(value11);

        return newModel;
      } catch (Exception e) {
        _log.error(e, e);
      }
    } finally {
      currentThread.setContextClassLoader(contextClassLoader);
    }

    return oldModel;
  }
Ejemplo n.º 2
0
  public static Object translateInputAnhXa(BaseModel<?> oldModel) {
    AnhXaClp oldCplModel = (AnhXaClp) oldModel;

    Thread currentThread = Thread.currentThread();

    ClassLoader contextClassLoader = currentThread.getContextClassLoader();

    try {
      currentThread.setContextClassLoader(_classLoader);

      try {
        Class<?> newModelClass =
            Class.forName("org.oep.cmon.dao.thamso.model.impl.AnhXaImpl", true, _classLoader);

        Object newModel = newModelClass.newInstance();

        Method method0 = newModelClass.getMethod("setId", new Class[] {Long.TYPE});

        Long value0 = new Long(oldCplModel.getId());

        method0.invoke(newModel, value0);

        Method method1 = newModelClass.getMethod("setMaDNG", new Class[] {String.class});

        String value1 = oldCplModel.getMaDNG();

        method1.invoke(newModel, value1);

        Method method2 = newModelClass.getMethod("setTenDNG", new Class[] {String.class});

        String value2 = oldCplModel.getTenDNG();

        method2.invoke(newModel, value2);

        Method method3 = newModelClass.getMethod("setMaKhac", new Class[] {String.class});

        String value3 = oldCplModel.getMaKhac();

        method3.invoke(newModel, value3);

        Method method4 = newModelClass.getMethod("setTenKhac", new Class[] {String.class});

        String value4 = oldCplModel.getTenKhac();

        method4.invoke(newModel, value4);

        Method method5 = newModelClass.getMethod("setTenBang", new Class[] {String.class});

        String value5 = oldCplModel.getTenBang();

        method5.invoke(newModel, value5);

        Method method6 = newModelClass.getMethod("setUngDungId", new Class[] {Long.TYPE});

        Long value6 = new Long(oldCplModel.getUngDungId());

        method6.invoke(newModel, value6);

        Method method7 = newModelClass.getMethod("setNgayTao", new Class[] {Date.class});

        Date value7 = oldCplModel.getNgayTao();

        method7.invoke(newModel, value7);

        Method method8 = newModelClass.getMethod("setNguoiTao", new Class[] {String.class});

        String value8 = oldCplModel.getNguoiTao();

        method8.invoke(newModel, value8);

        Method method9 = newModelClass.getMethod("setNgaySua", new Class[] {Date.class});

        Date value9 = oldCplModel.getNgaySua();

        method9.invoke(newModel, value9);

        Method method10 = newModelClass.getMethod("setNguoiSua", new Class[] {String.class});

        String value10 = oldCplModel.getNguoiSua();

        method10.invoke(newModel, value10);

        Method method11 = newModelClass.getMethod("setDaXoa", new Class[] {Integer.TYPE});

        Integer value11 = new Integer(oldCplModel.getDaXoa());

        method11.invoke(newModel, value11);

        return newModel;
      } catch (Exception e) {
        _log.error(e, e);
      }
    } finally {
      currentThread.setContextClassLoader(contextClassLoader);
    }

    return oldModel;
  }