001
014
015 package com.liferay.portlet.dynamicdatamapping.util;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
020 import com.liferay.portal.model.BaseModel;
021 import com.liferay.portal.service.ServiceContext;
022 import com.liferay.portlet.dynamicdatamapping.storage.Field;
023 import com.liferay.portlet.dynamicdatamapping.storage.Fields;
024
025 import javax.servlet.http.HttpServletRequest;
026 import javax.servlet.http.HttpServletResponse;
027
028
031 public class DDMUtil {
032
033 public static DDM getDDM() {
034 PortalRuntimePermission.checkGetBeanProperty(DDMUtil.class);
035
036 return _ddm;
037 }
038
039 public static Fields getFields(
040 long ddmStructureId, long ddmTemplateId,
041 ServiceContext serviceContext)
042 throws PortalException, SystemException {
043
044 return getDDM().getFields(
045 ddmStructureId, ddmTemplateId, serviceContext);
046 }
047
048 public static Fields getFields(
049 long ddmStructureId, long ddmTemplateId, String fieldNamespace,
050 ServiceContext serviceContext)
051 throws PortalException, SystemException {
052
053 return getDDM().getFields(
054 ddmStructureId, ddmTemplateId, fieldNamespace, serviceContext);
055 }
056
057 public static Fields getFields(
058 long ddmStructureId, ServiceContext serviceContext)
059 throws PortalException, SystemException {
060
061 return getDDM().getFields(ddmStructureId, serviceContext);
062 }
063
064 public static Fields getFields(
065 long ddmStructureId, String fieldNamespace,
066 ServiceContext serviceContext)
067 throws PortalException, SystemException {
068
069 return getDDM().getFields(
070 ddmStructureId, fieldNamespace, serviceContext);
071 }
072
073 public static String getFileUploadPath(BaseModel<?> baseModel) {
074 return getDDM().getFileUploadPath(baseModel);
075 }
076
077 public static void sendFieldFile(
078 HttpServletRequest request, HttpServletResponse response,
079 Field field)
080 throws Exception {
081
082 getDDM().sendFieldFile(request, response, field);
083 }
084
085 public static String uploadFieldFile(
086 long structureId, long storageId, BaseModel<?> baseModel,
087 String fieldName, ServiceContext serviceContext)
088 throws Exception {
089
090 return getDDM().uploadFieldFile(
091 structureId, storageId, baseModel, fieldName, serviceContext);
092 }
093
094 public static String uploadFieldFile(
095 long structureId, long storageId, BaseModel<?> baseModel,
096 String fieldName, String fieldNamespace,
097 ServiceContext serviceContext)
098 throws Exception {
099
100 return getDDM().uploadFieldFile(
101 structureId, storageId, baseModel, fieldName, fieldNamespace,
102 serviceContext);
103 }
104
105 public void setDDM(DDM ddm) {
106 PortalRuntimePermission.checkSetBeanProperty(getClass());
107
108 _ddm = ddm;
109 }
110
111 private static DDM _ddm;
112
113 }