Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default sorting for Datastore REST API simple queries #2666

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ public void onAfterMessageStore(MessageInfo messageInfo,
channelInfo.setFirstMessageId(message.getDatastoreId());
channelInfo.setFirstMessageOn(message.getTimestamp());
channelInfo.setId(new StorableIdImpl(ChannelInfoField.getOrDeriveId(null, channelInfo)));
clientInfo.setFirstMessageId(message.getDatastoreId());
clientInfo.setFirstMessageOn(message.getTimestamp());
channelInfoStoreFacade.upstore(channelInfo);

KapuaPayload payload = message.getPayload();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
*******************************************************************************/
package org.eclipse.kapua.service.datastore.internal.model.query;

import java.util.Collections;

import org.eclipse.kapua.model.id.KapuaId;
import org.eclipse.kapua.service.datastore.internal.AbstractStorableQuery;
import org.eclipse.kapua.service.datastore.internal.mediator.ChannelInfoField;
import org.eclipse.kapua.service.datastore.internal.schema.ChannelInfoSchema;
import org.eclipse.kapua.service.datastore.model.ChannelInfo;
import org.eclipse.kapua.service.datastore.model.query.ChannelInfoQuery;
import org.eclipse.kapua.service.datastore.model.query.SortField;
import org.eclipse.kapua.service.datastore.model.query.StorableFetchStyle;

/**
Expand All @@ -35,6 +39,7 @@ public class ChannelInfoQueryImpl extends AbstractStorableQuery<ChannelInfo> imp
*/
public ChannelInfoQueryImpl(KapuaId scopeId) {
super(scopeId);
setSortFields(Collections.singletonList(SortField.ascending(ChannelInfoSchema.CHANNEL_NAME)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
*******************************************************************************/
package org.eclipse.kapua.service.datastore.internal.model.query;

import java.util.Collections;

import org.eclipse.kapua.model.id.KapuaId;
import org.eclipse.kapua.service.datastore.internal.AbstractStorableQuery;
import org.eclipse.kapua.service.datastore.internal.mediator.ClientInfoField;
import org.eclipse.kapua.service.datastore.internal.schema.ClientInfoSchema;
import org.eclipse.kapua.service.datastore.model.ClientInfo;
import org.eclipse.kapua.service.datastore.model.query.ClientInfoQuery;
import org.eclipse.kapua.service.datastore.model.query.SortField;
import org.eclipse.kapua.service.datastore.model.query.StorableFetchStyle;

/**
Expand All @@ -34,6 +38,7 @@ public class ClientInfoQueryImpl extends AbstractStorableQuery<ClientInfo> imple
*/
public ClientInfoQueryImpl(KapuaId scopeId) {
super(scopeId);
setSortFields(Collections.singletonList(SortField.ascending(ClientInfoSchema.CLIENT_ID)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
*******************************************************************************/
package org.eclipse.kapua.service.datastore.internal.model.query;

import java.util.Collections;

import org.eclipse.kapua.model.id.KapuaId;
import org.eclipse.kapua.service.datastore.internal.AbstractStorableQuery;
import org.eclipse.kapua.service.datastore.internal.mediator.MessageField;
import org.eclipse.kapua.service.datastore.internal.schema.MessageSchema;
import org.eclipse.kapua.service.datastore.model.DatastoreMessage;
import org.eclipse.kapua.service.datastore.model.query.MessageQuery;
import org.eclipse.kapua.service.datastore.model.query.SortField;
import org.eclipse.kapua.service.datastore.model.query.StorableFetchStyle;

/**
Expand All @@ -36,6 +39,7 @@ public class MessageQueryImpl extends AbstractStorableQuery<DatastoreMessage> im
*/
public MessageQueryImpl(KapuaId scopeId) {
super(scopeId);
setSortFields(Collections.singletonList(SortField.descending(MessageSchema.MESSAGE_TIMESTAMP)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
*******************************************************************************/
package org.eclipse.kapua.service.datastore.internal.model.query;

import java.util.Collections;

import org.eclipse.kapua.model.id.KapuaId;
import org.eclipse.kapua.service.datastore.internal.AbstractStorableQuery;
import org.eclipse.kapua.service.datastore.internal.mediator.MetricInfoField;
import org.eclipse.kapua.service.datastore.internal.schema.MetricInfoSchema;
import org.eclipse.kapua.service.datastore.model.MetricInfo;
import org.eclipse.kapua.service.datastore.model.query.MetricInfoQuery;
import org.eclipse.kapua.service.datastore.model.query.SortField;
import org.eclipse.kapua.service.datastore.model.query.StorableFetchStyle;

/**
Expand All @@ -34,6 +38,7 @@ public class MetricInfoQueryImpl extends AbstractStorableQuery<MetricInfo> imple
*/
public MetricInfoQueryImpl(KapuaId scopeId) {
super(scopeId);
setSortFields(Collections.singletonList(SortField.ascending(MetricInfoSchema.METRIC_MTR_NAME_FULL)));
}

@Override
Expand Down