Merge branch 'master' into feature_target_filtering_supports_overdue
Conflicts: hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/FilterQueryValidation.java hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/customstyles/target-filter-query.scss
This commit is contained in:
@@ -208,15 +208,16 @@ public interface ArtifactManagement {
|
||||
void deleteLocalArtifact(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Searches for {@link Artifact} with given {@link Identifiable}.
|
||||
* Searches for {@link LocalArtifact} with given {@link Identifiable}.
|
||||
*
|
||||
* @param id
|
||||
* to search for
|
||||
* @return found {@link Artifact} or <code>null</code> is it could not be
|
||||
* found.
|
||||
* @return found {@link LocalArtifact} or <code>null</code> is it could not
|
||||
* be found.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Artifact findArtifact(@NotNull Long id);
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
LocalArtifact findLocalArtifact(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Find by artifact by software module id and filename.
|
||||
|
||||
@@ -183,22 +183,6 @@ public interface ControllerManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
String getPollingTime();
|
||||
|
||||
/**
|
||||
* An direct access to the security token of an
|
||||
* {@link Target#getSecurityToken()} without authorization. This is
|
||||
* necessary to be able to access the security-token without any
|
||||
* security-context information because the security-token is used for
|
||||
* authentication.
|
||||
*
|
||||
* @param controllerId
|
||||
* the ID of the controller to retrieve the security token for
|
||||
* @return the security context of the target, in case no target exists for
|
||||
* the given controllerId {@code null} is returned
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_TARGET_SEC_TOKEN)
|
||||
String getSecurityTokenByControllerId(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Checks if a given target has currently or has even been assigned to the
|
||||
* given artifact through the action history list. This can e.g. indicate if
|
||||
@@ -218,6 +202,25 @@ public interface ControllerManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
boolean hasTargetArtifactAssigned(@NotNull String controllerId, @NotNull LocalArtifact localArtifact);
|
||||
|
||||
/**
|
||||
* Checks if a given target has currently or has even been assigned to the
|
||||
* given artifact through the action history list. This can e.g. indicate if
|
||||
* a target is allowed to download a given artifact because it has currently
|
||||
* assigned or had ever been assigned to the target and so it's visible to a
|
||||
* specific target e.g. for downloading.
|
||||
*
|
||||
* @param targetId
|
||||
* the ID of the target to check
|
||||
* @param localArtifact
|
||||
* the artifact to verify if the given target had even been
|
||||
* assigned to
|
||||
* @return {@code true} if the given target has currently or had ever a
|
||||
* relation to the given artifact through the action history,
|
||||
* otherwise {@code false}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
boolean hasTargetArtifactAssigned(@NotNull Long targetId, @NotNull LocalArtifact localArtifact);
|
||||
|
||||
/**
|
||||
* Registers retrieved status for given {@link Target} and {@link Action} if
|
||||
* it does not exist yet.
|
||||
@@ -300,4 +303,32 @@ public interface ControllerManagement {
|
||||
TargetInfo updateTargetStatus(@NotNull TargetInfo targetInfo, TargetUpdateStatus status, Long lastTargetQuery,
|
||||
URI address);
|
||||
|
||||
/**
|
||||
* Finds {@link Target} based on given controller ID returns found Target
|
||||
* without details, i.e. NO {@link Target#getTags()} and
|
||||
* {@link Target#getActions()} possible.
|
||||
*
|
||||
* @param controllerId
|
||||
* to look for.
|
||||
* @return {@link Target} or {@code null} if it does not exist
|
||||
* @see Target#getControllerId()
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||
Target findByControllerId(@NotEmpty final String controllerId);
|
||||
|
||||
/**
|
||||
* Finds {@link Target} based on given ID returns found Target without
|
||||
* details, i.e. NO {@link Target#getTags()} and {@link Target#getActions()}
|
||||
* possible.
|
||||
*
|
||||
* @param targetId
|
||||
* to look for.
|
||||
* @return {@link Target} or {@code null} if it does not exist
|
||||
* @see Target#getId()
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||
Target findByTargetId(final long targetId);
|
||||
|
||||
}
|
||||
|
||||
@@ -57,7 +57,11 @@ public class DistributionSetAssignmentResult extends AssignmentResult<Target> {
|
||||
* @return the actionIds
|
||||
*/
|
||||
public List<Long> getActions() {
|
||||
return actions;
|
||||
if (actions == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(actions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -205,8 +205,10 @@ public interface DistributionSetManagement {
|
||||
/**
|
||||
* deletes a distribution set meta data entry.
|
||||
*
|
||||
* @param id
|
||||
* the ID of the distribution set meta data to delete
|
||||
* @param distributionSet
|
||||
* where meta data has to be deleted
|
||||
* @param key
|
||||
* of the meta data element
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
void deleteDistributionSetMetadata(@NotNull final DistributionSet distributionSet, @NotNull final String key);
|
||||
@@ -429,7 +431,7 @@ public interface DistributionSetManagement {
|
||||
*/
|
||||
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
DistributionSetType findDistributionSetTypeByKey(@NotNull String key);
|
||||
DistributionSetType findDistributionSetTypeByKey(@NotEmpty String key);
|
||||
|
||||
/**
|
||||
* @param name
|
||||
@@ -469,15 +471,16 @@ public interface DistributionSetManagement {
|
||||
/**
|
||||
* finds a single distribution set meta data by its id.
|
||||
*
|
||||
* @param id
|
||||
* the id of the distribution set meta data containing the meta
|
||||
* data key and the ID of the distribution set
|
||||
* @param distributionSet
|
||||
* where meta data has to rind
|
||||
* @param key
|
||||
* of the meta data element
|
||||
* @return the found DistributionSetMetadata or {@code null} if not exits
|
||||
* @throws EntityNotFoundException
|
||||
* in case the meta data does not exists for the given key
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
DistributionSetMetadata findOne(@NotNull DistributionSet distributionSet, @NotNull String key);
|
||||
DistributionSetMetadata findOne(@NotNull DistributionSet distributionSet, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* Checks if a {@link DistributionSet} is currently in use by a target in
|
||||
|
||||
@@ -155,11 +155,13 @@ public interface SoftwareManagement {
|
||||
/**
|
||||
* deletes a software module meta data entry.
|
||||
*
|
||||
* @param id
|
||||
* the ID of the software module meta data to delete
|
||||
* @param softwareModule
|
||||
* where meta data has to be deleted
|
||||
* @param key
|
||||
* of the metda data element
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
void deleteSoftwareModuleMetadata(@NotNull SoftwareModule softwareModule, @NotNull String key);
|
||||
void deleteSoftwareModuleMetadata(@NotNull SoftwareModule softwareModule, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* Deletes {@link SoftwareModule}s which is any if the given ids.
|
||||
@@ -251,9 +253,10 @@ public interface SoftwareManagement {
|
||||
/**
|
||||
* finds a single software module meta data by its id.
|
||||
*
|
||||
* @param id
|
||||
* the id of the software module meta data containing the meta
|
||||
* data key and the ID of the software module
|
||||
* @param softwareModule
|
||||
* where meta data has to be found
|
||||
* @param key
|
||||
* of the meta data element
|
||||
* @return the found SoftwareModuleMetadata or {@code null} if not exits
|
||||
* @throws EntityNotFoundException
|
||||
* in case the meta data does not exists for the given key
|
||||
@@ -280,8 +283,8 @@ public interface SoftwareManagement {
|
||||
*
|
||||
* @param softwareModuleId
|
||||
* the software module id to retrieve the meta data from
|
||||
* @param spec
|
||||
* the specification to filter the result
|
||||
* @param rsqlParam
|
||||
* filter definition in RSQL syntax
|
||||
* @param pageable
|
||||
* the page request to page the result
|
||||
* @return a paged result of all meta data entries for a given software
|
||||
@@ -346,8 +349,8 @@ public interface SoftwareManagement {
|
||||
/**
|
||||
* Retrieves all {@link SoftwareModule}s with a given specification.
|
||||
*
|
||||
* @param spec
|
||||
* the specification to filter the software modules
|
||||
* @param rsqlParam
|
||||
* filter definition in RSQL syntax
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @return the found {@link SoftwareModule}s
|
||||
@@ -392,7 +395,7 @@ public interface SoftwareManagement {
|
||||
* {@link SoftwareModuleType#getKey()}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
SoftwareModuleType findSoftwareModuleTypeByKey(@NotNull String key);
|
||||
SoftwareModuleType findSoftwareModuleTypeByKey(@NotEmpty String key);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -415,8 +418,8 @@ public interface SoftwareManagement {
|
||||
/**
|
||||
* Retrieves all {@link SoftwareModuleType}s with a given specification.
|
||||
*
|
||||
* @param spec
|
||||
* the specification to filter the software modules types
|
||||
* @param rsqlParam
|
||||
* filter definition in RSQL syntax
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @return the found {@link SoftwareModuleType}s
|
||||
|
||||
@@ -63,7 +63,8 @@ public interface SystemManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
|
||||
+ SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
TenantMetaData getTenantMetadata();
|
||||
|
||||
/**
|
||||
@@ -93,4 +94,14 @@ public interface SystemManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
|
||||
TenantMetaData updateTenantMetadata(@NotNull TenantMetaData metaData);
|
||||
|
||||
/**
|
||||
* Returns {@link TenantMetaData} of given tenant ID.
|
||||
*
|
||||
* @param tenantId
|
||||
* to retrieve data for
|
||||
* @return {@link TenantMetaData} of given tenant
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||
TenantMetaData getTenantMetadata(@NotNull Long tenantId);
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ public class RolloutGroupCreatedEvent extends AbstractDistributedEvent {
|
||||
* the revision of the event
|
||||
* @param rolloutId
|
||||
* the ID of the rollout the group has been created
|
||||
* @param rolloutGroupId
|
||||
* identifier of this group
|
||||
* @param totalRolloutGroup
|
||||
* the total number of rollout groups for this rollout
|
||||
* @param createdRolloutGroup
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DefaultEvent;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
|
||||
/**
|
||||
* Event that gets sent when a distribution set gets assigned to a target.
|
||||
@@ -21,10 +21,8 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
public class TargetAssignDistributionSetEvent extends DefaultEvent {
|
||||
|
||||
private final Collection<SoftwareModule> softwareModules;
|
||||
private final String controllerId;
|
||||
private final Target target;
|
||||
private final Long actionId;
|
||||
private final URI targetAdress;
|
||||
private final String targetToken;
|
||||
|
||||
/**
|
||||
* Creates a new {@link TargetAssignDistributionSetEvent}.
|
||||
@@ -33,26 +31,19 @@ public class TargetAssignDistributionSetEvent extends DefaultEvent {
|
||||
* the revision of the event
|
||||
* @param tenant
|
||||
* the tenant of the event
|
||||
* @param controllerId
|
||||
* the ID of the controller
|
||||
* @param target
|
||||
* the assigned {@link Target}
|
||||
* @param actionId
|
||||
* the action id of the assignment
|
||||
* @param softwareModules
|
||||
* the software modules which have been assigned to the target
|
||||
* @param targetAdress
|
||||
* the targetAdress of the target
|
||||
* @param targetToken
|
||||
* the authentication token of the target
|
||||
*/
|
||||
public TargetAssignDistributionSetEvent(final long revision, final String tenant, final String controllerId,
|
||||
final Long actionId, final Collection<SoftwareModule> softwareModules, final URI targetAdress,
|
||||
final String targetToken) {
|
||||
public TargetAssignDistributionSetEvent(final long revision, final String tenant, final Target target,
|
||||
final Long actionId, final Collection<SoftwareModule> softwareModules) {
|
||||
super(revision, tenant);
|
||||
this.controllerId = controllerId;
|
||||
this.target = target;
|
||||
this.actionId = actionId;
|
||||
this.softwareModules = softwareModules;
|
||||
this.targetAdress = targetAdress;
|
||||
this.targetToken = targetToken;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,11 +54,11 @@ public class TargetAssignDistributionSetEvent extends DefaultEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the controllerId of the Target which has been assigned to the
|
||||
* distribution set
|
||||
* @return the {@link Target} which has been assigned to the distribution
|
||||
* set
|
||||
*/
|
||||
public String getControllerId() {
|
||||
return controllerId;
|
||||
public Target getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,12 +67,4 @@ public class TargetAssignDistributionSetEvent extends DefaultEvent {
|
||||
public Collection<SoftwareModule> getSoftwareModules() {
|
||||
return softwareModules;
|
||||
}
|
||||
|
||||
public URI getTargetAdress() {
|
||||
return targetAdress;
|
||||
}
|
||||
|
||||
public String getTargetToken() {
|
||||
return targetToken;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class AssignedSoftwareModule implements Serializable {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (assigned ? 1231 : 1237);
|
||||
result = prime * result + (softwareModule == null ? 0 : softwareModule.hashCode());
|
||||
result = prime * result + ((softwareModule == null) ? 0 : softwareModule.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class AssignedSoftwareModule implements Serializable {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof AssignedSoftwareModule)) {
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final AssignedSoftwareModule other = (AssignedSoftwareModule) obj;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -82,14 +83,22 @@ public class AssignmentResult<T extends BaseEntity> {
|
||||
* @return {@link List} of assigned entity.
|
||||
*/
|
||||
public List<T> getAssignedEntity() {
|
||||
return assignedEntity;
|
||||
if (assignedEntity == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(assignedEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link List} of unassigned entity.
|
||||
*/
|
||||
public List<T> getUnassignedEntity() {
|
||||
return unassignedEntity;
|
||||
if (unassignedEntity == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(unassignedEntity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ package org.eclipse.hawkbit.repository.model;
|
||||
/**
|
||||
* Interface for the entity interceptor lifecycle.
|
||||
*/
|
||||
// Exception squid:EmptyStatementUsageCheck - don't want to force users to
|
||||
// impelemnt all methods
|
||||
@SuppressWarnings("squid:EmptyStatementUsageCheck")
|
||||
public interface EntityInterceptor {
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.rsql;
|
||||
|
||||
/**
|
||||
* An interface declaration which validates an RSQL based query syntax and
|
||||
* allows providing suggestions e.g. in case of syntax errors or current cursor
|
||||
* position.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface RsqlValidationOracle {
|
||||
|
||||
/**
|
||||
* Parses and validates an given RSQL based query syntax and provides
|
||||
* suggestion based on syntax error and cursor positioning.
|
||||
*
|
||||
* @param rsqlQuery
|
||||
* an RSQL based query string to parse.
|
||||
* @param cursorPosition
|
||||
* the position of the cursor to retrieve suggestions at the
|
||||
* position. {@code -1} indicates for no cursor suggestion
|
||||
* @return a validation oracle context providing information about syntax
|
||||
* errors and possible suggestions for fixing the syntax error or at
|
||||
* the cursor position to replace tokens
|
||||
*/
|
||||
ValidationOracleContext suggest(final String rsqlQuery, final int cursorPosition);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.rsql;
|
||||
|
||||
/**
|
||||
* A suggestion which contains the start and the end character position of the
|
||||
* suggested token of the suggestion of the token and the actual suggestion.
|
||||
*/
|
||||
public class SuggestToken {
|
||||
|
||||
private final int start;
|
||||
private final int end;
|
||||
private final String suggestion;
|
||||
private final String tokenImageName;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param start
|
||||
* the character position of the start of the token
|
||||
* @param end
|
||||
* the character position of the end of the token
|
||||
* @param tokenImageName
|
||||
* the entered name of the token, e.g. could be the beginning of
|
||||
* the suggestion like 'na' or 'name'
|
||||
* @param suggestion
|
||||
* the token suggestion
|
||||
*/
|
||||
public SuggestToken(final int start, final int end, final String tokenImageName, final String suggestion) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
this.tokenImageName = tokenImageName;
|
||||
this.suggestion = suggestion;
|
||||
}
|
||||
|
||||
public int getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public int getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public String getSuggestion() {
|
||||
return suggestion;
|
||||
}
|
||||
|
||||
public String getTokenImageName() {
|
||||
return tokenImageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SuggestToken [start=" + start + ", end=" + end + ", suggestion=" + suggestion + ", tokenImageName="
|
||||
+ tokenImageName + "]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.rsql;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The context which holds suggestions for the current cursor position.
|
||||
*/
|
||||
public class SuggestionContext {
|
||||
|
||||
private String rsqlQuery;
|
||||
private int cursorPosition;
|
||||
private List<SuggestToken> suggestions = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public SuggestionContext() {
|
||||
// nothing to initialize
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param rsqlQuery
|
||||
* the original RSQL based query the suggestions based on
|
||||
* @param cursorPosition
|
||||
* the current cursor position
|
||||
* @param suggestions
|
||||
* the suggestions for the current cursor position
|
||||
*/
|
||||
public SuggestionContext(final String rsqlQuery, final int cursorPosition, final List<SuggestToken> suggestions) {
|
||||
this.rsqlQuery = rsqlQuery;
|
||||
this.cursorPosition = cursorPosition;
|
||||
this.suggestions = suggestions;
|
||||
}
|
||||
|
||||
public List<SuggestToken> getSuggestions() {
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
public int getCursorPosition() {
|
||||
return cursorPosition;
|
||||
}
|
||||
|
||||
public String getRsqlQuery() {
|
||||
return rsqlQuery;
|
||||
}
|
||||
|
||||
public void setRsqlQuery(final String rsqlQuery) {
|
||||
this.rsqlQuery = rsqlQuery;
|
||||
}
|
||||
|
||||
public void setCursorPosition(final int cursorPosition) {
|
||||
this.cursorPosition = cursorPosition;
|
||||
}
|
||||
|
||||
public void setSuggestions(final List<SuggestToken> suggestions) {
|
||||
this.suggestions = suggestions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.rsql;
|
||||
|
||||
/**
|
||||
* An syntax error context object which holds the character position of the
|
||||
* syntax error and message.
|
||||
*/
|
||||
public class SyntaxErrorContext {
|
||||
|
||||
private int characterPosition = -1;
|
||||
private String errorMessage;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public SyntaxErrorContext() {
|
||||
// nothing to initialize
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param characterPosition
|
||||
* the position of the character within the RSQL query string the
|
||||
* error occurs.
|
||||
* @param errorMessage
|
||||
* the error message with further information
|
||||
*/
|
||||
public SyntaxErrorContext(final int characterPosition, final String errorMessage) {
|
||||
this.characterPosition = characterPosition;
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public int getCharacterPosition() {
|
||||
return characterPosition;
|
||||
}
|
||||
|
||||
public void setCharacterPosition(final int characterPosition) {
|
||||
this.characterPosition = characterPosition;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(final String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.rsql;
|
||||
|
||||
/**
|
||||
* A context object which contains information about validation and suggestions
|
||||
* of a parsed RSQL query.
|
||||
*/
|
||||
public class ValidationOracleContext {
|
||||
|
||||
private boolean syntaxError;
|
||||
|
||||
private SuggestionContext suggestionContext;
|
||||
|
||||
private SyntaxErrorContext syntaxErrorContext;
|
||||
|
||||
public boolean isSyntaxError() {
|
||||
return syntaxError;
|
||||
}
|
||||
|
||||
public SuggestionContext getSuggestionContext() {
|
||||
return suggestionContext;
|
||||
}
|
||||
|
||||
public SyntaxErrorContext getSyntaxErrorContext() {
|
||||
return syntaxErrorContext;
|
||||
}
|
||||
|
||||
public void setSyntaxError(final boolean syntaxError) {
|
||||
this.syntaxError = syntaxError;
|
||||
}
|
||||
|
||||
public void setSuggestionContext(final SuggestionContext suggestionContext) {
|
||||
this.suggestionContext = suggestionContext;
|
||||
}
|
||||
|
||||
public void setSyntaxErrorContext(final SyntaxErrorContext syntaxErrorContext) {
|
||||
this.syntaxErrorContext = syntaxErrorContext;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user