001package org.apache.archiva.redback.rest.api.model; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * Unless required by applicable law or agreed to in writing, 014 * software distributed under the License is distributed on an 015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 016 * KIND, either express or implied. See the License for the 017 * specific language governing permissions and limitations 018 * under the License. 019 */ 020 021import io.swagger.v3.oas.annotations.media.Schema; 022 023import javax.xml.bind.annotation.XmlRootElement; 024 025/** 026 * @author Martin Stockhammer <martin_s@apache.org> 027 */ 028@XmlRootElement( name = "actionStatus" ) 029@Schema( name = "ActionStatus", description = "Status result of a updating action, like post, put, delete" ) 030public class ActionStatus 031{ 032 private boolean success = false; 033 private int modifiedNumber = 0; 034 035 public static final ActionStatus SUCCESS = new ActionStatus( true ); 036 public static final ActionStatus FAIL = new ActionStatus( false ); 037 038 public static ActionStatus FROM( boolean status ) 039 { 040 return status ? SUCCESS : FAIL; 041 } 042 043 public ActionStatus( ) 044 { 045 046 } 047 048 public ActionStatus( boolean success ) 049 { 050 this.success = success; 051 } 052 053 public ActionStatus( boolean success, int modifiedNumber ) 054 { 055 this.success = success; 056 this.modifiedNumber = modifiedNumber; 057 } 058 059 public boolean isSuccess( ) 060 { 061 return success; 062 } 063 064 public void setSuccess( boolean success ) 065 { 066 this.success = success; 067 } 068 069 public int getModifiedNumber( ) 070 { 071 return modifiedNumber; 072 } 073 074 public void setModifiedNumber( int modifiedNumber ) 075 { 076 this.modifiedNumber = modifiedNumber; 077 } 078 079 @Override 080 public String toString( ) 081 { 082 return Boolean.toString( success ); 083 } 084}