1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.sanitizer;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.sanitizer.Sanitizer;
20  import com.liferay.portal.kernel.sanitizer.SanitizerException;
21  import com.liferay.portal.kernel.util.StreamUtil;
22  
23  import java.io.IOException;
24  import java.io.InputStream;
25  import java.io.OutputStream;
26  
27  import java.util.Map;
28  
29  /**
30   * <a href="DummySanitizerImpl.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Zsolt Balogh
33   * @author Brian Wing Shun Chan
34   */
35  public class DummySanitizerImpl implements Sanitizer {
36  
37      public byte[] sanitize(
38          long companyId, long groupId, long userId, String className,
39          long classPK, String contentType, String[] modes, byte[] byteArray,
40          Map<String, Object> options) {
41  
42          if (_log.isDebugEnabled()) {
43              _log.debug("Sanitizing " + className + "#" + classPK);
44          }
45  
46          return byteArray;
47      }
48  
49      public void sanitize(
50              long companyId, long groupId, long userId, String className,
51              long classPK, String contentType, String[] modes,
52              InputStream inputStream, OutputStream outputStream,
53              Map<String, Object> options)
54          throws SanitizerException {
55  
56          if (_log.isDebugEnabled()) {
57              _log.debug("Sanitizing " + className + "#" + classPK);
58          }
59  
60          try {
61              StreamUtil.transfer(inputStream, outputStream);
62          }
63          catch (IOException ioe) {
64              throw new SanitizerException(ioe);
65          }
66      }
67  
68      public String sanitize(
69          long companyId, long groupId, long userId, String className,
70          long classPK, String contentType, String[] modes, String s,
71          Map<String, Object> options) {
72  
73          if (_log.isDebugEnabled()) {
74              _log.debug("Sanitizing " + className + "#" + classPK);
75          }
76  
77          return s;
78      }
79  
80      private static Log _log = LogFactoryUtil.getLog(DummySanitizerImpl.class);
81  
82  }