KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > gui > control > Save


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.gui.control;
14
15 import info.magnolia.cms.beans.config.ContentRepository;
16 import info.magnolia.cms.beans.runtime.Document;
17 import info.magnolia.cms.beans.runtime.MultipartForm;
18 import info.magnolia.cms.core.Content;
19 import info.magnolia.cms.core.HierarchyManager;
20 import info.magnolia.cms.core.ItemType;
21 import info.magnolia.cms.core.NodeData;
22 import info.magnolia.cms.core.Path;
23 import info.magnolia.cms.gui.dialog.DialogSuper;
24 import info.magnolia.cms.gui.misc.FileProperties;
25 import info.magnolia.cms.security.AccessDeniedException;
26 import info.magnolia.cms.security.Digester;
27 import info.magnolia.cms.security.SessionAccessControl;
28 import info.magnolia.cms.util.LinkUtil;
29
30 import java.util.Calendar JavaDoc;
31 import java.util.GregorianCalendar JavaDoc;
32
33 import javax.jcr.PathNotFoundException;
34 import javax.jcr.PropertyType;
35 import javax.jcr.RepositoryException;
36 import javax.jcr.Value;
37 import javax.jcr.ValueFactory;
38 import javax.servlet.http.HttpServletRequest JavaDoc;
39 import javax.servlet.http.HttpSession JavaDoc;
40
41 import org.apache.commons.codec.binary.Base64;
42 import org.apache.commons.lang.BooleanUtils;
43 import org.apache.commons.lang.StringUtils;
44 import org.apache.commons.lang.exception.NestableRuntimeException;
45 import org.apache.log4j.Logger;
46
47
48 /**
49  * This class handels the saving in the dialogs. It uses the mgnlSaveInfo parameters sendend from the browser to store
50  * the data in the node.The structure of the parameter is the following: <br>
51  * <code>name, type, valueType, isRichEditValue, encoding</code>
52  * <p>
53  * To find the consts see ControlSuper <table>
54  * <tr>
55  * <td>name</td>
56  * <td>the name of the field</td>
57  * </tr>
58  * <tr>
59  * <td>type</td>
60  * <td>string, boolean, ...</td>
61  * </tr>
62  * <tr>
63  * <td>valueType</td>
64  * <td>single, multiple</td>
65  * </tr>
66  * <tr>
67  * <td>isRichEditValue</td>
68  * <td>value from an editor</td>
69  * </tr>
70  * <tr>
71  * <td>encoding</td>
72  * <td>base64, unix, none</td>
73  * </tr>
74  * </table>
75  * @author Vinzenz Wyser
76  * @version 2.0
77  */

78 public class Save extends ControlSuper {
79
80     /**
81      * Logger
82      */

83     private static Logger log = Logger.getLogger(Save.class);
84
85     /**
86      * The from, containing all the fields and files. This form is generated by magnolia.
87      */

88     private MultipartForm form;
89
90     /**
91      * creates the node if it is not present
92      */

93     private boolean create;
94
95     private ItemType creationItemType = ItemType.CONTENT;
96
97     /**
98      * The name of the repository to store the data. Website is default.
99      */

100     private String JavaDoc repository = ContentRepository.WEBSITE;
101
102     /**
103      * Do not use this without a reason.
104      */

105     public Save() {
106     }
107
108     /**
109      * Initialize the Save control.
110      * @param form the form generated from the request due to handle multipart forms
111      * @param request request
112      */

113     public Save(MultipartForm form, HttpServletRequest JavaDoc request) {
114         this.setForm(form);
115         this.setRequest(request);
116         this.setPath(form.getParameter("mgnlPath")); //$NON-NLS-1$
117
this.setNodeCollectionName(form.getParameter("mgnlNodeCollection")); //$NON-NLS-1$
118
this.setNodeName(form.getParameter("mgnlNode")); //$NON-NLS-1$
119
this.setParagraph(form.getParameter("mgnlParagraph")); //$NON-NLS-1$
120
this.setRepository(form.getParameter("mgnlRepository")); //$NON-NLS-1$
121
}
122
123     /**
124      * Uses the mgnlSageInfo parameters to save the data.
125      */

126     public void save() {
127         String JavaDoc[] saveInfos = getForm().getParameterValues("mgnlSaveInfo"); // name,type,propertyOrNode //$NON-NLS-1$
128
String JavaDoc nodeCollectionName = this.getNodeCollectionName(null);
129         String JavaDoc nodeName = this.getNodeName(null);
130         String JavaDoc path = this.getPath();
131         HttpServletRequest JavaDoc request = this.getRequest();
132
133         HierarchyManager hm = SessionAccessControl.getHierarchyManager(request, this.getRepository());
134         try {
135             Content page = null;
136             try {
137                 page = hm.getContent(path);
138             }
139             catch (RepositoryException e) {
140                 if (isCreate()) {
141                     String JavaDoc parentPath = StringUtils.substringBeforeLast(path, "/"); //$NON-NLS-1$
142
String JavaDoc label = StringUtils.substringAfterLast(path, "/"); //$NON-NLS-1$
143
if (StringUtils.isEmpty(parentPath)) {
144                         page = hm.getRoot();
145                     }
146                     else {
147                         page = hm.getContent(parentPath);
148                     }
149                     page = page.createContent(label, creationItemType);
150                 }
151                 else {
152                     log.error("tried to save a not existing node. use create = true to force creation"); //$NON-NLS-1$
153
}
154             }
155
156             // get or create nodeCollection
157
Content nodeCollection = null;
158             if (nodeCollectionName != null) {
159                 try {
160                     nodeCollection = page.getContent(nodeCollectionName);
161                 }
162                 catch (RepositoryException re) {
163                     // nodeCollection does not exist -> create
164
nodeCollection = page.createContent(nodeCollectionName, ItemType.CONTENTNODE);
165                     if (log.isDebugEnabled()) {
166                         log.debug("Create - " + nodeCollection.getHandle()); //$NON-NLS-1$
167
}
168                 }
169             }
170             else {
171                 nodeCollection = page;
172             }
173
174             // get or create node
175
Content node = null;
176             if (nodeName != null) {
177                 try {
178                     node = nodeCollection.getContent(nodeName);
179                 }
180                 catch (RepositoryException re) {
181                     // node does not exist -> create
182
if (nodeName.equals("mgnlNew")) { //$NON-NLS-1$
183
nodeName = Path.getUniqueLabel(hm, nodeCollection.getHandle(), "0"); //$NON-NLS-1$
184
}
185                     node = nodeCollection.createContent(nodeName, ItemType.CONTENTNODE);
186                     node.createNodeData("paragraph").setValue(this.getParagraph()); //$NON-NLS-1$
187
node.getMetaData().setSequencePosition();
188                 }
189             }
190             else {
191                 node = nodeCollection;
192             }
193             // update meta data (e.g. last modified) of this paragraph and the page
194
node.updateMetaData(request);
195             page.updateMetaData(request);
196             // loop all saveInfo controls; saveInfo format: name, type, valueType(single|multiple, )
197
for (int i = 0; i < saveInfos.length; i++) {
198                 String JavaDoc saveInfo = saveInfos[i];
199                 processSaveInfo(node, saveInfo);
200             }
201             if (log.isDebugEnabled()) {
202                 log.debug("Saving - " + path); //$NON-NLS-1$
203
}
204             hm.save();
205         }
206         catch (RepositoryException re) {
207             log.error(re.getMessage(), re);
208         }
209         this.removeSessionAttributes();
210     }
211
212     /**
213      * This method cears about one mgnlSaveInfo. It adds the value to the node
214      * @param node node to add data
215      * @param saveInfo <code>name, type, valueType, isRichEditValue, encoding</code>
216      * @throws PathNotFoundException exception
217      * @throws RepositoryException exception
218      * @throws AccessDeniedException no access
219      */

220     private void processSaveInfo(Content node, String JavaDoc saveInfo) throws PathNotFoundException, RepositoryException,
221         AccessDeniedException {
222
223         String JavaDoc name;
224         int type = type = PropertyType.STRING;
225         int valueType = ControlSuper.VALUETYPE_SINGLE;
226         int isRichEditValue = 0;
227         int encoding = ControlSuper.ENCODING_NO;
228         String JavaDoc[] values = {StringUtils.EMPTY};
229         if (StringUtils.contains(saveInfo, ',')) {
230             String JavaDoc[] info = saveInfo.split(","); //$NON-NLS-1$
231
name = info[0];
232             if (info.length >= 2) {
233                 type = PropertyType.valueFromName(info[1]);
234             }
235             if (info.length >= 3) {
236                 valueType = Integer.valueOf(info[2]).intValue();
237             }
238             if (info.length >= 4) {
239                 isRichEditValue = Integer.valueOf(info[3]).intValue();
240             }
241             if (info.length >= 5) {
242                 encoding = Integer.valueOf(info[4]).intValue();
243             }
244         }
245         else {
246             name = saveInfo;
247         }
248         if (type == PropertyType.BINARY) {
249             processBinary(node, name);
250         }
251         else {
252             values = getForm().getParameterValues(name);
253             if (valueType == ControlSuper.VALUETYPE_MULTIPLE) {
254                 processMultiple(node, name, type, values);
255             }
256             else {
257                 processCommon(node, name, type, isRichEditValue, encoding, values);
258             }
259         }
260     }
261
262     /**
263      * Process a common value
264      * @param node node where the data must be stored
265      * @param name name of the field
266      * @param type type
267      * @param isRichEditValue is it a return value of a richt edit field
268      * @param encoding must we encode (base64)
269      * @param values all values belonging to this field
270      * @throws PathNotFoundException exception
271      * @throws RepositoryException exception
272      * @throws AccessDeniedException exception
273      */

274     private void processCommon(Content node, String JavaDoc name, int type, int isRichEditValue, int encoding, String JavaDoc[] values)
275         throws PathNotFoundException, RepositoryException, AccessDeniedException {
276         String JavaDoc valueStr = StringUtils.EMPTY;
277         if (values != null) {
278             valueStr = values[0]; // values is null when the expected field would not exis, e.g no
279
}
280         // checkbox selected
281
NodeData data = node.getNodeData(name);
282         if (isRichEditValue != ControlSuper.RICHEDIT_NONE) {
283             valueStr = this.getRichEditValueStr(valueStr, isRichEditValue);
284         }
285         // actualy encoding does only work for control password
286
boolean remove = false;
287         boolean write = false;
288         if (encoding == ControlSuper.ENCODING_BASE64) {
289             if (StringUtils.isNotBlank(valueStr)) {
290                 valueStr = new String JavaDoc(Base64.encodeBase64(valueStr.getBytes()));
291                 write = true;
292             }
293         }
294         else if (encoding == ControlSuper.ENCODING_UNIX) {
295             if (StringUtils.isNotEmpty(valueStr)) {
296                 valueStr = Digester.getSHA1Hex(valueStr);
297                 write = true;
298             }
299         }
300         else {
301             // no encoding
302
if (values == null || StringUtils.isEmpty(valueStr)) {
303                 remove = true;
304             }
305             else {
306                 write = true;
307             }
308         }
309         if (remove) {
310             // remove node if already exists
311
if (data.isExist()) {
312                 node.deleteNodeData(name);
313             }
314         }
315         else if (write) {
316             Value value = this.getValue(valueStr, type);
317             if (value != null) {
318                 if (data.isExist()) {
319                     data.setValue(value);
320                 }
321                 else {
322                     node.createNodeData(name, value);
323                 }
324             }
325         }
326     }
327
328     /**
329      * @param node
330      * @param name
331      * @param type
332      * @param values
333      * @throws RepositoryException
334      * @throws PathNotFoundException
335      * @throws AccessDeniedException
336      */

337     private void processMultiple(Content node, String JavaDoc name, int type, String JavaDoc[] values) throws RepositoryException,
338         PathNotFoundException, AccessDeniedException {
339         // remove entire content node and (re-)write each
340
try {
341             node.delete(name);
342         }
343         catch (PathNotFoundException e) {
344             log.debug("Exception caught: " + e.getMessage(), e); //$NON-NLS-1$
345
}
346         if (values != null && values.length != 0) {
347             Content multiNode = node.createContent(name, ItemType.CONTENTNODE);
348             try {
349                 // MetaData.CREATION_DATE has private access; no method to delete it so far...
350
multiNode.deleteNodeData("creationdate"); //$NON-NLS-1$
351
}
352             catch (RepositoryException re) {
353                 log.debug("Exception caught: " + re.getMessage(), re); //$NON-NLS-1$
354
}
355             for (int j = 0; j < values.length; j++) {
356                 String JavaDoc valueStr = values[j];
357                 Value value = this.getValue(valueStr, type);
358                 multiNode.createNodeData(Integer.toString(j)).setValue(value);
359             }
360         }
361     }
362
363     /**
364      * Process binary data. File- or imageupload.
365      * @param node
366      * @param name
367      * @throws PathNotFoundException
368      * @throws RepositoryException
369      * @throws AccessDeniedException
370      */

371     private void processBinary(Content node, String JavaDoc name) throws PathNotFoundException, RepositoryException,
372         AccessDeniedException {
373         Document doc = getForm().getDocument(name);
374         if (doc == null && getForm().getParameter(name + "_" + File.REMOVE) != null) { //$NON-NLS-1$
375
try {
376                 node.delete(name + "_" + FileProperties.PROPERTIES_CONTENTNODE); //$NON-NLS-1$
377
}
378             catch (RepositoryException re) {
379                 log.debug("Exception caught: " + re.getMessage(), re); //$NON-NLS-1$
380
}
381             try {
382                 node.deleteNodeData(name);
383             }
384             catch (RepositoryException re) {
385                 log.debug("Exception caught: " + re.getMessage(), re); //$NON-NLS-1$
386
}
387
388         }
389         else {
390             Content propNode = null;
391             try {
392                 propNode = node.getContent(name + "_" + FileProperties.PROPERTIES_CONTENTNODE); //$NON-NLS-1$
393
}
394             catch (RepositoryException re) {
395                 try {
396                     if (doc != null) {
397                         propNode = node.createContent(name + "_" + FileProperties.PROPERTIES_CONTENTNODE, //$NON-NLS-1$
398
ItemType.CONTENTNODE);
399                     }
400                 }
401                 catch (RepositoryException re2) {
402                     log.debug("Exception caught: " + re2.getMessage(), re2); //$NON-NLS-1$
403
}
404             }
405             if (doc != null) {
406                 NodeData data = node.getNodeData(name);
407                 if (!data.isExist()) {
408                     data = node.createNodeData(name);
409                     if (log.isDebugEnabled()) {
410                         log.debug("creating under - " + node.getHandle()); //$NON-NLS-1$
411
log.debug("creating node data for binary store - " + name); //$NON-NLS-1$
412
}
413                 }
414                 data.setValue(doc.getStream());
415                 log.debug("Node data updated"); //$NON-NLS-1$
416
}
417             if (propNode != null) {
418                 NodeData propData;
419                 String JavaDoc fileName = getForm().getParameter(name + "_" + FileProperties.PROPERTY_FILENAME); //$NON-NLS-1$
420
if (fileName == null || fileName.equals(StringUtils.EMPTY)) {
421                     fileName = doc.getFileName();
422                 }
423                 propData = propNode.getNodeData(FileProperties.PROPERTY_FILENAME);
424                 if (!propData.isExist()) {
425                     propData = propNode.createNodeData(FileProperties.PROPERTY_FILENAME);
426                 }
427                 propData.setValue(fileName);
428                 if (doc != null) {
429                     propData = propNode.getNodeData(FileProperties.PROPERTY_CONTENTTYPE);
430                     if (!propData.isExist()) {
431                         propData = propNode.createNodeData(FileProperties.PROPERTY_CONTENTTYPE);
432                     }
433                     propData.setValue(doc.getType());
434                     propData = propNode.getNodeData(FileProperties.PROPERTY_SIZE);
435                     if (!propData.isExist()) {
436                         propData = propNode.createNodeData(FileProperties.PROPERTY_SIZE);
437                     }
438                     propData.setValue(doc.getLength());
439                     propData = propNode.getNodeData(FileProperties.PROPERTY_EXTENSION);
440                     if (!propData.isExist()) {
441                         propData = propNode.createNodeData(FileProperties.PROPERTY_EXTENSION);
442                     }
443                     propData.setValue(doc.getExtension());
444                     String JavaDoc template = getForm().getParameter(name + "_" + FileProperties.PROPERTY_TEMPLATE); //$NON-NLS-1$
445
if (StringUtils.isNotEmpty(template)) {
446                         propData = propNode.getNodeData(FileProperties.PROPERTY_TEMPLATE);
447                         if (!propData.isExist()) {
448                             propData = propNode.createNodeData(FileProperties.PROPERTY_TEMPLATE);
449                         }
450                         propData.setValue(template);
451                     }
452                     else {
453                         try {
454                             propNode.deleteNodeData(FileProperties.PROPERTY_TEMPLATE);
455                         }
456                         catch (PathNotFoundException e) {
457                             log.debug("Exception caught: " + e.getMessage(), e); //$NON-NLS-1$
458
}
459                     }
460                     doc.delete();
461                 }
462             }
463         }
464     }
465
466     public void removeSessionAttributes() {
467         HttpSession JavaDoc session = this.getRequest().getSession();
468         MultipartForm form = getForm();
469         String JavaDoc[] toRemove = form.getParameterValues(DialogSuper.SESSION_ATTRIBUTENAME_DIALOGOBJECT_REMOVE);
470         if (toRemove != null) {
471             for (int i = 0; i < toRemove.length; i++) {
472                 session.removeAttribute(toRemove[i]);
473                 // log.debug("removed: "+toRemove[i]);
474
}
475         }
476     }
477
478     public Value getValue(String JavaDoc s) {
479         return this.getValue(s, PropertyType.STRING);
480     }
481
482     public Value getValue(long l) {
483         HierarchyManager hm = SessionAccessControl.getHierarchyManager(this.getRequest(), this.getRepository());
484         ValueFactory valueFactory;
485         try {
486             valueFactory = hm.getWorkspace().getSession().getValueFactory();
487         }
488         catch (RepositoryException e) {
489             throw new NestableRuntimeException(e);
490         }
491         return valueFactory.createValue(l);
492     }
493
494     public Value getValue(String JavaDoc valueStr, int type) {
495
496         ValueFactory valueFactory = null;
497
498         HierarchyManager hm = SessionAccessControl.getHierarchyManager(this.getRequest(), this.getRepository());
499         try {
500             valueFactory = hm.getWorkspace().getSession().getValueFactory();
501         }
502         catch (RepositoryException e) {
503             throw new NestableRuntimeException(e);
504         }
505
506         Value value = null;
507         if (type == PropertyType.STRING) {
508             value = valueFactory.createValue(valueStr);
509         }
510         else if (type == PropertyType.BOOLEAN) {
511             value = valueFactory.createValue(BooleanUtils.toBoolean(valueStr));
512         }
513         else if (type == PropertyType.DOUBLE) {
514             try {
515                 value = valueFactory.createValue(Double.parseDouble(valueStr));
516             }
517             catch (NumberFormatException JavaDoc e) {
518                 value = valueFactory.createValue(0d);
519             }
520         }
521         else if (type == PropertyType.LONG) {
522             try {
523                 value = valueFactory.createValue(Long.parseLong(valueStr));
524             }
525             catch (NumberFormatException JavaDoc e) {
526                 value = valueFactory.createValue(0L);
527             }
528         }
529         else if (type == PropertyType.DATE) {
530             try {
531                 Calendar JavaDoc date = new GregorianCalendar JavaDoc();
532                 try {
533                     String JavaDoc newDateAndTime = valueStr;
534                     String JavaDoc[] dateAndTimeTokens = newDateAndTime.split("T"); //$NON-NLS-1$
535
String JavaDoc newDate = dateAndTimeTokens[0];
536                     String JavaDoc[] dateTokens = newDate.split("-"); //$NON-NLS-1$
537
int hour = 0;
538                     int minute = 0;
539                     int second = 0;
540                     int year = Integer.parseInt(dateTokens[0]);
541                     int month = Integer.parseInt(dateTokens[1]) - 1;
542                     int day = Integer.parseInt(dateTokens[2]);
543                     if (dateAndTimeTokens.length > 1) {
544                         String JavaDoc newTime = dateAndTimeTokens[1];
545                         String JavaDoc[] timeTokens = newTime.split(":"); //$NON-NLS-1$
546
hour = Integer.parseInt(timeTokens[0]);
547                         minute = Integer.parseInt(timeTokens[1]);
548                         second = Integer.parseInt(timeTokens[2]);
549                     }
550                     date.set(year, month, day, hour, minute, second);
551                 }
552                 // todo time zone??
553
catch (Exception JavaDoc e) {
554                     // ignore, it sets the current date / time
555
}
556                 value = value = valueFactory.createValue(date);
557             }
558             catch (Exception JavaDoc e) {
559                 log.debug("Exception caught: " + e.getMessage(), e); //$NON-NLS-1$
560
}
561         }
562         return value;
563     }
564
565     /**
566      * Manipulates the value returned from html editors (kupu, fck). It encodes the internal links.
567      * @param value
568      * @param isRichEditValue
569      * @return todo configurable regexp on save?
570      */

571     protected String JavaDoc getRichEditValueStr(String JavaDoc value, int isRichEditValue) {
572
573         // encode the internal links to avoid dependences from the contextpath, position of the page
574
String JavaDoc valueStr = LinkUtil.convertAbsoluteLinksToUUIDs(value);
575         switch (isRichEditValue) {
576             case ControlSuper.RICHEDIT_KUPU :
577             case ControlSuper.RICHEDIT_FCK :
578                 valueStr = StringUtils.replace(valueStr, "\r\n", " "); //$NON-NLS-1$ //$NON-NLS-2$
579
valueStr = StringUtils.replace(valueStr, "\n", " "); //$NON-NLS-1$ //$NON-NLS-2$
580

581                 // ie inserts some strange br...
582
valueStr = StringUtils.replace(valueStr, "</br>", StringUtils.EMPTY); //$NON-NLS-1$
583
valueStr = StringUtils.replace(valueStr, "<P><BR>", "<P>"); //$NON-NLS-1$ //$NON-NLS-2$
584

585                 valueStr = StringUtils.replace(valueStr, "<br>", "\n "); //$NON-NLS-1$ //$NON-NLS-2$
586
valueStr = StringUtils.replace(valueStr, "<BR>", "\n "); //$NON-NLS-1$ //$NON-NLS-2$
587
valueStr = StringUtils.replace(valueStr, "<br/>", "\n "); //$NON-NLS-1$ //$NON-NLS-2$
588

589                 // replace <P>
590
valueStr = replacePByBr(valueStr, "p"); //$NON-NLS-1$
591

592                 // TODO remove it definitly: the method seams not to work
593
// replace <a class="...></a> by <span class=""></span>
594
// valueStr = replaceABySpan(valueStr, "a");
595
break;
596             default :
597                 break;
598         }
599         return valueStr;
600
601     }
602
603     /**
604      * @param value
605      * @param tagName
606      * @return
607      */

608     protected static String JavaDoc replacePByBr(final String JavaDoc value, String JavaDoc tagName) {
609
610         if (StringUtils.isBlank(value)) {
611             return value;
612         }
613
614         String JavaDoc fixedValue = value;
615
616         String JavaDoc pre = "<" + tagName + ">"; //$NON-NLS-1$ //$NON-NLS-2$
617
String JavaDoc post = "</" + tagName + ">"; //$NON-NLS-1$ //$NON-NLS-2$
618

619         // get rid of last </p>
620
if (fixedValue.endsWith(post)) {
621             fixedValue = StringUtils.substringBeforeLast(fixedValue, post);
622         }
623
624         fixedValue = StringUtils.replace(fixedValue, pre + "&nbsp;" + post, "\n "); //$NON-NLS-1$ //$NON-NLS-2$
625
fixedValue = StringUtils.replace(fixedValue, pre, StringUtils.EMPTY);
626         fixedValue = StringUtils.replace(fixedValue, post, "\n\n "); //$NON-NLS-1$
627

628         if (!tagName.equals(tagName.toUpperCase())) {
629             fixedValue = replacePByBr(fixedValue, tagName.toUpperCase());
630         }
631         return fixedValue;
632     }
633
634     public boolean isCreate() {
635         return create;
636     }
637
638     public void setCreate(boolean create) {
639         this.create = create;
640     }
641
642     public ItemType getCreationItemType() {
643         return creationItemType;
644     }
645
646     public void setCreationItemType(ItemType creationItemType) {
647         this.creationItemType = creationItemType;
648     }
649
650     /**
651      * @return the form containing the values passed
652      */

653     protected MultipartForm getForm() {
654         return form;
655     }
656
657     /**
658      * set the from
659      * @param form containing the sended values
660      */

661     protected void setForm(MultipartForm form) {
662         this.form = form;
663     }
664
665     /**
666      * set the name of the repository saving to
667      * @param repository the name of the repository
668      */

669     protected void setRepository(String JavaDoc repository) {
670         this.repository = repository;
671     }
672
673     /**
674      * get the name of thre repository saving to
675      * @return name
676      */

677     protected String JavaDoc getRepository() {
678         return repository;
679     }
680
681 }
Popular Tags