예제 #1
0
  public static Object translateOutputModule(BaseModel<?> oldModel) {
    ModuleClp newModel = new ModuleClp();

    newModel.setModelAttributes(oldModel.getModelAttributes());

    newModel.setModuleRemoteModel(oldModel);

    return newModel;
  }
예제 #2
0
  public static Object translateInputModule(BaseModel<?> oldModel) {
    ModuleClp oldClpModel = (ModuleClp) oldModel;

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

    newModel.setModelAttributes(oldClpModel.getModelAttributes());

    return newModel;
  }
예제 #3
0
  public static Object translateInputModule(BaseModel<?> oldModel) {
    ModuleClp oldCplModel = (ModuleClp) oldModel;

    Thread currentThread = Thread.currentThread();

    ClassLoader contextClassLoader = currentThread.getContextClassLoader();

    try {
      currentThread.setContextClassLoader(_classLoader);

      try {
        Class<?> newModelClass =
            Class.forName("com.liferay.marketplace.model.impl.ModuleImpl", 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("setModuleId", new Class[] {Long.TYPE});

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

        method1.invoke(newModel, value1);

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

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

        method2.invoke(newModel, value2);

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

        String value3 = oldCplModel.getContextName();

        method3.invoke(newModel, value3);

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

    return oldModel;
  }
예제 #4
0
  public static Object translateOutputModule(BaseModel<?> oldModel) {
    Thread currentThread = Thread.currentThread();

    ClassLoader contextClassLoader = currentThread.getContextClassLoader();

    try {
      currentThread.setContextClassLoader(_classLoader);

      try {
        ModuleClp newModel = new ModuleClp();

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

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

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

        newModel.setUuid(value0);

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

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

        newModel.setModuleId(value1);

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

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

        newModel.setAppId(value2);

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

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

        newModel.setContextName(value3);

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

    return oldModel;
  }