public static StatViewCategoryPersistence getPersistence() {
    if (_persistence == null) {
      _persistence =
          (StatViewCategoryPersistence)
              PortletBeanLocatorUtil.locate(
                  com.idetronic.subur.service.ClpSerializer.getServletContextName(),
                  StatViewCategoryPersistence.class.getName());

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

    return _persistence;
  }
Beispiel #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 = _itemSubjectRemoteModel.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(_itemSubjectRemoteModel, remoteParameterValues);

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

    return returnValue;
  }