001    /**
002     * Copyright 2005-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.krad.datadictionary.mask;
017    
018    import org.kuali.rice.krad.datadictionary.parse.BeanTag;
019    import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
020    
021    /**
022     * The maskLiteral element is used to completely hide the field value for
023     * unauthorized users. The specified literal will be shown instead of the field
024     * value.
025     *
026     * @author Kuali Rice Team (rice.collab@kuali.org)
027     */
028    @BeanTag(name = "maskFormatterLiteral-bean")
029    public class MaskFormatterLiteral implements MaskFormatter {
030        private static final long serialVersionUID = 3368293409242411693L;
031    
032        protected String literal;
033    
034        public String maskValue(Object value) {
035            return literal;
036        }
037    
038        /**
039         * Gets the literalString attribute.
040         *
041         * @return Returns the literal String.
042         */
043        @BeanTagAttribute(name = "literal")
044        public String getLiteral() {
045            return literal;
046        }
047    
048        /**
049         * Specify the string that will be shown instead of the actual value when masked.
050         */
051        public void setLiteral(String literal) {
052            this.literal = literal;
053        }
054    
055    }