Exemplo n.º 1
0
  public static EmployeePersistence getPersistence() {
    if (_persistence == null) {
      _persistence =
          (EmployeePersistence)
              PortletBeanLocatorUtil.locate(
                  com.rknowsys.eapp.hrm.service.ClpSerializer.getServletContextName(),
                  EmployeePersistence.class.getName());

      ReferenceRegistry.registerReference(EmployeeUtil.class, "_persistence");
    }

    return _persistence;
  }
Exemplo n.º 2
0
  public Object invokeOnRemoteModel(
      String methodName, Class<?>[] parameterTypes, Object[] parameterValues) throws Exception {
    Object[] remoteParameterValues = new Object[parameterValues.length];

    for (int i = 0; i < parameterValues.length; i++) {
      if (parameterValues[i] != null) {
        remoteParameterValues[i] = ClpSerializer.translateInput(parameterValues[i]);
      }
    }

    Class<?> remoteModelClass = _empSalaryRemoteModel.getClass();

    ClassLoader remoteModelClassLoader = remoteModelClass.getClassLoader();

    Class<?>[] remoteParameterTypes = new Class[parameterTypes.length];

    for (int i = 0; i < parameterTypes.length; i++) {
      if (parameterTypes[i].isPrimitive()) {
        remoteParameterTypes[i] = parameterTypes[i];
      } else {
        String parameterTypeName = parameterTypes[i].getName();

        remoteParameterTypes[i] = remoteModelClassLoader.loadClass(parameterTypeName);
      }
    }

    Method method = remoteModelClass.getMethod(methodName, remoteParameterTypes);

    Object returnValue = method.invoke(_empSalaryRemoteModel, remoteParameterValues);

    if (returnValue != null) {
      returnValue = ClpSerializer.translateOutput(returnValue);
    }

    return returnValue;
  }