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.

EntityNotFoundException.java 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 requested entity does not exist.
  37. *
  38. * @author Martin Stockhammer <martin_s@apache.org>
  39. * @since 3.0
  40. */
  41. public class EntityNotFoundException extends RepositoryAdminException
  42. {
  43. public static final String KEY = "entity.not_found";
  44. public static EntityNotFoundException of(String... parameters) {
  45. String message = getMessage( KEY, parameters );
  46. return new EntityNotFoundException( message, parameters );
  47. }
  48. public static EntityNotFoundException ofMessage(String message, String... parameters) {
  49. return new EntityNotFoundException( message, parameters );
  50. }
  51. public EntityNotFoundException( String s, String... parameters )
  52. {
  53. super( s );
  54. setKey( KEY );
  55. setParameters( parameters );
  56. }
  57. public EntityNotFoundException( String s, String fieldName, String... parameters )
  58. {
  59. super( s, fieldName );
  60. setKey( KEY );
  61. setParameters( parameters );
  62. }
  63. public EntityNotFoundException( String message, Throwable cause, String... parameters )
  64. {
  65. super( message, cause );
  66. setKey( KEY );
  67. setParameters( parameters );
  68. }
  69. public EntityNotFoundException( String message, Throwable cause, String fieldName, String... parameters )
  70. {
  71. super( message, cause, fieldName );
  72. setKey( KEY );
  73. setParameters( parameters );
  74. }
  75. }