View Javadoc
1   package fr.paris.lutece.plugins.appcenter.modules.openam.service.client.rest;
2   
3   import java.io.IOException;
4   
5   import com.fasterxml.jackson.core.JsonGenerator;
6   import com.fasterxml.jackson.core.JsonProcessingException;
7   import com.fasterxml.jackson.databind.SerializerProvider;
8   import com.fasterxml.jackson.databind.ser.std.StdSerializer;
9   
10  public class CreateAgentSerializer extends StdSerializer<OpenamAgentDTO>{
11  
12  	public CreateAgentSerializer() {
13          this(null);
14      }
15     
16      public CreateAgentSerializer(Class<OpenamAgentDTO> t) {
17          super(t);
18      }
19   
20      @Override
21      public void serialize( OpenamAgentDTO value, JsonGenerator jgen, SerializerProvider provider) 
22      	    	      throws IOException, JsonProcessingException{
23      	
24      	 jgen.writeStartObject();
25           jgen.writeStringField(OpenamAgentDTO.USERNAEM, value.getName());
26           
27           jgen.writeFieldName(OpenamAgentDTO.CONFIG_FQDN_DEFAULT);
28           jgen.writeStartArray();
29           jgen.writeString(value.getName( ));
30           jgen.writeEndArray();
31           
32           jgen.writeFieldName(OpenamAgentDTO.CONFIG_REPOSITORY_LOCATION);
33           jgen.writeStartArray();
34           jgen.writeString("centralized");
35           jgen.writeEndArray();
36           
37           jgen.writeFieldName(OpenamAgentDTO.AGENTTYPE);
38           jgen.writeStartArray();
39           jgen.writeString("J2EEAgent");
40           jgen.writeEndArray();
41           
42           jgen.writeFieldName(OpenamAgentDTO.SERVERURL);
43           jgen.writeStartArray();
44           jgen.writeString(value.getServerUrl());
45           jgen.writeEndArray();
46           
47           jgen.writeFieldName(OpenamAgentDTO.AGENTURL);
48           jgen.writeStartArray();
49           jgen.writeString(value.getAgentUrl( ));
50           jgen.writeEndArray();
51           
52           jgen.writeFieldName(OpenamAgentDTO.USERPASSWORD);
53           jgen.writeStartArray();
54           jgen.writeString(value.getPassword( ));
55           jgen.writeEndArray();
56           
57           jgen.writeFieldName(OpenamAgentDTO.CONFIG_LOGIN_URL);
58           jgen.writeStartArray();
59           jgen.writeString("[0]="+value.getLoginUrl());
60           jgen.writeEndArray();
61           
62           jgen.writeFieldName(OpenamAgentDTO.CONFIG_LOGOUT_URL);
63           jgen.writeStartArray();
64           jgen.writeString("[0]="+value.getLogoutUrl());
65           jgen.writeEndArray();
66           
67           jgen.writeFieldName(OpenamAgentDTO.SUNIDENTITYSERVERDEVICESSTATUS);
68           jgen.writeStartArray();
69           jgen.writeString("Active");
70           jgen.writeEndArray();
71  
72           jgen.writeEndObject();
73      } 
74      	
75      	
76      
77  }