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.journal.util;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    import com.liferay.portlet.dynamicdatamapping.model.DDMStructure;
019    import com.liferay.portlet.dynamicdatamapping.storage.Fields;
020    
021    /**
022     * @author Marcellus Tavares
023     * @author Bruno Basto
024     */
025    public class JournalConverterUtil {
026    
027            public static String getContent(DDMStructure ddmStructure, Fields ddmFields)
028                    throws Exception {
029    
030                    return getJournalConverter().getContent(ddmStructure, ddmFields);
031            }
032    
033            public static Fields getDDMFields(DDMStructure ddmStructure, String content)
034                    throws Exception {
035    
036                    return getJournalConverter().getDDMFields(ddmStructure, content);
037            }
038    
039            public static String getDDMXSD(String journalXSD) throws Exception {
040                    return getJournalConverter().getDDMXSD(journalXSD);
041            }
042    
043            public static JournalConverter getJournalConverter() {
044                    PortalRuntimePermission.checkGetBeanProperty(
045                            JournalConverterUtil.class);
046    
047                    return _journalConverter;
048            }
049    
050            public static String getJournalXSD(String ddmXSD) throws Exception {
051                    return getJournalConverter().getJournalXSD(ddmXSD);
052            }
053    
054            public void setJournalConverter(JournalConverter journalConverter) {
055                    PortalRuntimePermission.checkSetBeanProperty(getClass());
056    
057                    _journalConverter = journalConverter;
058            }
059    
060            private static JournalConverter _journalConverter;
061    
062    }