Skip to content
Snippets Groups Projects
Verified Commit 283f06c2 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Update Proto again

parent 0f223a61
No related branches found
No related tags found
3 merge requests!44Release 0.6,!43Merge f-GRPC-main to dev,!42DEPS: Update proto and fix breaking changes
Pipeline #15856 passed
caosdb-proto @ fe58edac
Subproject commit c01fd9ff1471adafa707fdb36bdaa49749079fa6
Subproject commit fe58edacdedd2fa9992c103e18d4ae4875798a2c
......@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.Map;
import org.caosdb.api.entity.v1.MessageCode;
import org.caosdb.server.entity.xml.ToElementable;
import org.caosdb.server.utils.ServerMessages;
import org.jdom2.Element;
public class Message extends Exception implements Comparable<Message>, ToElementable {
......@@ -34,20 +35,21 @@ public class Message extends Exception implements Comparable<Message>, ToElement
private final String description;
private final String body;
@Deprecated private static final Map<MessageCode, String> legacy_codes_mapping = new HashMap<>();
@Deprecated private static final Map<Message, String> legacy_codes_mapping = new HashMap<>();
static {
legacy_codes_mapping.put(MessageCode.MESSAGE_CODE_ENTITY_HAS_BEEN_DELETED_SUCCESSFULLY, "10");
legacy_codes_mapping.put(MessageCode.MESSAGE_CODE_ATOMICITY_ERROR, "12");
legacy_codes_mapping.put(MessageCode.MESSAGE_CODE_ENTITY_DOES_NOT_EXIST, "101");
legacy_codes_mapping.put(MessageCode.MESSAGE_CODE_PROPERTY_HAS_NO_DATA_TYPE, "110");
legacy_codes_mapping.put(MessageCode.MESSAGE_CODE_ENTITY_HAS_UNQUALIFIED_PROPERTIES, "114");
legacy_codes_mapping.put(MessageCode.MESSAGE_CODE_ENTITY_HAS_UNQUALIFIED_PARENTS, "116");
legacy_codes_mapping.put(MessageCode.MESSAGE_CODE_WARNING_OCCURED, "128");
legacy_codes_mapping.put(MessageCode.MESSAGE_CODE_ENTITY_NAME_IS_NOT_UNIQUE, "152");
legacy_codes_mapping.put(MessageCode.MESSAGE_CODE_REQUIRED_BY_UNQUALIFIED, "192");
legacy_codes_mapping.put(MessageCode.MESSAGE_CODE_REFERENCED_ENTITY_DOES_NOT_EXIST, "235");
legacy_codes_mapping.put(MessageCode.MESSAGE_CODE_AUTHORIZATION_ERROR, "403");
legacy_codes_mapping.put(ServerMessages.ENTITY_HAS_BEEN_DELETED_SUCCESSFULLY, "10");
legacy_codes_mapping.put(ServerMessages.ATOMICITY_ERROR, "12");
legacy_codes_mapping.put(ServerMessages.ENTITY_DOES_NOT_EXIST, "101");
legacy_codes_mapping.put(ServerMessages.PROPERTY_HAS_NO_DATATYPE, "110");
legacy_codes_mapping.put(ServerMessages.ENTITY_HAS_UNQUALIFIED_PROPERTIES, "114");
legacy_codes_mapping.put(ServerMessages.ENTITY_HAS_UNQUALIFIED_PARENTS, "116");
legacy_codes_mapping.put(ServerMessages.WARNING_OCCURED, "128");
legacy_codes_mapping.put(ServerMessages.ENTITY_NAME_IS_NOT_UNIQUE, "152");
legacy_codes_mapping.put(ServerMessages.REQUIRED_BY_UNQUALIFIED, "192");
legacy_codes_mapping.put(ServerMessages.REFERENCED_ENTITY_DOES_NOT_EXIST, "235");
legacy_codes_mapping.put(ServerMessages.AUTHORIZATION_ERROR, "403");
legacy_codes_mapping.put(ServerMessages.ROLE_DOES_NOT_EXIST, "1104");
}
private static final long serialVersionUID = 1837110172902899264L;
......@@ -147,9 +149,11 @@ public class Message extends Exception implements Comparable<Message>, ToElement
public Element toElement() {
final Element e = new Element(this.type);
if (this.code != null && this.code != MessageCode.MESSAGE_CODE_UNKNOWN) {
if (legacy_codes_mapping.containsKey(this.code)) {
e.setAttribute("code", legacy_codes_mapping.get(this.code));
if (this.code != null) {
if (legacy_codes_mapping.containsKey(this)) {
e.setAttribute("code", legacy_codes_mapping.get(this));
} else if (this.code == MessageCode.MESSAGE_CODE_UNKNOWN) {
e.setAttribute("code", "0");
} else {
e.setAttribute("code", Integer.toString(this.code.getNumber()));
}
......
......@@ -36,7 +36,6 @@ import org.caosdb.server.utils.ServerMessages;
public class EntityTransactionServiceImpl extends EntityTransactionServiceImplBase {
/// MOVE END
private final CaosDBToGrpcConverters caosdbToGrpc = new CaosDBToGrpcConverters();
private final GrpcToCaosDBConverters grpcToCaosdb = new GrpcToCaosDBConverters();
private final FileTransmissionServiceImpl fileTransmissionService;
......
......@@ -33,7 +33,7 @@ import org.caosdb.server.utils.EntityStatus;
import org.caosdb.server.utils.ServerMessages;
public class GrpcToCaosDBConverters {
/// MOVE
public Integer getId(final String id) {
return Integer.parseInt(id);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment