Make entities immutable and create proper update methods that state by signature what can be updated. (#342)

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-11-17 20:07:23 +01:00
committed by GitHub
parent b6834e9ee2
commit ca63106d5c
314 changed files with 7699 additions and 6914 deletions

View File

@@ -64,30 +64,6 @@ public interface ArtifactManagement {
Artifact createArtifact(@NotNull InputStream inputStream, @NotNull Long moduleId, final String filename,
final boolean overrideExisting);
/**
* Persists artifact binary as provided by given InputStream. assign the
* artifact in addition to given {@link SoftwareModule}.
*
* @param inputStream
* to read from for artifact binary
* @param moduleId
* to assign the new artifact to
* @param filename
* of the artifact
* @param overrideExisting
* to <code>true</code> if the artifact binary can be overridden
* if it already exists
* @param contentType
* the contentType of the file
*
* @return uploaded {@link Artifact}
*
* @throw ArtifactUploadFailedException if upload fails
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
Artifact createArtifact(@NotNull InputStream inputStream, @NotNull Long moduleId, @NotNull String filename,
final boolean overrideExisting, @NotNull String contentType);
/**
* Persists artifact binary as provided by given InputStream. assign the
* artifact in addition to given {@link SoftwareModule}.
@@ -103,7 +79,7 @@ public interface ArtifactManagement {
* @param providedMd5Sum
* optional md5 checksum to check the new file against
* @param overrideExisting
* to <code>true</code> if the artifact binary can be overdiden
* to <code>true</code> if the artifact binary can be overridden
* if it already exists
* @param contentType
* the contentType of the file

View File

@@ -9,13 +9,13 @@
package org.eclipse.hawkbit.repository;
import java.net.URI;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.builder.ActionStatusCreate;
import org.eclipse.hawkbit.repository.event.remote.DownloadProgressEvent;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
@@ -44,16 +44,22 @@ public interface ControllerManagement {
* Adds an {@link ActionStatus} for a cancel {@link Action} including
* potential state changes for the target and the {@link Action} itself.
*
* @param actionStatus
* @param create
* to be added
* @return the persisted {@link Action}
* @return the updated {@link Action}
*
* @throws EntityAlreadyExistsException
* if a given entity already exists
*
* @throws TooManyStatusEntriesException
* if more than the allowed number of status entries are
* inserted
* @throws EntityNotFoundException
* if given action does not exist
*
*/
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Action addCancelActionStatus(@NotNull ActionStatus actionStatus);
Action addCancelActionStatus(@NotNull ActionStatusCreate create);
/**
* Sends the download progress and notifies the event publisher with a
@@ -75,19 +81,25 @@ public interface ControllerManagement {
* Simple addition of a new {@link ActionStatus} entry to the {@link Action}
* . No state changes.
*
* @param statusMessage
* @param create
* to add to the action
*
* @return create {@link ActionStatus} entity
* @return created {@link ActionStatus} entity
*
* @throws TooManyStatusEntriesException
* if more than the allowed number of status entries are
* inserted
* @throws EntityNotFoundException
* if given action does not exist
*/
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
ActionStatus addInformationalActionStatus(@NotNull ActionStatus statusMessage);
ActionStatus addInformationalActionStatus(@NotNull ActionStatusCreate create);
/**
* Adds an {@link ActionStatus} entry for an update {@link Action} including
* potential state changes for the target and the {@link Action} itself.
*
* @param actionStatus
* @param create
* to be added
* @return the updated {@link Action}
*
@@ -96,20 +108,12 @@ public interface ControllerManagement {
* @throws TooManyStatusEntriesException
* if more than the allowed number of status entries are
* inserted
* @throws TooManyStatusEntriesException
* if more than the allowed number of status entries are
* inserted
*/
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Action addUpdateActionStatus(@NotNull ActionStatus actionStatus);
/**
* Retrieves all {@link Action}s which are active and assigned to a
* {@link Target}.
*
* @param target
* the target to retrieve the actions from
* @return a list of actions assigned to given target which are active
*/
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
List<Action> findActiveActionByTarget(@NotNull Target target);
Action addUpdateActionStatus(@NotNull ActionStatusCreate create);
/**
* Retrieves oldest {@link Action} that is active and assigned to a

View File

@@ -44,26 +44,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
*/
public interface DeploymentManagement {
/**
* method assigns the {@link DistributionSet} to all {@link Target}s.
*
* @param pset
* {@link DistributionSet} which is assigned to the
* {@link Target}s
* @param targets
* the {@link Target}s which should obtain the
* {@link DistributionSet}
*
* @return the changed targets
*
* @throw IncompleteDistributionSetException if mandatory
* {@link SoftwareModuleType} are not assigned as define by the
* {@link DistributionSetType}. *
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
DistributionSetAssignmentResult assignDistributionSet(@NotNull DistributionSet pset,
@NotEmpty List<Target> targets);
/**
* method assigns the {@link DistributionSet} to all {@link Target}s by
* their IDs with a specific {@link ActionType} and {@code forcetime}.
@@ -75,17 +55,20 @@ public interface DeploymentManagement {
* @param forcedTimestamp
* the time when the action should be forced, only necessary for
* {@link ActionType#TIMEFORCED}
* @param targetIDs
* @param controllerIDs
* the IDs of the target to assign the distribution set
* @return the assignment result
*
* @throw IncompleteDistributionSetException if mandatory
* {@link SoftwareModuleType} are not assigned as define by the
* {@link DistributionSetType}.
*
* @throw {@link EntityNotFoundException} if either provided
* {@link DistributionSet} or {@link Target}s do not exist
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID, final ActionType actionType,
final long forcedTimestamp, @NotEmpty final String... targetIDs);
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID, @NotNull ActionType actionType,
long forcedTimestamp, @NotEmpty Collection<String> controllerIDs);
/**
* method assigns the {@link DistributionSet} to all {@link Target}s by
@@ -100,6 +83,9 @@ public interface DeploymentManagement {
* @throw IncompleteDistributionSetException if mandatory
* {@link SoftwareModuleType} are not assigned as define by the
* {@link DistributionSetType}.
*
* @throw {@link EntityNotFoundException} if either provided
* {@link DistributionSet} or {@link Target}s do not exist
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID,
@@ -120,11 +106,13 @@ public interface DeploymentManagement {
* @throw IncompleteDistributionSetException if mandatory
* {@link SoftwareModuleType} are not assigned as define by the
* {@link DistributionSetType}.
*
* @throw {@link EntityNotFoundException} if either provided
* {@link DistributionSet} or {@link Target}s do not exist
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID,
@NotEmpty Collection<TargetWithActionType> targets,
String actionMessage);
@NotEmpty Collection<TargetWithActionType> targets, String actionMessage);
/**
* method assigns the {@link DistributionSet} to all {@link Target}s by
@@ -143,34 +131,14 @@ public interface DeploymentManagement {
* @throw IncompleteDistributionSetException if mandatory
* {@link SoftwareModuleType} are not assigned as define by the
* {@link DistributionSetType}.
*
* @throw {@link EntityNotFoundException} if either provided
* {@link DistributionSet} or {@link Target}s do not exist
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID,
@NotEmpty Collection<TargetWithActionType> targets, Rollout rollout, RolloutGroup rolloutGroup);
/**
* method assigns the {@link DistributionSet} to all {@link Target}s by
* their IDs.
*
* @param dsID
* {@link DistributionSet} which is assigned to the
* {@link Target}s
* @param targetIDs
* IDs of the {@link Target}s which should obtain the
* {@link DistributionSet}
*
* @return the changed targets
*
* @throws EntityNotFoundException
* if {@link DistributionSet} does not exist.
*
* @throw IncompleteDistributionSetException if mandatory
* {@link SoftwareModuleType} are not assigned as define by the
* {@link DistributionSetType}.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID, @NotEmpty String... targetIDs);
/**
* Cancels given {@link Action} for given {@link Target}. The method will
* immediately add a {@link Status#CANCELED} status to the action. However,
@@ -275,7 +243,7 @@ public interface DeploymentManagement {
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
List<Action> findActionsByRolloutAndStatus(@NotNull Rollout rollout, @NotNull Action.Status actionStatus);
/**
* Retrieves all {@link Action}s of a specific target.
*
@@ -407,19 +375,6 @@ public interface DeploymentManagement {
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Action findActionWithDetails(@NotNull Long actionId);
/**
* Retrieves all active {@link Action}s of a specific target ordered by
* action ID.
*
* @param pageable
* the pagination parameter
* @param target
* the target associated with the actions
* @return a paged list of actions associated with the given target
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<Action> findActiveActionsByTarget(@NotNull Pageable pageable, @NotNull Target target);
/**
* Retrieves all active {@link Action}s of a specific target ordered by
* action ID.
@@ -431,19 +386,6 @@ public interface DeploymentManagement {
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
List<Action> findActiveActionsByTarget(@NotNull Target target);
/**
* Retrieves all inactive {@link Action}s of a specific target ordered by
* action ID.
*
* @param pageable
* the pagination parameter
* @param target
* the target associated with the actions
* @return a paged list of actions associated with the given target
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<Action> findInActiveActionsByTarget(@NotNull Pageable pageable, @NotNull Target target);
/**
* Retrieves all inactive {@link Action}s of a specific target ordered by
* action ID.

View File

@@ -10,17 +10,21 @@ package org.eclipse.hawkbit.repository;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.builder.DistributionSetCreate;
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeCreate;
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeUpdate;
import org.eclipse.hawkbit.repository.builder.DistributionSetUpdate;
import org.eclipse.hawkbit.repository.exception.DistributionSetCreationFailedMissingMandatoryModuleException;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.exception.UnsupportedSoftwareModuleForThisDistributionSetException;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter;
@@ -29,10 +33,12 @@ import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.MetaData;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetInfo;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -47,14 +53,27 @@ public interface DistributionSetManagement {
/**
* Assigns {@link SoftwareModule} to existing {@link DistributionSet}.
*
* @param ds
* @param setId
* to assign and update
* @param softwareModules
* @param moduleIds
* to get assigned
* @return the updated {@link DistributionSet}.
*
* @throws EntityNotFoundException
* if given module does not exist
*
* @throws EntityReadOnlyException
* if use tries to change the {@link DistributionSet} s while
* the DS is already in use.
*
* @throws UnsupportedSoftwareModuleForThisDistributionSetException
* is {@link SoftwareModule#getType()} is not supported by this
* {@link DistributionSet#getType()}.
*
*
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSet assignSoftwareModules(@NotNull DistributionSet ds, Set<SoftwareModule> softwareModules);
DistributionSet assignSoftwareModules(@NotNull Long setId, @NotEmpty Collection<Long> moduleIds);
/**
* Assign a {@link DistributionSetTag} assignment to given
@@ -99,84 +118,92 @@ public interface DistributionSetManagement {
/**
* Creates a new {@link DistributionSet}.
*
* @param dSet
* @param create
* {@link DistributionSet} to be created
* @return the new persisted {@link DistributionSet}
*
* @throws EntityAlreadyExistsException
* if a given entity already exists
* @throws EntityNotFoundException
* if a provided linked entity does not exists
* ({@link DistributionSet#getModules()} or
* {@link DistributionSet#getType()})
* @throws DistributionSetCreationFailedMissingMandatoryModuleException
* is {@link DistributionSet} does not contain mandatory
* {@link SoftwareModule}s.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
DistributionSet createDistributionSet(@NotNull DistributionSet dSet);
DistributionSet createDistributionSet(@NotNull DistributionSetCreate create);
/**
* creates a list of distribution set meta data entries.
*
* @param dsId
* if the {@link DistributionSet} the metadata has to be created
* for
* @param metadata
* the meta data entries to create or update
* @return the updated or created distribution set meta data entries
*
* @throws EntityNotFoundException
* if given set does not exist
* @throws EntityAlreadyExistsException
* in case one of the meta data entry already exists for the
* specific key
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
List<DistributionSetMetadata> createDistributionSetMetadata(@NotEmpty Collection<DistributionSetMetadata> metadata);
/**
* creates or updates a single distribution set meta data entry.
*
* @param metadata
* the meta data entry to create or update
* @return the updated or created distribution set meta data entry
* @throws EntityAlreadyExistsException
* in case the meta data entry already exists for the specific
* key
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetMetadata createDistributionSetMetadata(@NotNull DistributionSetMetadata metadata);
List<DistributionSetMetadata> createDistributionSetMetadata(@NotNull Long dsId,
@NotEmpty Collection<MetaData> metadata);
/**
* Creates multiple {@link DistributionSet}s.
*
* @param distributionSets
* @param creates
* to be created
* @return the new {@link DistributionSet}s
* @throws EntityAlreadyExistsException
* if a given entity already exists
* @throws EntityNotFoundException
* if a provided linked entity does not exists
* ({@link DistributionSet#getModules()} or
* {@link DistributionSet#getType()})
* @throws DistributionSetCreationFailedMissingMandatoryModuleException
* is {@link DistributionSet} does not contain mandatory
* {@link SoftwareModule}s.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<DistributionSet> createDistributionSets(@NotNull Collection<DistributionSet> distributionSets);
List<DistributionSet> createDistributionSets(@NotNull Collection<DistributionSetCreate> creates);
/**
* Creates new {@link DistributionSetType}.
*
* @param type
* @param create
* to create
* @return created {@link Entity}
* @return created entity
*
* @throws EntityNotFoundException
* if a provided linked entity does not exists
* ({@link DistributionSetType#getMandatoryModuleTypes()} or
* {@link DistributionSetType#getOptionalModuleTypes()}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
DistributionSetType createDistributionSetType(@NotNull DistributionSetType type);
DistributionSetType createDistributionSetType(@NotNull DistributionSetTypeCreate create);
/**
* Creates multiple {@link DistributionSetType}s.
*
* @param types
* @param creates
* to create
* @return created {@link Entity}
* @return created entity
*
* @throws EntityNotFoundException
* if a provided linked entity does not exists
* ({@link DistributionSetType#getMandatoryModuleTypes()} or
* {@link DistributionSetType#getOptionalModuleTypes()}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<DistributionSetType> createDistributionSetTypes(@NotNull Collection<DistributionSetType> types);
List<DistributionSetType> createDistributionSetTypes(@NotNull Collection<DistributionSetTypeCreate> creates);
/**
* <p>
* {@link DistributionSet} can be deleted/erased from the repository if they
* have never been assigned to any {@link UpdateAction} or {@link Target}.
* have never been assigned to any {@link Action} or {@link Target}.
* </p>
*
* <p>
@@ -193,8 +220,8 @@ public interface DistributionSetManagement {
/**
* Deleted {@link DistributionSet}s by their IDs. That is either a soft
* delete of the entities have been linked to an {@link UpdateAction} before
* or a hard delete if not.
* delete of the entities have been linked to an {@link Action} before or a
* hard delete if not.
*
* @param distributionSetIDs
* to be deleted
@@ -205,13 +232,16 @@ public interface DistributionSetManagement {
/**
* deletes a distribution set meta data entry.
*
* @param distributionSet
* @param dsId
* where meta data has to be deleted
* @param key
* of the meta data element
*
* @throws EntityNotFoundException
* if given set does not exist
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
void deleteDistributionSetMetadata(@NotNull final DistributionSet distributionSet, @NotNull final String key);
void deleteDistributionSetMetadata(@NotNull final Long dsId, @NotNull final String key);
/**
* Deletes or mark as delete in case the type is in use.
@@ -234,7 +264,7 @@ public interface DistributionSetManagement {
/**
* Find {@link DistributionSet} based on given ID without details, e.g.
* {@link DistributionSet#getAgentHub()}.
* {@link DistributionSet#getModules()}.
*
* @param distid
* to look for.
@@ -245,7 +275,7 @@ public interface DistributionSetManagement {
/**
* Find {@link DistributionSet} based on given ID including (lazy loaded)
* details, e.g. {@link DistributionSet#getAgentHub()}.
* details, e.g. {@link DistributionSet#getModules()}.
*
* Note: for performance reasons it is recommended to use
* {@link #findDistributionSetById(Long)} if details are not necessary.
@@ -319,9 +349,6 @@ public interface DistributionSetManagement {
* Retrieves {@link DistributionSet} List for overview purposes (no
* {@link SoftwareModule}s and {@link DistributionSetTag}s).
*
* Please use {@link #findDistributionSetListWithDetails(Iterable)} if
* details are required.
*
* @param dist
* List of {@link DistributionSet} IDs to be found
* @return the found {@link DistributionSet}s
@@ -343,9 +370,6 @@ public interface DistributionSetManagement {
* to <code>true</code> for returning only completed distribution
* sets or <code>false</code> for only incomplete ones nor
* <code>null</code> to return both.
* @param complete
* set to if <code>false</code> incomplete DS should also be
* shown.
*
*
* @return all found {@link DistributionSet}s
@@ -363,9 +387,9 @@ public interface DistributionSetManagement {
* the pagination parameter
* @param deleted
* if TRUE, {@link DistributionSet}s marked as deleted are
* returned. If FALSE, on {@link DistributionSet}s with
* {@link DistributionSet#isDeleted()} == FALSE are returned.
* <code>null</code> if both are to be returned
* returned. If FALSE, on {@link DistributionSet}s not marked as
* deleted are returned. <code>null</code> if both are to be
* returned
* @return all found {@link DistributionSet}s
*
* @throws RSQLParameterUnsupportedFieldException
@@ -383,7 +407,7 @@ public interface DistributionSetManagement {
* following order:
* <p>
* 1) {@link DistributionSet}s which have the given {@link Target} as
* {@link TargetStatus#getInstalledDistributionSet()}
* {@link TargetInfo#getInstalledDistributionSet()}
* <p>
* 2) {@link DistributionSet}s which have the given {@link Target} as
* {@link Target#getAssignedDistributionSet()}
@@ -397,7 +421,7 @@ public interface DistributionSetManagement {
* has details of filters to be applied
* @param assignedOrInstalled
* the controllerID of the Target to be ordered by
* @return
* @return {@link DistributionSet}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<DistributionSet> findDistributionSetsAllOrderedByLinkTarget(@NotNull Pageable pageable,
@@ -471,8 +495,8 @@ public interface DistributionSetManagement {
/**
* finds a single distribution set meta data by its id.
*
* @param distributionSet
* where meta data has to rind
* @param setId
* of the {@link DistributionSet}
* @param key
* of the meta data element
* @return the found DistributionSetMetadata or {@code null} if not exits
@@ -480,7 +504,7 @@ public interface DistributionSetManagement {
* in case the meta data does not exists for the given key
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
DistributionSetMetadata findOne(@NotNull DistributionSet distributionSet, @NotEmpty String key);
DistributionSetMetadata findDistributionSetMetadata(@NotNull Long setId, @NotEmpty String key);
/**
* Checks if a {@link DistributionSet} is currently in use by a target in
@@ -495,7 +519,7 @@ public interface DistributionSetManagement {
boolean isDistributionSetInUse(@NotNull DistributionSet distributionSet);
/**
* {@link Entity} based method call for
* entity based method call for
* {@link #toggleTagAssignment(Collection, String)}.
*
* @param sets
@@ -540,14 +564,21 @@ public interface DistributionSetManagement {
* Unassigns a {@link SoftwareModule} form an existing
* {@link DistributionSet}.
*
* @param ds
* @param setId
* to get unassigned form
* @param softwareModule
* to get unassigned
* @param moduleId
* to be unassigned
* @return the updated {@link DistributionSet}.
*
* @throws EntityNotFoundException
* if given module does not exist
*
* @throws EntityReadOnlyException
* if use tries to change the {@link DistributionSet} s while
* the DS is already in use.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSet unassignSoftwareModule(@NotNull DistributionSet ds, @NotNull SoftwareModule softwareModule);
DistributionSet unassignSoftwareModule(@NotNull Long setId, @NotNull Long moduleId);
/**
* Unassign a {@link DistributionSetTag} assignment to given
@@ -565,43 +596,118 @@ public interface DistributionSetManagement {
/**
* Updates existing {@link DistributionSet}.
*
* @param ds
* @param update
* to update
* @return the saved {@link Entity}.
* @throws NullPointerException
* of {@link DistributionSet#getId()} is <code>null</code>
* @throw DataDependencyViolationException in case of illegal update
*
* @return the saved entity.
*
* @throws EntityNotFoundException
* if given set does not exist
* @throws EntityReadOnlyException
* if user tries to change requiredMigrationStep or type on a DS
* that is already assigned to targets
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSet updateDistributionSet(@NotNull DistributionSet ds);
DistributionSet updateDistributionSet(@NotNull DistributionSetUpdate update);
/**
* updates a distribution set meta data value if corresponding entry exists.
*
* @param metadata
* the meta data entry to be updated
* @param dsId
* {@link DistributionSet} of the meta data entry to be updated
* @param md
* meta data entry to be updated
* @return the updated meta data entry
*
* @throws EntityNotFoundException
* in case the meta data entry does not exists and cannot be
* updated
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetMetadata updateDistributionSetMetadata(@NotNull DistributionSetMetadata metadata);
DistributionSetMetadata updateDistributionSetMetadata(@NotNull Long dsId, @NotNull MetaData md);
/**
* Updates existing {@link DistributionSetType}. However, keep in mind that
* is not possible to change the {@link DistributionSetTypeElement}s while
* the DS type is already in use.
* Updates existing {@link DistributionSetType}. Resets assigned
* {@link SoftwareModuleType}s as well and sets as provided.
*
* @param dsType
* @param update
* to update
* @return updated {@link Entity}
*
*
* @return updated entity
*
* @throws EntityNotFoundException
* in case the {@link DistributionSetType} does not exists and
* cannot be updated
*
* @throws EntityReadOnlyException
* if use tries to change the {@link DistributionSetTypeElement}
* s while the DS type is already in use.
* if the {@link DistributionSetType} is already in use by a
* {@link DistributionSet} and user tries to change list of
* {@link SoftwareModuleType}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetType updateDistributionSetType(@NotNull DistributionSetType dsType);
DistributionSetType updateDistributionSetType(@NotNull DistributionSetTypeUpdate update);
/**
* Unassigns a {@link SoftwareModuleType} from the
* {@link DistributionSetType}. Does nothing if {@link SoftwareModuleType}
* has not been assigned in the first place.
*
* @param dsTypeId
* to update
* @param softwareModuleId
* to unassign
* @return updated {@link DistributionSetType}
*
* @throws EntityNotFoundException
* in case the {@link DistributionSetType} does not exist
*
* @throws EntityReadOnlyException
* if the {@link DistributionSetType} while it is already in use
* by a {@link DistributionSet}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetType unassignSoftwareModuleType(@NotNull Long dsTypeId, @NotNull Long softwareModuleId);
/**
* Assigns {@link DistributionSetType#getMandatoryModuleTypes()}.
*
* @param dsTypeId
* to update
* @param softwareModuleTypeIds
* to assign
* @return updated {@link DistributionSetType}
*
* @throws EntityNotFoundException
* in case the {@link DistributionSetType} or at least one of
* the {@link SoftwareModuleType}s do not exist
*
* @throws EntityReadOnlyException
* if the {@link DistributionSetType} while it is already in use
* by a {@link DistributionSet}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetType assignOptionalSoftwareModuleTypes(@NotNull Long dsTypeId,
@NotEmpty Collection<Long> softwareModuleTypeIds);
/**
* Assigns {@link DistributionSetType#getOptionalModuleTypes()}.
*
* @param dsTypeId
* to update
* @param softwareModuleTypes
* to assign
* @return updated {@link DistributionSetType}
*
* @throws EntityNotFoundException
* in case the {@link DistributionSetType} or at least one of
* the {@link SoftwareModuleType}s do not exist
*
* @throws EntityReadOnlyException
* if the {@link DistributionSetType} while it is already in use
* by a {@link DistributionSet}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetType assignMandatorySoftwareModuleTypes(@NotNull Long dsTypeId,
@NotEmpty Collection<Long> softwareModuleTypes);
}

View File

@@ -8,28 +8,20 @@
*/
package org.eclipse.hawkbit.repository;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus;
import org.eclipse.hawkbit.repository.model.Artifact;
import org.eclipse.hawkbit.repository.builder.ActionStatusBuilder;
import org.eclipse.hawkbit.repository.builder.DistributionSetBuilder;
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeBuilder;
import org.eclipse.hawkbit.repository.builder.RolloutBuilder;
import org.eclipse.hawkbit.repository.builder.RolloutGroupBuilder;
import org.eclipse.hawkbit.repository.builder.SoftwareModuleBuilder;
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeBuilder;
import org.eclipse.hawkbit.repository.builder.TagBuilder;
import org.eclipse.hawkbit.repository.builder.TargetBuilder;
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryBuilder;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.repository.model.MetaData;
import org.hibernate.validator.constraints.NotEmpty;
/**
@@ -40,346 +32,65 @@ import org.hibernate.validator.constraints.NotEmpty;
public interface EntityFactory {
/**
* Generates an empty {@link Action} without persisting it.
*
* @return {@link Action} object
* @return {@link ActionStatusBuilder} object
*/
Action generateAction();
ActionStatusBuilder actionStatus();
/**
* Generates an empty {@link ActionStatus} object without persisting it.
*
* @return {@link ActionStatus} object
* @return {@link DistributionSetBuilder} object
*/
ActionStatus generateActionStatus();
DistributionSetBuilder distributionSet();
/**
* Generates an {@link ActionStatus} object without persisting it.
* Generates an {@link MetaData} element without persisting it.
*
* @param action
* the {@link ActionStatus} belongs to.
* @param status
* as reflected by this {@link ActionStatus}.
* @param occurredAt
* time in {@link TimeUnit#MILLISECONDS} GMT when the status
* change happened.
*
* @return {@link ActionStatus} object
*/
ActionStatus generateActionStatus(@NotNull Action action, @NotNull Status status, Long occurredAt);
/**
* Generates an {@link ActionStatus} object without persisting it.
*
* @param action
* the {@link ActionStatus} belongs to.
* @param status
* as reflected by this {@link ActionStatus}.
* @param occurredAt
* time in {@link TimeUnit#MILLISECONDS} GMT when the status
* change happened.
* @param messages
* optional comments
*
* @return {@link ActionStatus} object
*/
ActionStatus generateActionStatus(@NotNull Action action, @NotNull Status status, Long occurredAt,
final Collection<String> messages);
/**
* Generates an {@link ActionStatus} object without persisting it.
*
* @param action
* the {@link ActionStatus} belongs to.
* @param status
* as reflected by this {@link ActionStatus}.
* @param occurredAt
* time in {@link TimeUnit#MILLISECONDS} GMT when the status
* change happened.
* @param message
* optional comment
*
* @return {@link ActionStatus} object
*/
ActionStatus generateActionStatus(@NotNull Action action, @NotNull Status status, Long occurredAt,
final String message);
/**
* Generates an empty {@link DistributionSet} without persisting it.
*
* @return {@link DistributionSet} object
*/
DistributionSet generateDistributionSet();
/**
* Generates an {@link DistributionSet} without persisting it.
*
* @param name
* {@link DistributionSet#getName()}
* @param version
* {@link DistributionSet#getVersion()}
* @param description
* {@link DistributionSet#getDescription()}
* @param type
* {@link DistributionSet#getType()}
* @param moduleList
* {@link DistributionSet#getModules()}
*
* @return {@link DistributionSet} object
*/
DistributionSet generateDistributionSet(@NotNull String name, @NotNull String version, String description,
@NotNull DistributionSetType type, Collection<SoftwareModule> moduleList);
/**
* Generates an empty {@link DistributionSetMetadata} element without
* persisting it.
*
* @return {@link DistributionSetMetadata} object
*/
DistributionSetMetadata generateDistributionSetMetadata();
/**
* Generates an {@link DistributionSetMetadata} element without persisting
* it.
*
* @param distributionSet
* {@link DistributionSetMetadata#getDistributionSet()}
* @param key
* {@link DistributionSetMetadata#getKey()}
* {@link MetaData#getKey()}
* @param value
* {@link DistributionSetMetadata#getValue()}
* {@link MetaData#getValue()}
*
* @return {@link DistributionSetMetadata} object
* @return {@link MetaData} object
*/
DistributionSetMetadata generateDistributionSetMetadata(@NotNull DistributionSet distributionSet,
@NotNull String key, String value);
MetaData generateMetadata(@NotEmpty String key, @NotNull String value);
/**
* Generates an empty {@link DistributionSetTag} without persisting it.
*
* @return {@link DistributionSetTag} object
* @return {@link TagBuilder} object
*/
DistributionSetTag generateDistributionSetTag();
TagBuilder tag();
/**
* Generates a {@link DistributionSetTag} without persisting it.
*
* @param name
* of the tag
* @return {@link DistributionSetTag} object
* @return {@link RolloutGroupBuilder} object
*/
DistributionSetTag generateDistributionSetTag(@NotNull String name);
RolloutGroupBuilder rolloutGroup();
/**
* Generates a {@link DistributionSetTag} without persisting it.
*
* @param name
* of the tag
* @param description
* of the tag
* @param colour
* of the tag
* @return {@link DistributionSetTag} object
* @return {@link DistributionSetTypeBuilder} object
*/
DistributionSetTag generateDistributionSetTag(@NotNull String name, String description, String colour);
DistributionSetTypeBuilder distributionSetType();
/**
* Generates an empty {@link DistributionSetType} without persisting it.
*
* @return {@link DistributionSetType} object
* @return {@link RolloutBuilder} object
*/
DistributionSetType generateDistributionSetType();
RolloutBuilder rollout();
/**
* Generates a {@link DistributionSetType} without persisting it.
*
* @param key
* {@link DistributionSetType#getKey()}
* @param name
* {@link DistributionSetType#getName()}
* @param description
* {@link DistributionSetType#getDescription()}
*
* @return {@link DistributionSetType} object
* @return {@link SoftwareModuleBuilder} object
*/
DistributionSetType generateDistributionSetType(@NotNull String key, @NotNull String name, String description);
SoftwareModuleBuilder softwareModule();
/**
* Generates an empty {@link Rollout} without persisting it.
*
* @return {@link Rollout} object
* @return {@link SoftwareModuleTypeBuilder} object
*/
Rollout generateRollout();
SoftwareModuleTypeBuilder softwareModuleType();
/**
* Generates an empty {@link RolloutGroup} without persisting it.
*
* @return {@link RolloutGroup} object
* @return {@link TargetBuilder} object
*/
RolloutGroup generateRolloutGroup();
TargetBuilder target();
/**
* Generates an empty {@link SoftwareModule} without persisting it.
*
* @return {@link SoftwareModule} object
* @return {@link TargetFilterQueryBuilder} object
*/
SoftwareModule generateSoftwareModule();
/**
* Generates a {@link SoftwareModule} without persisting it.
*
* @param type
* of the {@link SoftwareModule}
* @param name
* abstract name of the {@link SoftwareModule}
* @param version
* of the {@link SoftwareModule}
* @param description
* of the {@link SoftwareModule}
* @param vendor
* of the {@link SoftwareModule}
*
* @return {@link SoftwareModule} object
*/
SoftwareModule generateSoftwareModule(@NotNull SoftwareModuleType type, @NotNull String name,
@NotNull String version, String description, String vendor);
/**
* Generates an empty {@link SoftwareModuleMetadata} pair without persisting
* it.
*
* @return {@link SoftwareModuleMetadata} object
*/
SoftwareModuleMetadata generateSoftwareModuleMetadata();
/**
* Generates a {@link SoftwareModuleMetadata} pair without persisting it.
*
* @param softwareModule
* {@link SoftwareModuleMetadata#getSoftwareModule()}
* @param key
* {@link SoftwareModuleMetadata#getKey()}
* @param value
* {@link SoftwareModuleMetadata#getValue()}
*
* @return {@link SoftwareModuleMetadata} object
*/
SoftwareModuleMetadata generateSoftwareModuleMetadata(@NotNull SoftwareModule softwareModule, @NotNull String key,
String value);
/**
* Generates an empty {@link SoftwareModuleType} without persisting it.
*
* @return {@link SoftwareModuleType} object
*/
SoftwareModuleType generateSoftwareModuleType();
/**
* Generates a {@link SoftwareModuleType} without persisting it.
*
* @param key
* {@link SoftwareModuleType#getKey()}
* @param name
* {@link SoftwareModuleType#getName()}
* @param description
* {@link SoftwareModuleType#getDescription()}
* @param maxAssignments
* {@link SoftwareModuleType#getMaxAssignments()}
*
* @return {@link SoftwareModuleType} object
*/
SoftwareModuleType generateSoftwareModuleType(@NotNull String key, @NotNull String name, String description,
int maxAssignments);
/**
* Generates an empty {@link Target} without persisting it.
* {@link Target#getSecurityToken()} is generated.
*
* @param controllerID
* of the {@link Target}
*
* @return {@link Target} object
*/
Target generateTarget(@NotEmpty String controllerID);
/**
* Generates an empty {@link Target} without persisting it.
*
* @param controllerID
* of the {@link Target}
* @param securityToken
* of the {@link Target} for authentication if enabled on tenant.
* Generates one if empty or <code>null</code>.
*
* @return {@link Target} object
*/
Target generateTarget(@NotEmpty String controllerID, String securityToken);
/**
* Generates an empty {@link TargetFilterQuery} without persisting it.
*
* @return {@link TargetFilterQuery} object
*/
TargetFilterQuery generateTargetFilterQuery();
/**
* Generates an {@link TargetFilterQuery} without persisting it.
*
* @param name
* name for the filter
* @param query
* query of the filter
* @return {@link TargetFilterQuery} object
*/
TargetFilterQuery generateTargetFilterQuery(String name, String query);
/**
* Generates an {@link TargetFilterQuery} without persisting it.
*
* @param name
* name for the filter
* @param query
* query of the filter
* @param autoAssignDS
* auto assign distribution set
* @return {@link TargetFilterQuery} object
*/
TargetFilterQuery generateTargetFilterQuery(String name, String query, DistributionSet autoAssignDS);
/**
* Generates an empty {@link TargetTag} without persisting it.
*
* @return {@link TargetTag} object
*/
TargetTag generateTargetTag();
/**
* Generates a {@link TargetTag} without persisting it.
*
* @param name
* of the tag
* @return {@link TargetTag} object
*/
TargetTag generateTargetTag(@NotNull String name);
/**
* Generates a {@link TargetTag} without persisting it.
*
* @param name
* of the tag
* @param description
* of the tag
* @param colour
* of the tag
* @return {@link TargetTag} object
*/
TargetTag generateTargetTag(@NotNull String name, String description, String colour);
/**
* Generates an empty {@link Artifact} without persisting it.
*
* @return {@link Artifact} object
*/
Artifact generateArtifact();
TargetFilterQueryBuilder targetFilterQuery();
}

View File

@@ -83,10 +83,7 @@ public final class OffsetBasedPageRequest extends PageRequest {
return false;
}
final OffsetBasedPageRequest other = (OffsetBasedPageRequest) obj;
if (offset != other.offset) {
return false;
}
return true;
return offset == other.offset;
}
}

View File

@@ -8,12 +8,20 @@
*/
package org.eclipse.hawkbit.repository;
import java.util.List;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.builder.RolloutCreate;
import org.eclipse.hawkbit.repository.builder.RolloutGroupCreate;
import org.eclipse.hawkbit.repository.builder.RolloutUpdate;
import org.eclipse.hawkbit.repository.exception.ConstraintViolationException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
@@ -25,8 +33,6 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.security.access.prepost.PreAuthorize;
import java.util.List;
/**
* RolloutManagement to control rollouts e.g. like creating, starting, resuming
* and pausing rollouts. This service secures all the functionality based on the
@@ -123,7 +129,7 @@ public interface RolloutManagement {
* to {@link RolloutStatus#READY} so it can be started with
* {@link #startRollout(Rollout)}.
*
* @param rollout
* @param create
* the rollout entity to create
* @param amountGroup
* the amount of groups to split the rollout into
@@ -132,11 +138,13 @@ public interface RolloutManagement {
* applied for each {@link RolloutGroup}
* @return the persisted rollout.
*
* @throws IllegalArgumentException
* in case the given groupSize is zero or lower.
* @throws EntityNotFoundException
* if given {@link DistributionSet} does not exist
* @throws ConstraintViolationException
* if rollout or group parameters are invalid
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
Rollout createRollout(@NotNull Rollout rollout, int amountGroup, @NotNull RolloutGroupConditions conditions);
Rollout createRollout(@NotNull RolloutCreate create, int amountGroup, @NotNull RolloutGroupConditions conditions);
/**
* Persists a new rollout entity. The filter within the
@@ -164,11 +172,14 @@ public interface RolloutManagement {
* RolloutGroup itself
* @return the persisted rollout.
*
* @throws IllegalArgumentException
* in case the given groupSize is zero or lower.
* @throws EntityNotFoundException
* if given {@link DistributionSet} does not exist
* @throws ConstraintViolationException
* if rollout or group parameters are invalid
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
Rollout createRollout(@NotNull Rollout rollout, @NotNull List<RolloutGroup> groups, RolloutGroupConditions conditions);
Rollout createRollout(@NotNull RolloutCreate rollout, @NotNull List<RolloutGroupCreate> groups,
RolloutGroupConditions conditions);
/**
* Can be called on a Rollout in {@link RolloutStatus#CREATING} to
@@ -184,8 +195,8 @@ public interface RolloutManagement {
* @param rollout
* the rollout
*/
void fillRolloutGroupsWithTargets(final Rollout rollout);
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
void fillRolloutGroupsWithTargets(@NotNull Long rollout);
/**
* Retrieves all rollouts.
@@ -344,12 +355,16 @@ public interface RolloutManagement {
/**
* Update rollout details.
*
* @param rollout
* @param update
* rollout to be updated
* @param name
* to update or <code>null</code>
* @param description
* to update or <code>null</code>
*
* @return Rollout updated rollout
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE)
Rollout updateRollout(@NotNull Rollout rollout);
Rollout updateRollout(@NotNull RolloutUpdate update);
}

View File

@@ -14,12 +14,17 @@ import java.util.List;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.builder.SoftwareModuleCreate;
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeCreate;
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeUpdate;
import org.eclipse.hawkbit.repository.builder.SoftwareModuleUpdate;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.model.AssignedSoftwareModule;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.MetaData;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
@@ -67,29 +72,31 @@ public interface SoftwareManagement {
/**
* Create {@link SoftwareModule}s in the repository.
*
* @param swModules
* @param creates
* {@link SoftwareModule}s to create
* @return SoftwareModule
* @throws EntityAlreadyExistsException
* if a given entity already exists
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<SoftwareModule> createSoftwareModule(@NotNull Collection<SoftwareModule> swModules);
List<SoftwareModule> createSoftwareModule(@NotNull Collection<SoftwareModuleCreate> creates);
/**
*
* @param swModule
* @param create
* SoftwareModule to create
* @return SoftwareModule
* @throws EntityAlreadyExistsException
* if a given entity already exists
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
SoftwareModule createSoftwareModule(@NotNull SoftwareModule swModule);
SoftwareModule createSoftwareModule(@NotNull SoftwareModuleCreate create);
/**
* creates a list of software module meta data entries.
*
*
* @param moduleId
* the metadata belongs to
* @param metadata
* the meta data entries to create or update
* @return the updated or created software module meta data entries
@@ -98,11 +105,14 @@ public interface SoftwareManagement {
* specific key
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
List<SoftwareModuleMetadata> createSoftwareModuleMetadata(@NotNull Collection<SoftwareModuleMetadata> metadata);
List<SoftwareModuleMetadata> createSoftwareModuleMetadata(@NotNull Long moduleId,
@NotNull Collection<MetaData> metadata);
/**
* creates or updates a single software module meta data entry.
*
*
* @param moduleId
* the metadata belongs to
* @param metadata
* the meta data entry to create or update
* @return the updated or created software module meta data entry
@@ -111,27 +121,27 @@ public interface SoftwareManagement {
* key
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModuleMetadata createSoftwareModuleMetadata(@NotNull SoftwareModuleMetadata metadata);
SoftwareModuleMetadata createSoftwareModuleMetadata(@NotNull Long moduleId, @NotNull MetaData metadata);
/**
* Creates multiple {@link SoftwareModuleType}s.
*
* @param types
* @param creates
* to create
* @return created Entity
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<SoftwareModuleType> createSoftwareModuleType(@NotNull Collection<SoftwareModuleType> types);
List<SoftwareModuleType> createSoftwareModuleType(@NotNull Collection<SoftwareModuleTypeCreate> creates);
/**
* Creates new {@link SoftwareModuleType}.
*
* @param type
* @param create
* to create
* @return created Entity
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
SoftwareModuleType createSoftwareModuleType(@NotNull SoftwareModuleType type);
SoftwareModuleType createSoftwareModuleType(@NotNull SoftwareModuleTypeCreate create);
/**
* Deletes the given {@link SoftwareModule} Entity.
@@ -198,6 +208,17 @@ public interface SoftwareManagement {
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Slice<SoftwareModule> findSoftwareModuleByFilters(@NotNull Pageable pageable, String searchText, Long typeId);
/**
* Finds {@link SoftwareModuleType} by given id.
*
* @param ids
* to search for
* @return the found {@link SoftwareModuleType}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.IS_CONTROLLER)
List<SoftwareModuleType> findSoftwareModuleTypesById(@NotEmpty Collection<Long> ids);
/**
* Finds {@link SoftwareModule} by given id.
*
@@ -412,46 +433,57 @@ public interface SoftwareManagement {
* {@link SoftwareModule#getDescription()}
* {@link SoftwareModule#getVendor()}.
*
* @param sm
* @param moduleId
* to update
* @param description
* to update or <code>null</code>
* @param vendor
* to update or <code>null</code>
*
* @throws EntityNotFoundException
* if given module does not exist
*
* @return the saved Entity.
*
* @throws NullPointerException
* of {@link SoftwareModule#getId()} is <code>null</code>
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModule updateSoftwareModule(@NotNull SoftwareModule sm);
SoftwareModule updateSoftwareModule(@NotNull SoftwareModuleUpdate update);
/**
* updates a distribution set meta data value if corresponding entry exists.
*
*
* @param moduleId
* the metadata belongs to
* @param metadata
* the meta data entry to be updated
*
*
* @return the updated meta data entry
* @throws EntityNotFoundException
* in case the meta data entry does not exists and cannot be
* updated
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModuleMetadata updateSoftwareModuleMetadata(@NotNull SoftwareModuleMetadata metadata);
SoftwareModuleMetadata updateSoftwareModuleMetadata(@NotNull Long moduleId, @NotNull MetaData metadata);
/**
* Updates existing {@link SoftwareModuleType}. Update-able value is
* {@link SoftwareModuleType#getDescription()} and
* {@link SoftwareModuleType#getColour()}.
* Updates existing {@link SoftwareModuleType}.
*
* @param sm
* @param update
* to update
*
* @return updated Entity
*
* @throws EntityNotFoundException
* in case the {@link SoftwareModuleType} does not exists and
* cannot be updated
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModuleType updateSoftwareModuleType(@NotNull SoftwareModuleType sm);
SoftwareModuleType updateSoftwareModuleType(@NotNull SoftwareModuleTypeUpdate update);
/**
* Finds all meta data by the given software module id.
*
* @param softwareModuleId
* @param moduleId
* the software module id to retrieve the meta data from
*
*

View File

@@ -85,14 +85,14 @@ public interface SystemManagement {
TenantMetaData getTenantMetadata(@NotNull String tenant);
/**
* Update call for {@link TenantMetaData}.
* Update call for {@link TenantMetaData} of the current tenant.
*
* @param metaData
* @param defaultDsType
* to update
* @return updated {@link TenantMetaData} entity
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
TenantMetaData updateTenantMetadata(@NotNull TenantMetaData metaData);
TenantMetaData updateTenantMetadata(@NotNull Long defaultDsType);
/**
* Returns {@link TenantMetaData} of given tenant ID.

View File

@@ -14,7 +14,10 @@ import java.util.List;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.builder.TagCreate;
import org.eclipse.hawkbit.repository.builder.TagUpdate;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.model.DistributionSet;
@@ -44,7 +47,7 @@ public interface TagManagement {
/**
* Creates a {@link DistributionSet}.
*
* @param distributionSetTag
* @param create
* to be created.
* @return the new {@link DistributionSet}
* @throws EntityAlreadyExistsException
@@ -52,24 +55,24 @@ public interface TagManagement {
*
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
DistributionSetTag createDistributionSetTag(@NotNull DistributionSetTag distributionSetTag);
DistributionSetTag createDistributionSetTag(@NotNull TagCreate create);
/**
* Creates multiple {@link DistributionSetTag}s.
*
* @param distributionSetTags
* @param creates
* to be created
* @return the new {@link DistributionSetTag}
* @throws EntityAlreadyExistsException
* if a given entity already exists
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<DistributionSetTag> createDistributionSetTags(@NotNull Collection<DistributionSetTag> distributionSetTags);
List<DistributionSetTag> createDistributionSetTags(@NotNull Collection<TagCreate> creates);
/**
* Creates a new {@link TargetTag}.
*
* @param targetTag
* @param create
* to be created
*
* @return the new created {@link TargetTag}
@@ -78,12 +81,12 @@ public interface TagManagement {
* if given object already exists
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
TargetTag createTargetTag(@NotNull TargetTag targetTag);
TargetTag createTargetTag(@NotNull TagCreate create);
/**
* created multiple {@link TargetTag}s.
*
* @param targetTags
* @param creates
* to be created
* @return the new created {@link TargetTag}s
*
@@ -91,7 +94,7 @@ public interface TagManagement {
* if given object has already an ID.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
List<TargetTag> createTargetTags(@NotNull Collection<TargetTag> targetTags);
List<TargetTag> createTargetTags(@NotNull Collection<TagCreate> creates);
/**
* Deletes {@link DistributionSetTag} by given
@@ -226,23 +229,30 @@ public interface TagManagement {
/**
* Updates an existing {@link DistributionSetTag}.
*
* @param distributionSetTag
* @param update
* to be updated
*
* @return the updated {@link DistributionSet}
* @throws NullPointerException
* of {@link DistributionSetTag#getName()} is <code>null</code>
*
* @throws EntityNotFoundException
* in case the {@link DistributionSetTag} does not exists and
* cannot be updated
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetTag updateDistributionSetTag(@NotNull DistributionSetTag distributionSetTag);
DistributionSetTag updateDistributionSetTag(@NotNull TagUpdate update);
/**
* updates the {@link TargetTag}.
*
* @param targetTag
* @param update
* the {@link TargetTag} with updated values
* @return the updated {@link TargetTag}
*
* @throws EntityNotFoundException
* in case the {@link TargetTag} does not exists and cannot be
* updated
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
TargetTag updateTargetTag(@NotNull TargetTag targetTag);
TargetTag updateTargetTag(@NotNull TagUpdate update);
}

View File

@@ -11,6 +11,9 @@ package org.eclipse.hawkbit.repository;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryCreate;
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryUpdate;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.model.DistributionSet;
@@ -28,11 +31,12 @@ public interface TargetFilterQueryManagement {
/**
* creating new {@link TargetFilterQuery}.
*
* @param customTargetFilter
* @param create
* to create
* @return the created {@link TargetFilterQuery}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
TargetFilterQuery createTargetFilterQuery(@NotNull TargetFilterQuery customTargetFilter);
TargetFilterQuery createTargetFilterQuery(@NotNull TargetFilterQueryCreate create);
/**
* Delete target filter query.
@@ -73,6 +77,7 @@ public interface TargetFilterQueryManagement {
/**
* Counts all target filter queries
*
* @return the number of all target filter queries
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@@ -135,7 +140,8 @@ public interface TargetFilterQueryManagement {
DistributionSet distributionSet, String rsqlParam);
/**
* Retrieves all target filter query with auto assign DS which {@link TargetFilterQuery}.
* Retrieves all target filter query with auto assign DS which
* {@link TargetFilterQuery}.
*
*
* @return the page with the found {@link TargetFilterQuery}
@@ -169,10 +175,32 @@ public interface TargetFilterQueryManagement {
/**
* updates the {@link TargetFilterQuery}.
*
* @param targetFilterQuery
* @param update
* to be updated
*
* @return the updated {@link TargetFilterQuery}
*
* @throws EntityNotFoundException
* if either {@link TargetFilterQuery} and/or autoAssignDs are
* provided but not found
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
TargetFilterQuery updateTargetFilterQuery(@NotNull TargetFilterQuery targetFilterQuery);
TargetFilterQuery updateTargetFilterQuery(TargetFilterQueryUpdate update);
/**
* updates the {@link TargetFilterQuery#getAutoAssignDistributionSet()}.
*
* @param queryId
* to be updated
* @param dsId
* to be updated or <code>null</code>
* @return the updated {@link TargetFilterQuery}
*
* @throws EntityNotFoundException
* if either {@link TargetFilterQuery} and/or autoAssignDs are
* provided but not found
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
TargetFilterQuery updateTargetFilterQueryAutoAssignDS(Long queryId, Long dsId);
}

View File

@@ -8,14 +8,16 @@
*/
package org.eclipse.hawkbit.repository;
import java.net.URI;
import java.util.Collection;
import java.util.List;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.builder.TargetCreate;
import org.eclipse.hawkbit.repository.builder.TargetUpdate;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.model.DistributionSet;
@@ -136,37 +138,14 @@ public interface TargetManagement {
/**
* creating a new {@link Target}.
*
* @param target
* @param create
* to be created
* @return the created {@link Target}
*
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.IS_CONTROLLER)
Target createTarget(@NotNull Target target);
/**
* creating new {@link Target}s including poll status data. useful
* especially in plug and play scenarios.
*
* @param target
* to be created *
* @param status
* of the target
* @param lastTargetQuery
* if a plug and play case
* @param address
* if a plug and play case
*
* @throws EntityAlreadyExistsException
* if {@link Target} with given {@link Target#getControllerId()}
* already exists.
*
* @return created {@link Target}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.IS_CONTROLLER)
Target createTarget(@NotNull Target target, @NotNull TargetUpdateStatus status, Long lastTargetQuery, URI address);
Target createTarget(@NotNull TargetCreate create);
/**
* creates multiple {@link Target}s. If some of the given {@link Target}s
@@ -174,7 +153,7 @@ public interface TargetManagement {
* thrown. {@link Target}s contain all objects of the parameter targets,
* including duplicates.
*
* @param targets
* @param creates
* to be created.
* @return the created {@link Target}s
*
@@ -182,7 +161,7 @@ public interface TargetManagement {
* of one of the given targets already exist.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
List<Target> createTargets(@NotNull Collection<Target> targets);
List<Target> createTargets(@NotNull Collection<TargetCreate> creates);
/**
* Deletes all targets with the given IDs.
@@ -439,8 +418,8 @@ public interface TargetManagement {
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Target> findTargetByFilters(@NotNull Pageable pageable, Collection<TargetUpdateStatus> status,
Boolean overdueState, String searchText, Long installedOrAssignedDistributionSetId, Boolean selectTargetWithNoTag,
String... tagNames);
Boolean overdueState, String searchText, Long installedOrAssignedDistributionSetId,
Boolean selectTargetWithNoTag, String... tagNames);
/**
* retrieves {@link Target}s by the installed {@link DistributionSet}without
@@ -651,23 +630,16 @@ public interface TargetManagement {
/**
* updates the {@link Target}.
*
* @param target
* @param update
* to be updated
*
* @return the updated {@link Target}
*
* @throws EntityNotFoundException
* if given target does not exist
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.IS_CONTROLLER)
Target updateTarget(@NotNull Target target);
/**
* updates multiple {@link Target}s.
*
* @param targets
* to be updated
* @return the updated {@link Target}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.IS_CONTROLLER)
List<Target> updateTargets(@NotNull Collection<Target> targets);
Target updateTarget(TargetUpdate update);
}

View File

@@ -0,0 +1,27 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.ActionStatus;
/**
* Builder for {@link ActionStatus}.
*
*/
@FunctionalInterface
public interface ActionStatusBuilder {
/**
* @param actionId
* the status is for
* @return create builder
*/
ActionStatusCreate create(long actionId);
}

View File

@@ -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.builder;
import java.util.Collection;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus;
import org.eclipse.hawkbit.repository.model.BaseEntity;
/**
* Builder to create a new {@link ActionStatus} entry. Defines all fields that
* can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/
public interface ActionStatusCreate {
/**
* @param status
* {@link ActionStatus#getStatus()}
* @return updated {@link ActionStatusCreate} object
*/
ActionStatusCreate status(Status status);
/**
* @param occurredAt
* for {@link ActionStatus#getOccurredAt()}
* @return updated {@link ActionStatusCreate} object
*/
ActionStatusCreate occurredAt(Long occurredAt);
/**
* @param messages
* for {@link ActionStatus#getMessages()}
* @return updated {@link ActionStatusCreate} object
*/
ActionStatusCreate messages(Collection<String> messages);
/**
* @param message
* for {@link ActionStatus#getMessages()}
* @return updated {@link ActionStatusCreate} object
*/
ActionStatusCreate message(String message);
/**
* @return peek on current state of {@link ActionStatus} in the builder
*/
ActionStatus build();
}

View File

@@ -0,0 +1,31 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.DistributionSet;
/**
* Builder for {@link DistributionSet}.
*
*/
public interface DistributionSetBuilder {
/**
* @param id
* of the updatable entity
* @return builder instance
*/
DistributionSetUpdate update(long id);
/**
* @return builder instance
*/
DistributionSetCreate create();
}

View File

@@ -0,0 +1,82 @@
/**
* 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.builder;
import java.util.Collection;
import java.util.Optional;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link DistributionSet} entry. Defines all fields
* that can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/
public interface DistributionSetCreate {
/**
* @param name
* for {@link DistributionSet#getName()}
* @return updated builder instance
*/
DistributionSetCreate name(@NotEmpty String name);
/**
* @param version
* for {@link DistributionSet#getVersion()}
* @return updated builder instance
*/
DistributionSetCreate version(@NotEmpty String version);
/**
* @param description
* for {@link DistributionSet#getDescription()}
* @return updated builder instance
*/
DistributionSetCreate description(String description);
/**
* @param typeKey
* for {@link DistributionSet#getType()}
* @return updated builder instance
*/
DistributionSetCreate type(@NotEmpty String typeKey);
/**
* @param type
* for {@link DistributionSet#getType()}
* @return updated builder instance
*/
default DistributionSetCreate type(final DistributionSetType type) {
return type(Optional.ofNullable(type).map(DistributionSetType::getKey).orElse(null));
}
/**
* @param modules
* for {@link DistributionSet#getModules()}
* @return updated builder instance
*/
DistributionSetCreate modules(Collection<Long> modules);
/**
* @param requiredMigrationStep
* for {@link DistributionSet#isRequiredMigrationStep()}
* @return updated builder instance
*/
DistributionSetCreate requiredMigrationStep(Boolean requiredMigrationStep);
/**
* @return peek on current state of {@link DistributionSet} in the builder
*/
DistributionSet build();
}

View File

@@ -0,0 +1,31 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
/**
* Builder for {@link DistributionSetType}.
*
*/
public interface DistributionSetTypeBuilder {
/**
* @param id
* of the updatable entity
* @return builder instance
*/
DistributionSetTypeUpdate update(long id);
/**
* @return builder instance
*/
DistributionSetTypeCreate create();
}

View File

@@ -0,0 +1,112 @@
/**
* 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.builder;
import java.util.Collection;
import java.util.Optional;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.hibernate.validator.constraints.NotEmpty;
import com.google.common.collect.Lists;
/**
* Builder to create a new {@link DistributionSetType} entry. Defines all fields
* that can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/
public interface DistributionSetTypeCreate {
/**
* @param key
* for {@link DistributionSetType#getKey()}
* @return updated builder instance
*/
DistributionSetTypeCreate key(@NotEmpty String key);
/**
* @param name
* for {@link DistributionSetType#getName()}
* @return updated builder instance
*/
DistributionSetTypeCreate name(@NotEmpty String name);
/**
* @param description
* for {@link DistributionSetType#getDescription()}
* @return updated builder instance
*/
DistributionSetTypeCreate description(String description);
/**
* @param colour
* for {@link DistributionSetType#getColour()}
* @return updated builder instance
*/
DistributionSetTypeCreate colour(String colour);
/**
* @param mandatory
* for {@link DistributionSetType#getMandatoryModuleTypes()}
* @return updated builder instance
*/
DistributionSetTypeCreate mandatory(Collection<Long> mandatory);
/**
* @param mandatory
* for {@link DistributionSetType#getMandatoryModuleTypes()}
* @return updated builder instance
*/
default DistributionSetTypeCreate mandatory(final Long mandatory) {
return mandatory(Lists.newArrayList(mandatory));
}
/**
* @param mandatory
* for {@link DistributionSetType#getOptionalModuleTypes()}
* @return updated builder instance
*/
default DistributionSetTypeCreate mandatory(final SoftwareModuleType mandatory) {
return mandatory(Optional.ofNullable(mandatory).map(SoftwareModuleType::getId).orElse(null));
}
/**
* @param optional
* for {@link DistributionSetType#getOptionalModuleTypes()}
* @return updated builder instance
*/
DistributionSetTypeCreate optional(Collection<Long> optional);
/**
* @param optional
* for {@link DistributionSetType#getOptionalModuleTypes()}
* @return updated builder instance
*/
default DistributionSetTypeCreate optional(final Long optional) {
return optional(Lists.newArrayList(optional));
}
/**
* @param optional
* for {@link DistributionSetType#getOptionalModuleTypes()}
* @return updated builder instance
*/
default DistributionSetTypeCreate optional(final SoftwareModuleType optional) {
return optional(Optional.ofNullable(optional).map(SoftwareModuleType::getId).orElse(null));
}
/**
* @return peek on current state of {@link DistributionSetType} in the
* builder
*/
DistributionSetType build();
}

View File

@@ -0,0 +1,49 @@
/**
* 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.builder;
import java.util.Collection;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
/**
* Builder to update an existing {@link DistributionSetType} entry. Defines all
* fields that can be updated.
*
*/
public interface DistributionSetTypeUpdate {
/**
* @param description
* for {@link DistributionSetType#getDescription()}
* @return updated builder instance
*/
DistributionSetTypeUpdate description(String description);
/**
* @param colour
* for {@link DistributionSetType#getColour()}
* @return updated builder instance
*/
DistributionSetTypeUpdate colour(String colour);
/**
* @param mandatory
* for {@link DistributionSetType#getMandatoryModuleTypes()}
* @return updated builder instance
*/
DistributionSetTypeUpdate mandatory(Collection<Long> mandatory);
/**
* @param optional
* for {@link DistributionSetType#getOptionalModuleTypes()}
* @return updated builder instance
*/
DistributionSetTypeUpdate optional(Collection<Long> optional);
}

View File

@@ -0,0 +1,66 @@
/**
* 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.builder;
import java.util.Optional;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to update an existing {@link DistributionSet} entry. Defines all
* fields that can be updated.
*
*/
public interface DistributionSetUpdate {
/**
* @param name
* for {@link DistributionSet#getName()}
* @return updated builder instance
*/
DistributionSetUpdate name(@NotEmpty String name);
/**
* @param version
* for {@link DistributionSet#getVersion()}
* @return updated builder instance
*/
DistributionSetUpdate version(@NotEmpty String version);
/**
* @param description
* for {@link DistributionSet#getDescription()}
* @return updated builder instance
*/
DistributionSetUpdate description(String description);
/**
* @param typeKey
* for {@link DistributionSet#getType()}
* @return updated builder instance
*/
DistributionSetUpdate type(@NotEmpty String typeKey);
/**
* @param type
* for {@link DistributionSet#getType()}
* @return updated builder instance
*/
default DistributionSetUpdate type(final DistributionSetType type) {
return type(Optional.ofNullable(type).map(DistributionSetType::getKey).orElse(null));
}
/**
* @param requiredMigrationStep
* for {@link DistributionSet#isRequiredMigrationStep()}
* @return updated builder instance
*/
DistributionSetUpdate requiredMigrationStep(Boolean requiredMigrationStep);
}

View File

@@ -0,0 +1,31 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.Rollout;
/**
* Builder for {@link Rollout}.
*
*/
public interface RolloutBuilder {
/**
* @param id
* of the updatable entity
* @return builder instance
*/
RolloutUpdate update(long id);
/**
* @return builder instance
*/
RolloutCreate create();
}

View File

@@ -0,0 +1,84 @@
/**
* 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.builder;
import java.util.Optional;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link Rollout} entry. Defines all fields that can be
* set at creation time. Other fields are set by the repository automatically,
* e.g. {@link BaseEntity#getCreatedAt()}.
*
*/
public interface RolloutCreate {
/**
* @param name
* for {@link Rollout#getName()}
* @return updated builder instance
*/
RolloutCreate name(@NotEmpty String name);
/**
* @param description
* for {@link Rollout#getDescription()}
* @return updated builder instance
*/
RolloutCreate description(String description);
/**
* @param set
* for {@link Rollout#getDistributionSet()}
* @return updated builder instance
*/
default RolloutCreate set(final DistributionSet set) {
return set(Optional.ofNullable(set).map(DistributionSet::getId).orElse(null));
}
/**
* @param setId
* for {@link Rollout#getDistributionSet()}
* @return updated builder instance
*/
RolloutCreate set(long setId);
/**
* @param targetFilterQuery
* for {@link Rollout#getTargetFilterQuery()}
* @return updated builder instance
*/
RolloutCreate targetFilterQuery(@NotEmpty String targetFilterQuery);
/**
* @param actionType
* for {@link Rollout#getActionType()}
* @return updated builder instance
*/
RolloutCreate actionType(@NotNull ActionType actionType);
/**
* @param forcedTime
* for {@link Rollout#getForcedTime()}
* @return updated builder instance
*/
RolloutCreate forcedTime(Long forcedTime);
/**
* @return peek on current state of {@link Rollout} in the builder
*/
Rollout build();
}

View File

@@ -0,0 +1,25 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.Rollout;
/**
* Builder for {@link Rollout}.
*
*/
@FunctionalInterface
public interface RolloutGroupBuilder {
/**
* @return builder instance
*/
RolloutGroupCreate create();
}

View File

@@ -0,0 +1,66 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link RolloutGroup} entry. Defines all fields that
* can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/
public interface RolloutGroupCreate {
/**
* @param name
* for {@link Rollout#getName()}
* @return updated builder instance
*/
RolloutGroupCreate name(@NotEmpty String name);
/**
* @param description
* for {@link Rollout#getDescription()}
* @return updated builder instance
*/
RolloutGroupCreate description(String description);
/**
* @param targetFilterQuery
* for {@link Rollout#getTargetFilterQuery()}
* @return updated builder instance
*/
RolloutGroupCreate targetFilterQuery(@NotEmpty String targetFilterQuery);
/**
* @param targetPercentage
* the percentage of matching Targets that should be assigned to
* this Group
* @return updated builder instance
*/
RolloutGroupCreate targetPercentage(Float targetPercentage);
/**
* @param conditions
* as created by {@link RolloutGroupConditionBuilder}.
* @return updated builder instance
*/
RolloutGroupCreate conditions(RolloutGroupConditions conditions);
/**
* @return peek on current state of {@link RolloutGroup} in the builder
*/
RolloutGroup build();
}

View File

@@ -0,0 +1,33 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to update an existing {@link Rollout} entry. Defines all fields that
* can be updated.
*
*/
public interface RolloutUpdate {
/**
* @param name
* for {@link Rollout#getName()}
* @return updated builder instance
*/
RolloutUpdate name(@NotEmpty String name);
/**
* @param description
* for {@link Rollout#getDescription()}
* @return updated builder instance
*/
RolloutUpdate description(String description);
}

View File

@@ -0,0 +1,30 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
/**
* Builder for {@link SoftwareModule}.
*
*/
public interface SoftwareModuleBuilder {
/**
* @param id
* of the updatable entity
* @return builder instance
*/
SoftwareModuleUpdate update(long id);
/**
* @return builder instance
*/
SoftwareModuleCreate create();
}

View File

@@ -0,0 +1,73 @@
/**
* 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.builder;
import java.util.Optional;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link SoftwareModule} entry. Defines all fields that
* can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/
public interface SoftwareModuleCreate {
/**
* @param name
* for {@link SoftwareModule#getName()}
* @return updated builder instance
*/
SoftwareModuleCreate name(@NotEmpty String name);
/**
* @param version
* for {@link SoftwareModule#getVersion()}
* @return updated builder instance
*/
SoftwareModuleCreate version(@NotEmpty String version);
/**
* @param description
* for {@link SoftwareModule#getDescription()}
* @return updated builder instance
*/
SoftwareModuleCreate description(String description);
/**
* @param vendor
* for {@link SoftwareModule#getVendor()}
* @return updated builder instance
*/
SoftwareModuleCreate vendor(String vendor);
/**
* @param typeKey
* for {@link SoftwareModule#getType()}
* @return updated builder instance
*/
SoftwareModuleCreate type(@NotEmpty String typeKey);
/**
* @param type
* for {@link SoftwareModule#getType()}
* @return updated builder instance
*/
default SoftwareModuleCreate type(final SoftwareModuleType type) {
return type(Optional.ofNullable(type).map(SoftwareModuleType::getKey).orElse(null));
}
/**
* @return peek on current state of {@link SoftwareModule} in the builder
*/
SoftwareModule build();
}

View File

@@ -0,0 +1,30 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
/**
* Builder for {@link SoftwareModuleType}.
*
*/
public interface SoftwareModuleTypeBuilder {
/**
* @param id
* of the updatable entity
* @return builder instance
*/
SoftwareModuleTypeUpdate update(long id);
/**
* @return builder instance
*/
SoftwareModuleTypeCreate create();
}

View File

@@ -0,0 +1,62 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link SoftwareModuleType} entry. Defines all fields
* that can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/
public interface SoftwareModuleTypeCreate {
/**
* @param key
* for {@link SoftwareModuleType#getKey()}
* @return updated builder instance
*/
SoftwareModuleTypeCreate key(@NotEmpty String key);
/**
* @param name
* for {@link SoftwareModuleType#getName()}
* @return updated builder instance
*/
SoftwareModuleTypeCreate name(@NotEmpty String name);
/**
* @param description
* for {@link SoftwareModuleType#getDescription()}
* @return updated builder instance
*/
SoftwareModuleTypeCreate description(String description);
/**
* @param colour
* for {@link SoftwareModuleType#getColour()}
* @return updated builder instance
*/
SoftwareModuleTypeCreate colour(String colour);
/**
* @param maxAssignments
* for {@link SoftwareModuleType#getMaxAssignments()}
* @return updated builder instance
*/
SoftwareModuleTypeCreate maxAssignments(int maxAssignments);
/**
* @return peek on current state of {@link SoftwareModuleType} in the
* builder
*/
SoftwareModuleType build();
}

View File

@@ -0,0 +1,32 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
/**
* Builder to update an existing {@link SoftwareModuleType} entry. Defines all
* fields that can be updated.
*
*/
public interface SoftwareModuleTypeUpdate {
/**
* @param description
* for {@link SoftwareModuleType#getDescription()}
* @return updated builder instance
*/
SoftwareModuleTypeUpdate description(String description);
/**
* @param colour
* for {@link SoftwareModuleType#getColour()}
* @return updated builder instance
*/
SoftwareModuleTypeUpdate colour(String colour);
}

View File

@@ -0,0 +1,33 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
/**
* Builder to update an existing {@link SoftwareModule} entry. Defines all
* fields that can be updated.
*
*/
public interface SoftwareModuleUpdate {
/**
* @param description
* for {@link SoftwareModule#getDescription()}
* @return updated builder instance
*/
SoftwareModuleUpdate description(String description);
/**
* @param vendor
* for {@link SoftwareModule#getVendor()}
* @return updated builder instance
*/
SoftwareModuleUpdate vendor(String vendor);
}

View File

@@ -0,0 +1,31 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.Tag;
/**
* Builder for {@link Tag}.
*
*/
public interface TagBuilder {
/**
* @param id
* of the updatable entity
* @return builder instance
*/
TagUpdate update(long id);
/**
* @return builder instance
*/
TagCreate create();
}

View File

@@ -0,0 +1,47 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.Tag;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link Tag} entry. Defines all fields that can be set
* at creation time. Other fields are set by the repository automatically, e.g.
* {@link BaseEntity#getCreatedAt()}.
*
*/
public interface TagCreate {
/**
* @param name
* for {@link Tag#getName()}
* @return updated builder instance
*/
TagCreate name(@NotEmpty String name);
/**
* @param description
* for {@link Tag#getDescription()}
* @return updated builder instance
*/
TagCreate description(String description);
/**
* @param colour
* for {@link Tag#getColour()}
* @return updated builder instance
*/
TagCreate colour(String colour);
/**
* @return peek on current state of {@link Tag} in the builder
*/
Tag build();
}

View File

@@ -0,0 +1,41 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.Tag;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to update an existing {@link Tag} entry. Defines all fields that can
* be updated.
*
*/
public interface TagUpdate {
/**
* @param name
* for {@link Tag#getName()}
* @return updated builder instance
*/
TagUpdate name(@NotEmpty String name);
/**
* @param description
* for {@link Tag#getDescription()}
* @return updated builder instance
*/
TagUpdate description(String description);
/**
* @param colour
* for {@link Tag#getColour()}
* @return updated builder instance
*/
TagUpdate colour(String colour);
}

View File

@@ -0,0 +1,31 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.Target;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder for {@link Target}.
*
*/
public interface TargetBuilder {
/**
* @param controllerId
* of the updatable entity
* @return builder instance
*/
TargetUpdate update(@NotEmpty String controllerId);
/**
* @return builder instance
*/
TargetCreate create();
}

View File

@@ -0,0 +1,83 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetInfo;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link Target} entry. Defines all fields that can be
* set at creation time. Other fields are set by the repository automatically,
* e.g. {@link BaseEntity#getCreatedAt()}.
*
*/
public interface TargetCreate {
/**
* @param controllerId
* for {@link Target#getControllerId()}
* @return updated builder instance
*/
TargetCreate controllerId(@NotEmpty String controllerId);
/**
* @param name
* for {@link Target#getName()}
* @return updated builder instance
*/
TargetCreate name(@NotEmpty String name);
/**
* @param description
* for {@link Target#getDescription()}
* @return updated builder instance
*/
TargetCreate description(String description);
/**
* @param securityToken
* for {@link Target#getSecurityToken()}
* @return updated builder instance
*/
TargetCreate securityToken(String securityToken);
/**
* @param address
* for {@link TargetInfo#getAddress()}
*
* @throws IllegalArgumentException
* If the given string violates RFC&nbsp;2396
*
* @return updated builder instance
*/
TargetCreate address(String address);
/**
* @param lastTargetQuery
* for {@link TargetInfo#getLastTargetQuery()}
* @return updated builder instance
*/
TargetCreate lastTargetQuery(Long lastTargetQuery);
/**
* @param status
* for {@link TargetInfo#getUpdateStatus()}
* @return updated builder instance
*/
TargetCreate status(TargetUpdateStatus status);
/**
* @return peek on current state of {@link Target} in the builder
*/
Target build();
}

View File

@@ -0,0 +1,29 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
/**
* Builder for {@link TargetFilterQuery}.
*
*/
public interface TargetFilterQueryBuilder {
/**
* @param id
* of the updatable entity
* @return builder instance
*/
TargetFilterQueryUpdate update(long id);
/**
* @return builder instance
*/
TargetFilterQueryCreate create();
}

View File

@@ -0,0 +1,59 @@
/**
* 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.builder;
import java.util.Optional;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to create a new {@link TargetFilterQuery} entry. Defines all fields
* that can be set at creation time. Other fields are set by the repository
* automatically, e.g. {@link BaseEntity#getCreatedAt()}.
*
*/
public interface TargetFilterQueryCreate {
/**
* @param name
* of {@link TargetFilterQuery#getName()}
* @return updated builder instance
*/
TargetFilterQueryCreate name(@NotEmpty String name);
/**
* @param query
* of {@link TargetFilterQuery#getQuery()}
* @return updated builder instance
*/
TargetFilterQueryCreate query(@NotEmpty String query);
/**
* @param set
* for {@link TargetFilterQuery#getAutoAssignDistributionSet()}
* @return updated builder instance
*/
default TargetFilterQueryCreate set(final DistributionSet set) {
return set(Optional.ofNullable(set).map(DistributionSet::getId).orElse(null));
}
/**
* @param setId
* for {@link TargetFilterQuery#getAutoAssignDistributionSet()}
* @return updated builder instance
*/
TargetFilterQueryCreate set(long setId);
/**
* @return peek on current state of {@link TargetFilterQuery} in the builder
*/
TargetFilterQuery build();
}

View File

@@ -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.builder;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to update an existing {@link TargetFilterQuery} entry. Defines all
* fields that can be updated.
*
*/
public interface TargetFilterQueryUpdate {
/**
* @param name
* of {@link TargetFilterQuery#getName()}
* @return updated builder instance
*/
TargetFilterQueryUpdate name(@NotEmpty String name);
/**
* @param query
* of {@link TargetFilterQuery#getQuery()}
* @return updated builder instance
*/
TargetFilterQueryUpdate query(@NotEmpty String query);
}

View File

@@ -0,0 +1,68 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetInfo;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Builder to update an existing {@link Target} entry. Defines all fields that
* can be updated.
*
*/
public interface TargetUpdate {
/**
* @param name
* for {@link Target#getName()}
* @return updated builder instance
*/
TargetUpdate name(@NotEmpty String name);
/**
* @param description
* for {@link Target#getDescription()}
* @return updated builder instance
*/
TargetUpdate description(String description);
/**
* @param securityToken
* for {@link Target#getSecurityToken()}
* @return updated builder instance
*/
TargetUpdate securityToken(@NotEmpty String securityToken);
/**
* @param address
* for {@link TargetInfo#getAddress()}
*
* @throws IllegalArgumentException
* If the given string violates RFC&nbsp;2396
*
* @return updated builder instance
*/
TargetUpdate address(String address);
/**
* @param lastTargetQuery
* for {@link TargetInfo#getLastTargetQuery()}
* @return updated builder instance
*/
TargetUpdate lastTargetQuery(Long lastTargetQuery);
/**
* @param status
* for {@link TargetInfo#getUpdateStatus()}
* @return updated builder instance
*/
TargetUpdate status(TargetUpdateStatus status);
}

View File

@@ -12,7 +12,9 @@ import java.util.Collection;
import java.util.Collections;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.Target;
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -54,7 +56,20 @@ public class TargetAssignDistributionSetEvent extends RemoteTenantAwareEvent {
}
private TargetAssignDistributionSetEvent(final String tenant, final Long actionId, final Long distributionSetId,
/**
* Constructor.
*
* @param tenant
* the event belongs to
* @param actionId
* to the action
* @param distributionSetId
* of the assigned {@link DistributionSet}
* @param controllerId
* of the assignment {@link Target}
* @param applicationId
*/
public TargetAssignDistributionSetEvent(final String tenant, final Long actionId, final Long distributionSetId,
final String controllerId, final String applicationId) {
super(actionId, tenant, applicationId);
this.actionId = actionId;

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Thrown if artifact deletion failed.

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
*

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Thrown if cancelation of actions is performened where the action is not

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* {@link ConcurrentModificationException} is thrown when a given entity in's

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Thrown if DS creation failed.

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetType;

View File

@@ -1,64 +0,0 @@
/**
* 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.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
/**
* The {@link EntityLockedException} is thrown when an entity has been locked by
* the server to prevent modification.
*
*
*
*/
public class EntityLockedException extends AbstractServerRtException {
private static final long serialVersionUID = 1L;
private static final SpServerError THIS_ERROR = SpServerError.SP_ENTITY_LOCKED;
/**
* Default constructor.
*/
public EntityLockedException() {
super(THIS_ERROR);
}
/**
* Parameterized constructor.
*
* @param cause
* of the exception
*/
public EntityLockedException(final Throwable cause) {
super(THIS_ERROR, cause);
}
/**
* Parameterized constructor.
*
* @param message
* of the exception
* @param cause
* of the exception
*/
public EntityLockedException(final String message, final Throwable cause) {
super(message, THIS_ERROR, cause);
}
/**
* Parameterized constructor.
*
* @param message
* of the exception
*/
public EntityLockedException(final String message) {
super(message, THIS_ERROR);
}
}

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* the {@link EntityNotFoundException} is thrown when a entity is tried find but

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* the {@link EntityReadOnlyException} is thrown when a entity is in read only

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Thrown when force quitting an actions is not allowed. e.g. the action is not

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
*

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Thrown if a distribution set is assigned to a a target that is incomplete

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Exception which is thrown in case the current security context object does

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Thrown if MD5 checksum check fails.

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Thrown if SHA1 checksum check fails.

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Exception which is thrown when trying to set an invalid target address.

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Thrown if a multi part exception occurred.

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Exception used by the REST API in case of RSQL search filter query.

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Exception used by the REST API in case of invalid field name in the rsql

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* the {@link RolloutIllegalStateException} is thrown when a rollout is changing

View File

@@ -1,63 +0,0 @@
/**
* 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.exception;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* the {@link RolloutVerificationException} is thrown when a rollout or
* its groups get created or modified with a configuration that is
* not valid or can't be verified
*
*/
public class RolloutVerificationException extends AbstractServerRtException {
private static final long serialVersionUID = 1L;
private static final SpServerError THIS_ERROR = SpServerError.SP_ROLLOUT_VERIFICATION_FAILED;
/**
* Default constructor.
*/
public RolloutVerificationException() {
super(THIS_ERROR);
}
/**
* Parameterized constructor.
*
* @param cause
* of the exception
*/
public RolloutVerificationException(final Throwable cause) {
super(THIS_ERROR, cause);
}
/**
* Parameterized constructor.
*
* @param message
* of the exception
* @param cause
* of the exception
*/
public RolloutVerificationException(final String message, final Throwable cause) {
super(message, THIS_ERROR, cause);
}
/**
* Parameterized constructor.
*
* @param message
* of the exception
*/
public RolloutVerificationException(final String message) {
super(message, THIS_ERROR);
}
}

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* the {@link TenantNotExistException} is thrown when e.g. a controller tries to

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Thrown if too many status entries have been inserted.

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Thrown if too many status entries have been inserted.

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModule;

View File

@@ -24,12 +24,6 @@ public interface Action extends TenantAwareBaseEntity {
*/
DistributionSet getDistributionSet();
/**
* @param distributionSet
* the distributionSet to set
*/
void setDistributionSet(DistributionSet distributionSet);
/**
* @return <code>true</code> when action is in state
* {@link Status#CANCELING} or {@link Status#CANCELED}, false
@@ -44,12 +38,6 @@ public interface Action extends TenantAwareBaseEntity {
*/
Status getStatus();
/**
* @param status
* of the {@link Action}
*/
void setStatus(Status status);
/**
* @return <code>true</code> if {@link Action} is still running.
*/
@@ -65,12 +53,6 @@ public interface Action extends TenantAwareBaseEntity {
*/
List<ActionStatus> getActionStatus();
/**
* @param target
* of this {@link Action}
*/
void setTarget(Target target);
/**
* @return {@link Target} of this {@link Action}.
*/

View File

@@ -28,21 +28,6 @@ public interface ActionStatus extends TenantAwareBaseEntity {
*/
Long getOccurredAt();
/**
* @param occurredAt
* time in {@link TimeUnit#MILLISECONDS} when the status was
* reported.
*/
void setOccurredAt(Long occurredAt);
/**
* Adds message including splitting in case it exceeds 512 length.
*
* @param message
* to add
*/
void addMessage(String message);
/**
* @return immutable list of message entries that in the
* {@link ActionStatus}.
@@ -54,12 +39,6 @@ public interface ActionStatus extends TenantAwareBaseEntity {
*/
Action getAction();
/**
* @param action
* this {@link ActionStatus} belongs to.
*/
void setAction(Action action);
/**
* @return the {@link Status} of this {@link ActionStatus}. Caused
* potentially a transition change of the {@link #getAction()} if
@@ -67,12 +46,4 @@ public interface ActionStatus extends TenantAwareBaseEntity {
*/
Status getStatus();
/**
* @param status
* of this {@link ActionStatus}. May cause a transition change of
* the {@link #getAction()} if different from the previous
* {@link ActionStatus#getStatus()}.
*/
void setStatus(Status status);
}

View File

@@ -30,21 +30,6 @@ public interface DistributionSet extends NamedVersionedEntity {
*/
Set<DistributionSetTag> getTags();
/**
* @param tag
* to add
* @return <code>true</code> if tag could be added sucessfully (i.e. was not
* already in the list).
*/
boolean addTag(final DistributionSetTag tag);
/**
* @param tag
* to remove
* @return <code>true</code> if tag was in the list and removed
*/
boolean removeTag(final DistributionSetTag tag);
/**
* @return <code>true</code> if the set is deleted and only kept for history
* purposes.
@@ -64,25 +49,6 @@ public interface DistributionSet extends NamedVersionedEntity {
*/
boolean isRequiredMigrationStep();
/**
* @param deleted
* to <code>true</code> if {@link DistributionSet} is no longer
* be usage but kept for history purposes.
* @return updated {@link DistributionSet}
*/
DistributionSet setDeleted(boolean deleted);
/**
* @param isRequiredMigrationStep
* to <code>true</code> if {@link DistributionSet} contains a
* mandatory migration step, i.e. unfinished {@link Action}s will
* kept active and not automatically canceled if overridden by a
* newer update.
*
* @return updated {@link DistributionSet}
*/
DistributionSet setRequiredMigrationStep(boolean isRequiredMigrationStep);
/**
* @return the assignedTargets
*/
@@ -104,44 +70,22 @@ public interface DistributionSet extends NamedVersionedEntity {
*/
Set<SoftwareModule> getModules();
/**
* @param softwareModule
* @return <code>true</code> if the module was added and <code>false</code>
* if it already existed in the set
*
*/
boolean addModule(SoftwareModule softwareModule);
/**
* Removed given {@link SoftwareModule} from this DS instance.
*
* @param softwareModule
* to remove
* @return <code>true</code> if element was found and removed
*/
boolean removeModule(SoftwareModule softwareModule);
/**
* Searches through modules for the given type.
*
* @param type
* to search for
* @return SoftwareModule of given type or <code>null</code> if not in the
* list.
* @return SoftwareModule of given type or <code>null</code> if not found.
*/
SoftwareModule findFirstModuleByType(SoftwareModuleType type);
default SoftwareModule findFirstModuleByType(final SoftwareModuleType type) {
return getModules().stream().filter(module -> module.getType().equals(type)).findFirst().orElse(null);
}
/**
* @return type of the {@link DistributionSet}.
*/
DistributionSetType getType();
/**
* @param type
* of the {@link DistributionSet}.
*/
void setType(DistributionSetType type);
/**
* @return <code>true</code> if all defined
* {@link DistributionSetType#getMandatoryModuleTypes()} of

View File

@@ -111,46 +111,11 @@ public interface DistributionSetType extends NamedEntity {
*/
boolean areModuleEntriesIdentical(DistributionSetType dsType);
/**
* Adds {@link SoftwareModuleType} that is optional for the
* {@link DistributionSet}.
*
* @param smType
* to add
* @return updated instance
*/
DistributionSetType addOptionalModuleType(SoftwareModuleType smType);
/**
* Adds {@link SoftwareModuleType} that is mandatory for the
* {@link DistributionSet}.
*
* @param smType
* to add
* @return updated instance
*/
DistributionSetType addMandatoryModuleType(SoftwareModuleType smType);
/**
* Removes {@link SoftwareModuleType} from the list.
*
* @param smTypeId
* to remove
* @return updated instance
*/
DistributionSetType removeModuleType(Long smTypeId);
/**
* @return business key of this {@link DistributionSetType}.
*/
String getKey();
/**
* @param key
* of this {@link DistributionSetType}.
*/
void setKey(String key);
/**
* @param distributionSet
* to check for completeness
@@ -164,10 +129,4 @@ public interface DistributionSetType extends NamedEntity {
*/
String getColour();
/**
* @param colour
* code to by used in management UI views.
*/
void setColour(final String colour);
}

View File

@@ -1,41 +0,0 @@
/**
* 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.model;
/**
* External repositories for artifact storage. The update server provides URLs
* for the targets to download from these external resources but does not access
* them itself.
*
*/
public interface ExternalArtifactProvider extends NamedEntity {
/**
* @return prefix for url generation
*/
String getBasePath();
/**
* @return default for {@link ExternalArtifact#getUrlSuffix()}.
*/
String getDefaultSuffix();
/**
* @param basePath
* prefix for url generation
*/
void setBasePath(String basePath);
/**
* @param defaultSuffix
* for {@link ExternalArtifact#getUrlSuffix()}.
*/
void setDefaultSuffix(String defaultSuffix);
}

View File

@@ -21,19 +21,9 @@ public interface MetaData extends Serializable {
*/
String getKey();
/**
* @param key
*/
void setKey(String key);
/**
* @return the value
*/
String getValue();
/**
* @param value
*/
void setValue(String value);
}

View File

@@ -23,17 +23,4 @@ public interface NamedEntity extends TenantAwareBaseEntity {
* @return the name of the entity.
*/
String getName();
/**
* @param description
* of the entity.
*/
void setDescription(String description);
/**
* @param name
* of the entity.
*/
void setName(String name);
}

View File

@@ -13,16 +13,8 @@ package org.eclipse.hawkbit.repository.model;
*
*/
public interface NamedVersionedEntity extends NamedEntity {
/**
* @return the version of entity.
*/
String getVersion();
/**
* @param version
* of the entity.
*/
void setVersion(String version);
}

View File

@@ -31,12 +31,6 @@ public interface Rollout extends NamedEntity {
*/
DistributionSet getDistributionSet();
/**
* @param distributionSet
* that is rolled out
*/
void setDistributionSet(DistributionSet distributionSet);
/**
* @return immutable list of deployment groups of the rollout.
*/
@@ -48,12 +42,6 @@ public interface Rollout extends NamedEntity {
*/
String getTargetFilterQuery();
/**
* @param targetFilterQuery
* that identifies the targets that are part of this rollout.
*/
void setTargetFilterQuery(String targetFilterQuery);
/**
* @return status of the rollout
*/
@@ -64,12 +52,6 @@ public interface Rollout extends NamedEntity {
*/
ActionType getActionType();
/**
* @param actionType
* of the rollout.
*/
void setActionType(ActionType actionType);
/**
* @return time in {@link TimeUnit#MILLISECONDS} after which
* {@link #isForced()} switches to <code>true</code> in case of
@@ -77,14 +59,6 @@ public interface Rollout extends NamedEntity {
*/
long getForcedTime();
/**
* @param forcedTime
* in {@link TimeUnit#MILLISECONDS} after which
* {@link #isForced()} switches to <code>true</code> in case of
* {@link ActionType#TIMEFORCED}.
*/
void setForcedTime(long forcedTime);
/**
* @return number of {@link Target}s in this rollout.
*/

View File

@@ -21,23 +21,11 @@ public interface RolloutGroup extends NamedEntity {
*/
Rollout getRollout();
/**
* @param rollout
* sets the {@link Rollout} for this group
*/
void setRollout(Rollout rollout);
/**
* @return the current {@link RolloutGroupStatus} for this group
*/
RolloutGroupStatus getStatus();
/**
* @param status
* the {@link RolloutGroupStatus} to set for this group
*/
void setStatus(RolloutGroupStatus status);
/**
* @return the parent group of this group, in case the group is the root
* group it does not have a parent and so return {@code null}
@@ -50,14 +38,6 @@ public interface RolloutGroup extends NamedEntity {
*/
RolloutGroupSuccessCondition getSuccessCondition();
/**
* @param successCondition
* the {@link RolloutGroupSuccessCondition} to be set for this
* group to indicate when a group is successfully and a next
* group might be started
*/
void setSuccessCondition(RolloutGroupSuccessCondition successCondition);
/**
* @return a String representation of the expression to be evaluated by the
* {@link RolloutGroupSuccessCondition} to indicate if the condition
@@ -66,31 +46,12 @@ public interface RolloutGroup extends NamedEntity {
*/
String getSuccessConditionExp();
/**
* @param successConditionExp
* sets a String represented expression which is evaluated by the
* {@link RolloutGroupSuccessCondition}, might be {@code null} if
* the set {@link RolloutGroupSuccessCondition} can handle
* {@code null} value
*/
void setSuccessConditionExp(String successConditionExp);
/**
* @return the {@link RolloutGroupErrorCondition} for this group to indicate
* when a group should marked as failed
*/
RolloutGroupErrorCondition getErrorCondition();
/**
*
* @param errorCondition
* the {@link RolloutGroupErrorCondition} to be set for this
* group to indicate when a group is marked as failed and the
* corresponding {@link RolloutGroupErrorAction} should be
* executed
*/
void setErrorCondition(RolloutGroupErrorCondition errorCondition);
/**
* @return a String representation of the expression to be evaluated by the
* {@link RolloutGroupErrorCondition} to indicate if the condition
@@ -99,15 +60,6 @@ public interface RolloutGroup extends NamedEntity {
*/
String getErrorConditionExp();
/**
* @param errorExp
* sets a String represented expression which is evaluated by the
* {@link RolloutGroupErrorCondition}, might be {@code null} if
* the set {@link RolloutGroupErrorCondition} can handle
* {@code null} value
*/
void setErrorConditionExp(String errorExp);
/**
* @return a {@link RolloutGroupErrorAction} which is executed when the
* given {@link RolloutGroupErrorCondition} is met, might be
@@ -115,14 +67,6 @@ public interface RolloutGroup extends NamedEntity {
*/
RolloutGroupErrorAction getErrorAction();
/**
* @param errorAction
* the {@link RolloutGroupErrorAction} to be set which should be
* executed if the {@link RolloutGroupErrorCondition} is met,
* might be {@code null} if no error action should be executed
*/
void setErrorAction(RolloutGroupErrorAction errorAction);
/**
* @return a String representation of the expression to be evaluated by the
* {@link RolloutGroupErrorAction} might be {@code null} if no
@@ -130,15 +74,6 @@ public interface RolloutGroup extends NamedEntity {
*/
String getErrorActionExp();
/**
* @param errorActionExp
* sets a String represented expression which is evaluated by the
* {@link RolloutGroupErrorAction}, might be {@code null} if the
* set {@link RolloutGroupErrorAction} can handle {@code null}
* value
*/
void setErrorActionExp(String errorActionExp);
/**
* @return the {@link RolloutGroupSuccessAction} which is executed if the
* {@link RolloutGroupSuccessCondition} is met
@@ -152,23 +87,6 @@ public interface RolloutGroup extends NamedEntity {
*/
String getSuccessActionExp();
/**
* @param successAction
* which is executed if the {@link RolloutGroupSuccessCondition}
* is met
*/
void setSuccessAction(RolloutGroupSuccessAction successAction);
/**
*
* @param successActionExp
* a String representation of the expression to be evaluated by
* the {@link RolloutGroupSuccessAction} might be {@code null} if
* no expression must be set for the
* {@link RolloutGroupSuccessAction}
*/
void setSuccessActionExp(String successActionExp);
/**
* @return the total amount of targets containing in this group
*/
@@ -179,38 +97,18 @@ public interface RolloutGroup extends NamedEntity {
*/
TotalTargetCountStatus getTotalTargetCountStatus();
/**
* @param totalTargetCountStatus
* the totalTargetCountStatus to set
*/
void setTotalTargetCountStatus(TotalTargetCountStatus totalTargetCountStatus);
/**
* @return the target filter query, that is used to assign Targets to this
* Group
*/
String getTargetFilterQuery();
/**
* @param targetFilterQuery
* the target filter query, that is used to assign Targets to
* this Group. Can be null, if no restrictions should apply.
*/
void setTargetFilterQuery(String targetFilterQuery);
/**
* @return the percentage of matching Targets that should be assigned to
* this Group
*/
float getTargetPercentage();
/**
* @param targetPercentage
* the percentage of matching Targets that should be assigned to
* this Group
*/
void setTargetPercentage(float targetPercentage);
/**
* Rollout group state machine.
*
@@ -290,7 +188,8 @@ public interface RolloutGroup extends NamedEntity {
}
/**
* The actions executed when the {@link RolloutGroup#getErrorCondition()} is hit.
* The actions executed when the {@link RolloutGroup#getErrorCondition()} is
* hit.
*/
enum RolloutGroupErrorAction {
PAUSE("pauseRolloutGroupAction");
@@ -310,8 +209,8 @@ public interface RolloutGroup extends NamedEntity {
}
/**
* The actions executed when the {@link RolloutGroup#getSuccessCondition()} is
* hit.
* The actions executed when the {@link RolloutGroup#getSuccessCondition()}
* is hit.
*/
enum RolloutGroupSuccessAction {
NEXTGROUP("startNextRolloutGroupAction");

View File

@@ -88,4 +88,17 @@ public class RolloutGroupConditionBuilder {
conditions.setErrorActionExp(expression);
return this;
}
/**
* Sets condition defaults.
*
* @return the builder itself
*/
public RolloutGroupConditionBuilder withDefaults() {
successCondition(RolloutGroupSuccessCondition.THRESHOLD, "50");
successAction(RolloutGroupSuccessAction.NEXTGROUP, "");
errorCondition(RolloutGroupErrorCondition.THRESHOLD, "50");
errorAction(RolloutGroupErrorAction.PAUSE, "");
return this;
}
}

View File

@@ -18,14 +18,14 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCond
* easily built.
*/
public class RolloutGroupConditions {
private RolloutGroupSuccessCondition successCondition = RolloutGroupSuccessCondition.THRESHOLD;
private String successConditionExp = "50";
private RolloutGroupSuccessAction successAction = RolloutGroupSuccessAction.NEXTGROUP;
private String successActionExp = "";
private RolloutGroupErrorCondition errorCondition = RolloutGroupErrorCondition.THRESHOLD;
private String errorConditionExp = "50";
private RolloutGroupErrorAction errorAction = RolloutGroupErrorAction.PAUSE;
private String errorActionExp = "";
private RolloutGroupSuccessCondition successCondition;
private String successConditionExp;
private RolloutGroupSuccessAction successAction;
private String successActionExp;
private RolloutGroupErrorCondition errorCondition;
private String errorConditionExp;
private RolloutGroupErrorAction errorAction;
private String errorActionExp;
public RolloutGroupSuccessCondition getSuccessCondition() {
return successCondition;

View File

@@ -16,12 +16,7 @@ import java.util.Optional;
*
*/
public interface SoftwareModule extends NamedVersionedEntity {
/**
* @param artifact
* is added to the assigned {@link Artifact}s.
*/
void addArtifact(Artifact artifact);
/**
* @param artifactId
* to look for
@@ -59,12 +54,6 @@ public interface SoftwareModule extends NamedVersionedEntity {
*/
String getVendor();
/**
* @param vendor
* the vendor of this software module to set
*/
void setVendor(String vendor);
/**
* @return the type of the software module
*/
@@ -76,12 +65,6 @@ public interface SoftwareModule extends NamedVersionedEntity {
*/
boolean isDeleted();
/**
* @param type
* the module type for this software module
*/
void setType(SoftwareModuleType type);
/**
* @return immutable list of {@link DistributionSet}s the module is assigned
* to

View File

@@ -18,11 +18,4 @@ public interface SoftwareModuleMetadata extends MetaData {
* @return {@link SoftwareModule} this entry belongs to.
*/
SoftwareModule getSoftwareModule();
/**
* @param softwareModule
* this entry belongs to.
*/
void setSoftwareModule(SoftwareModule softwareModule);
}

View File

@@ -21,25 +21,12 @@ public interface SoftwareModuleType extends NamedEntity {
*/
String getKey();
/**
* @param key
* of this {@link SoftwareModuleType}.
*/
void setKey(String key);
/**
* @return maximum assignments of an {@link SoftwareModule} of this type to
* a {@link DistributionSet}.
*/
int getMaxAssignments();
/**
* @param maxAssignments
* of an {@link SoftwareModule} of this type to a
* {@link DistributionSet}.
*/
void setMaxAssignments(int maxAssignments);
/**
* @return <code>true</code> if the type is deleted and only kept for
* history purposes.
@@ -51,10 +38,4 @@ public interface SoftwareModuleType extends NamedEntity {
*/
String getColour();
/**
* @param colour
* code to by used in management UI views.
*/
void setColour(final String colour);
}

View File

@@ -19,9 +19,4 @@ public interface Tag extends NamedEntity {
*/
String getColour();
/**
* @param colour
*/
void setColour(String colour);
}

View File

@@ -59,24 +59,10 @@ public interface Target extends NamedEntity {
String getSecurityToken();
/**
* @param token
* new securityToken
* @return {@link TargetWithActionType} with default settings
*/
void setSecurityToken(String token);
/**
* @param tag
* to add
* @return <code>true</code> if tag could be added sucessfully (i.e. was not
* already in the list).
*/
boolean addTag(TargetTag tag);
/**
* @param tag
* to remove
* @return <code>true</code> if tag was in the list and removed
*/
boolean removeTag(TargetTag tag);
default TargetWithActionType getTargetWithActionType() {
return new TargetWithActionType(getControllerId());
}
}

View File

@@ -39,33 +39,14 @@ public interface TargetFilterQuery extends TenantAwareBaseEntity {
*/
String getName();
/**
* @param name
* of the {@link TargetFilterQuery}.
*/
void setName(String name);
/**
* @return RSQL query
*/
String getQuery();
/**
* @param query
* in RSQL notation.
*/
void setQuery(String query);
/**
* @return the auto assign {@link DistributionSet} if given.
*/
DistributionSet getAutoAssignDistributionSet();
/**
* @param distributionSet
* the {@link DistributionSet} that should be assigned to a
* target when this filter matches.
*/
void setAutoAssignDistributionSet(DistributionSet distributionSet);
}

View File

@@ -81,10 +81,7 @@ public class TargetIdName implements Serializable {
return false;
}
final TargetIdName other = (TargetIdName) obj;
if (targetId != other.targetId) {
return false;
}
return true;
return targetId == other.targetId;
}
@Override

View File

@@ -20,15 +20,6 @@ public interface TargetInfo extends Serializable {
*/
URI getAddress();
/**
* @param address
* the target address to set
*
* @throws IllegalArgumentException
* If the given string violates RFC&nbsp;2396
*/
void setAddress(String address);
/**
* @return {@link Target} this info element belongs to.
*/

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.repository.model;
/**
* The overall {@link TargetUpdateStatus} of a {@link Target} that describes its
* status. A {@link Target} can have only one status. independent of the number
* of {@link UpdateAction}s that have to be applied.
* of {@link Action}s that have to be applied.
*
*/
public enum TargetUpdateStatus {

View File

@@ -18,24 +18,22 @@ import org.eclipse.hawkbit.repository.model.Action.ActionType;
*/
public class TargetWithActionType {
private final String targetId;
private final String controllerId;
private final ActionType actionType;
private final long forceTime;
/**
* @param targetId
* @param actionType
* @param forceTime
*/
public TargetWithActionType(final String targetId, final ActionType actionType, final long forceTime) {
this.targetId = targetId;
public TargetWithActionType(final String controllerId) {
this.controllerId = controllerId;
this.actionType = ActionType.FORCED;
this.forceTime = 0;
}
public TargetWithActionType(final String controllerId, final ActionType actionType, final long forceTime) {
this.controllerId = controllerId;
this.actionType = actionType;
this.forceTime = forceTime;
}
/**
* @return the actionType
*/
public ActionType getActionType() {
if (actionType != null) {
return actionType;
@@ -44,9 +42,6 @@ public class TargetWithActionType {
return ActionType.FORCED;
}
/**
* @return the forceTime
*/
public long getForceTime() {
if (actionType == ActionType.TIMEFORCED) {
return forceTime;
@@ -54,10 +49,7 @@ public class TargetWithActionType {
return RepositoryModelConstants.NO_FORCE_TIME;
}
/**
* @return the targetId
*/
public String getTargetId() {
return targetId;
public String getControllerId() {
return controllerId;
}
}

View File

@@ -18,5 +18,4 @@ public interface TenantAwareBaseEntity extends BaseEntity {
* @return tenant name
*/
String getTenant();
}

View File

@@ -20,21 +20,9 @@ public interface TenantConfiguration extends TenantAwareBaseEntity {
*/
String getKey();
/**
* @param key
* of the entry
*/
void setKey(String key);
/**
* @return value of the entry
*/
String getValue();
/**
* @param value
* of the entry
*/
void setValue(String value);
}

View File

@@ -19,13 +19,6 @@ public interface TenantMetaData extends BaseEntity {
*/
DistributionSetType getDefaultDsType();
/**
* @param defaultDsType
* that is used of none is selected for a new
* {@link DistributionSet}.
*/
void setDefaultDsType(DistributionSetType defaultDsType);
/**
* @return tenant name
*/

View File

@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.repository;
import java.time.Duration;
import java.time.Instant;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.repository.model.helper.TenantConfigurationManagementHolder;
import org.eclipse.hawkbit.tenancy.configuration.DurationHelper;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;

View File

@@ -0,0 +1,68 @@
/**
* 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.builder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Optional;
import org.eclipse.hawkbit.repository.model.Action.Status;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
*/
public abstract class AbstractActionStatusCreate<T> {
protected Status status;
protected Long occurredAt;
protected Collection<String> messages;
protected Long actionId;
public Long getActionId() {
return actionId;
}
public T status(final Status status) {
this.status = status;
return (T) this;
}
public T occurredAt(final Long occurredAt) {
this.occurredAt = occurredAt;
return (T) this;
}
public T messages(final Collection<String> messages) {
if (this.messages == null) {
this.messages = messages;
} else {
this.messages.addAll(messages);
}
return (T) this;
}
public T message(final String message) {
if (this.messages == null) {
this.messages = new ArrayList<>();
}
this.messages.add(message);
return (T) this;
}
public Optional<Long> getOccurredAt() {
return Optional.ofNullable(occurredAt);
}
}

View File

@@ -0,0 +1,22 @@
/**
* 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.builder;
import org.springframework.hateoas.Identifiable;
public abstract class AbstractBaseEntityBuilder implements Identifiable<Long> {
protected Long id;
@Override
public Long getId() {
return id;
}
}

View File

@@ -0,0 +1,72 @@
/**
* 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.builder;
import java.util.Collection;
import java.util.Optional;
import org.springframework.util.CollectionUtils;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
*/
public abstract class AbstractDistributionSetTypeUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
protected String colour;
protected String key;
protected Collection<Long> mandatory;
protected Collection<Long> optional;
public T mandatory(final Collection<Long> mandatory) {
this.mandatory = mandatory;
return (T) this;
}
public T optional(final Collection<Long> optional) {
this.optional = optional;
return (T) this;
}
public Optional<Collection<Long>> getMandatory() {
if (CollectionUtils.isEmpty(mandatory)) {
return Optional.empty();
}
return Optional.ofNullable(mandatory);
}
public Optional<Collection<Long>> getOptional() {
if (CollectionUtils.isEmpty(optional)) {
return Optional.empty();
}
return Optional.ofNullable(optional);
}
public T colour(final String colour) {
this.colour = colour;
return (T) this;
}
public Optional<String> getColour() {
return Optional.ofNullable(colour);
}
public T key(final String key) {
this.key = key;
return (T) this;
}
public Optional<String> getKey() {
return Optional.ofNullable(key);
}
}

View File

@@ -0,0 +1,62 @@
/**
* 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.builder;
import java.util.Collection;
import java.util.Optional;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
*/
public abstract class AbstractDistributionSetUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
protected String version;
protected Boolean requiredMigrationStep;
protected String type;
protected Collection<Long> modules;
public T modules(final Collection<Long> modules) {
this.modules = modules;
return (T) this;
}
public Collection<Long> getModules() {
return modules;
}
public T type(final String type) {
this.type = type;
return (T) this;
}
public String getType() {
return type;
}
public T requiredMigrationStep(final Boolean requiredMigrationStep) {
this.requiredMigrationStep = requiredMigrationStep;
return (T) this;
}
public Boolean isRequiredMigrationStep() {
return requiredMigrationStep;
}
public T version(final String version) {
this.version = version;
return (T) this;
}
public Optional<String> getVersion() {
return Optional.ofNullable(version);
}
}

View File

@@ -0,0 +1,36 @@
/**
* 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.builder;
import java.util.Optional;
public abstract class AbstractNamedEntityBuilder<T> extends AbstractBaseEntityBuilder {
protected String name;
protected String description;
public T name(final String name) {
this.name = name;
return (T) this;
}
public T description(final String description) {
this.description = description;
return (T) this;
}
public Optional<String> getName() {
return Optional.ofNullable(name);
}
public Optional<String> getDescription() {
return Optional.ofNullable(description);
}
}

View File

@@ -0,0 +1,39 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
/**
* Create builder DTO.
*
* @param <T>
* update or create builder interface
*/
public abstract class AbstractRolloutGroupCreate<T> extends AbstractNamedEntityBuilder<T> {
protected String targetFilterQuery;
protected Float targetPercentage;
protected RolloutGroupConditions conditions;
public T targetFilterQuery(final String targetFilterQuery) {
this.targetFilterQuery = targetFilterQuery;
return (T) this;
}
public T targetPercentage(final Float targetPercentage) {
this.targetPercentage = targetPercentage;
return (T) this;
}
public T conditions(final RolloutGroupConditions conditions) {
this.conditions = conditions;
return (T) this;
}
}

View File

@@ -0,0 +1,45 @@
/**
* 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.builder;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
*/
public abstract class AbstractRolloutUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
protected Long set;
protected String targetFilterQuery;
protected ActionType actionType;
protected Long forcedTime;
public T set(final long set) {
this.set = set;
return (T) this;
}
public T targetFilterQuery(final String targetFilterQuery) {
this.targetFilterQuery = targetFilterQuery;
return (T) this;
}
public T actionType(final ActionType actionType) {
this.actionType = actionType;
return (T) this;
}
public T forcedTime(final Long forcedTime) {
this.forcedTime = forcedTime;
return (T) this;
}
}

View File

@@ -0,0 +1,51 @@
/**
* 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.builder;
import java.util.Optional;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
*/
public abstract class AbstractSoftwareModuleTypeUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
protected String colour;
protected String key;
protected int maxAssignments = 1;
public T maxAssignments(final int maxAssignments) {
this.maxAssignments = maxAssignments;
return (T) this;
}
public int getMaxAssignments() {
return maxAssignments;
}
public T colour(final String colour) {
this.colour = colour;
return (T) this;
}
public Optional<String> getColour() {
return Optional.ofNullable(colour);
}
public T key(final String key) {
this.key = key;
return (T) this;
}
public Optional<String> getKey() {
return Optional.ofNullable(key);
}
}

Some files were not shown because too many files have changed in this diff Show More