001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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    }