001
014
015 package com.liferay.portal.sanitizer;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.sanitizer.Sanitizer;
020 import com.liferay.portal.kernel.sanitizer.SanitizerException;
021 import com.liferay.portal.kernel.util.StreamUtil;
022
023 import java.io.IOException;
024 import java.io.InputStream;
025 import java.io.OutputStream;
026
027 import java.util.Map;
028
029
033 public class DummySanitizerImpl implements Sanitizer {
034
035 @Override
036 public byte[] sanitize(
037 long companyId, long groupId, long userId, String className,
038 long classPK, String contentType, String[] modes, byte[] bytes,
039 Map<String, Object> options) {
040
041 if (_log.isDebugEnabled()) {
042 _log.debug("Sanitizing " + className + "#" + classPK);
043 }
044
045 return bytes;
046 }
047
048 @Override
049 public void sanitize(
050 long companyId, long groupId, long userId, String className,
051 long classPK, String contentType, String[] modes,
052 InputStream inputStream, OutputStream outputStream,
053 Map<String, Object> options)
054 throws SanitizerException {
055
056 if (_log.isDebugEnabled()) {
057 _log.debug("Sanitizing " + className + "#" + classPK);
058 }
059
060 try {
061 StreamUtil.transfer(inputStream, outputStream);
062 }
063 catch (IOException ioe) {
064 throw new SanitizerException(ioe);
065 }
066 }
067
068 @Override
069 public String sanitize(
070 long companyId, long groupId, long userId, String className,
071 long classPK, String contentType, String[] modes, String s,
072 Map<String, Object> options) {
073
074 if (_log.isDebugEnabled()) {
075 _log.debug("Sanitizing " + className + "#" + classPK);
076 }
077
078 return s;
079 }
080
081 private static Log _log = LogFactoryUtil.getLog(DummySanitizerImpl.class);
082
083 }