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(); short getDownloadProgressPercent();
/** /**
* @return list of message entries that can be added to the * @return immutable list of message entries that in the
* {@link ActionStatus}. * {@link ActionStatus}.
*/ */
List<String> getMessages(); List<String> getMessages();

View File

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

View File

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

View File

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

View File

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

View File

@@ -32,12 +32,12 @@ public interface Target extends NamedEntity {
String getControllerId(); String getControllerId();
/** /**
* @return assigned {@link TargetTag}s. * @return immutable set of assigned {@link TargetTag}s.
*/ */
Set<TargetTag> getTags(); Set<TargetTag> getTags();
/** /**
* @return {@link Action} history of the {@link Target}. * @return immutable {@link Action} history of the {@link Target}.
*/ */
List<Action> getActions(); List<Action> getActions();
@@ -64,4 +64,19 @@ public interface Target extends NamedEntity {
*/ */
void setSecurityToken(String token); 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 { 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(); List<Target> getAssignedToTargets();

View File

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