-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6dd092
commit 3832091
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
search-commons/src/main/java/no/unit/nva/search2/model/Facets/Facet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package no.unit.nva.search2.model.Facets; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import java.util.Map; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) | ||
@JsonSubTypes({ | ||
@Type(FundingFacet.class), | ||
@Type(TopLevelOrganizationIdFacet.class) | ||
}) | ||
public abstract class Facet { | ||
|
||
@JsonProperty("docCount") | ||
private Integer count; | ||
|
||
public Integer getCount() { | ||
return count; | ||
} | ||
|
||
@JsonProperty("key") | ||
public abstract String getKey(); | ||
|
||
@JsonProperty("labels") | ||
public abstract Map<String, String> getLabels(); | ||
} |
28 changes: 28 additions & 0 deletions
28
search-commons/src/main/java/no/unit/nva/search2/model/Facets/FundingFacet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package no.unit.nva.search2.model.Facets; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.Map; | ||
|
||
public class FundingFacet extends Facet { | ||
|
||
private final String identifier; | ||
private final Map<String, String> institutionName; | ||
|
||
public FundingFacet(@JsonProperty("cristin_institution_id") String institutionId, | ||
@JsonProperty("institution_name") Map<String, String> institutionName) { | ||
super(); | ||
this.identifier = institutionId; | ||
this.institutionName = institutionName; | ||
} | ||
|
||
@Override | ||
public String getKey() { | ||
return identifier; | ||
} | ||
|
||
@Override | ||
public Map<String, String> getLabels() { | ||
return institutionName; | ||
} | ||
} | ||
|
28 changes: 28 additions & 0 deletions
28
...h-commons/src/main/java/no/unit/nva/search2/model/Facets/TopLevelOrganizationIdFacet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package no.unit.nva.search2.model.Facets; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.Map; | ||
|
||
public class TopLevelOrganizationIdFacet extends Facet { | ||
|
||
private final String identifier; | ||
private final Map<String, String> institutionName; | ||
|
||
public TopLevelOrganizationIdFacet(@JsonProperty("topLevelOrganizations.id") String id, | ||
@JsonProperty("institution_name") Map<String, String> institutionName) { | ||
super(); | ||
this.identifier = id; | ||
this.institutionName = institutionName; | ||
} | ||
|
||
@Override | ||
public String getKey() { | ||
return identifier; | ||
} | ||
|
||
@Override | ||
public Map<String, String> getLabels() { | ||
return institutionName; | ||
} | ||
} | ||
|
5 changes: 5 additions & 0 deletions
5
search-commons/src/test/java/no/unit/nva/search2/FacetsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package no.unit.nva.search2; | ||
|
||
public class FacetsTest { | ||
|
||
} |