Ejemplo n.º 1
0
  public static Object translateOutputApp(BaseModel<?> oldModel) {
    AppClp newModel = new AppClp();

    newModel.setModelAttributes(oldModel.getModelAttributes());

    newModel.setAppRemoteModel(oldModel);

    return newModel;
  }
Ejemplo n.º 2
0
  public static Object translateInputApp(BaseModel<?> oldModel) {
    AppClp oldClpModel = (AppClp) oldModel;

    BaseModel<?> newModel = oldClpModel.getAppRemoteModel();

    newModel.setModelAttributes(oldClpModel.getModelAttributes());

    return newModel;
  }
Ejemplo n.º 3
0
  public static Object translateOutputApp(BaseModel<?> oldModel) {
    Thread currentThread = Thread.currentThread();

    ClassLoader contextClassLoader = currentThread.getContextClassLoader();

    try {
      currentThread.setContextClassLoader(_classLoader);

      try {
        AppClp newModel = new AppClp();

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

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

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

        newModel.setUuid(value0);

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

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

        newModel.setAppId(value1);

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

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

        newModel.setCompanyId(value2);

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

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

        newModel.setUserId(value3);

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

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

        newModel.setUserName(value4);

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

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

        newModel.setCreateDate(value5);

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

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

        newModel.setModifiedDate(value6);

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

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

        newModel.setRemoteAppId(value7);

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

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

        newModel.setVersion(value8);

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

    return oldModel;
  }
Ejemplo n.º 4
0
  public static Object translateInputApp(BaseModel<?> oldModel) {
    AppClp oldCplModel = (AppClp) oldModel;

    Thread currentThread = Thread.currentThread();

    ClassLoader contextClassLoader = currentThread.getContextClassLoader();

    try {
      currentThread.setContextClassLoader(_classLoader);

      try {
        Class<?> newModelClass =
            Class.forName("com.liferay.marketplace.model.impl.AppImpl", true, _classLoader);

        Object newModel = newModelClass.newInstance();

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

        String value0 = oldCplModel.getUuid();

        method0.invoke(newModel, value0);

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

        Long value1 = new Long(oldCplModel.getAppId());

        method1.invoke(newModel, value1);

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

        Long value2 = new Long(oldCplModel.getCompanyId());

        method2.invoke(newModel, value2);

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

        Long value3 = new Long(oldCplModel.getUserId());

        method3.invoke(newModel, value3);

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

        String value4 = oldCplModel.getUserName();

        method4.invoke(newModel, value4);

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

        Date value5 = oldCplModel.getCreateDate();

        method5.invoke(newModel, value5);

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

        Date value6 = oldCplModel.getModifiedDate();

        method6.invoke(newModel, value6);

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

        Long value7 = new Long(oldCplModel.getRemoteAppId());

        method7.invoke(newModel, value7);

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

        String value8 = oldCplModel.getVersion();

        method8.invoke(newModel, value8);

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

    return oldModel;
  }