Skip to content

Commit

Permalink
WW-3714 Deprecate and migrate assorted marker interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
kusalk committed Oct 22, 2024
1 parent 8ba8ee5 commit 111bc25
Show file tree
Hide file tree
Showing 17 changed files with 412 additions and 196 deletions.
16 changes: 3 additions & 13 deletions core/src/main/java/com/opensymphony/xwork2/ModelDriven.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,8 @@
package com.opensymphony.xwork2;

/**
* ModelDriven Actions provide a model object to be pushed onto the ValueStack
* in addition to the Action itself, allowing a FormBean type approach like Struts.
*
* @author Jason Carreira
* @deprecated since 6.7.0, use {@link org.apache.struts2.ModelDriven} instead.
*/
public interface ModelDriven<T> {

/**
* Gets the model to be pushed onto the ValueStack instead of the Action itself.
*
* @return the model
*/
T getModel();

@Deprecated
public interface ModelDriven<T> extends org.apache.struts2.ModelDriven<T> {
}
17 changes: 3 additions & 14 deletions core/src/main/java/com/opensymphony/xwork2/Preparable.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,8 @@
package com.opensymphony.xwork2;

/**
* Preparable Actions will have their <code>prepare()</code> method called if the {@link com.opensymphony.xwork2.interceptor.PrepareInterceptor}
* is applied to the ActionConfig.
*
* @author Jason Carreira
* @see com.opensymphony.xwork2.interceptor.PrepareInterceptor
* @deprecated since 6.7.0, use {@link org.apache.struts2.Preparable} instead.
*/
public interface Preparable {

/**
* This method is called to allow the action to prepare itself.
*
* @throws Exception thrown if a system level exception occurs.
*/
void prepare() throws Exception;

@Deprecated
public interface Preparable extends org.apache.struts2.Preparable {
}
7 changes: 3 additions & 4 deletions core/src/main/java/com/opensymphony/xwork2/Unchainable.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
package com.opensymphony.xwork2;

/**
* Simple marker interface to indicate an object should <b>not</b> have its properties copied during chaining.
*
* @see com.opensymphony.xwork2.interceptor.ChainingInterceptor
* @deprecated since 6.7.0, use {@link org.apache.struts2.Unchainable} instead.
*/
public interface Unchainable {
@Deprecated
public interface Unchainable extends org.apache.struts2.Unchainable {
}
15 changes: 3 additions & 12 deletions core/src/main/java/com/opensymphony/xwork2/Validateable.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,8 @@
package com.opensymphony.xwork2;

/**
* Provides an interface in which a call for a validation check can be done.
*
* @author Jason Carreira
* @see ActionSupport
* @see com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor
* @deprecated since 6.7.0, use {@link org.apache.struts2.Validateable} instead.
*/
public interface Validateable {

/**
* Performs validation.
*/
void validate();

@Deprecated
public interface Validateable extends org.apache.struts2.Validateable {
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,8 @@
import com.opensymphony.xwork2.ModelDriven;

/**
* Adds the ability to set a model, probably retrieved from a given state.
* @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.ScopedModelDriven} instead.
*/
public interface ScopedModelDriven<T> extends ModelDriven<T> {

/**
* @param model sets the model
*/
void setModel(T model);

/**
* Sets the key under which the model is stored
* @param key The model key
*/
void setScopeKey(String key);

/**
* @return the key under which the model is stored
*/
String getScopeKey();
@Deprecated
public interface ScopedModelDriven<T> extends org.apache.struts2.interceptor.ScopedModelDriven<T>, ModelDriven<T> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,114 +18,9 @@
*/
package com.opensymphony.xwork2.interceptor;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
* ValidationAware classes can accept Action (class level) or field level error messages. Action level messages are kept
* in a Collection. Field level error messages are kept in a Map from String field name to a List of field error msgs.
* @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.ValidationAware} instead.
*/
public interface ValidationAware {

/**
* Set the Collection of Action-level String error messages.
*
* @param errorMessages Collection of String error messages
*/
void setActionErrors(Collection<String> errorMessages);

/**
* Get the Collection of Action-level error messages for this action. Error messages should not
* be added directly here, as implementations are free to return a new Collection or an
* Unmodifiable Collection.
*
* @return Collection of String error messages
*/
Collection<String> getActionErrors();

/**
* Set the Collection of Action-level String messages (not errors).
*
* @param messages Collection of String messages (not errors).
*/
void setActionMessages(Collection<String> messages);

/**
* Get the Collection of Action-level messages for this action. Messages should not be added
* directly here, as implementations are free to return a new Collection or an Unmodifiable
* Collection.
*
* @return Collection of String messages
*/
Collection<String> getActionMessages();

/**
* Set the field error map of fieldname (String) to Collection of String error messages.
*
* @param errorMap field error map
*/
void setFieldErrors(Map<String, List<String>> errorMap);

/**
* Get the field specific errors associated with this action. Error messages should not be added
* directly here, as implementations are free to return a new Collection or an Unmodifiable
* Collection.
*
* @return Map with errors mapped from fieldname (String) to Collection of String error messages
*/
Map<String, List<String>> getFieldErrors();

/**
* Add an Action-level error message to this Action.
*
* @param anErrorMessage the error message
*/
void addActionError(String anErrorMessage);

/**
* Add an Action-level message to this Action.
*
* @param aMessage the message
*/
void addActionMessage(String aMessage);

/**
* Add an error message for a given field.
*
* @param fieldName name of field
* @param errorMessage the error message
*/
void addFieldError(String fieldName, String errorMessage);

/**
* Check whether there are any Action-level error messages.
*
* @return true if any Action-level error messages have been registered
*/
boolean hasActionErrors();

/**
* Checks whether there are any Action-level messages.
*
* @return true if any Action-level messages have been registered
*/
boolean hasActionMessages();

/**
* Checks whether there are any action errors or field errors.
*
* @return <code>(hasActionErrors() || hasFieldErrors())</code>
*/
default boolean hasErrors() {
return hasActionErrors() || hasFieldErrors();
}

/**
* Check whether there are any field errors associated with this action.
*
* @return whether there are any field errors
*/
boolean hasFieldErrors();

@Deprecated
public interface ValidationAware extends org.apache.struts2.interceptor.ValidationAware {
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,8 @@
package com.opensymphony.xwork2.interceptor;

/**
* ValidationErrorAware classes can be notified about validation errors
* before {@link com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor} will return 'inputResultName' result
* to allow change or not the result name
*
* This interface can be only applied to action which already implements {@link ValidationAware} interface!
*
* @since 2.3.15
* @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.ValidationErrorAware} instead.
*/
public interface ValidationErrorAware {

/**
* Allows to notify action about occurred action/field errors
*
* @param currentResultName current result name, action can change it or return the same
* @return new result name or passed currentResultName
*/
String actionErrorOccurred(final String currentResultName);

@Deprecated
public interface ValidationErrorAware extends org.apache.struts2.interceptor.ValidationErrorAware {
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@
package com.opensymphony.xwork2.interceptor;

/**
* ValidationWorkflowAware classes can programmatically change result name when errors occurred
*
* This interface can be only applied to action which already implements {@link ValidationAware} interface!
* @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.ValidationWorkflowAware} instead.
*/
public interface ValidationWorkflowAware {

String getInputResultName();

@Deprecated
public interface ValidationWorkflowAware extends org.apache.struts2.interceptor.ValidationWorkflowAware {
}
36 changes: 36 additions & 0 deletions core/src/main/java/org/apache/struts2/ModelDriven.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2;

/**
* ModelDriven Actions provide a model object to be pushed onto the ValueStack
* in addition to the Action itself, allowing a FormBean type approach like Struts.
*
* @author Jason Carreira
*/
public interface ModelDriven<T> {

/**
* Gets the model to be pushed onto the ValueStack instead of the Action itself.
*
* @return the model
*/
T getModel();

}
37 changes: 37 additions & 0 deletions core/src/main/java/org/apache/struts2/Preparable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2;

/**
* Preparable Actions will have their <code>prepare()</code> method called if the {@link com.opensymphony.xwork2.interceptor.PrepareInterceptor}
* is applied to the ActionConfig.
*
* @author Jason Carreira
* @see com.opensymphony.xwork2.interceptor.PrepareInterceptor
*/
public interface Preparable {

/**
* This method is called to allow the action to prepare itself.
*
* @throws Exception thrown if a system level exception occurs.
*/
void prepare() throws Exception;

}
27 changes: 27 additions & 0 deletions core/src/main/java/org/apache/struts2/Unchainable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2;

/**
* Simple marker interface to indicate an object should <b>not</b> have its properties copied during chaining.
*
* @see com.opensymphony.xwork2.interceptor.ChainingInterceptor
*/
public interface Unchainable {
}
Loading

0 comments on commit 111bc25

Please sign in to comment.