Skip to content

Instantly share code, notes, and snippets.

View amusarra's full-sized avatar

Antonio Musarra amusarra

View GitHub Profile
@amusarra
amusarra / SOAPRequest.xml
Created April 4, 2014 12:08
SugarCRM Get Entry Bye Email
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<sug:get_entry_list soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<session xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">q8a05imogajdfpvvo97idped64</session>
<module_name xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">Leads</module_name>
<query xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">leads.id in (
SELECT eabr.bean_id
FROM email_addr_bean_rel eabr JOIN email_addresses ea
ON (ea.id = eabr.email_address_id)
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<sug:set_entry soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<session xsi:type="xsd:string">bd9m099g9rn8j7p2mqnh29lj22</session>
<module_name xsi:type="xsd:string">Cases</module_name>
<name_value_list xsi:type="sug:name_value_list" soapenc:arrayType="sug:name_value[6]">
<item xsi:type="ns1:name_value">
<name xsi:type="xsd:string">priority</name>
<value xsi:type="xsd:string">P1</value>
@amusarra
amusarra / get-users-company-by-tag-name.json
Created March 28, 2014 10:01
Listato 6 Esempio di risposta del servizio JSON.
[{
"agreedToTermsOfUse": false,
"comments": "",
"companyId": 10157,
"contactId": 12102,
"createDate": 1392734987656,
"defaultUser": false,
"digest": "",
"emailAddress": "[email protected]",
"emailAddressVerified": false,
@amusarra
amusarra / get-users-company-by-tag-name
Created March 28, 2014 10:00
Listato 5 Test del servizio JSON tramite curl.
curl http://localhost:8080/api/jsonws/ShirusLabsExampleServices-portlet.customusers/get-users-company-by-tag-name \
-u [email protected]:test \
-d companyId=10157 \
-d tagName='crm' \
-d userStatus=0 \
-d start=0 \
-d end=3
@amusarra
amusarra / TestGetUsersCompanyByTagNameService.java
Created March 28, 2014 09:59
Listato 4 Esempio di accesso al servizio SOAP tramite il client generato dall’SDK.
public class TestGetUsersCompanyByTagNameService {
static final String LIFERAY_USER_NAME = (System.getProperty("username") != null) ? System
.getProperty("username") : "[email protected]";
static final String LIFERAY_USER_PASSWORD = (System.getProperty("password") != null) ? System
.getProperty("username") : "test";
static final String USER_SERVICE = "Portal_UserService";
/**
@amusarra
amusarra / CustomUsersServiceImpl-partial.java
Created March 28, 2014 09:59
Listato 3 Implementazione del metodo getUsersCompanyByTagName per l’interfaccia remota.
public UserSoap[] getUsersCompanyByTagName(long companyId, String tagName,
Integer userStatus, int start, int end) throws PortalException,
SystemException {
return CustomUsersLocalServiceUtil.getUsersCompanyByTagName(companyId, tagName, userStatus, start, end);
}
@amusarra
amusarra / CustomUsersLocalServiceImpl-partial.java
Created March 28, 2014 09:57
Listato 2 Implementazione del metodo getUsersCompanyByTagName per l’interfaccia locale.
public com.liferay.portal.model.UserSoap[] getUsersCompanyByTagName(long companyId, String tagName,
Integer userStatus, int start, int end) throws PortalException,
SystemException {
SearchContext searchContext = new SearchContext();
searchContext.setCompanyId(companyId);
searchContext.setEntryClassNames(new String[] { User.class.getName() });
@amusarra
amusarra / service.xml
Created March 28, 2014 09:55
Listato 1 Configurazione del Service Builder sul file service.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd">
<service-builder package-path="it.dontesta.shirus.labs.liferay.ws.example">
<author>amusarra</author>
<namespace>shirus_labs_liferay_ws_example</namespace>
<entity name="CustomUsers" local-service="true" remote-service="true">
</entity>
<exceptions>
<exception>UsersNotFound</exception>
</exceptions>
@amusarra
amusarra / RESTfulTestBycURL.txt
Created March 19, 2014 23:25
Test RESTful Service by cURL
$ curl -v http://localhost:8080/services/horses.xml | xmllint --format -
$ curl -v http://localhost:8080/services/horses.json | jsonlint -
##
# XML Output
##
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<horses>
<count>3</count>
<horse>
@amusarra
amusarra / SizeOfTheLiferayDocumentLibrary.sql
Created March 18, 2014 09:55
Size of the Liferay Document Library
SELECT DLFILEENTRY.REPOSITORYID,
(SUM(DLFILEENTRY.SIZE_) / 1048576) SIZE_MBYTE
FROM DLFILEENTRY
GROUP BY DLFILEENTRY.REPOSITORYID
ORDER BY SIZE_MBYTE;