001    /**
002     * Copyright (c) 2000-present 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.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.model.CacheField;
022    import com.liferay.portlet.dynamicdatamapping.io.DDMFormLayoutJSONDeserializerUtil;
023    import com.liferay.portlet.dynamicdatamapping.model.DDMFormLayout;
024    
025    /**
026     * @author Marcellus Tavares
027     */
028    @ProviderType
029    public class DDMStructureLayoutImpl extends DDMStructureLayoutBaseImpl {
030    
031            @Override
032            public DDMFormLayout getDDMFormLayout() {
033                    if (_ddmFormLayout == null) {
034                            try {
035                                    _ddmFormLayout = DDMFormLayoutJSONDeserializerUtil.deserialize(
036                                            getDefinition());
037                            }
038                            catch (Exception e) {
039                                    _log.error(e, e);
040                            }
041                    }
042    
043                    return new DDMFormLayout(_ddmFormLayout);
044            }
045    
046            private static final Log _log = LogFactoryUtil.getLog(
047                    DDMStructureLayoutImpl.class);
048    
049            @CacheField(methodName = "DDMFormLayout")
050            private DDMFormLayout _ddmFormLayout;
051    
052    }