Skip to content

Commit

Permalink
Applying IDE-Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Jul 29, 2023
1 parent d28ddd0 commit 5eb82ec
Show file tree
Hide file tree
Showing 232 changed files with 2,023 additions and 2,181 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public void processEvent(final SystemEvent event) {
log.info("Running on {} ( Version : {} )",
pack.getImplementationTitle() != null ? pack.getImplementationTitle().toUpperCase()
: "cuioss-Common-Ui",
pack.getImplementationVersion() != null ? pack.getImplementationVersion().toUpperCase()
: "unknown");
pack.getImplementationVersion() != null ? pack.getImplementationVersion().toUpperCase() : "unknown");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
import lombok.ToString;

/**
* Messages provider utilized for combining multiple {@link ResourceBundle} usually in the form of a
* {@link ResourceBundleWrapper}. It is normally utilized as a ManagedBean.
* Messages provider utilized for combining multiple {@link ResourceBundle}
* usually in the form of a {@link ResourceBundleWrapper}. It is normally
* utilized as a ManagedBean.
*
* @author Oliver Wolff
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
import java.util.Set;

/**
* Wraps the Bundles managed by cui. It contains a method for accessing the actual message and a
* technical method for the caching of the underlying {@link ResourceBundle}
* Wraps the Bundles managed by cui. It contains a method for accessing the
* actual message and a technical method for the caching of the underlying
* {@link ResourceBundle}
*
* @author Oliver Wolff
*/
Expand All @@ -19,17 +20,19 @@ public interface ResourceBundleWrapper extends Serializable {
* Returns resolved message by given key.
*
* @param key to be looked up
* @return the resolved message if key is defined, otherwise "??[key value]??" will be
* returned and warning will be written
* @throws MissingResourceException if key is unknown and application is in development mode
* @return the resolved message if key is defined, otherwise "??[key value]??"
* will be returned and warning will be written
* @throws MissingResourceException if key is unknown and application is in
* development mode
*/
String getMessage(String key);

/**
* Technical method for {@link ResourceBundle} caching the resolved keys and values @see
* {@link ResourceBundle#getKeys()}
* Technical method for {@link ResourceBundle} caching the resolved keys and
* values @see {@link ResourceBundle#getKeys()}
*
* @return an Enumeration of the keys contained in this ResourceBundle and its parent bundles.
* @return an Enumeration of the keys contained in this ResourceBundle and its
* parent bundles.
*/
default Enumeration<String> getKeys() {
return Collections.enumeration(keySet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

/**
* <p>
* Aggregates a number of configured {@link ResourceBundle} in order to unify the access to multiple
* ResourceBundles.
* Aggregates a number of configured {@link ResourceBundle} in order to unify
* the access to multiple ResourceBundles.
* </p>
* <em>Caution: </em> If {@link ResourceBundleWrapperImpl} is not {@link RequestScoped} you need to
* configure resourceBundleNames as well in order to enable restoring of the
* wrapper after Serialization.
* <em>Caution: </em> If {@link ResourceBundleWrapperImpl} is not
* {@link RequestScoped} you need to configure resourceBundleNames as well in
* order to enable restoring of the wrapper after Serialization.
*
* @author Oliver Wolff
*/
Expand Down Expand Up @@ -55,13 +55,11 @@ public String getMessage(final String key) {
return bundle.getString(key);
}
}
throw new MissingResourceException("No key '" + key
+ "' defined within any of the configuredBundles: "
+ Joiner.on(", ").skipNulls()
.join(resourceBundles.stream().map(ResourceBundle::getBaseBundleName)
.collect(Collectors.toList())),
"ResourceBundleWrapperImpl",
key);
throw new MissingResourceException(
"No key '" + key + "' defined within any of the configuredBundles: "
+ Joiner.on(", ").skipNulls().join(resourceBundles.stream()
.map(ResourceBundle::getBaseBundleName).collect(Collectors.toList())),
"ResourceBundleWrapperImpl", key);
}

/**
Expand All @@ -71,8 +69,7 @@ private List<ResourceBundle> getBundles() {
if (null == resourceBundles || resourceBundles.isEmpty()) {
resourceBundles = new ArrayList<>();
if (null == resourceBundleNames || resourceBundleNames.isEmpty()) {
log.error(
"Unable to restore ResourceBundles. They have been lost because of serialization");
log.error("Unable to restore ResourceBundles. They have been lost because of serialization");
} else {
final var context = FacesContext.getCurrentInstance();
final var application = context.getApplication();
Expand All @@ -98,7 +95,7 @@ public Set<String> keySet() {

@Override
public String getBundleContent() {
return Joiner.on(", ").skipNulls().join(resourceBundles.stream().map(ResourceBundle::getBaseBundleName)
.collect(Collectors.toList()));
return Joiner.on(", ").skipNulls()
.join(resourceBundles.stream().map(ResourceBundle::getBaseBundleName).collect(Collectors.toList()));
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
/**
* <h2>Summary</h2>
* <p>
* The {@link de.cuioss.jsf.api.application.bundle.CuiResourceBundle} provides the composite
* handling of multiple {@link java.util.ResourceBundle}s in a uniform way. The concept name is
* Unified-Resource-Bundle.
* The {@link de.cuioss.jsf.api.application.bundle.CuiResourceBundle} provides
* the composite handling of multiple {@link java.util.ResourceBundle}s in a
* uniform way. The concept name is Unified-Resource-Bundle.
* </p>
* <h2>Introduction</h2>
* <p>
* Every cuioss JSF application uses many resource bundles inside. <br>
* This results in the situation when one page uses different EL-expressions to refer to bundles in
* order to resolve labels, i.e. <code>#{cui_msg['key']}</code> or <code>#{msg['key']}</code> or
* <code>#{vendor['key']}</code> and so on. It is not that easy to handle i18nized strings in xhtml
* with this approach.
* This results in the situation when one page uses different EL-expressions to
* refer to bundles in order to resolve labels, i.e.
* <code>#{cui_msg['key']}</code> or <code>#{msg['key']}</code> or
* <code>#{vendor['key']}</code> and so on. It is not that easy to handle
* i18nized strings in xhtml with this approach.
* </p>
* <p>
* The concept of the Unified-Resource-Bundle allows to use one EL-expression to refer to all
* bundles within the application in a unified way / notation.
* The concept of the Unified-Resource-Bundle allows to use one EL-expression to
* refer to all bundles within the application in a unified way / notation.
* </p>
* <h2>Unified access to resource bundles</h2>
* <p>
* CUI applications should initialize
* {@link de.cuioss.jsf.api.application.bundle.CuiResourceBundle} in faces-context as request
* scoped bean with the name
* {@link de.cuioss.jsf.api.application.bundle.CuiResourceBundle#BEAN_NAME} . This bean
* extends {@link java.util.ResourceBundle} class which allows to use it as common resourceBundle.
* {@link de.cuioss.jsf.api.application.bundle.CuiResourceBundle} in
* faces-context as request scoped bean with the name
* {@link de.cuioss.jsf.api.application.bundle.CuiResourceBundle#BEAN_NAME} .
* This bean extends {@link java.util.ResourceBundle} class which allows to use
* it as common resourceBundle.
* </p>
*
* <pre>
Expand All @@ -40,22 +42,24 @@
}
* </pre>
* <p>
* This bean allows us to refer to the {@link java.util.ResourceBundle} as usual EL-expression:
* <code>#{msgs['key']}</code>
* This bean allows us to refer to the {@link java.util.ResourceBundle} as usual
* EL-expression: <code>#{msgs['key']}</code>
* </p>
* <p>
* CuiResourceBundle requires the implementation of
* {@link de.cuioss.jsf.api.application.bundle.ResourceBundleWrapper} as parameter. This
* interface has an own method to resolve messages:
* {@link de.cuioss.jsf.api.application.bundle.ResourceBundleWrapper#getMessage(String)} It
* can be implemented within a portal application or the basic CUI implementation can be used.
* {@link de.cuioss.jsf.api.application.bundle.ResourceBundleWrapper} as
* parameter. This interface has an own method to resolve messages:
* {@link de.cuioss.jsf.api.application.bundle.ResourceBundleWrapper#getMessage(String)}
* It can be implemented within a portal application or the basic CUI
* implementation can be used.
* </p>
* <p>
* The basic implementation
* {@link de.cuioss.jsf.api.application.bundle.ResourceBundleWrapperImpl} requires a
* {@link java.util.List} of {@link java.util.ResourceBundle}s that are configured as
* <code>resourceBundles</code> and a {@link java.util.List} of {@link java.lang.String} that are
* configured as <code>resourceBundleNames</code> variables in faces-context. The second
* {@link de.cuioss.jsf.api.application.bundle.ResourceBundleWrapperImpl}
* requires a {@link java.util.List} of {@link java.util.ResourceBundle}s that
* are configured as <code>resourceBundles</code> and a {@link java.util.List}
* of {@link java.lang.String} that are configured as
* <code>resourceBundleNames</code> variables in faces-context. The second
* configuration is necessary in order to enable deserialization of the
* {@link de.cuioss.jsf.api.application.bundle.ResourceBundleWrapperImpl}
* </p>
Expand Down Expand Up @@ -88,25 +92,28 @@
* <p>
* The implementation of
* {@link de.cuioss.jsf.api.application.bundle.ResourceBundleWrapper#getMessage(String)}
* method iterates through the bundles variables and tries to resolve label in every of them. Once a
* message is resolved it will be returned.
* method iterates through the bundles variables and tries to resolve label in
* every of them. Once a message is resolved it will be returned.
* </p>
* <h2>Usage in components and beans</h2>
* <p>
* Because the {@link de.cuioss.jsf.api.application.bundle.CuiResourceBundle} is exposed as a
* managed bean you can access it with
* Because the {@link de.cuioss.jsf.api.application.bundle.CuiResourceBundle} is
* exposed as a managed bean you can access it with
* {@link de.cuioss.jsf.api.application.bundle.CuiResourceBundleAccessor}
* </p>
* <h2>Profit</h2>
* <p>
* The developer has still access to all resource bundles in the application, all "own" pages from
* any portal applications will still work.<br>
* The unified way to access label is the same like the access to usual resource bundle.<br>
* It is possible to override keys in different bundles, because first bundle in the list will win.
* <br>
* No need to remember all bundle names since it is configured once. Easy re-factoring: keys can be
* moved in other bundles without changes in the xhtml.<br>
* Since the beans are request scoped there is no need to care about locale-changes.
* The developer has still access to all resource bundles in the application,
* all "own" pages from any portal applications will still work.<br>
* The unified way to access label is the same like the access to usual resource
* bundle.<br>
* It is possible to override keys in different bundles, because first bundle in
* the list will win. <br>
* No need to remember all bundle names since it is configured once. Easy
* re-factoring: keys can be moved in other bundles without changes in the
* xhtml.<br>
* Since the beans are request scoped there is no need to care about
* locale-changes.
* </p>
*
* @author Oliver Wolff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,43 @@
public interface HistoryConfiguration extends Serializable {

/**
* @return The fallback url to be used if history is empty. <em>Caution:</em> Currently we do
* not consider parameter for this url, we utilize it as outcome only. May be null but
* than {@link #getFallbackOutcome()} must not be null
* @return The fallback url to be used if history is empty. <em>Caution:</em>
* Currently we do not consider parameter for this url, we utilize it as
* outcome only. May be null but than {@link #getFallbackOutcome()} must
* not be null
*/
String getFallback();

/**
* @return The outcome-variant of the fallback. The configuration must either provide a
* {@link #getFallback()} or {@link #getFallbackOutcome()}
* @return The outcome-variant of the fallback. The configuration must either
* provide a {@link #getFallback()} or {@link #getFallbackOutcome()}
*/
String getFallbackOutcome();

/**
* @return Defines the count of the available history entries. Sensible default is 10 It must be
* in the range 1 &lt; historySize &lt; 100
* @return Defines the count of the available history entries. Sensible default
* is 10 It must be in the range 1 &lt; historySize &lt; 100
*/
int getHistorySize();

/**
* @return The String ids of the parameters to be excluded. <em>Caution: </em> the checks are
* against lower-case, therefore the excludes should be lower-case as well, because else
* they will be ignored.
* @return The String ids of the parameters to be excluded. <em>Caution: </em>
* the checks are against lower-case, therefore the excludes should be
* lower-case as well, because else they will be ignored.
*/
List<String> getExcludeParameter();

/**
* Indicates whether to filter jsf specific technical parameter. Sensible default is true
* Indicates whether to filter jsf specific technical parameter. Sensible
* default is true
*
* @return the boolean flag
*/
boolean isExcludeFacesParameter();

/**
* @return a view matcher that checks whether the given view is to be added to history at all.
* @return a view matcher that checks whether the given view is to be added to
* history at all.
*/
ViewMatcher getExcludeFromHistoryMatcher();
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,35 @@
public interface HistoryManager extends Serializable, Iterable<ViewIdentifier> {

/**
* @return the current view, that is not put history yet. If no navigation done before, the
* default "home" configured {@linkplain ViewIdentifier} will be retrieved
* @return the current view, that is not put history yet. If no navigation done
* before, the default "home" configured {@linkplain ViewIdentifier}
* will be retrieved
*/
ViewIdentifier getCurrentView();

/**
* Adds the current view to the {@link HistoryManager}. This method is usually called
* programmatically, not by an {@link ComponentSystemEvent}. Within the CUI-portal this is done
* with a {@link PhaseListener}. <em>Caution</em>: The caller must ensure that this method is
* not called with {@link FacesContext#isPostback()}
* Adds the current view to the {@link HistoryManager}. This method is usually
* called programmatically, not by an {@link ComponentSystemEvent}. Within the
* CUI-portal this is done with a {@link PhaseListener}. <em>Caution</em>: The
* caller must ensure that this method is not called with
* {@link FacesContext#isPostback()}
*
* @param viewId must not be null.
*/
void addCurrentUriToHistory(ViewDescriptor viewId);

/**
* This methods checks whether a page was reloaded using f5 or the corresponding link.
* <h3>
* Assumptions</h3>
* This methods checks whether a page was reloaded using f5 or the corresponding
* link.
* <h3>Assumptions</h3>
* <ul>
* <li>This works for pages which participate in HistoryManager by calling
* {@link #addCurrentUriToHistory(ViewDescriptor)} with a {@link PostAddToViewEvent} on the
* page</li>
* <li>This method <em>must</em> be called within the initViewAction or {@link PostConstruct}
* because
* otherwise the algorithm will not work.</li>
* <li>Calling from a different part of the lifecycle will result in a false positive check.
* </li>
* {@link #addCurrentUriToHistory(ViewDescriptor)} with a
* {@link PostAddToViewEvent} on the page</li>
* <li>This method <em>must</em> be called within the initViewAction or
* {@link PostConstruct} because otherwise the algorithm will not work.</li>
* <li>Calling from a different part of the lifecycle will result in a false
* positive check.</li>
* </ul>
*
* @return boolean indicating whether the current page is reloaded.
Expand All @@ -67,14 +68,16 @@ public interface HistoryManager extends Serializable, Iterable<ViewIdentifier> {
ParameterFilter getParameterFilter();

/**
* @return the previous page. If there is none found it returns the defaultpage. The found
* ViewIdentifer, if it is not the fallback, will be <em>removed</em> from the history
* @return the previous page. If there is none found it returns the defaultpage.
* The found ViewIdentifer, if it is not the fallback, will be
* <em>removed</em> from the history
*/
ViewIdentifier popPrevious();

/**
* @return the previous page. If there is none found it returns the default page. The found
* ViewIdentifer, if it is not the fallback, will be <em>kept</em> from the history
* @return the previous page. If there is none found it returns the default
* page. The found ViewIdentifer, if it is not the fallback, will be
* <em>kept</em> from the history
*/
ViewIdentifier peekPrevious();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import de.cuioss.jsf.api.common.accessor.ManagedBeanAccessor;

/**
* Helper class for accessing instances of {@link HistoryManager} within objects that are not under
* control of the MangedBeanFacility, e.g. Converter, validators, components.
* Helper class for accessing instances of {@link HistoryManager} within objects
* that are not under control of the MangedBeanFacility, e.g. Converter,
* validators, components.
*
* @author Oliver Wolff
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* <ul>
* <li>historySize=10</li>
* <li>excludeFacesParameter=true</li>
* <li>excludeFromHistoryMatcher = {@link EmptyViewMatcher} that will always return false.
* <li>excludeFromHistoryMatcher = {@link EmptyViewMatcher} that will always
* return false.
* <li>
* </ul>
*
Expand Down
Loading

0 comments on commit 5eb82ec

Please sign in to comment.