This is an automated email from the ASF dual-hosted git repository. surajk pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit a5619831eb92c2408ecc56d9df908f59f4492fba Author: Suraj Khurana <suraj.khur...@hotwax.co> AuthorDate: Sun Sep 13 11:28:00 2020 +0530 Improved: Added missing Javadocs for remaining methods in framework component, this is required for all classes which looks like designed for extension (can be subclassed). (OFBIZ-11947) Thanks Jacques for review. --- .../base/location/ClasspathLocationResolver.java | 7 ++++++ .../org/apache/ofbiz/base/util/URLConnector.java | 6 ++++++ .../container/CrossSubdomainSessionValve.java | 25 +++++++++++++--------- .../org/apache/ofbiz/entity/model/ModelChild.java | 4 ++++ .../ofbiz/entity/model/ModelGroupReader.java | 5 +++++ .../ofbiz/service/engine/AbstractEngine.java | 8 +++++++ .../org/apache/ofbiz/service/group/GroupModel.java | 13 +++++++---- .../ofbiz/service/rmi/RemoteDispatcherImpl.java | 8 +++++++ .../apache/ofbiz/webapp/event/EventFactory.java | 6 ++++++ .../ofbiz/webtools/labelmanager/LabelInfo.java | 8 +++++++ .../ofbiz/widget/model/AbstractModelCondition.java | 11 ++++++++++ .../ofbiz/widget/model/CommonWidgetModels.java | 14 +++++++++++- .../org/apache/ofbiz/widget/model/FieldInfo.java | 12 +++++++++++ .../org/apache/ofbiz/widget/model/HtmlWidget.java | 4 ++++ .../org/apache/ofbiz/widget/model/ModelForm.java | 8 +++++++ .../apache/ofbiz/widget/model/ModelFormField.java | 5 +++++ .../ofbiz/widget/model/ModelScreenWidget.java | 4 ++++ .../ofbiz/widget/model/ModelTreeCondition.java | 4 ++++ .../ofbiz/widget/model/ModelWidgetCondition.java | 9 ++++++++ 19 files changed, 146 insertions(+), 15 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/location/ClasspathLocationResolver.java b/framework/base/src/main/java/org/apache/ofbiz/base/location/ClasspathLocationResolver.java index 974025a..23c7f5c 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/location/ClasspathLocationResolver.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/location/ClasspathLocationResolver.java @@ -34,6 +34,13 @@ public class ClasspathLocationResolver implements LocationResolver { return resolveLocation(location, null); } + /** + * Resolve location url. + * @param location the location + * @param loader the loader + * @return the url + * @throws MalformedURLException the malformed url exception + */ public URL resolveLocation(String location, ClassLoader loader) throws MalformedURLException { String baseLocation = FlexibleLocation.stripLocationType(location); // if there is a leading forward slash, remove it diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/URLConnector.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/URLConnector.java index 174cd3f..9b41456 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/URLConnector.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/URLConnector.java @@ -52,6 +52,12 @@ public class URLConnector { this.hostCertLevel = hostCertLevel; } + /** + * Open connection url connection. + * @param timeout the timeout + * @return the url connection + * @throws IOException the io exception + */ protected synchronized URLConnection openConnection(int timeout) throws IOException { Thread t = new Thread(new URLConnectorThread()); t.start(); diff --git a/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CrossSubdomainSessionValve.java b/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CrossSubdomainSessionValve.java index 8afde01..ac56986 100644 --- a/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CrossSubdomainSessionValve.java +++ b/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CrossSubdomainSessionValve.java @@ -42,7 +42,8 @@ public class CrossSubdomainSessionValve extends ValveBase { super(); } - public @Override void invoke(Request request, Response response) throws IOException, ServletException { + @Override + public void invoke(Request request, Response response) throws IOException, ServletException { // this will cause Request.doGetSession to create the session cookie if necessary request.getSession(true); @@ -61,6 +62,12 @@ public class CrossSubdomainSessionValve extends ValveBase { getNext().invoke(request, response); } + /** + * Replace cookie. + * @param request the request + * @param response the response + * @param cookie the cookie + */ protected void replaceCookie(Request request, Response response, Cookie cookie) { Delegator delegator = (Delegator) request.getAttribute("delegator"); @@ -89,7 +96,6 @@ public class CrossSubdomainSessionValve extends ValveBase { } } - if (UtilValidate.isNotEmpty(cookieDomain)) { Cookie newCookie = new Cookie(cookie.getName(), cookie.getValue()); if (cookie.getPath() != null) { @@ -115,14 +121,13 @@ public class CrossSubdomainSessionValve extends ValveBase { if (mimeHeaders.getName(i).equals("Set-Cookie")) { MessageBytes value = mimeHeaders.getValue(i); if (value.indexOf(cookie.getName()) >= 0) { - String newCookieValue = request.getContext(). - getCookieProcessor().generateHeader(newCookie, request); - if (Debug.verboseOn()) - Debug.logVerbose("CrossSubdomainSessionValve: old Set-Cookie value: " + value.toString(), - MODULE); - if (Debug.verboseOn()) - Debug.logVerbose("CrossSubdomainSessionValve: new Set-Cookie value: " + newCookieValue, - MODULE); + String newCookieValue = request.getContext().getCookieProcessor().generateHeader(newCookie, request); + if (Debug.verboseOn()) { + Debug.logVerbose("CrossSubdomainSessionValve: old Set-Cookie value: " + value.toString(), MODULE); + } + if (Debug.verboseOn()) { + Debug.logVerbose("CrossSubdomainSessionValve: new Set-Cookie value: " + newCookieValue, MODULE); + } value.setString(newCookieValue); } } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelChild.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelChild.java index 3ce5dcb..b509c63 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelChild.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelChild.java @@ -42,6 +42,10 @@ public abstract class ModelChild implements Serializable { this.description = description; } + /** + * Gets model entity. + * @return the model entity + */ public ModelEntity getModelEntity() { return this.modelEntity; } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelGroupReader.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelGroupReader.java index 98505b0..9290b56 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelGroupReader.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelGroupReader.java @@ -100,6 +100,11 @@ public class ModelGroupReader implements Serializable { getGroupCache(delegatorName); } + /** + * Gets group cache. + * @param delegatorName the delegator name + * @return the group cache + */ public Map<String, String> getGroupCache(String delegatorName) { if (this.groupCache == null) { // don't want to block here synchronized (ModelGroupReader.class) { diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/engine/AbstractEngine.java b/framework/service/src/main/java/org/apache/ofbiz/service/engine/AbstractEngine.java index 9fb182a..65f77ea 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/engine/AbstractEngine.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/engine/AbstractEngine.java @@ -107,6 +107,14 @@ public abstract class AbstractEngine implements GenericEngine { } } + /** + * Allow callbacks boolean. + * @param model the model + * @param context the context + * @param mode the mode + * @return the boolean + * @throws GenericServiceException the generic service exception + */ protected boolean allowCallbacks(ModelService model, Map<String, Object> context, int mode) throws GenericServiceException { return true; } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java b/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java index 1b7b941..c3af6c8 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java @@ -38,7 +38,8 @@ public class GroupModel { private static final String MODULE = GroupModel.class.getName(); - private String groupName, sendMode; + private String groupName; + private String sendMode; private List<GroupServiceModel> services; private boolean optional = false; private int lastServiceRan; @@ -71,7 +72,7 @@ public class GroupModel { } if (Debug.verboseOn()) { - Debug.logVerbose("Created Service Group Model --> " + this, MODULE); + Debug.logVerbose("Created Service Group Model --> " + this, MODULE); } } @@ -112,6 +113,10 @@ public class GroupModel { return this.services; } + /** + * Is optional boolean. + * @return the boolean + */ public boolean isOptional() { return optional; } @@ -162,11 +167,11 @@ public class GroupModel { Map<String, Object> result = new HashMap<>(); for (GroupServiceModel model : services) { if (Debug.verboseOn()) { - Debug.logVerbose("Using Context: " + runContext, MODULE); + Debug.logVerbose("Using Context: " + runContext, MODULE); } Map<String, Object> thisResult = model.invoke(dispatcher, localName, runContext); if (Debug.verboseOn()) { - Debug.logVerbose("Result: " + thisResult, MODULE); + Debug.logVerbose("Result: " + thisResult, MODULE); } // make sure we didn't fail diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RemoteDispatcherImpl.java b/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RemoteDispatcherImpl.java index f66b286..7111c67 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RemoteDispatcherImpl.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RemoteDispatcherImpl.java @@ -152,10 +152,18 @@ public class RemoteDispatcherImpl extends UnicastRemoteObject implements RemoteD dispatcher.schedule(serviceName, context, startTime); } + /** + * Deregister. + */ public void deregister() { dispatcher.deregister(); } + /** + * Check export flag. + * @param serviceName the service name + * @throws GenericServiceException the generic service exception + */ protected void checkExportFlag(String serviceName) throws GenericServiceException { ModelService model = dispatcher.getDispatchContext().getModelService(serviceName); if (!model.isExport() && !exportAll) { diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/EventFactory.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/EventFactory.java index b647104..a1f44bf 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/EventFactory.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/EventFactory.java @@ -53,6 +53,12 @@ public class EventFactory { } } + /** + * Gets event handler. + * @param type the type + * @return the event handler + * @throws EventHandlerException the event handler exception + */ public EventHandler getEventHandler(String type) throws EventHandlerException { EventHandler handler = handlers.get(type); if (handler == null) { diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelInfo.java index 6fc58c5..aea0407 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelInfo.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelInfo.java @@ -89,6 +89,14 @@ public class LabelInfo { return labelValues.size(); } + /** + * Sets label value. + * @param localeStr the locale str + * @param labelValue the label value + * @param labelComment the label comment + * @param update the update + * @return the label value + */ public boolean setLabelValue(String localeStr, String labelValue, String labelComment, boolean update) { LabelValue localeFound = getLabelValue(localeStr); boolean isDuplicatedLocales = false; diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java index c8beb08..3d459ba 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java @@ -88,6 +88,10 @@ public abstract class AbstractModelCondition implements Serializable, ModelCondi this.modelWidget = modelWidget; } + /** + * Gets model widget. + * @return the model widget + */ public ModelWidget getModelWidget() { return modelWidget; } @@ -170,6 +174,13 @@ public abstract class AbstractModelCondition implements Serializable, ModelCondi return newInstance(this, modelWidget, conditionElement); } + /** + * New instance model condition. + * @param factory the factory + * @param modelWidget the model widget + * @param conditionElement the condition element + * @return the model condition + */ // TODO: Test extended factory protected ModelCondition newInstance(ModelConditionFactory factory, ModelWidget modelWidget, Element conditionElement) { if (conditionElement == null) { diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/CommonWidgetModels.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/CommonWidgetModels.java index 46b9cf8..042f50d 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/CommonWidgetModels.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/CommonWidgetModels.java @@ -81,6 +81,12 @@ public final class CommonWidgetModels { } } + /** + * Gets parameters map. + * @param context the context + * @param defaultEntityName the default entity name + * @return the parameters map + */ @SuppressWarnings("unchecked") public Map<String, String> getParametersMap(Map<String, Object> context, String defaultEntityName) { Map<String, String> autEntityParams = new HashMap<>(); @@ -109,7 +115,7 @@ public final class CommonWidgetModels { FlexibleMapAccessor<Object> fma = FlexibleMapAccessor.getInstance(fieldName); boolean shouldExclude = excludeList.contains(fieldName); if ((!shouldExclude) && (!field.getIsAutoCreatedInternal()) - && ((field.getIsPk() && includePk) || (!field.getIsPk() && includeNonPk))) { + && ((field.getIsPk() && includePk) || (!field.getIsPk() && includeNonPk))) { Object flexibleValue = fma.get(context); if (UtilValidate.isEmpty(flexibleValue) && context.containsKey("parameters")) { flexibleValue = fma.get((Map<String, Object>) context.get("parameters")); @@ -141,6 +147,12 @@ public final class CommonWidgetModels { } } + /** + * Gets parameters map. + * @param context the context + * @param defaultServiceName the default service name + * @return the parameters map + */ @SuppressWarnings("unchecked") public Map<String, String> getParametersMap(Map<String, Object> context, String defaultServiceName) { Map<String, String> autServiceParams = new HashMap<>(); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/FieldInfo.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/FieldInfo.java index 1246abe..ea5c5e2 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/FieldInfo.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/FieldInfo.java @@ -154,14 +154,26 @@ public abstract class FieldInfo { */ public abstract FieldInfo copy(ModelFormField modelFormField); + /** + * Gets field source. + * @return the field source + */ public int getFieldSource() { return fieldSource; } + /** + * Gets field type. + * @return the field type + */ public int getFieldType() { return fieldType; } + /** + * Gets model form field. + * @return the model form field + */ public ModelFormField getModelFormField() { return modelFormField; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index bd21c03..d9a31e3 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -426,6 +426,10 @@ public class HtmlWidget extends ModelScreenWidget { visitor.visit(this); } + /** + * Gets sub widgets. + * @return the sub widgets + */ public List<ModelScreenWidget> getSubWidgets() { return subWidgets; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java index 8178712..62d9d91 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java @@ -1812,10 +1812,18 @@ public abstract class ModelForm extends ModelWidget { private final String useWhen; private final String style; + /** + * Gets use when. + * @return the use when + */ public String getUseWhen() { return useWhen; } + /** + * Gets style. + * @return the style + */ public String getStyle() { return style; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java index d70f6f2..5c75f73 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java @@ -2665,6 +2665,11 @@ public class ModelFormField { } } + /** + * Gets model grid. + * @param context the context + * @return the model grid + */ public ModelForm getModelGrid(Map<String, Object> context) { String name = this.getGridName(context); String location = this.getGridLocation(context); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java index 6a6f54a..83b9028 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java @@ -108,6 +108,10 @@ public abstract class ModelScreenWidget extends ModelWidget { } } + /** + * Gets model screen. + * @return the model screen + */ public ModelScreen getModelScreen() { return this.modelScreen; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeCondition.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeCondition.java index 2b450d7..7c170df 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeCondition.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeCondition.java @@ -33,6 +33,10 @@ public class ModelTreeCondition { this.condition = AbstractModelCondition.DEFAULT_CONDITION_FACTORY.newInstance(modelTree, conditionElement); } + /** + * Gets condition. + * @return the condition + */ public ModelCondition getCondition() { return condition; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java index 5e1ebd6..c3c1b76 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java @@ -81,10 +81,19 @@ public abstract class ModelWidgetCondition implements Serializable { this.rootCondition = factory.newInstance(modelWidget, firstChildElement); } + /** + * Eval boolean. + * @param context the context + * @return the boolean + */ public boolean eval(Map<String, Object> context) { return rootCondition.eval(context); } + /** + * Gets model widget. + * @return the model widget + */ public ModelWidget getModelWidget() { return modelWidget; }