View Javadoc
1   package fr.paris.lutece.plugins.accrochageff.service;
2   
3   import fr.paris.lutece.portal.service.util.AppLogService;
4   import fr.paris.lutece.portal.service.util.AppPropertiesService;
5   import fr.paris.lutece.util.httpaccess.HttpAccess; 
6   import fr.paris.lutece.util.httpaccess.HttpAccessException;
7   
8   public class FFApi
9   {
10  
11      private static final String PROPERTY_URL_WS_FF="accrochageff.wsUrl";
12      public static   FederationLinkListResponse getFederationLinkList(String strToken)
13      {
14           
15          String strResponse =null;
16          String strUrlWs=AppPropertiesService.getProperty( PROPERTY_URL_WS_FF)+strToken +"/";
17          FederationLinkListResponse ffLinkListResponse=null;
18          try
19          {
20              HttpAccess httpAccess = new HttpAccess(  );
21              strResponse = httpAccess.doPost( strUrlWs, null );
22              if(strResponse!=null)
23              {
24                  ffLinkListResponse= JsonUtil.getObjectResponse( strResponse, FederationLinkListResponse.class );
25              }
26              
27              
28          }
29          catch ( HttpAccessException e )
30          {
31              String strError = "Error calling getting FFLinkList '" +strUrlWs;
32              AppLogService.error( strError + e.getMessage(  ), e );
33             
34          }
35  
36          return ffLinkListResponse;
37          
38          }
39      public static   FederationLinkDeleteResponse  deleteFederationLink(String strIdLink,String strToken)
40      {
41           
42          String strResponse =null;
43          String strUrlWs=AppPropertiesService.getProperty( PROPERTY_URL_WS_FF)+strIdLink
44                  +"/"+strToken+"/";
45          FederationLinkDeleteResponse ffDeleteResponse=null;
46          try
47          {
48              HttpAccess httpAccess = new HttpAccess(  );
49              strResponse = httpAccess.doDelete( strUrlWs, null, null, null,null);
50              if(strResponse!=null)
51              {
52                  ffDeleteResponse= JsonUtil.getObjectResponse( strResponse, FederationLinkDeleteResponse.class );
53              }
54              
55              
56          }
57          catch ( HttpAccessException e )
58          {
59              String strError = "Error calling getting FFLinkList '" +strUrlWs;
60              AppLogService.error( strError + e.getMessage(  ), e );
61             
62          }
63  
64          return ffDeleteResponse;
65          
66          }
67  
68      
69  }