View Javadoc

1   /*
2    * Copyright 2010 Metastratus Web Solutions Limited. All Rights Reserved.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *    http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.fatwire.gst.foundation.taglib;
17  
18  import java.io.IOException;
19  import javax.servlet.jsp.JspException;
20  
21  import com.fatwire.gst.foundation.properties.AssetApiPropertyDao;
22  import com.fatwire.gst.foundation.properties.PropertyDao;
23  
24  /**
25   * Set the property name, optionally including the site names to add to this particular property.
26   *
27   * @author Tony Field
28   * @since 2012-03-27
29   */
30  public final class SetPropertyTag extends GsfSimpleTag {
31  
32      private String description;
33      private String value;
34      private String property;
35      private String publist = null;
36  
37      @Override
38      public void doTag() throws JspException, IOException {
39          PropertyDao dao = AssetApiPropertyDao.getInstance(getICS());
40          dao.setProperty(property, description, value);
41          if (publist != null) dao.addToSite(property, publist.split(","));
42          super.doTag();
43      }
44  
45      public void setDescription(String description) {
46          this.description = description;
47      }
48  
49      public void setValue(String value) {
50          this.value = value;
51      }
52  
53      public void setProperty(String property) {
54          this.property = property;
55      }
56  
57      public void setPublist(String s) {
58          this.publist = s;
59      }
60  }