001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.maven.scm;
020
021import java.io.Serializable;
022
023/**
024 * @author Olivier Lamy
025 * @since 1.2
026 */
027public class ScmTagParameters implements Serializable {
028    private static final long serialVersionUID = 7241536408630606807L;
029
030    private String message;
031
032    private boolean remoteTagging = false;
033
034    private boolean pinExternals = false;
035
036    private CommandParameters.SignOption signOption;
037
038    private String scmRevision;
039
040    public ScmTagParameters() {
041        this.remoteTagging = false;
042        this.pinExternals = false;
043        this.signOption = CommandParameters.SignOption.DEFAULT;
044    }
045
046    public ScmTagParameters(String message) {
047        this.message = message;
048    }
049
050    public String getMessage() {
051        return message;
052    }
053
054    public void setMessage(String message) {
055        this.message = message;
056    }
057
058    public boolean isRemoteTagging() {
059        return remoteTagging;
060    }
061
062    public void setRemoteTagging(boolean remoteTagging) {
063        this.remoteTagging = remoteTagging;
064    }
065
066    public boolean isPinExternals() {
067        return pinExternals;
068    }
069
070    public void setPinExternals(boolean pinExternals) {
071        this.pinExternals = pinExternals;
072    }
073
074    /**
075     * @return true if the tag operation should be signed, false otherwise
076     * @deprecated use {@link #getSignOption()} instead
077     */
078    @Deprecated
079    public boolean isSign() {
080        return signOption == CommandParameters.SignOption.FORCE_SIGN;
081    }
082
083    /**
084     * Set the signing option for the tag operation.
085     *
086     * @param sign
087     * @deprecated use {@link #setSignOption(org.apache.maven.scm.CommandParameters.SignOption)} instead
088     */
089    @Deprecated
090    public void setSign(boolean sign) {
091        signOption = sign ? CommandParameters.SignOption.FORCE_SIGN : CommandParameters.SignOption.DEFAULT;
092    }
093
094    public String getScmRevision() {
095        return scmRevision;
096    }
097
098    public void setScmRevision(String scmRevision) {
099        this.scmRevision = scmRevision;
100    }
101
102    /**
103     * Get the signing option for the tag operation.
104     *
105     * @return the signing option
106     * @since 2.2.1
107     */
108    public CommandParameters.SignOption getSignOption() {
109        return signOption;
110    }
111
112    /**
113     * Set the signing option for the tag operation.
114     *
115     * @param signOption
116     * @since 2.2.1
117     */
118    public void setSignOption(CommandParameters.SignOption signOption) {
119        this.signOption = signOption;
120    }
121
122    @Override
123    public String toString() {
124        return "ScmTagParameters{" + "message='"
125                + message + '\'' + ", remoteTagging="
126                + remoteTagging + ", pinExternals="
127                + pinExternals + ", signOption="
128                + signOption + ", scmRevision='"
129                + scmRevision + '\'' + '}';
130    }
131}