Added immutable comments.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
kaizimmerm
2016-09-22 11:48:41 +02:00
parent 91383e9625
commit 948196ae28
8 changed files with 35 additions and 14 deletions

View File

@@ -50,7 +50,7 @@ public interface ActionStatus extends TenantAwareBaseEntity {
short getDownloadProgressPercent();
/**
* @return list of message entries that can be added to the
* @return immutable list of message entries that in the
* {@link ActionStatus}.
*/
List<String> getMessages();

View File

@@ -17,8 +17,8 @@ import java.util.List;
public interface DistributionSetTag extends Tag {
/**
* @return {@link List} of {@link DistributionSet}s this {@link Tag} is
* assigned to.
* @return immutable {@link List} of {@link DistributionSet}s this
* {@link Tag} is assigned to.
*/
List<DistributionSet> getAssignedToDistributionSet();

View File

@@ -27,15 +27,15 @@ public interface DistributionSetType extends NamedEntity {
boolean isDeleted();
/**
* @return set of {@link SoftwareModuleType}s that need to be in a
* @return immutable set of {@link SoftwareModuleType}s that need to be in a
* {@link DistributionSet} of this type to be
* {@link DistributionSet#isComplete()}.
*/
Set<SoftwareModuleType> getMandatoryModuleTypes();
/**
* @return set of optional {@link SoftwareModuleType}s that can be in a
* {@link DistributionSet} of this type.
* @return immutable set of optional {@link SoftwareModuleType}s that can be
* in a {@link DistributionSet} of this type.
*/
Set<SoftwareModuleType> getOptionalModuleTypes();

View File

@@ -38,7 +38,7 @@ public interface Rollout extends NamedEntity {
void setDistributionSet(DistributionSet distributionSet);
/**
* @return list of deployment groups of the rollout.
* @return immutable list of deployment groups of the rollout.
*/
List<RolloutGroup> getRolloutGroups();

View File

@@ -11,6 +11,10 @@ package org.eclipse.hawkbit.repository.model;
import java.util.List;
import java.util.Optional;
/**
* Software package as sub element of a {@link DistributionSet}.
*
*/
public interface SoftwareModule extends NamedVersionedEntity {
/**
@@ -40,12 +44,12 @@ public interface SoftwareModule extends NamedVersionedEntity {
Optional<LocalArtifact> getLocalArtifactByFilename(String fileName);
/**
* @return the artifacts
* @return immutable list of all artifacts
*/
List<Artifact> getArtifacts();
/**
* @return local artifacts only
* @return immutable list of local artifacts only
*/
List<LocalArtifact> getLocalArtifacts();
@@ -104,7 +108,8 @@ public interface SoftwareModule extends NamedVersionedEntity {
List<SoftwareModuleMetadata> getMetadata();
/**
* @return the assignedTo
* @return immutable list of {@link DistributionSet}s the module is assigned
* to
*/
List<DistributionSet> getAssignedTo();

View File

@@ -32,12 +32,12 @@ public interface Target extends NamedEntity {
String getControllerId();
/**
* @return assigned {@link TargetTag}s.
* @return immutable set of assigned {@link TargetTag}s.
*/
Set<TargetTag> getTags();
/**
* @return {@link Action} history of the {@link Target}.
* @return immutable {@link Action} history of the {@link Target}.
*/
List<Action> getActions();
@@ -64,4 +64,19 @@ public interface Target extends NamedEntity {
*/
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).
*/
public boolean addTag(TargetTag tag);
/**
* @param tag
* to remove
* @return <code>true</code> if tag was in the list and removed
*/
public boolean removeTag(TargetTag tag);
}

View File

@@ -17,7 +17,7 @@ import java.util.List;
public interface TargetTag extends Tag {
/**
* @return {@link List} of targets assigned to this {@link Tag}.
* @return immutable {@link List} of targets assigned to this {@link Tag}.
*/
List<Target> getAssignedToTargets();

View File

@@ -343,7 +343,7 @@ public class JpaTargetManagement implements TargetManagement {
// all are already assigned -> unassign
if (alreadyAssignedTargets.size() == allTargets.size()) {
alreadyAssignedTargets.forEach(target -> ((JpaTarget) target).removeTag(tag));
alreadyAssignedTargets.forEach(target -> target.removeTag(tag));
final TargetTagAssignmentResult result = new TargetTagAssignmentResult(0, 0, alreadyAssignedTargets.size(),
Collections.emptyList(), alreadyAssignedTargets, tag);
@@ -385,6 +385,7 @@ public class JpaTargetManagement implements TargetManagement {
}
private List<Target> unAssignTag(final Collection<Target> targets, final TargetTag tag) {
@SuppressWarnings({ "unchecked", "rawtypes" })
final Collection<JpaTarget> toUnassign = (Collection) targets;
toUnassign.forEach(target -> target.removeTag(tag));