/** * Returns a new {@link ThingTag}. * * @param id the ID of the modified Thing. * @param revision the revision of the modified Thing. * @return a new {@link ThingTag}. */ public static ThingTag of(final String id, final long revision) { return new ThingTag(id, revision); }
private void processThingTag(final ThingTag thingTag) { LogUtil.enhanceLogWithCorrelationId(log, "things-tags-sync-" + thingTag.asIdentifierString()); log.debug("Received new Thing Tag for thing <{}> with revision <{}>: <{}>.", thingId, sequenceNumber, thingTag.asIdentifierString()); activeSyncMetadata = new SyncMetadata(getSender(), thingTag); if (thingTag.getRevision() > sequenceNumber) { log.info("The Thing Tag for the thing <{}> has the revision {} which is greater than the current actor's" + " sequence number <{}>.", thingId, thingTag.getRevision(), sequenceNumber); triggerSynchronization(); } else { ackSync(true); } }
private static ThingTag createElement(final PidWithSeqNr pidWithSeqNr) { final String id = pidWithSeqNr.getPersistenceId() .replaceFirst(ThingPersistenceActor.PERSISTENCE_ID_PREFIX, ""); return ThingTag.of(id, pidWithSeqNr.getSequenceNr()); } }
private void processThingTag(final ThingTag thingTag) { final String elementIdentifier = thingTag.asIdentifierString(); LogUtil.enhanceLogWithCorrelationId(log, "things-tags-sync-" + elementIdentifier); log.debug("Forwarding incoming ThingTag '{}'", elementIdentifier); forwardJsonifiableToShardRegion(thingTag, ThingTag::getId); }
private static void addThingsStrategies(final MappingStrategiesBuilder builder) { builder.add(ThingErrorRegistry.newInstance()) .add(ThingCommandRegistry.newInstance()) .add(ThingCommandResponseRegistry.newInstance()) .add(ThingEventRegistry.newInstance()) .add(SudoCommandRegistry.newInstance()) .add(SudoCommandResponseRegistry.newInstance()) .add(StreamingRegistry.newInstance()) .add(Thing.class, (jsonObject) -> ThingsModelFactory.newThing(jsonObject)) // do not replace with lambda! .add(ThingTag.class, jsonObject -> ThingTag.fromJson(jsonObject)) // do not replace with lambda! .add(BatchedEntityIdWithRevisions.typeOf(ThingTag.class), BatchedEntityIdWithRevisions.deserializer(jsonObject -> ThingTag.fromJson(jsonObject))) .build(); }
private void processThingTag(final ThingTag thingTag) { LogUtil.enhanceLogWithCorrelationId(log, "things-tags-sync-" + thingTag.asIdentifierString()); log.debug("Received new Thing Tag for thing <{}> with revision <{}>: <{}>.", thingId, sequenceNumber, thingTag.asIdentifierString()); activeSyncMetadata = new SyncMetadata(getSender(), thingTag); if (thingTag.getRevision() > sequenceNumber) { log.info("The Thing Tag for the thing <{}> has the revision {} which is greater than the current actor's" + " sequence number <{}>.", thingId, thingTag.getRevision(), sequenceNumber); triggerSynchronization(); } else { ackSync(true); } }
private static ThingTag createElement(final PidWithSeqNr pidWithSeqNr) { final String id = pidWithSeqNr.getPersistenceId() .replaceFirst(ThingPersistenceActor.PERSISTENCE_ID_PREFIX, ""); return ThingTag.of(id, pidWithSeqNr.getSequenceNr()); } }
private void processThingTag(final ThingTag thingTag) { final String elementIdentifier = thingTag.asIdentifierString(); LogUtil.enhanceLogWithCorrelationId(log, "things-tags-sync-" + elementIdentifier); log.debug("Forwarding incoming ThingTag '{}'", elementIdentifier); forwardJsonifiableToShardRegion(thingTag, ThingTag::getId); }
private static void addThingsStrategies(final MappingStrategiesBuilder builder) { builder .add(ThingErrorRegistry.newInstance()) .add(ThingCommandRegistry.newInstance()) .add(ThingCommandResponseRegistry.newInstance()) .add(ThingEventRegistry.newInstance()) .add(SudoCommandRegistry.newInstance()) .add(SudoCommandResponseRegistry.newInstance()) .add(StreamingRegistry.newInstance()) .add(Thing.class, (jsonObject) -> ThingsModelFactory.newThing(jsonObject)) // do not replace with lambda! .add(ThingTag.class, jsonObject -> ThingTag.fromJson(jsonObject)) // do not replace with lambda! .add(BatchedEntityIdWithRevisions.typeOf(ThingTag.class), BatchedEntityIdWithRevisions.deserializer(jsonObject -> ThingTag.fromJson(jsonObject))) .build(); }
/** * Returns a new {@link ThingTag}. * * @param id the ID of the modified Thing. * @param revision the revision of the modified Thing. * @return a new {@link ThingTag}. */ public static ThingTag of(final String id, final long revision) { return new ThingTag(id, revision); }
/** * Creates a new {@link ThingTag} from a JSON object. * * @param jsonObject the JSON object of which a new {@link ThingTag} is to be created. * @return the {@link ThingTag} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws IllegalArgumentException if {@code jsonObject} is empty. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} is not valid JSON. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the passed in {@code jsonObject} was not in the * expected format. */ public static ThingTag fromJson(final JsonObject jsonObject) { return new ThingTag(jsonObject); }
/** * Creates a new {@link ThingTag} from a JSON object. * * @param jsonObject the JSON object of which a new {@link ThingTag} is to be created. * @return the {@link ThingTag} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws IllegalArgumentException if {@code jsonObject} is empty. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} is not valid JSON. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the passed in {@code jsonObject} was not in the * expected format. */ public static ThingTag fromJson(final JsonObject jsonObject) { return new ThingTag(jsonObject); }