001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.dynamicdatamapping.util;
016    
017    import com.liferay.portal.kernel.search.Document;
018    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
019    import com.liferay.portlet.dynamicdatamapping.model.DDMStructure;
020    import com.liferay.portlet.dynamicdatamapping.storage.Fields;
021    
022    /**
023     * @author Alexander Chow
024     */
025    public class DDMIndexerUtil {
026    
027            public static void addAttributes(
028                    Document document, DDMStructure ddmStructure, Fields fields) {
029    
030                    getDDMIndexer().addAttributes(document, ddmStructure, fields);
031            }
032    
033            public static String encodeName(long ddmStructureId, String fieldName) {
034                    return getDDMIndexer().encodeName(ddmStructureId, fieldName);
035            }
036    
037            public static DDMIndexer getDDMIndexer() {
038                    PortalRuntimePermission.checkGetBeanProperty(DDMIndexerUtil.class);
039    
040                    return _ddmIndexer;
041            }
042    
043            public void setDDMIndexer(DDMIndexer ddmIndexer) {
044                    PortalRuntimePermission.checkSetBeanProperty(getClass());
045    
046                    _ddmIndexer = ddmIndexer;
047            }
048    
049            private static DDMIndexer _ddmIndexer;
050    
051    }