use of org.molgenis.data.UnknownEntityException in project molgenis by molgenis.
the class DataPersisterImpl method updateEntityTypeFirstPass.
private EntityType updateEntityTypeFirstPass(EntityType entityType) {
String entityTypeId = entityType.getId();
EntityType existingEntityType = dataService.findOneById(ENTITY_TYPE_META_DATA, entityTypeId, EntityType.class);
if (existingEntityType == null) {
throw new UnknownEntityException(format("Unknown entity type [%s]", entityType.getId()));
}
return updateEntityTypeFirstPass(entityType, existingEntityType);
}
use of org.molgenis.data.UnknownEntityException in project molgenis by molgenis.
the class PackageRepositoryValidationDecorator method deleteById.
@Override
public void deleteById(Object id) {
Package package_ = findOneById(id);
if (package_ == null) {
throw new UnknownEntityException(format("Unknown package [%s]", id.toString()));
}
packageValidator.validate(package_);
super.deleteById(id);
}
use of org.molgenis.data.UnknownEntityException in project molgenis by molgenis.
the class FairController method getCatalog.
@GetMapping(produces = TEXT_TURTLE_VALUE, value = "/{catalogID}")
@ResponseBody
@RunAsSystem
public Model getCatalog(@PathVariable("catalogID") String catalogID) {
String subjectIRI = getBaseUri().pathSegment(catalogID).toUriString();
Entity subjectEntity = dataService.findOneById("fdp_Catalog", catalogID);
if (subjectEntity == null) {
throw new UnknownEntityException(format("Catalog with id [%s] does not exist", catalogID));
}
return entityModelWriter.createRdfModel(subjectIRI, subjectEntity);
}
use of org.molgenis.data.UnknownEntityException in project molgenis by molgenis.
the class UntypedTagService method addEntityTag.
@Override
public void addEntityTag(SemanticTag<EntityType, LabeledResource, LabeledResource> tag) {
Entity entity = findEntity(tag.getSubject());
if (entity == null) {
throw new UnknownEntityException("Unknown entity [" + tag.getSubject().getId() + "]");
}
ImmutableList<SemanticTag<EntityType, LabeledResource, LabeledResource>> existingTags = ImmutableList.copyOf(getTagsForEntity(tag.getSubject()));
if (existingTags.contains(tag)) {
LOG.debug("Tag already present");
return;
}
ImmutableList.Builder<Entity> builder = ImmutableList.builder();
builder.addAll(entity.getEntities(EntityTypeMetadata.TAGS));
builder.add(getTagEntity(tag));
entity.set(EntityTypeMetadata.TAGS, builder.build());
dataService.update(ENTITY_TYPE_META_DATA, entity);
}
Aggregations