2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 package org.onap.crud.dao.champ;
23 import java.nio.charset.Charset;
24 import java.util.ArrayList;
25 import java.util.Arrays;
26 import java.util.HashMap;
27 import java.util.HashSet;
28 import java.util.List;
30 import javax.ws.rs.core.MediaType;
31 import javax.ws.rs.core.Response;
32 import org.apache.http.NameValuePair;
33 import org.apache.http.client.utils.URLEncodedUtils;
34 import org.apache.http.message.BasicNameValuePair;
35 import org.eclipse.jetty.util.security.Password;
36 import org.onap.aai.cl.api.Logger;
37 import org.onap.aai.cl.eelf.LoggerFactory;
38 import org.onap.aai.cl.mdc.MdcContext;
39 import org.onap.aai.logging.LoggingContext;
40 import org.onap.aai.restclient.client.OperationResult;
41 import org.onap.aai.restclient.client.RestClient;
42 import org.onap.aai.restclient.enums.RestAuthenticationMode;
43 import org.onap.crud.dao.GraphDao;
44 import org.onap.crud.entity.Edge;
45 import org.onap.crud.entity.Vertex;
46 import org.onap.crud.exception.CrudException;
47 import org.onap.crud.util.CrudServiceConstants;
49 import com.google.gson.Gson;
50 import com.google.gson.GsonBuilder;
51 import com.google.gson.reflect.TypeToken;
52 import net.dongliu.gson.GsonJava8TypeAdapterFactory;
54 public class ChampDao implements GraphDao {
55 protected RestClient client;
56 protected String baseObjectUrl;
57 protected String baseRelationshipUrl;
58 protected String baseTransactionUrl;
60 protected static final String HEADER_FROM_APP = "X-FromAppId";
61 protected static final String HEADER_TRANS_ID = "X-TransactionId";
62 protected static final String FROM_APP_NAME = "Gizmo";
63 protected static final String OBJECT_SUB_URL = "objects";
64 protected static final String RELATIONSHIP_SUB_URL = "relationships";
65 protected static final String TRANSACTION_SUB_URL = "transaction";
67 private Logger logger = LoggerFactory.getInstance().getLogger(ChampDao.class.getName());
69 // We use a custom vertex serializer for champ because it expects "key"
71 protected static final Gson champGson = new GsonBuilder()
72 .registerTypeAdapterFactory(new GsonJava8TypeAdapterFactory())
73 .registerTypeAdapter(Vertex.class, new ChampVertexSerializer())
74 .registerTypeAdapter(Edge.class, new ChampEdgeSerializer()).create();
79 public ChampDao(String champUrl, String certPassword) {
81 client = new RestClient().authenticationMode(RestAuthenticationMode.SSL_CERT).validateServerHostname(false)
82 .validateServerCertChain(false).clientCertFile(CrudServiceConstants.CRD_CHAMP_AUTH_FILE)
83 .clientCertPassword(Password.deobfuscate(certPassword));
85 baseObjectUrl = champUrl + OBJECT_SUB_URL;
86 baseRelationshipUrl = champUrl + RELATIONSHIP_SUB_URL;
87 baseTransactionUrl = champUrl + TRANSACTION_SUB_URL;
88 } catch (Exception e) {
89 System.out.println("Error setting up Champ configuration");
95 public ChampDao(RestClient client, String baseObjectUrl, String baseRelationshipUrl, String baseTransactionUrl) {
97 this.baseObjectUrl = baseObjectUrl;
98 this.baseRelationshipUrl = baseRelationshipUrl;
99 this.baseTransactionUrl = baseTransactionUrl;
103 public Vertex getVertex(String id, String version) throws CrudException {
104 String url = baseObjectUrl + "/" + id;
105 OperationResult getResult = client.get(url, createHeader(), MediaType.APPLICATION_JSON_TYPE);
107 if (getResult.getResultCode() == 200) {
108 return Vertex.fromJson(getResult.getResult(), version);
110 // We didn't find a vertex with the supplied id, so just throw an
112 throw createErrorException(getResult, javax.ws.rs.core.Response.Status.NOT_FOUND, "No vertex with id " + id + " found in graph");
117 public OperationResult getVertex(String id, String type, String version, Map<String, String> queryParams) throws CrudException {
118 StringBuilder strBuild = new StringBuilder(baseObjectUrl);
119 strBuild.append("/");
121 if(queryParams != null && !queryParams.isEmpty())
123 strBuild.append("?");
124 strBuild.append(URLEncodedUtils.format(convertToNameValuePair(queryParams), Charset.defaultCharset()));
127 OperationResult getResult = client.get(strBuild.toString(), createHeader(), MediaType.APPLICATION_JSON_TYPE);
129 if (getResult.getResultCode() == 200) {
130 Vertex vert = Vertex.fromJson(getResult.getResult(), version);
132 if (!vert.getType().equalsIgnoreCase(type)) {
133 // We didn't find a vertex with the supplied type, so just throw an
135 throw new CrudException("No vertex with id " + id + " and type " + type + " found in graph",
136 javax.ws.rs.core.Response.Status.NOT_FOUND);
140 // We didn't find a vertex with the supplied id, so just throw an
142 throw createErrorException(getResult, javax.ws.rs.core.Response.Status.NOT_FOUND, "No vertex with id " + id + " found in graph");
147 public List<Edge> getVertexEdges(String id, Map<String, String> queryParams) throws CrudException {
148 StringBuilder strBuild = new StringBuilder(baseObjectUrl);
149 strBuild.append("/relationships/");
151 if(queryParams != null && !queryParams.isEmpty())
153 strBuild.append("?");
154 strBuild.append(URLEncodedUtils.format(convertToNameValuePair(queryParams), Charset.defaultCharset()));
157 OperationResult getResult = client.get(strBuild.toString(), createHeader(), MediaType.APPLICATION_JSON_TYPE);
159 if (getResult.getResultCode() == 200) {
160 return champGson.fromJson(getResult.getResult(), new TypeToken<List<Edge>>() {
163 // We didn't find a vertex with the supplied id, so just throw an
165 throw createErrorException(getResult, javax.ws.rs.core.Response.Status.NOT_FOUND, "No vertex with id " + id + " found in graph");
170 public OperationResult getVertices(String type, Map<String, Object> filter, String version) throws CrudException {
171 return getVertices(type, filter, new HashSet<String>(), version);
175 public OperationResult getVertices(String type, Map<String, Object> filter, HashSet<String> properties, String version) throws CrudException {
176 filter.put(org.onap.schema.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
178 List<NameValuePair> queryParams = convertToNameValuePair(filter);
179 queryParams.addAll(convertToNameValuePair("properties", properties));
180 String url = baseObjectUrl + "/filter" + "?"
181 + URLEncodedUtils.format(queryParams, Charset.defaultCharset());
183 OperationResult getResult = client.get(url, createHeader(), MediaType.APPLICATION_JSON_TYPE);
185 if (getResult.getResultCode() == 200) {
188 // We didn't find a vertex with the supplied id, so just throw an
190 throw createErrorException(getResult, javax.ws.rs.core.Response.Status.NOT_FOUND, "No vertices found in graph for given filters");
195 public OperationResult getEdge(String id, String type, Map<String, String> queryParams) throws CrudException {
196 StringBuilder strBuild = new StringBuilder(baseRelationshipUrl);
197 strBuild.append("/");
199 if(queryParams != null && !queryParams.isEmpty())
201 strBuild.append("?");
202 strBuild.append(URLEncodedUtils.format(convertToNameValuePair(queryParams), Charset.defaultCharset()));
204 OperationResult getResult = client.get(strBuild.toString(), createHeader(), MediaType.APPLICATION_JSON_TYPE);
206 if (getResult.getResultCode() == 200) {
207 Edge edge = Edge.fromJson(getResult.getResult());
209 if (!edge.getType().equalsIgnoreCase(type)) {
210 // We didn't find an edge with the supplied type, so just throw an
212 throw new CrudException("No edge with id " + id + "and type " + type + " found in graph",
213 javax.ws.rs.core.Response.Status.NOT_FOUND);
217 // We didn't find a edge with the supplied type, so just throw an
219 throw createErrorException(getResult, javax.ws.rs.core.Response.Status.NOT_FOUND, "No edge with id " + id + " found in graph");
224 public OperationResult getEdges(String type, Map<String, Object> filter) throws CrudException {
225 String url = baseRelationshipUrl + "/filter" + "?"
226 + URLEncodedUtils.format(convertToNameValuePair(filter), Charset.defaultCharset());
228 OperationResult getResult = client.get(url, createHeader(), MediaType.APPLICATION_JSON_TYPE);
230 if (getResult.getResultCode() == 200) {
233 // We didn't find a vertex with the supplied id, so just throw an
235 throw createErrorException(getResult, javax.ws.rs.core.Response.Status.NOT_FOUND, "No edges found in graph for given filters");
240 public OperationResult addVertex(String type, Map<String, Object> properties, String version) throws CrudException {
241 String url = baseObjectUrl;
243 // Add the aai_node_type so that AAI can read the data created by gizmo
244 // TODO: This probably shouldn't be here
245 properties.put(org.onap.schema.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
247 Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
248 properties.forEach(insertVertexBuilder::property);
249 Vertex insertVertex = insertVertexBuilder.build();
251 OperationResult getResult = client.post(url, insertVertex.toJson(), createHeader(), MediaType.APPLICATION_JSON_TYPE,
252 MediaType.APPLICATION_JSON_TYPE);
254 if (getResult.getResultCode() == Response.Status.CREATED.getStatusCode()) {
257 // We didn't create a vertex with the supplied type, so just throw an
259 throw new CrudException("Failed to create vertex: " + getResult.getFailureCause(), Response.Status.fromStatusCode(getResult.getResultCode()));
264 public OperationResult updateVertex(String id, String type, Map<String, Object> properties, String version) throws CrudException {
265 String url = baseObjectUrl + "/" + id;
267 // Add the aai_node_type so that AAI can read the data created by gizmo
268 // TODO: This probably shouldn't be here
269 properties.put(org.onap.schema.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
271 Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
272 insertVertexBuilder.id(id);
273 properties.forEach(insertVertexBuilder::property);
274 Vertex insertVertex = insertVertexBuilder.build();
276 String payload = insertVertex.toJson(champGson);
277 OperationResult getResult = client.put(url, payload, createHeader(), MediaType.APPLICATION_JSON_TYPE,
278 MediaType.APPLICATION_JSON_TYPE);
280 if (getResult.getResultCode() == Response.Status.OK.getStatusCode()) {
283 // We didn't create a vertex with the supplied type, so just throw an
285 throw new CrudException("Failed to update vertex: " + getResult.getFailureCause(), Response.Status.fromStatusCode(getResult.getResultCode()));
290 public void deleteVertex(String id, String type) throws CrudException {
291 String url = baseObjectUrl + "/" + id;
292 OperationResult getResult = client.delete(url, createHeader(), MediaType.APPLICATION_JSON_TYPE);
294 if (getResult.getResultCode() != Response.Status.OK.getStatusCode()) {
295 // We didn't delete a vertex with the supplied id, so just throw an
297 throw new CrudException("Failed to delete vertex: " + getResult.getFailureCause(), Response.Status.fromStatusCode(getResult.getResultCode()));
302 public OperationResult addEdge(String type, Vertex source, Vertex target, Map<String, Object> properties, String version) throws CrudException {
303 String url = baseRelationshipUrl;
305 // Try requests to ensure source and target exist in Champ
306 OperationResult dbSourceOpResult = getVertex(source.getId().get(), source.getType(), version, new HashMap<String, String>());
307 Vertex dbSource = Vertex.fromJson(dbSourceOpResult.getResult(), version);
308 OperationResult dbTargetOpResult = getVertex(target.getId().get(), target.getType(), version, new HashMap<String, String>());
309 Vertex dbTarget = Vertex.fromJson(dbTargetOpResult.getResult(), version);
311 Edge.Builder insertEdgeBuilder = new Edge.Builder(type).source(dbSource).target(dbTarget);
312 properties.forEach(insertEdgeBuilder::property);
313 Edge insertEdge = insertEdgeBuilder.build();
315 String edgeJson = insertEdge.toJson(champGson);
316 OperationResult getResult = client.post(url, edgeJson, createHeader(), MediaType.APPLICATION_JSON_TYPE,
317 MediaType.APPLICATION_JSON_TYPE);
319 if (getResult.getResultCode() == Response.Status.CREATED.getStatusCode()) {
322 // We didn't create an edge with the supplied type, so just throw an
324 throw new CrudException("Failed to create edge: " + getResult.getFailureCause(), Response.Status.fromStatusCode(getResult.getResultCode()));
329 public OperationResult updateEdge(Edge edge) throws CrudException {
330 if (!edge.getId().isPresent()) {
331 throw new CrudException("Unable to identify edge: " + edge.toString(), Response.Status.BAD_REQUEST);
333 String url = baseRelationshipUrl + "/" + edge.getId().get();
335 String edgeJson = edge.toJson(champGson);
336 OperationResult getResult = client.put(url, edgeJson, createHeader(), MediaType.APPLICATION_JSON_TYPE,
337 MediaType.APPLICATION_JSON_TYPE);
339 if (getResult.getResultCode() == Response.Status.OK.getStatusCode()) {
342 // We didn't create an edge with the supplied type, so just throw an
344 throw new CrudException("Failed to update edge: " + getResult.getFailureCause(), Response.Status.fromStatusCode(getResult.getResultCode()));
349 public void deleteEdge(String id, String type) throws CrudException {
350 String url = baseRelationshipUrl + "/" + id;
351 OperationResult getResult = client.delete(url, createHeader(), MediaType.APPLICATION_JSON_TYPE);
353 if (getResult.getResultCode() != 200) {
354 // We didn't find an edge with the supplied type, so just throw an
356 throw createErrorException(getResult, javax.ws.rs.core.Response.Status.NOT_FOUND, "No edge with id " + id + " found in graph");
361 public String openTransaction() {
362 String url = baseTransactionUrl;
364 OperationResult getResult = client.post(url, "", createHeader(), MediaType.TEXT_PLAIN_TYPE, MediaType.TEXT_PLAIN_TYPE);
366 if (getResult.getResultCode() == 200) {
367 return getResult.getResult();
374 public void commitTransaction(String id) throws CrudException {
375 String url = baseTransactionUrl + "/" + id;
377 OperationResult getResult = client.put(url, "{\"method\": \"commit\"}", createHeader(), MediaType.APPLICATION_JSON_TYPE,
378 MediaType.TEXT_PLAIN_TYPE);
380 if (getResult.getResultCode() != 200) {
381 throw new CrudException("Unable to commit transaction",
382 Response.Status.fromStatusCode(getResult.getResultCode()));
387 public void rollbackTransaction(String id) throws CrudException {
388 String url = baseTransactionUrl + "/" + id;
390 OperationResult getResult = client.put(url, "{\"method\": \"rollback\"}", createHeader(), MediaType.APPLICATION_JSON_TYPE,
391 MediaType.TEXT_PLAIN_TYPE);
393 if (getResult.getResultCode() != 200) {
394 throw new CrudException("Unable to rollback transaction",
395 Response.Status.fromStatusCode(getResult.getResultCode()));
400 public boolean transactionExists(String id) throws CrudException {
401 String url = baseTransactionUrl + "/" + id;
402 Map<String, List<String>> headers = new HashMap<>();
403 headers.put(HEADER_FROM_APP, Arrays.asList("Gizmo"));
404 headers.put(HEADER_TRANS_ID, Arrays.asList(MDC.get(LoggingContext.LoggingField.REQUEST_ID.toString())));
406 OperationResult getResult = client.get(url, headers, MediaType.APPLICATION_JSON_TYPE);
408 return getResult.getResultCode() == 200;
412 public Vertex addVertex(String type, Map<String, Object> properties, String version, String txId) throws CrudException {
413 String url = baseObjectUrl + "?transactionId=" + txId;
415 // Add the aai_node_type so that AAI can read the data created by gizmo
416 // TODO: This probably shouldn't be here
417 properties.put(org.onap.schema.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
419 Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
420 properties.forEach(insertVertexBuilder::property);
421 Vertex insertVertex = insertVertexBuilder.build();
423 OperationResult getResult = client.post(url, insertVertex.toJson(), createHeader(), MediaType.APPLICATION_JSON_TYPE,
424 MediaType.APPLICATION_JSON_TYPE);
426 if (getResult.getResultCode() == Response.Status.CREATED.getStatusCode()) {
427 return Vertex.fromJson(getResult.getResult(), version);
429 // We didn't create a vertex with the supplied type, so just throw an
431 throw new CrudException("Failed to create vertex: " + getResult.getFailureCause(), Response.Status.fromStatusCode(getResult.getResultCode()));
436 public Edge addEdge(String type, Vertex source, Vertex target, Map<String, Object> properties, String version, String txId)
437 throws CrudException {
438 String url = baseRelationshipUrl + "?transactionId=" + txId;
440 // Try requests to ensure source and target exist in Champ
441 Vertex dbSource = getVertex(source.getId().get(), source.getType(), version, txId);
442 Vertex dbTarget = getVertex(target.getId().get(), target.getType(), version, txId);
444 Edge.Builder insertEdgeBuilder = new Edge.Builder(type).source(dbSource).target(dbTarget);
445 properties.forEach(insertEdgeBuilder::property);
446 Edge insertEdge = insertEdgeBuilder.build();
448 OperationResult getResult = client.post(url, insertEdge.toJson(champGson), createHeader(),
449 MediaType.APPLICATION_JSON_TYPE, MediaType.APPLICATION_JSON_TYPE);
451 if (getResult.getResultCode() == Response.Status.CREATED.getStatusCode()) {
452 return Edge.fromJson(getResult.getResult());
454 // We didn't create an edge with the supplied type, so just throw an
456 throw new CrudException("Failed to create edge: " + getResult.getFailureCause(), Response.Status.fromStatusCode(getResult.getResultCode()));
461 public Vertex updateVertex(String id, String type, Map<String, Object> properties, String version, String txId) throws CrudException {
462 String url = baseObjectUrl + "/" + id + "?transactionId=" + txId;
464 // Add the aai_node_type so that AAI can read the data created by gizmo
465 // TODO: This probably shouldn't be here
466 properties.put(org.onap.schema.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
468 Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
469 insertVertexBuilder.id(id);
470 properties.forEach(insertVertexBuilder::property);
471 Vertex insertVertex = insertVertexBuilder.build();
473 String payload = insertVertex.toJson(champGson);
474 OperationResult getResult = client.put(url, payload, createHeader(), MediaType.APPLICATION_JSON_TYPE,
475 MediaType.APPLICATION_JSON_TYPE);
477 if (getResult.getResultCode() == Response.Status.OK.getStatusCode()) {
478 return Vertex.fromJson(getResult.getResult(), version);
480 // We didn't create a vertex with the supplied type, so just throw an
482 throw new CrudException("Failed to update vertex: " + getResult.getFailureCause(), Response.Status.fromStatusCode(getResult.getResultCode()));
487 public void deleteVertex(String id, String type, String txId) throws CrudException {
488 String url = baseObjectUrl + "/" + id + "?transactionId=" + txId;
489 OperationResult getResult = client.delete(url, createHeader(), MediaType.APPLICATION_JSON_TYPE);
491 if (getResult.getResultCode() != Response.Status.OK.getStatusCode()) {
492 // We didn't delete a vertex with the supplied id, so just throw an
494 throw new CrudException("Failed to delete vertex: " + getResult.getFailureCause(), Response.Status.fromStatusCode(getResult.getResultCode()));
499 public Edge updateEdge(Edge edge, String txId) throws CrudException {
500 if (!edge.getId().isPresent()) {
501 throw new CrudException("Unable to identify edge: " + edge.toString(), Response.Status.BAD_REQUEST);
503 String url = baseRelationshipUrl + "/" + edge.getId().get() + "?transactionId=" + txId;
504 OperationResult getResult = client.put(url, edge.toJson(champGson), createHeader(), MediaType.APPLICATION_JSON_TYPE,
505 MediaType.APPLICATION_JSON_TYPE);
507 if (getResult.getResultCode() == Response.Status.OK.getStatusCode()) {
508 return Edge.fromJson(getResult.getResult());
510 // We didn't create an edge with the supplied type, so just throw an
512 throw new CrudException("Failed to update edge: " + getResult.getFailureCause(),
513 Response.Status.fromStatusCode(getResult.getResultCode()));
518 public void deleteEdge(String id, String type, String txId) throws CrudException {
519 String url = baseRelationshipUrl + "/" + id + "?transactionId=" + txId;
520 OperationResult getResult = client.delete(url, createHeader(), MediaType.APPLICATION_JSON_TYPE);
522 if (getResult.getResultCode() != 200) {
523 // We didn't find an edge with the supplied type, so just throw an
525 throw createErrorException(getResult, javax.ws.rs.core.Response.Status.NOT_FOUND, "No edge with id " + id + " found in graph");
530 public Edge getEdge(String id, String type, String txId) throws CrudException {
531 String url = baseRelationshipUrl + "/" + id + "?transactionId=" + txId;
532 OperationResult getResult = client.get(url, createHeader(), MediaType.APPLICATION_JSON_TYPE);
534 if (getResult.getResultCode() == 200) {
535 Edge edge = Edge.fromJson(getResult.getResult());
537 if (!edge.getType().equalsIgnoreCase(type)) {
538 // We didn't find an edge with the supplied type, so just throw an
540 throw new CrudException("No edge with id " + id + "and type " + type + " found in graph",
541 javax.ws.rs.core.Response.Status.NOT_FOUND);
545 // We didn't find an edge with the supplied id, so just throw an
547 throw createErrorException(getResult, javax.ws.rs.core.Response.Status.NOT_FOUND, "No edge with id " + id + " found in graph");
551 public Vertex getVertex(String id, String type, String version, String txId) throws CrudException {
552 String url = baseObjectUrl + "/" + id + "?transactionId=" + txId;
553 OperationResult getResult = client.get(url, createHeader(), MediaType.APPLICATION_JSON_TYPE);
555 if (getResult.getResultCode() == 200) {
556 Vertex vert = Vertex.fromJson(getResult.getResult(), version);
558 if (!vert.getType().equalsIgnoreCase(type)) {
559 // We didn't find a vertex with the supplied type, so just throw an
561 throw new CrudException("No vertex with id " + id + "and type " + type + " found in graph",
562 javax.ws.rs.core.Response.Status.NOT_FOUND);
566 // We didn't find a vertex with the supplied id, so just throw an
568 throw createErrorException(getResult, javax.ws.rs.core.Response.Status.NOT_FOUND, "No vertex with id " + id + " found in graph");
572 // https://stackoverflow.com/questions/26942330/convert-mapstring-string-to-listnamevaluepair-is-this-the-most-efficient
573 private List<NameValuePair> convertToNameValuePair(Map<String, ? super String> pairs) {
574 List<NameValuePair> nvpList = new ArrayList<>(pairs.size());
576 pairs.forEach((key, value) -> nvpList.add(new BasicNameValuePair(key, value.toString())));
581 // https://stackoverflow.com/questions/26942330/convert-mapstring-string-to-listnamevaluepair-is-this-the-most-efficient
582 private List<NameValuePair> convertToNameValuePair(String k, HashSet<String> values) {
583 List<NameValuePair> nvpList = new ArrayList<>(values.size());
585 values.forEach((v) -> nvpList.add(new BasicNameValuePair(k, v)));
590 private Map<String, List<String>> createHeader() {
591 Map<String, List<String>> headers = new HashMap<>();
592 headers.put(HEADER_FROM_APP, Arrays.asList(FROM_APP_NAME));
593 headers.put(HEADER_TRANS_ID, Arrays.asList(MDC.get(MdcContext.MDC_REQUEST_ID)));
597 private CrudException createErrorException(OperationResult result, javax.ws.rs.core.Response.Status defaultErrorCode , String defaultErrorMsg)
599 CrudException ce = null;
601 ce = new CrudException(result.getFailureCause(), Response.Status.fromStatusCode(result.getResultCode()));
603 ce = new CrudException(defaultErrorMsg, defaultErrorCode);