forked from Qortal/qortal
Exclude status if includeStatus != true
This commit is contained in:
parent
d03a2d7da9
commit
cdcb268bd9
@ -135,7 +135,7 @@ public class ArbitraryResource {
|
|||||||
|
|
||||||
List<ArbitraryResourceData> resources = repository.getArbitraryRepository()
|
List<ArbitraryResourceData> resources = repository.getArbitraryRepository()
|
||||||
.getArbitraryResources(service, identifier, names, defaultRes, followedOnly, excludeBlocked,
|
.getArbitraryResources(service, identifier, names, defaultRes, followedOnly, excludeBlocked,
|
||||||
includeMetadata, limit, offset, reverse);
|
includeMetadata, includeStatus, limit, offset, reverse);
|
||||||
|
|
||||||
if (resources == null) {
|
if (resources == null) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
@ -202,7 +202,7 @@ public class ArbitraryResource {
|
|||||||
|
|
||||||
List<ArbitraryResourceData> resources = repository.getArbitraryRepository()
|
List<ArbitraryResourceData> resources = repository.getArbitraryRepository()
|
||||||
.searchArbitraryResources(service, query, identifier, names, usePrefixOnly, exactMatchNames,
|
.searchArbitraryResources(service, query, identifier, names, usePrefixOnly, exactMatchNames,
|
||||||
defaultRes, followedOnly, excludeBlocked, includeMetadata, limit, offset, reverse);
|
defaultRes, followedOnly, excludeBlocked, includeMetadata, includeStatus, limit, offset, reverse);
|
||||||
|
|
||||||
if (resources == null) {
|
if (resources == null) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
@ -37,9 +37,9 @@ public interface ArbitraryRepository {
|
|||||||
|
|
||||||
public List<ArbitraryResourceData> getArbitraryResources(Integer limit, Integer offset, Boolean reverse) throws DataException;
|
public List<ArbitraryResourceData> getArbitraryResources(Integer limit, Integer offset, Boolean reverse) throws DataException;
|
||||||
|
|
||||||
public List<ArbitraryResourceData> getArbitraryResources(Service service, String identifier, List<String> names, boolean defaultResource, Boolean followedOnly, Boolean excludeBlocked, Boolean includeMetadata, Integer limit, Integer offset, Boolean reverse) throws DataException;
|
public List<ArbitraryResourceData> getArbitraryResources(Service service, String identifier, List<String> names, boolean defaultResource, Boolean followedOnly, Boolean excludeBlocked, Boolean includeMetadata, Boolean includeStatus, Integer limit, Integer offset, Boolean reverse) throws DataException;
|
||||||
|
|
||||||
public List<ArbitraryResourceData> searchArbitraryResources(Service service, String query, String identifier, List<String> names, boolean prefixOnly, List<String> namesFilter, boolean defaultResource, Boolean followedOnly, Boolean excludeBlocked, Boolean includeMetadata, Integer limit, Integer offset, Boolean reverse) throws DataException;
|
public List<ArbitraryResourceData> searchArbitraryResources(Service service, String query, String identifier, List<String> names, boolean prefixOnly, List<String> namesFilter, boolean defaultResource, Boolean followedOnly, Boolean excludeBlocked, Boolean includeMetadata, Boolean includeStatus, Integer limit, Integer offset, Boolean reverse) throws DataException;
|
||||||
|
|
||||||
|
|
||||||
// Arbitrary resources cache save/load
|
// Arbitrary resources cache save/load
|
||||||
|
@ -488,7 +488,8 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
|||||||
@Override
|
@Override
|
||||||
public List<ArbitraryResourceData> getArbitraryResources(Service service, String identifier, List<String> names,
|
public List<ArbitraryResourceData> getArbitraryResources(Service service, String identifier, List<String> names,
|
||||||
boolean defaultResource, Boolean followedOnly, Boolean excludeBlocked,
|
boolean defaultResource, Boolean followedOnly, Boolean excludeBlocked,
|
||||||
Boolean includeMetadata, Integer limit, Integer offset, Boolean reverse) throws DataException {
|
Boolean includeMetadata, Boolean includeStatus,
|
||||||
|
Integer limit, Integer offset, Boolean reverse) throws DataException {
|
||||||
StringBuilder sql = new StringBuilder(512);
|
StringBuilder sql = new StringBuilder(512);
|
||||||
List<Object> bindParams = new ArrayList<>();
|
List<Object> bindParams = new ArrayList<>();
|
||||||
|
|
||||||
@ -600,10 +601,13 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
|||||||
arbitraryResourceData.service = serviceResult;
|
arbitraryResourceData.service = serviceResult;
|
||||||
arbitraryResourceData.identifier = identifierResult;
|
arbitraryResourceData.identifier = identifierResult;
|
||||||
arbitraryResourceData.size = sizeResult;
|
arbitraryResourceData.size = sizeResult;
|
||||||
arbitraryResourceData.setStatus(ArbitraryResourceStatus.Status.valueOf(status));
|
|
||||||
arbitraryResourceData.created = created;
|
arbitraryResourceData.created = created;
|
||||||
arbitraryResourceData.updated = (updated == 0) ? null : updated;
|
arbitraryResourceData.updated = (updated == 0) ? null : updated;
|
||||||
|
|
||||||
|
if (includeStatus != null && includeStatus) {
|
||||||
|
arbitraryResourceData.setStatus(ArbitraryResourceStatus.Status.valueOf(status));
|
||||||
|
}
|
||||||
|
|
||||||
if (includeMetadata != null && includeMetadata) {
|
if (includeMetadata != null && includeMetadata) {
|
||||||
// TODO: we could avoid the join altogether
|
// TODO: we could avoid the join altogether
|
||||||
ArbitraryResourceMetadata metadata = new ArbitraryResourceMetadata();
|
ArbitraryResourceMetadata metadata = new ArbitraryResourceMetadata();
|
||||||
@ -636,7 +640,7 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
|||||||
@Override
|
@Override
|
||||||
public List<ArbitraryResourceData> searchArbitraryResources(Service service, String query, String identifier, List<String> names, boolean prefixOnly,
|
public List<ArbitraryResourceData> searchArbitraryResources(Service service, String query, String identifier, List<String> names, boolean prefixOnly,
|
||||||
List<String> exactMatchNames, boolean defaultResource, Boolean followedOnly, Boolean excludeBlocked,
|
List<String> exactMatchNames, boolean defaultResource, Boolean followedOnly, Boolean excludeBlocked,
|
||||||
Boolean includeMetadata, Integer limit, Integer offset, Boolean reverse) throws DataException {
|
Boolean includeMetadata, Boolean includeStatus, Integer limit, Integer offset, Boolean reverse) throws DataException {
|
||||||
StringBuilder sql = new StringBuilder(512);
|
StringBuilder sql = new StringBuilder(512);
|
||||||
List<Object> bindParams = new ArrayList<>();
|
List<Object> bindParams = new ArrayList<>();
|
||||||
|
|
||||||
@ -778,10 +782,13 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
|||||||
arbitraryResourceData.service = serviceResult;
|
arbitraryResourceData.service = serviceResult;
|
||||||
arbitraryResourceData.identifier = identifierResult;
|
arbitraryResourceData.identifier = identifierResult;
|
||||||
arbitraryResourceData.size = sizeResult;
|
arbitraryResourceData.size = sizeResult;
|
||||||
arbitraryResourceData.setStatus(ArbitraryResourceStatus.Status.valueOf(status));
|
|
||||||
arbitraryResourceData.created = created;
|
arbitraryResourceData.created = created;
|
||||||
arbitraryResourceData.updated = (updated == 0) ? null : updated;
|
arbitraryResourceData.updated = (updated == 0) ? null : updated;
|
||||||
|
|
||||||
|
if (includeStatus != null && includeStatus) {
|
||||||
|
arbitraryResourceData.setStatus(ArbitraryResourceStatus.Status.valueOf(status));
|
||||||
|
}
|
||||||
|
|
||||||
if (includeMetadata != null && includeMetadata) {
|
if (includeMetadata != null && includeMetadata) {
|
||||||
// TODO: we could avoid the join altogether
|
// TODO: we could avoid the join altogether
|
||||||
ArbitraryResourceMetadata metadata = new ArbitraryResourceMetadata();
|
ArbitraryResourceMetadata metadata = new ArbitraryResourceMetadata();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user