Skip to content

Commit

Permalink
#98: fix "Tag @link: reference not found" for generic links
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-kovalenko-ct committed Sep 27, 2017
1 parent 11e0a90 commit 4dc6f41
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class SphereClientUtils {
public static final Long QUERY_MAX_LIMIT = 500L;

/**
* Fetches resources of {@link T} using a {@code query}. The {@code ctpRequest} is applied on each resultant
* Fetches resources of {@code T} using a {@code query}. The {@code ctpRequest} is applied on each resultant
* resource from fetching, to make a {@link SphereRequest}. Then each request is executed by {@code client}.
* Method blocks until above operations were done.
*
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/commercetools/sync/commons/BaseSync.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ protected BaseSync(@Nonnull final U statistics, @Nonnull final V syncOptions) {
* actions on the existing resource if it exists or create it if it doesn't.
*
* @param resourceDrafts the list of new resources as drafts.
* @return an instance of {@link CompletionStage}<{@link U}> which contains as a result an instance of
* {@link U} which is a subclass of {@link BaseSyncStatistics} representing the {@code statistics} instance
* @return an instance of {@link CompletionStage}<{@code U}> which contains as a result an instance of
* {@code U} which is a subclass of {@link BaseSyncStatistics} representing the {@code statistics} instance
* attribute of {@code this} {@link BaseSync}.
*/
protected abstract CompletionStage<U> process(@Nonnull final List<T> resourceDrafts);
Expand All @@ -38,8 +38,8 @@ protected BaseSync(@Nonnull final U statistics, @Nonnull final V syncOptions) {
* container so that the total processing time is computed in the statistics.
*
* @param resourceDrafts the list of new resources as drafts.
* @return an instance of {@link CompletionStage}&lt;{@link U}&gt; which contains as a result an instance of
* {@link U} which is a subclass of {@link BaseSyncStatistics} representing the {@code statistics} instance
* @return an instance of {@link CompletionStage}&lt;{@code U}&gt; which contains as a result an instance of
* {@code U} which is a subclass of {@link BaseSyncStatistics} representing the {@code statistics} instance
* attribute of {@code this} {@link BaseSync}.
*/
public CompletionStage<U> sync(@Nonnull final List<T> resourceDrafts) {
Expand Down Expand Up @@ -73,7 +73,7 @@ public U getStatistics() {
* @param result in the first call of this recursive method, this result is normally a completed future, it
* used from within the method to recursively sync each batch once the previous batch has
* finished syncing.
* @return an instance of {@link CompletionStage}&lt;{@link U}&gt; which contains as a result an instance of
* @return an instance of {@link CompletionStage}&lt;{@code U}&gt; which contains as a result an instance of
* {@link BaseSyncStatistics} representing the {@code statistics} of the sync process executed on the
* given list of batches.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected CustomReferenceResolver(@Nonnull final S options, @Nonnull final TypeS
}

/**
* Given a draft of {@link T} (e.g. {@link CategoryDraft}) this method attempts to resolve it's custom type
* Given a draft of {@code T} (e.g. {@link CategoryDraft}) this method attempts to resolve it's custom type
* reference to return {@link CompletionStage} which contains a new instance of the draft with the resolved
* custom type reference. The key of the custom type is taken from the from the id field of the reference.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
*/
public abstract class GenericCustomActionBuilder<T extends Custom & Resource<T>> {
/**
* Creates a CTP "setCustomType" update action on the given resource {@link T} that removes the custom type set on
* the given resource {@link T} (which currently could either be a {@link Category} or a {@link Channel}).
* Creates a CTP "setCustomType" update action on the given resource {@code T} that removes the custom type set on
* the given resource {@code T} (which currently could either be a {@link Category} or a {@link Channel}).
*
* @return a setCustomType update action that removes the custom type from the resource it's requested on.
*/
@Nonnull
public abstract UpdateAction<T> buildRemoveCustomTypeAction();

/**
* Creates a CTP "setCustomType" update action on the given resource {@link T} (which currently could either
* Creates a CTP "setCustomType" update action on the given resource {@code T} (which currently could either
* be a {@link Category} or a {@link Channel}).
*
* @param customTypeId the id of the new custom type.
Expand All @@ -43,9 +43,9 @@ public abstract UpdateAction<T> buildSetCustomTypeAction(@Nullable final String
@Nullable final Map<String, JsonNode> customFieldsJsonMap);

/**
* Creates a CTP "setCustomField" update action on the given resource {@link T} that updates a custom field with
* Creates a CTP "setCustomField" update action on the given resource {@code T} that updates a custom field with
* {@code customFieldName} and a {@code customFieldValue} on the given
* resource {@link T} (which currently could either be a {@link Category} or a {@link Channel}).
* resource {@code T} (which currently could either be a {@link Category} or a {@link Channel}).
*
* @param customFieldName the name of the custom field to update.
* @param customFieldValue the new JSON value of the custom field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public final class CustomUpdateActionUtils {
private static final String CUSTOM_TYPE_ID_IS_BLANK = "New resource's custom type id is blank (empty/null).";

/**
* Compares the {@link CustomFields} of an old resource {@link T} (for example {@link Category},
* Compares the {@link CustomFields} of an old resource {@code T} (for example {@link Category},
* {@link io.sphere.sdk.products.Product}, etc..), to the {@link CustomFieldsDraft}, of a new
* resource draft {@link S} (for example {@link CategoryDraft}, {@link io.sphere.sdk.products.ProductVariantDraft},
* resource draft {@code S} (for example {@link CategoryDraft}, {@link io.sphere.sdk.products.ProductVariantDraft},
* etc..), and returns a {@link List}&lt;{@link UpdateAction}&gt; as a result. If no update action is needed,
* for example in the case where both the {@link CustomFields} and the {@link CustomFieldsDraft} are null, an empty
* {@link List}&lt;{@link UpdateAction}&gt; is returned. A {@link BaseSyncOptions} instance is injected into the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class GenericUpdateActionUtils {
+ "remove the custom type on the %s with id '%s'. Reason: %s";

/**
* Creates a CTP "setCustomType" update action on the given resource {@link T} (which currently could either
* Creates a CTP "setCustomType" update action on the given resource {@code T} (which currently could either
* be a {@link Category} or a {@link Channel}).
*
* @param customTypeId the id of the new custom type.
Expand Down Expand Up @@ -56,8 +56,8 @@ static <T extends Custom & Resource<T>> Optional<UpdateAction<T>> buildTypedSetC
}

/**
* Creates a CTP "setCustomType" update action on the given resource {@link T} that removes the custom type set on
* the given resource {@link T} (which currently could either be a {@link Category} or a {@link Channel}).
* Creates a CTP "setCustomType" update action on the given resource {@code T} that removes the custom type set on
* the given resource {@code T} (which currently could either be a {@link Category} or a {@link Channel}).
*
* @param resource the resource to do the update action on.
* @param <T> the type of the resource to do the update action on.
Expand All @@ -77,9 +77,9 @@ static <T extends Custom & Resource<T>> Optional<UpdateAction<T>> buildTypedRemo
}

/**
* Creates a CTP "setCustomField" update action on the given resource {@link T} that updates a custom field with
* Creates a CTP "setCustomField" update action on the given resource {@code T} that updates a custom field with
* {@code customFieldName} and a {@code customFieldValue} on the given
* resource {@link T} (which currently could either be a {@link Category} or a {@link Channel}).
* resource {@code T} (which currently could either be a {@link Category} or a {@link Channel}).
*
* @param customFieldName the name of the custom field to update.
* @param customFieldValue the new JSON value of the custom field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,27 @@
import io.sphere.sdk.inventory.commands.updateactions.SetCustomField;
import io.sphere.sdk.inventory.commands.updateactions.SetCustomType;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Map;

public class InventoryCustomActionBuilder extends GenericCustomActionBuilder<InventoryEntry> {

@Nonnull
@Override
public UpdateAction<InventoryEntry> buildRemoveCustomTypeAction() {
return SetCustomType.ofRemoveType();
}

@Nonnull
@Override
public UpdateAction<InventoryEntry> buildSetCustomTypeAction(@Nullable final String customTypeId,
@Nullable final Map<String, JsonNode>
customFieldsJsonMap) {
return SetCustomType.ofTypeIdAndJson(customTypeId, customFieldsJsonMap);
}

@Nonnull
@Override
public UpdateAction<InventoryEntry> buildSetCustomFieldAction(@Nullable final String customFieldName,
@Nullable final JsonNode customFieldValue) {
Expand Down

0 comments on commit 4dc6f41

Please sign in to comment.