1 /* 2 * Copyright (c) 2002-2021, City of Paris 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright notice 10 * and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright notice 13 * and the following disclaimer in the documentation and/or other materials 14 * provided with the distribution. 15 * 16 * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its 17 * contributors may be used to endorse or promote products derived from 18 * this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE 24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 * 32 * License 1.0 33 */ 34 package fr.paris.lutece.plugins.workflowcore.service.provider; 35 36 /** 37 * <p> 38 * This class represents a marker for passing values to other tasks. In the Notify task configuration, some fields can contains markers which are replaced by 39 * the actual value of the resource when the {@link fr.paris.lutece.plugins.grubusiness.business.notification.Notification} is send. 40 * </p> 41 * <p> 42 * This class has two goals: 43 * <ul> 44 * <li>To give the description of the marker in the task configuration page</li> 45 * <li>To give the actual value of the resource at sending time</li> 46 * </ul> 47 * </p> 48 * 49 */ 50 public class InfoMarker 51 { 52 private String _strMarker; 53 54 private String _strDescription; 55 56 private Object _data; 57 58 /** 59 * Constructor 60 * 61 * @param marker 62 * the name of the marker 63 * @param data 64 * the value 65 */ 66 public InfoMarker (String marker, Object data) { 67 _strMarker = marker; 68 _data = data; 69 } 70 71 /** 72 * Constructor 73 * 74 * @param strMarker 75 * the marker 76 */ 77 public InfoMarker( String strMarker ) 78 { 79 _strMarker = strMarker; 80 } 81 82 /** 83 * Gives the marker 84 * 85 * @return the marker 86 */ 87 public String getMarker( ) 88 { 89 return _strMarker; 90 } 91 92 /** 93 * <p> 94 * Gives the description of the marker. 95 * </p> 96 * <p> 97 * Used in the task configuration page 98 * </p> 99 * 100 * @return the description 101 */ 102 public String getDescription( ) 103 { 104 return _strDescription; 105 } 106 107 /** 108 * Sets the description of the marker 109 * 110 * @param strDescription 111 * the description to set 112 */ 113 public void setDescription( String strDescription ) 114 { 115 _strDescription = strDescription; 116 } 117 118 /** 119 * Gives the value of the marker. The value is the actual value of the resource. 120 * Used when the notification is sent 121 * 122 * @return the value 123 */ 124 public Object getData( ) 125 { 126 return _data; 127 } 128 129 /** 130 * Sets the value of the marker 131 * 132 * @param data 133 * the value to set 134 */ 135 public void setData( Object data ) 136 { 137 _data = data ; 138 } 139 /** 140 * <p> 141 * Gives the value of the marker. The value is the actual value of the resource. 142 * </p> 143 * <p> 144 * Used when the notification is sent 145 * </p> 146 * 147 * @return the value 148 */ 149 @Deprecated 150 public String getValue( ) 151 { 152 return ( _data != null ? _data.toString( ) : null ); 153 } 154 155 /** 156 * Sets the value of the marker 157 * 158 * @param data 159 * the value to set 160 */ 161 @Deprecated 162 public void setValue( String strData ) 163 { 164 _data = strData; 165 } 166 167 }