2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.model.operations.impl;
23 import org.openecomp.sdc.be.dao.neo4j.Neo4jOperationStatus;
24 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
26 public class Neo4jStatusConverter {
28 public static StorageOperationStatus convertNeo4jStatusToStorageStatus(Neo4jOperationStatus neo4jStatus) {
30 if (neo4jStatus == null) {
31 return StorageOperationStatus.GENERAL_ERROR;
34 switch (neo4jStatus) {
37 return StorageOperationStatus.OK;
40 return StorageOperationStatus.CONNECTION_FAILURE;
43 return StorageOperationStatus.PERMISSION_ERROR;
45 case HTTP_PROTOCOL_ERROR:
46 return StorageOperationStatus.HTTP_PROTOCOL_ERROR;
47 case DB_NOT_AVAILABLE:
48 return StorageOperationStatus.STORAGE_NOT_AVAILABLE;
50 return StorageOperationStatus.READ_ONLY_STORAGE;
52 return StorageOperationStatus.BAD_REQUEST;
53 case LEGACY_INDEX_ERROR:
54 return StorageOperationStatus.STORAGE_LEGACY_INDEX_ERROR;
56 return StorageOperationStatus.SCHEMA_ERROR;
57 case TRANSACTION_ERROR:
58 return StorageOperationStatus.TRANSACTION_ERROR;
59 case EXECUTION_FAILED:
60 return StorageOperationStatus.EXEUCTION_FAILED;
61 case ENTITY_ALREADY_EXIST:
62 return StorageOperationStatus.ENTITY_ALREADY_EXISTS;
64 return StorageOperationStatus.BAD_REQUEST;
66 return StorageOperationStatus.GENERAL_ERROR;
68 return StorageOperationStatus.OPERATION_NOT_SUPPORTED;
70 return StorageOperationStatus.NOT_FOUND;
73 return StorageOperationStatus.GENERAL_ERROR;