01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. The ASF licenses this file to You
04: * under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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. For additional information regarding
15: * copyright in this work, please see the NOTICE file in the top level
16: * directory of this distribution.
17: */
18: package org.apache.roller.ui.authoring.struts.formbeans;
19:
20: import org.apache.roller.RollerException;
21: import org.apache.roller.pojos.WeblogCategoryData;
22: import org.apache.roller.ui.authoring.struts.forms.WeblogCategoryForm;
23:
24: /**
25: * Extends the WeblogCategoryForm so that additional properties may be added.
26: * These properties are not persistent and are only needed for the UI.
27: *
28: * @struts.form name="weblogCategoryFormEx"
29: */
30: public class WeblogCategoryFormEx extends WeblogCategoryForm {
31: private String mParentId = null;
32: private boolean mMoveContents = false;
33: private String mMoveToWeblogCategoryId = null;
34:
35: public WeblogCategoryFormEx() {
36: super ();
37: }
38:
39: public WeblogCategoryFormEx(WeblogCategoryData catData,
40: java.util.Locale locale) throws RollerException {
41: super (catData, locale);
42: }
43:
44: public String getParentId() {
45: return mParentId;
46: }
47:
48: public void setParentId(String parentId) {
49: mParentId = parentId;
50: }
51:
52: /** If true then contents should be moved when this folder is removed */
53: public boolean getMoveContents() {
54: return mMoveContents;
55: }
56:
57: public void setMoveContents(boolean flag) {
58: mMoveContents = flag;
59: }
60:
61: /** WeblogCategory where contents should be moved if this cat is removed */
62: public String getMoveToWeblogCategoryId() {
63: return mMoveToWeblogCategoryId;
64: }
65:
66: public void setMoveToWeblogCategoryId(String id) {
67: mMoveToWeblogCategoryId = id;
68: }
69:
70: /**
71: * @see org.apache.roller.ui.authoring.struts.forms.WeblogCategoryForm#copyFrom(org.apache.roller.pojos.WeblogCategoryData)
72: */
73: public void copyFrom(WeblogCategoryData dataHolder,
74: java.util.Locale locale) throws RollerException {
75: super .copyFrom(dataHolder, locale);
76: try {
77: mParentId = dataHolder.getParent().getId();
78: } catch (RollerException e) {
79: throw new RuntimeException(
80: "ERROR fetching parent category.");
81: }
82: }
83:
84: }
|