You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EntityExistsException.java 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package org.apache.archiva.admin.model;/*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. * Unless required by applicable law or agreed to in writing,
  12. * software distributed under the License is distributed on an
  13. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. * KIND, either express or implied. See the License for the
  15. * specific language governing permissions and limitations
  16. * under the License.
  17. */
  18. /*
  19. * Licensed to the Apache Software Foundation (ASF) under one
  20. * or more contributor license agreements. See the NOTICE file
  21. * distributed with this work for additional information
  22. * regarding copyright ownership. The ASF licenses this file
  23. * to you under the Apache License, Version 2.0 (the
  24. * "License"); you may not use this file except in compliance
  25. * with the License. You may obtain a copy of the License at
  26. *
  27. * http://www.apache.org/licenses/LICENSE-2.0
  28. * Unless required by applicable law or agreed to in writing,
  29. * software distributed under the License is distributed on an
  30. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  31. * KIND, either express or implied. See the License for the
  32. * specific language governing permissions and limitations
  33. * under the License.
  34. */
  35. /**
  36. * This exception is thrown, if a entity that should be created, exists already.
  37. * @author Martin Stockhammer <martin_s@apache.org>
  38. * @since 3.0
  39. */
  40. public class EntityExistsException extends RepositoryAdminException
  41. {
  42. private static final String KEY = "entity.exists";
  43. public static EntityExistsException of(String... parameters) {
  44. String message = getMessage( KEY, parameters );
  45. return new EntityExistsException( message, parameters );
  46. }
  47. public EntityExistsException( String s, String... parameters )
  48. {
  49. super( s );
  50. setKey( KEY );
  51. setParameters( parameters );
  52. }
  53. public EntityExistsException( String s, String fieldName, String... parameters )
  54. {
  55. super( s, fieldName );
  56. setKey( KEY );
  57. setParameters( parameters );
  58. }
  59. public EntityExistsException( String message, Throwable cause, String... parameters )
  60. {
  61. super( message, cause );
  62. setKey( KEY );
  63. setParameters( parameters );
  64. }
  65. public EntityExistsException( String message, Throwable cause, String fieldName, String... parameters )
  66. {
  67. super( message, cause, fieldName );
  68. setKey( KEY );
  69. setParameters( parameters );
  70. }
  71. }