[Minor] Code cleanup
This commit is contained in:
parent
b9a2e84dee
commit
c872a22aac
|
@ -1,12 +1,12 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2015 Robert von Burg <eitch@eitchnet.ch>
|
* Copyright 2015 Robert von Burg <eitch@eitchnet.ch>
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -396,8 +396,6 @@ public class Inspector {
|
||||||
queryData.initializeUnsetFields();
|
queryData.initializeUnsetFields();
|
||||||
Certificate cert = (Certificate) request.getAttribute(StrolchRestfulConstants.STROLCH_CERTIFICATE);
|
Certificate cert = (Certificate) request.getAttribute(StrolchRestfulConstants.STROLCH_CERTIFICATE);
|
||||||
|
|
||||||
List<Resource> resources = new ArrayList<>();
|
|
||||||
|
|
||||||
// parse the query string
|
// parse the query string
|
||||||
ResourceQuery<Resource> query = QueryParser.parseToResourceQuery(queryData.getQuery(), true, true, false);
|
ResourceQuery<Resource> query = QueryParser.parseToResourceQuery(queryData.getQuery(), true, true, false);
|
||||||
|
|
||||||
|
@ -405,11 +403,12 @@ public class Inspector {
|
||||||
query.setNavigation(new StrolchTypeNavigation(type));
|
query.setNavigation(new StrolchTypeNavigation(type));
|
||||||
|
|
||||||
// query the data
|
// query the data
|
||||||
|
List<Resource> resources;
|
||||||
long dataSetSize = 0L;
|
long dataSetSize = 0L;
|
||||||
try (StrolchTransaction tx = openTx(cert, realm)) {
|
try (StrolchTransaction tx = openTx(cert, realm)) {
|
||||||
ResourceMap resourceMap = tx.getResourceMap();
|
ResourceMap resourceMap = tx.getResourceMap();
|
||||||
dataSetSize = resourceMap.querySize(tx);
|
dataSetSize = resourceMap.querySize(tx);
|
||||||
resources.addAll(tx.doQuery(query));
|
resources = tx.doQuery(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do ordering
|
// do ordering
|
||||||
|
@ -432,18 +431,17 @@ public class Inspector {
|
||||||
queryData.initializeUnsetFields();
|
queryData.initializeUnsetFields();
|
||||||
Certificate cert = (Certificate) request.getAttribute(StrolchRestfulConstants.STROLCH_CERTIFICATE);
|
Certificate cert = (Certificate) request.getAttribute(StrolchRestfulConstants.STROLCH_CERTIFICATE);
|
||||||
|
|
||||||
List<Order> orders = new ArrayList<>();
|
|
||||||
|
|
||||||
// parse the query string
|
// parse the query string
|
||||||
OrderQuery<Order> query = QueryParser.parseToOrderQuery(queryData.getQuery(), true, true, false);
|
OrderQuery<Order> query = QueryParser.parseToOrderQuery(queryData.getQuery(), true, true, false);
|
||||||
query.setNavigation(new StrolchTypeNavigation(type));
|
query.setNavigation(new StrolchTypeNavigation(type));
|
||||||
|
|
||||||
// query the data
|
// query the data
|
||||||
|
List<Order> orders;
|
||||||
long dataSetSize = 0L;
|
long dataSetSize = 0L;
|
||||||
try (StrolchTransaction tx = openTx(cert, realm)) {
|
try (StrolchTransaction tx = openTx(cert, realm)) {
|
||||||
OrderMap orderMap = tx.getOrderMap();
|
OrderMap orderMap = tx.getOrderMap();
|
||||||
dataSetSize = orderMap.querySize(tx);
|
dataSetSize = orderMap.querySize(tx);
|
||||||
orders.addAll(tx.doQuery(query));
|
orders = tx.doQuery(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do ordering
|
// do ordering
|
||||||
|
@ -466,18 +464,17 @@ public class Inspector {
|
||||||
queryData.initializeUnsetFields();
|
queryData.initializeUnsetFields();
|
||||||
Certificate cert = (Certificate) request.getAttribute(StrolchRestfulConstants.STROLCH_CERTIFICATE);
|
Certificate cert = (Certificate) request.getAttribute(StrolchRestfulConstants.STROLCH_CERTIFICATE);
|
||||||
|
|
||||||
List<Activity> activities = new ArrayList<>();
|
|
||||||
|
|
||||||
// parse the query string
|
// parse the query string
|
||||||
ActivityQuery<Activity> query = QueryParser.parseToActivityQuery(queryData.getQuery(), true, true, false);
|
ActivityQuery<Activity> query = QueryParser.parseToActivityQuery(queryData.getQuery(), true, true, false);
|
||||||
query.setNavigation(new StrolchTypeNavigation(type));
|
query.setNavigation(new StrolchTypeNavigation(type));
|
||||||
|
|
||||||
// query the data
|
// query the data
|
||||||
|
List<Activity> activities;
|
||||||
long dataSetSize = 0L;
|
long dataSetSize = 0L;
|
||||||
try (StrolchTransaction tx = openTx(cert, realm)) {
|
try (StrolchTransaction tx = openTx(cert, realm)) {
|
||||||
ActivityMap activityMap = tx.getActivityMap();
|
ActivityMap activityMap = tx.getActivityMap();
|
||||||
dataSetSize = activityMap.querySize(tx);
|
dataSetSize = activityMap.querySize(tx);
|
||||||
activities.addAll(tx.doQuery(query));
|
activities = tx.doQuery(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do ordering
|
// do ordering
|
||||||
|
@ -981,7 +978,8 @@ public class Inspector {
|
||||||
return ResponseUtil.toResponse(e);
|
return ResponseUtil.toResponse(e);
|
||||||
} finally {
|
} finally {
|
||||||
if (tempFile != null) {
|
if (tempFile != null) {
|
||||||
tempFile.delete();
|
if (!tempFile.delete())
|
||||||
|
logger.error("Failed to delete " + tempFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue