View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.common.rest.api.beans;
20  
21  import java.util.ArrayList;
22  import java.util.Collection;
23  import java.util.List;
24  import javax.ws.rs.DefaultValue;
25  import javax.ws.rs.QueryParam;
26  
27  public class CSVPushSpec extends AbstractCSVSpec {
28  
29      private static final long serialVersionUID = -8198709720749169648L;
30  
31      public static class Builder extends AbstractCSVSpec.Builder<CSVPushSpec, Builder> {
32  
33          @Override
34          protected CSVPushSpec newInstance() {
35              return new CSVPushSpec();
36          }
37  
38          public Builder(final String anyTypeKey) {
39              getInstance().setAnyTypeKey(anyTypeKey);
40          }
41  
42          public Builder field(final String field) {
43              getInstance().getFields().add(field);
44              return this;
45          }
46  
47          public Builder fields(final Collection<String> fields) {
48              getInstance().getFields().addAll(fields);
49              return this;
50          }
51  
52          public Builder plainAttr(final String plainAttr) {
53              getInstance().getPlainAttrs().add(plainAttr);
54              return this;
55          }
56  
57          public Builder plainAttrs(final Collection<String> plainAttrs) {
58              getInstance().getPlainAttrs().addAll(plainAttrs);
59              return this;
60          }
61  
62          public Builder derAttr(final String derAttr) {
63              getInstance().getDerAttrs().add(derAttr);
64              return this;
65          }
66  
67          public Builder derAttrs(final Collection<String> derAttrs) {
68              getInstance().getDerAttrs().addAll(derAttrs);
69              return this;
70          }
71  
72          public Builder virAttr(final String virAttr) {
73              getInstance().getVirAttrs().add(virAttr);
74              return this;
75          }
76  
77          public Builder virAttrs(final Collection<String> virAttrs) {
78              getInstance().getVirAttrs().addAll(virAttrs);
79              return this;
80          }
81  
82          public Builder ignorePaging(final boolean ignorePaging) {
83              getInstance().setIgnorePaging(ignorePaging);
84              return this;
85          }
86  
87          public Builder propagationAction(final String propagationAction) {
88              getInstance().getPropagationActions().add(propagationAction);
89              return this;
90          }
91      }
92  
93      private List<String> fields = new ArrayList<>();
94  
95      private List<String> plainAttrs = new ArrayList<>();
96  
97      private List<String> derAttrs = new ArrayList<>();
98  
99      private List<String> virAttrs = new ArrayList<>();
100 
101     private Boolean ignorePaging;
102 
103     protected List<String> propagationActions = new ArrayList<>();
104 
105     public List<String> getFields() {
106         return fields;
107     }
108 
109     @QueryParam("fields")
110     public void setFields(final List<String> fields) {
111         this.fields = fields;
112     }
113 
114     public List<String> getPlainAttrs() {
115         return plainAttrs;
116     }
117 
118     @QueryParam("plainAttrs")
119     public void setPlainAttrs(final List<String> plainAttrs) {
120         this.plainAttrs = plainAttrs;
121     }
122 
123     public List<String> getDerAttrs() {
124         return derAttrs;
125     }
126 
127     @QueryParam("derAttrs")
128     public void setDerAttrs(final List<String> derAttrs) {
129         this.derAttrs = derAttrs;
130     }
131 
132     public List<String> getVirAttrs() {
133         return virAttrs;
134     }
135 
136     @QueryParam("virAttrs")
137     public void setVirAttrs(final List<String> virAttrs) {
138         this.virAttrs = virAttrs;
139     }
140 
141     public Boolean getIgnorePaging() {
142         return ignorePaging == null ? Boolean.FALSE : ignorePaging;
143     }
144 
145     @QueryParam("ignorePaging")
146     @DefaultValue("false")
147     public void setIgnorePaging(final Boolean ignorePaging) {
148         this.ignorePaging = ignorePaging;
149     }
150 
151     public List<String> getPropagationActions() {
152         return propagationActions;
153     }
154 
155     @QueryParam("propagationActions")
156     public void setPropagationActions(final List<String> propagationActions) {
157         this.propagationActions = propagationActions;
158     }
159 }