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