/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the “License”);
+ * you may not use this software except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ================================================================================
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.openecomp.portalapp.portal.controller;
public class SharedContextRestController extends EPRestrictedRESTfulBaseController {
/**
- * Model for a one-element JSON object returned by many methods.
+ * Model for a one-element JSON object returned by many methods.
*/
class SharedContextJsonResponse {
String response;
}
-
+
/**
* Access to the database
*/
/**
* Gets a value for the specified context and key (RESTful service method).
*
- * @param ctxtId
+ * @param request
+ * HTTP servlet request
+ * @param context_id
* ID that identifies the context, usually the ECOMP Portal
* session key.
* @param ckey
* Key for the key-value pair to fetch
* @return JSON with shared context object; response=null if not found.
+ * @throws Exception
+ * on bad arguments
*/
@ApiOperation(value = "Gets a value for the specified context and key.", response = SharedContext.class)
@RequestMapping(value = { "/get" }, method = RequestMethod.GET, produces = "application/json")
/**
* Gets user information for the specified context (RESTful service method).
*
- * @param ctxtId
+ * @param request
+ * HTTP servlet request
+ * @param context_id
* ID that identifies the context, usually the ECOMP Portal
* session key.
- *
* @return List of shared-context objects as JSON; should have user's first
* name, last name and email address; null if none found
+ * @throws Exception
+ * on bad arguments
*/
@ApiOperation(value = "Gets user information for the specified context.", response = SharedContext.class, responseContainer = "List")
@RequestMapping(value = { "/get_user" }, method = RequestMethod.GET, produces = "application/json")
SharedContext lastNameContext = contextService.getSharedContext(context_id,
EPCommonSystemProperties.USER_LAST_NAME);
SharedContext emailContext = contextService.getSharedContext(context_id, EPCommonSystemProperties.USER_EMAIL);
- SharedContext attuidContext = contextService.getSharedContext(context_id,
+ SharedContext orgUserIdContext = contextService.getSharedContext(context_id,
EPCommonSystemProperties.USER_ORG_USERID);
if (firstNameContext != null)
listSharedContext.add(firstNameContext);
listSharedContext.add(lastNameContext);
if (emailContext != null)
listSharedContext.add(emailContext);
- if (attuidContext != null)
- listSharedContext.add(attuidContext);
+ if (orgUserIdContext != null)
+ listSharedContext.add(orgUserIdContext);
String jsonResponse = convertResponseToJSON(listSharedContext);
return jsonResponse;
}
* Tests for presence of the specified key in the specified context (RESTful
* service method).
*
+ * @param request
+ * HTTP servlet request
* @param context_id
* ID that identifies the context, usually the ECOMP Portal
* session key.
* Key for the key-value pair to test
* @return JSON with result indicating whether the context and key were
* found.
+ * @throws Exception
+ * on bad arguments
*/
@ApiOperation(value = "Tests for presence of the specified key in the specified context.", response = SharedContextJsonResponse.class)
@RequestMapping(value = { "/check" }, method = RequestMethod.GET, produces = "application/json")
* Removes the specified key in the specified context (RESTful service
* method).
*
+ * @param request
+ * HTTP servlet request
* @param context_id
* ID that identifies the context, usually the ECOMP Portal
* session key.
* Key for the key-value pair to remove
* @return JSON with result indicating whether the context and key were
* found.
+ * @throws Exception
+ * on bad arguments
*/
@ApiOperation(value = "Removes the specified key in the specified context.", response = SharedContextJsonResponse.class)
@RequestMapping(value = { "/remove" }, method = RequestMethod.GET, produces = "application/json")
* Clears all key-value pairs in the specified context (RESTful service
* method).
*
+ * @param request
+ * HTTP servlet request
* @param context_id
* ID that identifies the context, usually the ECOMP Portal
* session key.
* @return JSON with result indicating the number of key-value pairs
* removed.
+ * @throws Exception
+ * on bad arguments
*/
@ApiOperation(value = "Clears all key-value pairs in the specified context.", response = SharedContextJsonResponse.class)
@RequestMapping(value = { "/clear" }, method = RequestMethod.GET, produces = "application/json")
* method). Creates the context if no context with the specified ID-key pair
* exists, overwrites the value if it exists already.
*
+ * @param request
+ * HTTP servlet request
* @param userJson
* JSON block with these tag-value pairs:
* <UL>
* </UL>
* @return JSON with result indicating whether the value was added (key not
* previously known) or replaced (key previously known).
+ * @throws Exception
+ * on bad arguments
*/
@ApiOperation(value = "Sets a context value for the specified context and key. Creates the context if no context with the specified ID-key pair exists, overwrites the value if it exists already.", response = SharedContextJsonResponse.class)
@RequestMapping(value = { "/set" }, method = RequestMethod.POST, produces = "application/json")
/**
* Creates a JSON object with the content of the shared context; null is ok.
*
- * @param responseBody
+ * @param context
* @return tag "response" with collection of context object's fields
* @throws JsonProcessingException
*/