001
014
015 package com.liferay.portlet.dynamicdatamapping.model.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.LocaleUtil;
020 import com.liferay.portal.kernel.xml.Document;
021 import com.liferay.portal.kernel.xml.Element;
022 import com.liferay.portal.kernel.xml.SAXReaderUtil;
023 import com.liferay.portal.model.Image;
024 import com.liferay.portal.service.ImageLocalServiceUtil;
025
026 import java.util.Locale;
027
028
031 public class DDMTemplateImpl extends DDMTemplateBaseImpl {
032
033 public DDMTemplateImpl() {
034 }
035
036 public String getDefaultLanguageId() {
037 Document document = null;
038
039 try {
040 document = SAXReaderUtil.read(getName());
041
042 if (document != null) {
043 Element rootElement = document.getRootElement();
044
045 return rootElement.attributeValue("default-locale");
046 }
047 }
048 catch (Exception e) {
049 }
050
051 Locale locale = LocaleUtil.getDefault();
052
053 return locale.toString();
054 }
055
056 public String getSmallImageType() throws PortalException, SystemException {
057 if ((_smallImageType == null) && isSmallImage()) {
058 Image smallImage = ImageLocalServiceUtil.getImage(
059 getSmallImageId());
060
061 _smallImageType = smallImage.getType();
062 }
063
064 return _smallImageType;
065 }
066
067 public void setSmallImageType(String smallImageType) {
068 _smallImageType = smallImageType;
069 }
070
071 private String _smallImageType;
072
073 }