Added integration option with device simulator.
Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -179,25 +179,6 @@ public interface TargetManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
List<Target> createTargets(@NotNull Collection<Target> targets);
|
||||
|
||||
/**
|
||||
* creating a new {@link Target} including poll status data. useful
|
||||
* especially in plug and play scenarios.
|
||||
*
|
||||
* @param targets
|
||||
* to be created *
|
||||
* @param status
|
||||
* of the target
|
||||
* @param lastTargetQuery
|
||||
* if a plug and play case
|
||||
* @param address
|
||||
* if a plug and play case
|
||||
*
|
||||
* @return newly created target
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
List<Target> createTargets(@NotNull Collection<Target> targets, @NotNull TargetUpdateStatus status,
|
||||
Long lastTargetQuery, URI address);
|
||||
|
||||
/**
|
||||
* Deletes all targets with the given IDs.
|
||||
*
|
||||
|
||||
@@ -16,10 +16,19 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public interface TargetInfo extends Serializable {
|
||||
/**
|
||||
* @return the address under whioch the target can be reached
|
||||
* @return the address under which the target can be reached
|
||||
*/
|
||||
URI getAddress();
|
||||
|
||||
/**
|
||||
* @param address
|
||||
* the target address to set
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* If the given string violates RFC 2396
|
||||
*/
|
||||
void setAddress(String address);
|
||||
|
||||
/**
|
||||
* @return {@link Target} this info element belongs to.
|
||||
*/
|
||||
|
||||
@@ -608,24 +608,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
final List<Target> savedTargets = new ArrayList<>();
|
||||
for (final Target t : targets) {
|
||||
final Target myTarget = createTarget(t);
|
||||
savedTargets.add(myTarget);
|
||||
}
|
||||
return savedTargets;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Modifying
|
||||
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||
public List<Target> createTargets(final Collection<Target> targets, final TargetUpdateStatus status,
|
||||
final Long lastTargetQuery, final URI address) {
|
||||
if (targetRepository.countByControllerIdIn(
|
||||
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList())) > 0) {
|
||||
throw new EntityAlreadyExistsException();
|
||||
}
|
||||
final List<Target> savedTargets = new ArrayList<>();
|
||||
for (final Target t : targets) {
|
||||
final Target myTarget = createTarget(t, status, lastTargetQuery, address);
|
||||
final Target myTarget = createTarget(t, TargetUpdateStatus.UNKNOWN, null, t.getTargetInfo().getAddress());
|
||||
savedTargets.add(myTarget);
|
||||
}
|
||||
return savedTargets;
|
||||
|
||||
@@ -168,7 +168,7 @@ public class JpaTargetInfo implements Persistable<Long>, TargetInfo {
|
||||
|
||||
/**
|
||||
* @param address
|
||||
* the ipAddress to set
|
||||
* the target address to set
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* If the given string violates RFC 2396
|
||||
|
||||
Reference in New Issue
Block a user