47 lines
799 B
Java
47 lines
799 B
Java
package org.gcube.data.publishing.ckan2zenodo.model;
|
|
|
|
import java.util.List;
|
|
|
|
import com.jayway.jsonpath.JsonPath;
|
|
import com.jayway.jsonpath.ReadContext;
|
|
|
|
import lombok.Getter;
|
|
import lombok.NoArgsConstructor;
|
|
import lombok.NonNull;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
@RequiredArgsConstructor
|
|
@NoArgsConstructor
|
|
public class CkanItemDescriptor {
|
|
|
|
private static final String PROFILE="$.extras[?(@.key=='system:type')].value";
|
|
|
|
|
|
|
|
@NonNull
|
|
@Getter
|
|
private String itemName;
|
|
@NonNull
|
|
@Getter
|
|
private String content;
|
|
|
|
|
|
@Getter(lazy=true)
|
|
private final ReadContext document=document();
|
|
|
|
|
|
private ReadContext document() {
|
|
return JsonPath.parse(content);
|
|
}
|
|
|
|
|
|
public String getProfile() {
|
|
List<String> values=getDocument().read(PROFILE);
|
|
return values.get(0);
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|