Skip to content

Commit

Permalink
- Fixes as per @aaime review
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Fabiani committed Sep 21, 2018
1 parent 63dbd62 commit b7da171
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 27 deletions.
9 changes: 0 additions & 9 deletions src/extension/wps/web-wps/pom.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@
<groupId>org.apache.wicket</groupId> <groupId>org.apache.wicket</groupId>
<artifactId>wicket-extensions</artifactId> <artifactId>wicket-extensions</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-datetime</artifactId>
<version>${wicket.version}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.geoserver.extension</groupId> <groupId>org.geoserver.extension</groupId>
<artifactId>gs-wps-core</artifactId> <artifactId>gs-wps-core</artifactId>
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TimeZone;
import org.apache.wicket.Component; import org.apache.wicket.Component;
import org.apache.wicket.Session; import org.apache.wicket.Session;
import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.datetime.markup.html.basic.DateLabel;
import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Fragment; import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.model.IModel; import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.geoserver.web.GeoServerApplication; import org.geoserver.web.GeoServerApplication;
import org.geoserver.web.GeoServerSecuredPage; import org.geoserver.web.GeoServerSecuredPage;
import org.geoserver.web.wicket.GeoServerDataProvider.Property; import org.geoserver.web.wicket.GeoServerDataProvider.Property;
Expand Down Expand Up @@ -57,8 +56,8 @@ protected Component getComponentForProperty(
new SimpleDateFormat( new SimpleDateFormat(
"E, d MMM yyyy HH:mm:ss.SSS 'GMT'", "E, d MMM yyyy HH:mm:ss.SSS 'GMT'",
Session.get().getLocale()); Session.get().getLocale());
return DateLabel.forDatePattern( gmtFrmt.setTimeZone(TimeZone.getTimeZone("GMT"));
id, Model.of((Date) value), gmtFrmt.toPattern()); return new Label(id, gmtFrmt.format((Date) value));
} }
return null; return null;
} }
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


import static org.geoserver.catalog.Predicates.acceptAll; import static org.geoserver.catalog.Predicates.acceptAll;
import static org.geoserver.catalog.Predicates.or; import static org.geoserver.catalog.Predicates.or;
import static org.geoserver.catalog.Predicates.sortBy;


import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
Expand All @@ -14,6 +15,7 @@
import java.util.logging.Logger; import java.util.logging.Logger;
import org.apache.wicket.extensions.markup.html.repeater.util.SortParam; import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
import org.geoserver.catalog.Predicates; import org.geoserver.catalog.Predicates;
import org.geoserver.catalog.StoreInfo;
import org.geoserver.web.GeoServerApplication; import org.geoserver.web.GeoServerApplication;
import org.geoserver.web.wicket.GeoServerDataProvider; import org.geoserver.web.wicket.GeoServerDataProvider;
import org.geoserver.wps.ProcessStatusStore; import org.geoserver.wps.ProcessStatusStore;
Expand All @@ -25,7 +27,7 @@
import org.geotools.util.logging.Logging; import org.geotools.util.logging.Logging;
import org.opengis.filter.Filter; import org.opengis.filter.Filter;
import org.opengis.filter.FilterFactory2; import org.opengis.filter.FilterFactory2;
import org.opengis.filter.sort.SortOrder; import org.opengis.filter.sort.SortBy;


/** /**
* Provides a filtered, sorted view over the running/recently completed processes * Provides a filtered, sorted view over the running/recently completed processes
Expand Down Expand Up @@ -179,16 +181,17 @@ protected List<ExecutionStatus> getFilteredItems() {
query.setStartIndex((int) first); query.setStartIndex((int) first);
query.setMaxFeatures((int) count); query.setMaxFeatures((int) count);
} }
SortParam sort = getSort();
final SortParam sort = getSort();

SortBy sortOrder = null;
if (sort != null) { if (sort != null) {
SortByImpl[] sortBys = new SortByImpl[1]; SortBy[] sortBys = new SortByImpl[1];
final Property<?> property = getProperty(sort); final Property<?> property = getProperty(sort);
if (property.isSearchable()) { // we really need another flag if (property.isSearchable()) { // we really need another flag
sortBys[0] = new SortByImpl(FF.property(property.getName()), SortOrder.ASCENDING); final String sortProperty = ((BeanProperty<StoreInfo>) property).getPropertyPath();
FF.sort(property.getName(), SortOrder.ASCENDING); sortOrder = sortBy(sortProperty, sort.isAscending());
if (!sort.isAscending()) { sortBys[0] = sortOrder;
sortBys[0].setSortOrder(SortOrder.DESCENDING);
}
query.setSortBy(sortBys); query.setSortBy(sortBys);
} }
} }
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TimeZone;
import org.apache.wicket.behavior.AbstractAjaxBehavior; import org.apache.wicket.behavior.AbstractAjaxBehavior;
import org.custommonkey.xmlunit.SimpleNamespaceContext; import org.custommonkey.xmlunit.SimpleNamespaceContext;
import org.custommonkey.xmlunit.XMLUnit; import org.custommonkey.xmlunit.XMLUnit;
Expand Down Expand Up @@ -76,6 +77,7 @@ public void test() throws Exception {
DateFormat df = DateFormat df =
new SimpleDateFormat( new SimpleDateFormat(
"E, d MMM yyyy HH:mm:ss.SSS 'GMT'", tester.getSession().getLocale()); "E, d MMM yyyy HH:mm:ss.SSS 'GMT'", tester.getSession().getLocale());
df.setTimeZone(TimeZone.getTimeZone("GMT"));
tester.assertLabel( tester.assertLabel(
"table:listContainer:items:1:itemProperties:7:component", "table:listContainer:items:1:itemProperties:7:component",
df.format(status.getExpirationDate())); df.format(status.getExpirationDate()));
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ else if (request.owner != null
Executions.NO_SUCH_PROCESS_CODE, "No Process Execution available."); Executions.NO_SUCH_PROCESS_CODE, "No Process Execution available.");
} }


// Are we done? How to collect all the responses outputs? // Going to collect all the responses outputs
GetExecutionsTransformer executionsTransformer = GetExecutionsTransformer executionsTransformer =
new GetExecutionsTransformer( new GetExecutionsTransformer(
gs.getService(WPSInfo.class), gs.getService(WPSInfo.class),
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ protected void encodeDataInputs(
inputAttributes); inputAttributes);
} }
} catch (Exception e) { } catch (Exception e) {
// LOGGER.log(Level.WARNING, "", e); LOGGER.log(Level.WARNING, "", e);
} }
} else { } else {
if (ppio instanceof LiteralPPIO) { if (ppio instanceof LiteralPPIO) {
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void fireProgress(float progress, String task) {


// Update the estimated completion. // Update the estimated completion.
// By default we estimate the completion as: // By default we estimate the completion as:
// "time elapsed / percentage completed" // "time elapsed millis / percentage completed"
if (progress > 0) { if (progress > 0) {
long timeEalpsedMillis = long timeEalpsedMillis =
(new Date().getTime() - status.getCreationTime().getTime()); (new Date().getTime() - status.getCreationTime().getTime());
Expand All @@ -81,7 +81,6 @@ public void fireProgress(float progress, String task) {
calendar.setTime(status.getCreationTime()); calendar.setTime(status.getCreationTime());
calendar.add(Calendar.MILLISECOND, estimatedCompletionMillis); calendar.add(Calendar.MILLISECOND, estimatedCompletionMillis);
status.setEstimatedCompletion(calendar.getTime()); status.setEstimatedCompletion(calendar.getTime());
/** TODO: add / search for completion estimators extensions */
} }


ProcessEvent event = new ProcessEvent(status, inputs, outputs); ProcessEvent event = new ProcessEvent(status, inputs, outputs);
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ public ExecuteResponseType submit(final ExecuteRequest request, boolean synchron
// Therefore at this stage we cannot still have an idea about such estimation. // Therefore at this stage we cannot still have an idea about such estimation.
// We'll need to wait for the next poll / call to the ProcessListener // We'll need to wait for the next poll / call to the ProcessListener
status.setEstimatedCompletion(null); status.setEstimatedCompletion(null);
/** TODO: add / search for completion estimators extensions */


// By default, at the beginning, we'd suggest to make the next poll at least // By default, at the beginning, we'd suggest to make the next poll at least
// half of the maximum execution time (if > 0). // half of the maximum execution time (if > 0).
Expand All @@ -184,7 +183,6 @@ public ExecuteResponseType submit(final ExecuteRequest request, boolean synchron
calendar.setTime(new Date()); calendar.setTime(new Date());
calendar.add(Calendar.SECOND, nextPollTimeDelta); calendar.add(Calendar.SECOND, nextPollTimeDelta);
status.setNextPoll(new Date()); status.setNextPoll(new Date());
/** TODO: add / search for next poll estimators extensions */
Executor executor = Executor executor =
new Executor( new Executor(
request, request,
Expand Down

0 comments on commit b7da171

Please sign in to comment.