Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
QuangTranXuan committed Nov 10, 2023
1 parent 7e57ad4 commit 66dc179
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package nz.co.manawabay.core.models;
package nz.co.manawabay.core.models.form;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import nz.co.manawabay.core.models.form.OptionItemImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.HttpGet;
Expand All @@ -13,7 +12,6 @@
import org.apache.sling.models.annotations.DefaultInjectionStrategy;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.Via;
import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
import org.apache.sling.models.annotations.injectorspecific.Self;
import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
import org.apache.sling.models.annotations.via.ResourceSuperType;
Expand Down Expand Up @@ -45,17 +43,17 @@ public class Options implements com.adobe.cq.wcm.core.components.models.form.Opt

private List<com.adobe.cq.wcm.core.components.models.form.OptionItem> optionItems;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "source")
@ValueMapValue(name = "source")
@Nullable
private String sourceString;
private String source;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
@ValueMapValue
@Nullable
private String datasourceRT;

@Override
public List<com.adobe.cq.wcm.core.components.models.form.OptionItem> getItems() {
if (StringUtils.equalsIgnoreCase(sourceString, "datasource")) {
if (StringUtils.equalsIgnoreCase(source, "datasource")) {
if (optionItems == null) {
populateOptionItemsFromDatasource();
}
Expand Down Expand Up @@ -86,7 +84,7 @@ private void populateOptionItemsFromDatasource() {
return response;
});
} catch (IOException e) {
LOGGER.error(String.format("Cannot get items from resource: %s", sourceString), e);
LOGGER.error(String.format("Cannot get items from resource: %s", source), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@Version("1.0")
package nz.co.manawabay.core.models.form;

import org.osgi.annotation.versioning.Version;

0 comments on commit 66dc179

Please sign in to comment.