implemented get
parent
3076da1ed8
commit
0b480bac10
|
@ -28,7 +28,6 @@ import javax.persistence.GeneratedValue;
|
|||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
|
@ -113,9 +112,10 @@ public class ResourceSet {
|
|||
* @return the scopes
|
||||
*/
|
||||
@ElementCollection(fetch=FetchType.EAGER)
|
||||
@Column(name = "scope")
|
||||
@CollectionTable(
|
||||
name="resource_set_scope",
|
||||
joinColumns=@JoinColumn(name="owner_id")
|
||||
joinColumns=@JoinColumn(name = "owner_id")
|
||||
)
|
||||
public Set<String> getScopes() {
|
||||
return scopes;
|
||||
|
|
|
@ -29,4 +29,6 @@ public interface ResourceSetService {
|
|||
|
||||
public ResourceSet saveNew(ResourceSet rs);
|
||||
|
||||
public ResourceSet getById(Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -156,6 +156,22 @@ public class JsonUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the given member as a Long, null if it doesn't exist
|
||||
*/
|
||||
public static Long getAsLong(JsonObject o, String member) {
|
||||
if (o.has(member)) {
|
||||
JsonElement e = o.get(member);
|
||||
if (e != null && e.isJsonPrimitive()) {
|
||||
return e.getAsLong();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the given given member as a set of strings, null if it doesn't exist
|
||||
*/
|
||||
|
|
|
@ -27,4 +27,6 @@ public interface ResourceSetRepository {
|
|||
|
||||
public ResourceSet save(ResourceSet rs);
|
||||
|
||||
public ResourceSet getById(Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -42,4 +42,9 @@ public class JpaResourceSetRepository implements ResourceSetRepository {
|
|||
return JpaUtil.saveOrUpdate(rs.getId(), em, rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceSet getById(Long id) {
|
||||
return em.find(ResourceSet.class, id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,6 +46,11 @@ public class DefaultResourceSetService implements ResourceSetService {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceSet getById(Long id) {
|
||||
return repository.getById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue