@@ -71,18 +71,6 @@ public NsxProviderVO() {
7171 this .uuid = UUID .randomUUID ().toString ();
7272 }
7373
74- public NsxProviderVO ( long zoneId , long hostId , String providerName , String hostname , String username , String password , String tier0Gateway , String edgeCluster ) {
75- this .zoneId = zoneId ;
76- this .hostId = hostId ;
77- this .uuid = UUID .randomUUID ().toString ();
78- this .providerName = providerName ;
79- this .hostname = hostname ;
80- this .username = username ;
81- this .password = password ;
82- this .tier0Gateway = tier0Gateway ;
83- this .edgeCluster = edgeCluster ;
84- }
85-
8674 @ Override
8775 public long getId () {
8876 return id ;
@@ -177,4 +165,78 @@ public String getEdgeCluster() {
177165 public void setEdgeCluster (String edgeCluster ) {
178166 this .edgeCluster = edgeCluster ;
179167 }
168+
169+ public static final class Builder {
170+ private long zoneId ;
171+ private long hostId ;
172+ private String providerName ;
173+ private String hostname ;
174+ private String port ;
175+ private String username ;
176+ private String password ;
177+ private String tier0Gateway ;
178+ private String edgeCluster ;
179+
180+ public Builder () {
181+ }
182+
183+ public Builder setZoneId (long zoneId ) {
184+ this .zoneId = zoneId ;
185+ return this ;
186+ }
187+
188+ public Builder setHostId (long hostId ) {
189+ this .hostId = hostId ;
190+ return this ;
191+ }
192+
193+ public Builder setProviderName (String providerName ) {
194+ this .providerName = providerName ;
195+ return this ;
196+ }
197+
198+ public Builder setHostname (String hostname ) {
199+ this .hostname = hostname ;
200+ return this ;
201+ }
202+
203+ public Builder setPort (String port ) {
204+ this .port = port ;
205+ return this ;
206+ }
207+
208+ public Builder setUsername (String username ) {
209+ this .username = username ;
210+ return this ;
211+ }
212+
213+ public Builder setPassword (String password ) {
214+ this .password = password ;
215+ return this ;
216+ }
217+
218+ public Builder setTier0Gateway (String tier0Gateway ) {
219+ this .tier0Gateway = tier0Gateway ;
220+ return this ;
221+ }
222+
223+ public Builder setEdgeCluster (String edgeCluster ) {
224+ this .edgeCluster = edgeCluster ;
225+ return this ;
226+ }
227+ public NsxProviderVO build () {
228+ NsxProviderVO provider = new NsxProviderVO ();
229+ provider .setZoneId (this .zoneId );
230+ provider .setHostId (this .hostId );
231+ provider .setUuid (UUID .randomUUID ().toString ());
232+ provider .setProviderName (this .providerName );
233+ provider .setHostname (this .hostname );
234+ provider .setPort (this .port );
235+ provider .setUsername (this .username );
236+ provider .setPassword (this .password );
237+ provider .setTier0Gateway (this .tier0Gateway );
238+ provider .setEdgeCluster (this .edgeCluster );
239+ return provider ;
240+ }
241+ }
180242}
0 commit comments