edu.stanford.protege.webprotege.crud.uuid.UuidSuffixKit Maven / Gradle / Ivy
The newest version!
package edu.stanford.protege.webprotege.crud.uuid;
import com.fasterxml.jackson.annotation.JsonTypeName;
import edu.stanford.protege.webprotege.crud.EntityCrudKit;
import edu.stanford.protege.webprotege.crud.EntityCrudKitId;
import edu.stanford.protege.webprotege.crud.EntityCrudKitPrefixSettings;
import edu.stanford.protege.webprotege.crud.gen.GeneratedAnnotationsSettings;
import org.semanticweb.owlapi.model.IRI;
import javax.inject.Inject;
import java.util.Optional;
/**
* Author: Matthew Horridge
* Stanford University
* Bio-Medical Informatics Research Group
* Date: 13/08/2013
*/
@JsonTypeName("Uuid")
public class UuidSuffixKit extends EntityCrudKit {
public static final String EXAMPLE_SUFFIX = "RtvBaCCEyk09YwGRQljc2z";
private static final EntityCrudKitId ID = EntityCrudKitId.get("UUID");
@Inject
public UuidSuffixKit() {
super(ID, "Auto-generated Universally Unique Id (UUID)");
}
public static EntityCrudKitId getId() {
return ID;
}
@Override
public EntityCrudKitPrefixSettings getDefaultPrefixSettings() {
return EntityCrudKitPrefixSettings.get();
}
@Override
public UuidSuffixSettings getDefaultSuffixSettings() {
return UuidSuffixSettings.get();
}
@Override
public Optional getPrefixValidationMessage(String prefix) {
if(!(prefix.endsWith("#") || prefix.endsWith("/"))) {
return Optional.of("It is recommended that your prefix ends with a forward slash i.e. / (or a #)");
}
else {
return Optional.empty();
}
}
@Override
public IRI generateExample(EntityCrudKitPrefixSettings prefixSettings, UuidSuffixSettings suffixSettings) {
return IRI.create(prefixSettings.getIRIPrefix(), EXAMPLE_SUFFIX);
}
@Override
public GeneratedAnnotationsSettings getDefaultGeneratedAnnotationsSettings() {
return GeneratedAnnotationsSettings.empty();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy