/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.dynamic.data.mapping.form.evaluator.internal;
import com.liferay.dynamic.data.mapping.data.provider.DDMDataProviderInvoker;
import com.liferay.dynamic.data.mapping.expression.DDMExpressionFactory;
import com.liferay.dynamic.data.mapping.form.evaluator.DDMFormEvaluationException;
import com.liferay.dynamic.data.mapping.form.evaluator.DDMFormEvaluationResult;
import com.liferay.dynamic.data.mapping.form.evaluator.DDMFormEvaluator;
import com.liferay.dynamic.data.mapping.form.evaluator.DDMFormEvaluatorContext;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.json.JSONFactory;
import com.liferay.portal.kernel.service.RoleLocalService;
import com.liferay.portal.kernel.service.UserGroupRoleLocalService;
import com.liferay.portal.kernel.service.UserLocalService;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* @author Pablo Carvalho
*/
@Component(immediate = true, service = DDMFormEvaluator.class)
public class DDMFormEvaluatorImpl implements DDMFormEvaluator {
@Override
public DDMFormEvaluationResult evaluate(
DDMFormEvaluatorContext ddmFormEvaluatorContext)
throws DDMFormEvaluationException {
try {
DDMFormEvaluatorHelper ddmFormRuleEvaluatorHelper =
new DDMFormEvaluatorHelper(
_ddmDataProviderInvoker, _ddmExpressionFactory,
ddmFormEvaluatorContext, _jsonFactory, _roleLocalService,
_userGroupRoleLocalService, _userLocalService);
return ddmFormRuleEvaluatorHelper.evaluate();
}
catch (PortalException pe) {
throw new DDMFormEvaluationException(pe);
}
}
@Reference
private DDMDataProviderInvoker _ddmDataProviderInvoker;
@Reference
private DDMExpressionFactory _ddmExpressionFactory;
@Reference
private JSONFactory _jsonFactory;
@Reference
private RoleLocalService _roleLocalService;
@Reference
private UserGroupRoleLocalService _userGroupRoleLocalService;
@Reference
private UserLocalService _userLocalService;
}