Class ContactRestController
- java.lang.Object
-
- org.neotropic.kuwaiba.northbound.rest.bem.ContactRestController
-
- All Implemented Interfaces:
ContactRestOpenApi
@RestController @RequestMapping("/v2.1.1/contact-manager/") public class ContactRestController extends Object implements ContactRestOpenApiThe definition of the Contact Rest Controller.- Author:
- Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description ContactRestController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateContact(String contactClassName, String customerClassName, String customerId, String userName, String sessionId)Creates a contact.voiddeleteContact(String contactClassName, String contactId, String userName, String sessionId)Deletes a contact.ContactgetContact(String contactClassName, String contactId, String sessionId)Gets the entire information of a given contact.List<BusinessObjectLight>getContactResources(String contactClassName, String contactId, String sessionId)Retrieves the list of resources (inventory objects) related to a contact.List<Contact>getContacts(int page, int limit, HashMap<String,Object> filters, String sessionId)Retrieves the list of contacts that matches the search criteria.List<Contact>getContactsForCustomer(String customerClassName, String customerId, String sessionId)Retrieves the list of contacts associated to a customer.voidrelateObjectToContact(String objectClassName, String objectId, String contactClassName, String contactId, String userName, String sessionId)Relates an inventory object to a contact.voidreleaseObjectFromContact(String objectClassName, String objectId, String contactClassName, String contactId, String userName, String sessionId)Releases an inventory object from a contact.List<Contact>searchForContacts(String searchString, int maxResults, String sessionId)Searches in all the properties of a contact for a given string.voidupdateContact(String contactClassName, String contactId, List<StringPair> properties, String userName, String sessionId)Updates a contact's information.
-
-
-
Field Detail
-
PATH
public static final String PATH
Path that includes the Kuwaiba version and core- See Also:
- Constant Field Values
-
-
Method Detail
-
createContact
@RequestMapping(method=POST, value="createContact/{contactClassName}/{customerClassName}/{customerId}/{userName}/{sessionId}", produces="application/json") public String createContact(@PathVariable("contactClassName") String contactClassName, @PathVariable("customerClassName") String customerClassName, @PathVariable("customerId") String customerId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)Creates a contact. Contacts are always associated to a customer.- Specified by:
createContactin interfaceContactRestOpenApi- Parameters:
contactClassName- Class of the contact. This class should always be a subclass of GenericContact.customerClassName- The class of the customer this contact will be associated to.customerId- The id of the customer this contact will be associated to.userName- The user name of the session.sessionId- The session token id.- Returns:
- The id of the newly created contact.
-
updateContact
@RequestMapping(method=PUT, value="updateContact/{contactClassName}/{contactId}/{userName}/{sessionId}", produces="application/json") public void updateContact(@PathVariable("contactClassName") String contactClassName, @PathVariable("contactId") String contactId, @RequestBody List<StringPair> properties, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)Updates a contact's information.- Specified by:
updateContactin interfaceContactRestOpenApi- Parameters:
contactClassName- The class of the contact.contactId- The id of the contact.properties- The attributes to be updated. The list types require only the id of the linked list type as a string.userName- The user name of the session.sessionId- The session token id.
-
deleteContact
@RequestMapping(method=DELETE, value="deleteContact/{contactClassName}/{contactId}/{userName}/{sessionId}", produces="application/json") public void deleteContact(@PathVariable("contactClassName") String contactClassName, @PathVariable("contactId") String contactId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)Deletes a contact.- Specified by:
deleteContactin interfaceContactRestOpenApi- Parameters:
contactClassName- The class of the contact.contactId- The id of the contact.userName- The user name of the session.sessionId- The session token id.
-
getContact
@RequestMapping(method=GET, value="getContact/{contactClassName}/{contactId}/{sessionId}", produces="application/json") public Contact getContact(@PathVariable("contactClassName") String contactClassName, @PathVariable("contactId") String contactId, @PathVariable("sessionId") String sessionId)Gets the entire information of a given contact.- Specified by:
getContactin interfaceContactRestOpenApi- Parameters:
contactClassName- The class of the contact.contactId- The id of the contactsessionId- The session token id.- Returns:
- The contact.
-
getContactsForCustomer
@RequestMapping(method=GET, value="getContactsForCustomer/{customerClassName}/{customerId}/{sessionId}", produces="application/json") public List<Contact> getContactsForCustomer(@PathVariable("customerClassName") String customerClassName, @PathVariable("customerId") String customerId, @PathVariable("sessionId") String sessionId)Retrieves the list of contacts associated to a customer.- Specified by:
getContactsForCustomerin interfaceContactRestOpenApi- Parameters:
customerClassName- The class of the customer the contacts belong to.customerId- The id of the customer the contacts belong to.sessionId- The session token id.- Returns:
- The list of contacts.
-
searchForContacts
@RequestMapping(method=GET, value="searchForContacts/{searchString}/{maxResults}/{sessionId}", produces="application/json") public List<Contact> searchForContacts(@PathVariable("searchString") String searchString, @PathVariable("maxResults") int maxResults, @PathVariable("sessionId") String sessionId)Searches in all the properties of a contact for a given string.- Specified by:
searchForContactsin interfaceContactRestOpenApi- Parameters:
searchString- The string to be matched.maxResults- The max number of results. Use -1 to retrieve al results.sessionId- The session token id.- Returns:
- The list of contacts that matches the search criteria.
-
getContacts
@RequestMapping(method=POST, value="getContacts/{page}/{limit}/{sessionId}", produces="application/json") public List<Contact> getContacts(@PathVariable("page") int page, @PathVariable("limit") int limit, @RequestBody(required=false) HashMap<String,Object> filters, @PathVariable("sessionId") String sessionId)Retrieves the list of contacts that matches the search criteria.- Specified by:
getContactsin interfaceContactRestOpenApi- Parameters:
page- Current page.limit- Limit of results per page. -1 to retrieve them all.filters- The response may be filtered by customer (use keycustomer, value the customer name, a String) by type (use keytype, value the type name, a String) by contact name (use keycontact_name, value the contact name, a String) by contact email1 (use keycontact_email1, value the contact email1, a String) by contact email2 (use keycontact_email2, value the contact email2, a String)sessionId- The session token id.- Returns:
- The list of contacts that matches the search criteria.
-
relateObjectToContact
@RequestMapping(method=PUT, value="relateObjectToContact/{objectClassName}/{objectId}/{contactClassName}/{contactId}/{userName}/{sessionId}", produces="application/json") public void relateObjectToContact(@PathVariable("objectClassName") String objectClassName, @PathVariable("objectId") String objectId, @PathVariable("contactClassName") String contactClassName, @PathVariable("contactId") String contactId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)Relates an inventory object to a contact.- Specified by:
relateObjectToContactin interfaceContactRestOpenApi- Parameters:
objectClassName- The class of the object.objectId- The id of the object.contactClassName- The class of the contact.contactId- The id of the contact.userName- The user name of the session.sessionId- The session token id.
-
releaseObjectFromContact
@RequestMapping(method=PUT, value="releaseObjectFromContact/{objectClassName}/{objectId}/{contactClassName}/{contactId}/{userName}/{sessionId}", produces="application/json") public void releaseObjectFromContact(@PathVariable("objectClassName") String objectClassName, @PathVariable("objectId") String objectId, @PathVariable("contactClassName") String contactClassName, @PathVariable("contactId") String contactId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)Releases an inventory object from a contact.- Specified by:
releaseObjectFromContactin interfaceContactRestOpenApi- Parameters:
objectClassName- The class of the object.objectId- The id of the object.contactClassName- The class of the contact.contactId- The id of the contact.userName- The user name of the session.sessionId- The session token id.
-
getContactResources
@RequestMapping(method=GET, value="getContactResources/{contactClassName}/{contactId}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getContactResources(@PathVariable("contactClassName") String contactClassName, @PathVariable("contactId") String contactId, @PathVariable("sessionId") String sessionId)Retrieves the list of resources (inventory objects) related to a contact.- Specified by:
getContactResourcesin interfaceContactRestOpenApi- Parameters:
contactClassName- The class of the contact.contactId- The id of the contact.sessionId- The session token id.- Returns:
- List of related resources.
-
-