/**
 * Copyright (c) 2015-present Jorge Díaz 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 jorgediazest.indexchecker.model;

import jorgediazest.indexchecker.util.ConfigurationUtil;

import jorgediazest.util.model.Model;
import jorgediazest.util.model.ModelFactory;

/**
 * @author Jorge Díaz
 */
public class IndexCheckerModelFactory extends ModelFactory {

	@Override
	public Model getModelObject(String className) {
		Model model = super.getModelObject(className);

		if (model == null) {
			return null;
		}

		String stringFilter = ConfigurationUtil.getStringFilter(model);

		model.setFilter(model.generateCriterionFilter(stringFilter));

		return model;
	}

}
@@ -621,24 +621,77 @@
 ker.model;%0A%0A
+import com.liferay.portal.kernel.dao.orm.Criterion;%0A%0A
 import jorge
@@ -818,16 +818,61 @@
 Factory;
+%0Aimport jorgediazest.util.model.ModelWrapper;
 %0A%0A/**%0A *
@@ -1184,24 +1184,27 @@
 %0A%0A%09%09
-model.setF
+Criterion f
 ilter
-(
+ = 
 mode
@@ -1242,16 +1242,152 @@
 gFilter)
+;%0A%0A%09%09if (filter == null) %7B%0A%09%09%09return model;%0A%09%09%7D%0A%0A%09%09ModelWrapper modelWrapper = new ModelWrapper(model);%0A%0A%09%09modelWrapper.setFilter(filter
 );%0A%0A%09%09re
@@ -1396,15 +1396,22 @@
 rn model
+Wrapper
 ;%0A%09%7D%0A%0A%7D

Use new ModelWrapper class