KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > managementtool > actions > ViewContentTypeDefinitionAction


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23
24 package org.infoglue.cms.applications.managementtool.actions;
25
26 import java.io.IOException JavaDoc;
27 import java.io.StringReader JavaDoc;
28 import java.util.ArrayList JavaDoc;
29 import java.util.Iterator JavaDoc;
30 import java.util.List JavaDoc;
31
32 import javax.xml.transform.TransformerException JavaDoc;
33
34 import org.apache.log4j.Logger;
35 import org.apache.xerces.parsers.DOMParser;
36 import org.apache.xpath.XPathAPI;
37 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
38 import org.infoglue.cms.controllers.kernel.impl.simple.CategoryController;
39 import org.infoglue.cms.controllers.kernel.impl.simple.ContentTypeDefinitionController;
40 import org.infoglue.cms.controllers.kernel.impl.simple.LanguageController;
41 import org.infoglue.cms.entities.management.CategoryAttribute;
42 import org.infoglue.cms.entities.management.ContentTypeDefinitionVO;
43 import org.infoglue.cms.exception.ConstraintException;
44 import org.infoglue.cms.exception.SystemException;
45 import org.infoglue.cms.util.ConstraintExceptionBuffer;
46 import org.infoglue.cms.util.XMLHelper;
47 import org.w3c.dom.Document JavaDoc;
48 import org.w3c.dom.Element JavaDoc;
49 import org.w3c.dom.Node JavaDoc;
50 import org.w3c.dom.NodeList JavaDoc;
51 import org.xml.sax.InputSource JavaDoc;
52 import org.xml.sax.SAXException JavaDoc;
53
54 /**
55  * This class implements the action class for viewContentTypeDefinition.
56  * The use-case lets the user see all information about a specific site/contentTypeDefinition.
57  *
58  * @author Mattias Bogeblad
59  */

60
61 public class ViewContentTypeDefinitionAction extends InfoGlueAbstractAction
62 {
63     private final static Logger logger = Logger.getLogger(ViewContentTypeDefinitionAction.class.getName());
64
65     private static final long serialVersionUID = 1L;
66
67     public static final String JavaDoc USE_EDITOR = "useEditor";
68
69     private static CategoryController categoryController = CategoryController.getController();
70
71     private ContentTypeDefinitionVO contentTypeDefinitionVO;
72     private String JavaDoc currentContentTypeEditorViewLanguageCode;
73     private List JavaDoc attributes = null;
74     private List JavaDoc availableLanguages = null;
75     private List JavaDoc languageVOList;
76     private String JavaDoc title;
77     private String JavaDoc inputTypeId;
78     private String JavaDoc attributeName;
79     private String JavaDoc newAttributeName;
80     private String JavaDoc attributeParameterId;
81     private String JavaDoc attributeParameterValueId;
82     private String JavaDoc newAttributeParameterValueId;
83     private String JavaDoc attributeParameterValueLabel;
84     private String JavaDoc attributeParameterValueLocale;
85     private String JavaDoc attributeToExpand;
86     private String JavaDoc assetKey;
87     private String JavaDoc newAssetKey;
88     private String JavaDoc categoryKey;
89     private String JavaDoc newCategoryKey;
90     
91     private String JavaDoc description = "";
92     private Integer JavaDoc maximumSize;
93     private String JavaDoc allowedContentTypes = "any";
94     private String JavaDoc imageWidth;
95     private String JavaDoc imageHeight;
96     
97     private List JavaDoc activatedName = new ArrayList JavaDoc();
98
99     public ViewContentTypeDefinitionAction()
100     {
101         this(new ContentTypeDefinitionVO());
102     }
103
104     public ViewContentTypeDefinitionAction(ContentTypeDefinitionVO contentTypeDefinitionVO)
105     {
106         this.contentTypeDefinitionVO = contentTypeDefinitionVO;
107     }
108
109     protected void initialize(Integer JavaDoc contentTypeDefinitionId) throws Exception JavaDoc
110     {
111         this.contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentTypeDefinitionId);
112         //logger.info("Initializing:" + this.contentTypeDefinitionVO.getSchemaValue());
113

114         this.contentTypeDefinitionVO = ContentTypeDefinitionController.getController().validateAndUpdateContentType(this.contentTypeDefinitionVO);
115         this.contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentTypeDefinitionId);
116         this.attributes = ContentTypeDefinitionController.getController().getContentTypeAttributes(this.contentTypeDefinitionVO.getSchemaValue());
117         this.availableLanguages = LanguageController.getController().getLanguageVOList();
118     }
119
120     /**
121      * The main method that fetches the Value-object for this use-case
122      */

123
124     public String JavaDoc doExecute() throws Exception JavaDoc
125     {
126         this.initialize(getContentTypeDefinitionId());
127         return USE_EDITOR;
128     }
129
130     /**
131      * The method that initializes all for the editor mode
132      */

133
134     public String JavaDoc doUseEditor() throws Exception JavaDoc
135     {
136         this.initialize(getContentTypeDefinitionId());
137         return USE_EDITOR;
138     }
139
140     /**
141      * The method that initializes all for the simple mode
142      */

143
144     public String JavaDoc doUseSimple() throws Exception JavaDoc
145     {
146         this.initialize(getContentTypeDefinitionId());
147         return SUCCESS;
148     }
149
150     public String JavaDoc doInsertAttribute() throws Exception JavaDoc
151     {
152         this.initialize(getContentTypeDefinitionId());
153         String JavaDoc newSchemaValue = ContentTypeDefinitionController.getController().insertContentTypeAttribute(this.contentTypeDefinitionVO.getSchemaValue(), this.inputTypeId, this.activatedName);
154         this.contentTypeDefinitionVO.setSchemaValue(newSchemaValue);
155         ContentTypeDefinitionController.getController().update(this.contentTypeDefinitionVO);
156
157         this.initialize(getContentTypeDefinitionId());
158         return USE_EDITOR;
159     }
160
161
162     public String JavaDoc doDeleteAttribute() throws Exception JavaDoc
163     {
164         this.initialize(getContentTypeDefinitionId());
165
166         try
167         {
168             Document JavaDoc document = createDocumentFromDefinition();
169
170             String JavaDoc attributesXPath = "/xs:schema/xs:complexType/xs:all/xs:element/xs:complexType/xs:all/xs:element[@name='" + this.attributeName + "']";
171             NodeList JavaDoc anl = org.apache.xpath.XPathAPI.selectNodeList(document.getDocumentElement(), attributesXPath);
172             if(anl != null && anl.getLength() > 0)
173             {
174                 Element JavaDoc element = (Element JavaDoc)anl.item(0);
175                 element.getParentNode().removeChild(element);
176             }
177
178             String JavaDoc validatorsXPath = "/xs:schema/xs:complexType[@name = 'Validation']/xs:annotation/xs:appinfo/form-validation/formset/form/field[@property = '" + attributeName + "']";
179             NodeList JavaDoc anl2 = org.apache.xpath.XPathAPI.selectNodeList(document.getDocumentElement(), validatorsXPath);
180             for(int i=0; i<anl2.getLength(); i++)
181             {
182                 Element JavaDoc element = (Element JavaDoc)anl2.item(i);
183                 element.getParentNode().removeChild(element);
184             }
185
186             saveUpdatedDefinition(document);
187         }
188         catch(Exception JavaDoc e)
189         {
190             e.printStackTrace();
191         }
192
193         this.initialize(getContentTypeDefinitionId());
194         return USE_EDITOR;
195     }
196
197     /**
198      * This method moves an content type attribute up one step.
199      */

200
201     public String JavaDoc doMoveAttributeUp() throws Exception JavaDoc
202     {
203         this.initialize(getContentTypeDefinitionId());
204
205         try
206         {
207             Document JavaDoc document = createDocumentFromDefinition();
208
209             String JavaDoc attributesXPath = "/xs:schema/xs:complexType/xs:all/xs:element/xs:complexType/xs:all/xs:element";
210             NodeList JavaDoc anl = org.apache.xpath.XPathAPI.selectNodeList(document.getDocumentElement(), attributesXPath);
211             Element JavaDoc previousElement = null;
212             for(int i=0; i < anl.getLength(); i++)
213             {
214                 Element JavaDoc element = (Element JavaDoc)anl.item(i);
215                 if(element.getAttribute("name").equalsIgnoreCase(this.attributeName) && previousElement != null)
216                 {
217                     Element JavaDoc parent = (Element JavaDoc)element.getParentNode();
218                     parent.removeChild(element);
219                     parent.insertBefore(element, previousElement);
220                 }
221                 previousElement = element;
222             }
223
224             saveUpdatedDefinition(document);
225         }
226         catch(Exception JavaDoc e)
227         {
228             e.printStackTrace();
229         }
230
231         this.initialize(getContentTypeDefinitionId());
232         return USE_EDITOR;
233     }
234
235
236     /**
237      * This method moves an content type attribute down one step.
238      */

239
240     public String JavaDoc doMoveAttributeDown() throws Exception JavaDoc
241     {
242         this.initialize(getContentTypeDefinitionId());
243
244         try
245         {
246             Document JavaDoc document = createDocumentFromDefinition();
247
248             String JavaDoc attributesXPath = "/xs:schema/xs:complexType/xs:all/xs:element/xs:complexType/xs:all/xs:element";
249             NodeList JavaDoc anl = org.apache.xpath.XPathAPI.selectNodeList(document.getDocumentElement(), attributesXPath);
250             Element JavaDoc parent = null;
251             Element JavaDoc elementToMove = null;
252             boolean isInserted = false;
253             int position = 0;
254             for(int i=0; i < anl.getLength(); i++)
255             {
256                 Element JavaDoc element = (Element JavaDoc)anl.item(i);
257                 parent = (Element JavaDoc)element.getParentNode();
258
259                 if(elementToMove != null)
260                 {
261                     if(position == 2)
262                     {
263                         parent.insertBefore(elementToMove, element);
264                         isInserted = true;
265                         break;
266                     }
267                     else
268                         position++;
269                 }
270
271                 if(element.getAttribute("name").equalsIgnoreCase(this.attributeName))
272                 {
273                     elementToMove = element;
274                     parent.removeChild(elementToMove);
275                     position++;
276                 }
277             }
278
279             if(!isInserted && elementToMove != null)
280                 parent.appendChild(elementToMove);
281
282             saveUpdatedDefinition(document);
283         }
284         catch(Exception JavaDoc e)
285         {
286             e.printStackTrace();
287         }
288
289         this.initialize(getContentTypeDefinitionId());
290         return USE_EDITOR;
291     }
292
293     
294     /**
295      * This method moves an content type assetKey up one step.
296      */

297
298     public String JavaDoc doMoveAssetKeyUp() throws Exception JavaDoc
299     {
300         this.initialize(getContentTypeDefinitionId());
301
302         try
303         {
304             Document JavaDoc document = createDocumentFromDefinition();
305
306             String JavaDoc attributesXPath = "/xs:schema/xs:simpleType[@name = '" + ContentTypeDefinitionController.ASSET_KEYS + "']/xs:restriction/xs:enumeration[@value='" + this.assetKey + "']";
307             NodeList JavaDoc anl = XPathAPI.selectNodeList(document.getDocumentElement(), attributesXPath);
308             if(anl != null && anl.getLength() > 0)
309             {
310                 Element JavaDoc element = (Element JavaDoc)anl.item(0);
311                 Node JavaDoc parentElement = element.getParentNode();
312                 Node JavaDoc previuosSibling = element.getPreviousSibling();
313                 if(previuosSibling != null)
314                 {
315                     parentElement.removeChild(element);
316                     parentElement.insertBefore(element, previuosSibling);
317                 }
318             }
319                         
320             saveUpdatedDefinition(document);
321         }
322         catch(Exception JavaDoc e)
323         {
324             e.printStackTrace();
325         }
326
327         this.initialize(getContentTypeDefinitionId());
328         
329         return USE_EDITOR;
330     }
331
332
333     /**
334      * This method moves an content type asset key down one step.
335      */

336
337     public String JavaDoc doMoveAssetKeyDown() throws Exception JavaDoc
338     {
339         this.initialize(getContentTypeDefinitionId());
340
341         try
342         {
343             Document JavaDoc document = createDocumentFromDefinition();
344
345             String JavaDoc attributesXPath = "/xs:schema/xs:simpleType[@name = '" + ContentTypeDefinitionController.ASSET_KEYS + "']/xs:restriction/xs:enumeration[@value='" + this.assetKey + "']";
346             NodeList JavaDoc anl = XPathAPI.selectNodeList(document.getDocumentElement(), attributesXPath);
347             if(anl != null && anl.getLength() > 0)
348             {
349                 Element JavaDoc element = (Element JavaDoc)anl.item(0);
350                 Node JavaDoc parentElement = element.getParentNode();
351                 Node JavaDoc nextSibling = element.getNextSibling();
352                 if(nextSibling != null)
353                 {
354                     parentElement.removeChild(nextSibling);
355                     parentElement.insertBefore(nextSibling, element);
356                 }
357             }
358
359             saveUpdatedDefinition(document);
360         }
361         catch(Exception JavaDoc e)
362         {
363             e.printStackTrace();
364         }
365
366         this.initialize(getContentTypeDefinitionId());
367         return USE_EDITOR;
368     }
369
370
371     public String JavaDoc doDeleteAttributeParameterValue() throws Exception JavaDoc
372     {
373         this.initialize(getContentTypeDefinitionId());
374
375         try
376         {
377             Document JavaDoc document = createDocumentFromDefinition();
378
379             String JavaDoc attributesXPath = "/xs:schema/xs:complexType/xs:all/xs:element/xs:complexType/xs:all/xs:element[@name='" + this.attributeName + "']/xs:annotation/xs:appinfo/params/param[@id='" + this.attributeParameterId +"']/values/value[@id='" + this.attributeParameterValueId + "']";
380             NodeList JavaDoc anl = org.apache.xpath.XPathAPI.selectNodeList(document.getDocumentElement(), attributesXPath);
381             if(anl != null && anl.getLength() > 0)
382             {
383                 Element JavaDoc element = (Element JavaDoc)anl.item(0);
384                 element.getParentNode().removeChild(element);
385             }
386
387             saveUpdatedDefinition(document);
388         }
389         catch(Exception JavaDoc e)
390         {
391             e.printStackTrace();
392         }
393
394         this.initialize(getContentTypeDefinitionId());
395         return USE_EDITOR;
396     }
397
398     public String JavaDoc doInsertAttributeParameterValue() throws Exception JavaDoc
399     {
400         this.initialize(getContentTypeDefinitionId());
401
402         try
403         {
404             Document JavaDoc document = createDocumentFromDefinition();
405
406             String JavaDoc attributesXPath = "/xs:schema/xs:complexType/xs:all/xs:element/xs:complexType/xs:all/xs:element[@name='" + this.attributeName + "']/xs:annotation/xs:appinfo/params/param[@id='" + this.attributeParameterId +"']/values";
407             NodeList JavaDoc anl = org.apache.xpath.XPathAPI.selectNodeList(document.getDocumentElement(), attributesXPath);
408             if(anl != null && anl.getLength() > 0)
409             {
410                 Element JavaDoc element = (Element JavaDoc)anl.item(0);
411                 Element JavaDoc newValue = document.createElement("value");
412                 newValue.setAttribute("id", getRandomName());
413                 newValue.setAttribute("label", getRandomName());
414                 element.appendChild(newValue);
415             }
416
417             saveUpdatedDefinition(document);
418         }
419         catch(Exception JavaDoc e)
420         {
421             e.printStackTrace();
422         }
423
424         this.initialize(getContentTypeDefinitionId());
425         return USE_EDITOR;
426     }
427
428     /**
429      * We validate that ' ', '.', ''', '"' is not used in the attribute name as that will break the javascripts later.
430      */

431
432     public String JavaDoc doUpdateAttribute() throws Exception JavaDoc
433     {
434         ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();
435         if(this.newAttributeName.indexOf(" ") > -1 || this.newAttributeName.indexOf(".") > -1 || this.newAttributeName.indexOf("'") > -1 || this.newAttributeName.indexOf("\"") > -1)
436         {
437             ceb.add(new ConstraintException("ContentTypeAttribute.updateAction", "3500"));
438         }
439
440         ceb.throwIfNotEmpty();
441
442
443         this.initialize(getContentTypeDefinitionId());
444
445         try
446         {
447             Document JavaDoc document = createDocumentFromDefinition();
448
449             //Updating the content attribute
450
String JavaDoc[] extraParameterNames = getRequest().getParameterValues("parameterNames");
451             if(extraParameterNames != null)
452             {
453                 for(int i=0; i < extraParameterNames.length; i++)
454                 {
455                     String JavaDoc extraParameterName = extraParameterNames[i];
456                     String JavaDoc value = getRequest().getParameter(extraParameterName);
457
458                     String JavaDoc extraParametersXPath = "/xs:schema/xs:complexType/xs:all/xs:element/xs:complexType/xs:all/xs:element[@name='" + this.attributeName + "']/xs:annotation/xs:appinfo/params/param[@id='" + extraParameterName +"']/values/value";
459                     NodeList JavaDoc extraParamsNodeList = org.apache.xpath.XPathAPI.selectNodeList(document.getDocumentElement(), extraParametersXPath);
460                     if(extraParamsNodeList != null && extraParamsNodeList.getLength() > 0)
461                     {
462                         Element JavaDoc element = (Element JavaDoc)extraParamsNodeList.item(0);
463
464                         if(extraParameterName.equalsIgnoreCase("values") && (this.inputTypeId.equalsIgnoreCase("select") || this.inputTypeId.equalsIgnoreCase("checkbox") || this.inputTypeId.equalsIgnoreCase("radiobutton")))
465                         {
466                             ((Element JavaDoc)element.getParentNode().getParentNode()).setAttribute("inputTypeId", "1");
467                         }
468                         else
469                         {
470                             ((Element JavaDoc)element.getParentNode().getParentNode()).setAttribute("inputTypeId", "0");
471                         }
472
473                         if(((Element JavaDoc)element.getParentNode().getParentNode()).getAttribute("inputTypeId").equals("0"))
474                         {
475                             if(this.currentContentTypeEditorViewLanguageCode != null && this.currentContentTypeEditorViewLanguageCode.length() > 0)
476                             {
477                                 element.setAttribute("label_" + this.currentContentTypeEditorViewLanguageCode, value);
478                             }
479                             else
480                             {
481                                 element.setAttribute("label", value);
482                             }
483                         }
484                     }
485                 }
486             }
487
488             //Updating the name and type
489
String JavaDoc attributeXPath = "/xs:schema/xs:complexType/xs:all/xs:element/xs:complexType/xs:all/xs:element[@name='" + this.attributeName + "']";
490             NodeList JavaDoc anl = org.apache.xpath.XPathAPI.selectNodeList(document.getDocumentElement(), attributeXPath);
491             if(anl != null && anl.getLength() > 0)
492             {
493                 Element JavaDoc element = (Element JavaDoc)anl.item(0);
494                 element.setAttribute("name", this.newAttributeName);
495                 element.setAttribute("type", this.inputTypeId);
496             }
497
498             try
499             {
500                 //Updating the validation part
501
String JavaDoc validationXPath = "//xs:complexType[@name='Validation']/xs:annotation/xs:appinfo/form-validation/formset/form/field[@property='" + this.attributeName + "']";
502                 NodeList JavaDoc fieldNodeList = org.apache.xpath.XPathAPI.selectNodeList(document.getDocumentElement(), validationXPath);
503                 if(fieldNodeList != null && fieldNodeList.getLength() > 0)
504                 {
505                     Element JavaDoc element = (Element JavaDoc)fieldNodeList.item(0);
506                     element.setAttribute("property", this.newAttributeName);
507                 }
508
509                 //Updating the dependent part
510
String JavaDoc validationDependentXPath = "//xs:complexType[@name='Validation']/xs:annotation/xs:appinfo/form-validation/formset/form/field[@depends='requiredif']/var/var-value";
511                 NodeList JavaDoc requiredIfValueNodeList = org.apache.xpath.XPathAPI.selectNodeList(document.getDocumentElement(), validationDependentXPath);
512                 if(requiredIfValueNodeList != null && requiredIfValueNodeList.getLength() > 0)
513                 {
514                     for(int i=0; i<requiredIfValueNodeList.getLength(); i++)
515                     {
516                         Element JavaDoc element = (Element JavaDoc)requiredIfValueNodeList.item(0);
517                         if(element.getFirstChild() != null && element.getFirstChild().getNodeValue() != null && element.getFirstChild().getNodeValue().equals(this.attributeName))
518                             element.getFirstChild().setNodeValue(this.newAttributeName);
519                     }
520                 }
521             }
522             catch(Exception JavaDoc ve)
523             {
524                 ve.printStackTrace();
525             }
526                 
527             saveUpdatedDefinition(document);
528         }
529         catch(Exception JavaDoc e)
530         {
531             e.printStackTrace();
532         }
533
534         this.initialize(getContentTypeDefinitionId());
535
536         return USE_EDITOR;
537     }
538
539
540     public String JavaDoc doUpdateAttributeParameterValue() throws Exception JavaDoc
541     {
542         this.initialize(getContentTypeDefinitionId());
543
544         try
545         {
546             Document JavaDoc document = createDocumentFromDefinition();
547
548             String JavaDoc parameterValueXPath = "/xs:schema/xs:complexType/xs:all/xs:element/xs:complexType/xs:all/xs:element[@name='" + this.attributeName + "']/xs:annotation/xs:appinfo/params/param[@id='" + this.attributeParameterId +"']/values/value[@id='" + this.attributeParameterValueId + "']";
549             NodeList JavaDoc parameterValuesNodeList = org.apache.xpath.XPathAPI.selectNodeList(document.getDocumentElement(), parameterValueXPath);
550             if(parameterValuesNodeList != null && parameterValuesNodeList.getLength() > 0)
551             {
552                 Element JavaDoc element = (Element JavaDoc)parameterValuesNodeList.item(0);
553                 element.setAttribute("id", this.newAttributeParameterValueId);
554
555                 if(this.currentContentTypeEditorViewLanguageCode != null && this.currentContentTypeEditorViewLanguageCode.length() > 0)
556                     element.setAttribute("label_" + this.currentContentTypeEditorViewLanguageCode, this.attributeParameterValueLabel);
557                 else
558                     element.setAttribute("label", this.attributeParameterValueLabel);
559             }
560
561             saveUpdatedDefinition(document);
562         }
563         catch(Exception JavaDoc e)
564         {
565             e.printStackTrace();
566         }
567
568         this.initialize(getContentTypeDefinitionId());
569         return USE_EDITOR;
570     }
571
572
573     public String JavaDoc doInsertAttributeValidator() throws Exception JavaDoc
574     {
575         this.initialize(getContentTypeDefinitionId());
576
577         try
578         {
579             Document JavaDoc document = createDocumentFromDefinition();
580
581             String JavaDoc validatorName = this.getRequest().getParameter("validatorName");
582             
583             if(validatorName != null && !validatorName.equalsIgnoreCase(""))
584             {
585                 String JavaDoc validatorsXPath = "/xs:schema/xs:complexType[@name = 'Validation']/xs:annotation/xs:appinfo/form-validation/formset/form";
586                 Node JavaDoc formNode = org.apache.xpath.XPathAPI.selectSingleNode(document.getDocumentElement(), validatorsXPath);
587                 if(formNode != null)
588                 {
589                     Element JavaDoc element = (Element JavaDoc)formNode;
590                     
591                     Element JavaDoc newField = document.createElement("field");
592                     newField.setAttribute("property", this.attributeName);
593                     newField.setAttribute("depends", validatorName);
594
595                     String JavaDoc errorKey = null;
596                     
597                     if(validatorName.equals("required"))
598                     {
599                         errorKey = "300"; //Required
600
}
601                     else if(validatorName.equals("requiredif"))
602                     {
603                         errorKey = "300"; //Required
604

605                         Element JavaDoc newVar = document.createElement("var");
606                         Element JavaDoc varNameElement = createTextElement(document, "var-name", "dependent");
607                         Element JavaDoc varValueElement = createTextElement(document, "var-value", "AttributeName");
608                         newVar.appendChild(varNameElement);
609                         newVar.appendChild(varValueElement);
610                         newField.appendChild(newVar);
611                     }
612                     else if(validatorName.equals("matchRegexp"))
613                     {
614                         errorKey = "307"; //Invalid format
615

616                         Element JavaDoc newVar = document.createElement("var");
617                         Element JavaDoc varNameElement = createTextElement(document, "var-name", "regexp");
618                         Element JavaDoc varValueElement = createTextElement(document, "var-value", ".*");
619                         newVar.appendChild(varNameElement);
620                         newVar.appendChild(varValueElement);
621                         newField.appendChild(newVar);
622                     }
623
624                     Element JavaDoc newMessage = document.createElement("msg");
625                     newMessage.setAttribute("name", validatorName);
626                     newMessage.setAttribute("key", errorKey);
627                     newField.appendChild(newMessage);
628                     
629                     element.appendChild(newField);
630                 }
631             }
632             
633             saveUpdatedDefinition(document);
634         }
635         catch(Exception JavaDoc e)
636         {
637             e.printStackTrace();
638         }
639
640         this.initialize(getContentTypeDefinitionId());
641         return USE_EDITOR;
642     }
643
644     public String JavaDoc doUpdateAttributeValidatorArguments() throws Exception JavaDoc
645     {
646         this.initialize(getContentTypeDefinitionId());
647
648         try
649         {
650             Document JavaDoc document = createDocumentFromDefinition();
651
652             int i = 0;
653             String JavaDoc attributeValidatorName = this.getRequest().getParameter("attributeValidatorName");
654             String JavaDoc argumentName = this.getRequest().getParameter(i + "_argumentName");
655             
656             while(argumentName != null && !argumentName.equalsIgnoreCase(""))
657             {
658                 String JavaDoc argumentValue = this.getRequest().getParameter(i + "_argumentValue");
659                 
660                 String JavaDoc validatorsXPath = "/xs:schema/xs:complexType[@name = 'Validation']/xs:annotation/xs:appinfo/form-validation/formset/form/field[@property = '" + attributeName + "'][@depends = '" + attributeValidatorName + "']";
661                 Node JavaDoc fieldNode = org.apache.xpath.XPathAPI.selectSingleNode(document.getDocumentElement(), validatorsXPath);
662                 if(fieldNode != null)
663                 {
664                     Element JavaDoc element = (Element JavaDoc)fieldNode;
665                     NodeList JavaDoc nl = element.getElementsByTagName("var");
666                     for(int nlIndex=0; nlIndex < nl.getLength(); nlIndex++)
667                     {
668                         Node JavaDoc node = (Node JavaDoc)nl.item(nlIndex);
669                         element.removeChild(node);
670                     }
671                     
672                     Element JavaDoc newVar = document.createElement("var");
673                     
674                     Element JavaDoc varNameElement = createTextElement(document, "var-name", argumentName);
675                     Element JavaDoc varValueElement = createTextElement(document, "var-value", argumentValue);
676                     newVar.appendChild(varNameElement);
677                     newVar.appendChild(varValueElement);
678                     
679                     element.appendChild(newVar);
680                 }
681                 
682                 i++;
683                 argumentName = this.getRequest().getParameter(i + "_argumentName");
684             }
685             
686             saveUpdatedDefinition(document);
687         }
688         catch(Exception JavaDoc e)
689         {
690             e.printStackTrace();
691         }
692
693         this.initialize(getContentTypeDefinitionId());
694         return USE_EDITOR;
695     }
696
697     public String JavaDoc doDeleteAttributeValidator() throws Exception JavaDoc
698     {
699         this.initialize(getContentTypeDefinitionId());
700
701         try
702         {
703             Document JavaDoc document = createDocumentFromDefinition();
704
705             int i = 0;
706             String JavaDoc attributeValidatorName = this.getRequest().getParameter("attributeValidatorName");
707             if(attributeValidatorName != null && !attributeValidatorName.equalsIgnoreCase(""))
708             {
709                 String JavaDoc validatorsXPath = "/xs:schema/xs:complexType[@name = 'Validation']/xs:annotation/xs:appinfo/form-validation/formset/form/field[@property = '" + attributeName + "'][@depends = '" + attributeValidatorName + "']";
710                 Node JavaDoc fieldNode = org.apache.xpath.XPathAPI.selectSingleNode(document.getDocumentElement(), validatorsXPath);
711                 if(fieldNode != null)
712                 {
713                     Element JavaDoc element = (Element JavaDoc)fieldNode;
714                     element.getParentNode().removeChild(element);
715                 }
716             }
717             
718             saveUpdatedDefinition(document);
719         }
720         catch(Exception JavaDoc e)
721         {
722             e.printStackTrace();
723         }
724
725         this.initialize(getContentTypeDefinitionId());
726         return USE_EDITOR;
727     }
728
729     
730     //-------------------------------------------------------------------------------------
731
// Methods dealing with extra keys
732
//
733
// TODO: I think it makes sense to move all methods dealing with ContentTypeDefinition XML
734
// TODO: into the ContentTypeDefinitionController, that way only ONE class knows about the
735
// TODO: XML structure and we can make adequate tests
736
//-------------------------------------------------------------------------------------
737
/**
738      * Gets the list of defined assetKeys.
739      */

740     public List JavaDoc getDefinedAssetKeys()
741     {
742         return ContentTypeDefinitionController.getController().getDefinedAssetKeys(contentTypeDefinitionVO.getSchemaValue());
743     }
744
745     /**
746      * Gets the list of defined categoryKeys, also populate the category name for the UI.
747      */

748     public List JavaDoc getDefinedCategoryKeys() throws Exception JavaDoc
749     {
750         List JavaDoc categoryKeys = ContentTypeDefinitionController.getController().getDefinedCategoryKeys(contentTypeDefinitionVO.getSchemaValue());
751         for (Iterator JavaDoc iter = categoryKeys.iterator(); iter.hasNext();)
752         {
753             CategoryAttribute info = (CategoryAttribute) iter.next();
754             if(info.getCategoryId() != null)
755                 info.setCategoryName(getCategoryName(info.getCategoryId()));
756             else
757                 info.setCategoryName("Undefined");
758         }
759         return categoryKeys;
760     }
761
762     /**
763      * Return the Category name, if we cannot find the category name (id not an int, bad id, etc)
764      * then do not barf, but return a user friendly name. This can happen if someone removes a
765      * category that is references by a content type definition.
766      */

767     public String JavaDoc getCategoryName(Integer JavaDoc id)
768     {
769         try
770         {
771             return categoryController.findById(id).getName();
772         }
773         catch(SystemException e)
774         {
775             return "Category not found";
776         }
777     }
778
779     public String JavaDoc doInsertAssetKey() throws Exception JavaDoc
780     {
781         this.initialize(getContentTypeDefinitionId());
782
783         try
784         {
785             Document JavaDoc document = createDocumentFromDefinition();
786             createNewEnumerationKey(document, ContentTypeDefinitionController.ASSET_KEYS);
787             saveUpdatedDefinition(document);
788         }
789         catch(Exception JavaDoc e)
790         {
791             logger.warn("Error adding asset key: ", e);
792         }
793
794         this.initialize(getContentTypeDefinitionId());
795         return USE_EDITOR;
796     }
797
798     public String JavaDoc doInsertCategoryKey() throws Exception JavaDoc
799     {
800         this.initialize(getContentTypeDefinitionId());
801
802         try
803         {
804             Document JavaDoc document = createDocumentFromDefinition();
805             Element JavaDoc enumeration = createNewEnumerationKey(document, ContentTypeDefinitionController.CATEGORY_KEYS);
806
807             Element JavaDoc annotation = document.createElement("xs:annotation");
808             Element JavaDoc appinfo = document.createElement("xs:appinfo");
809             Element JavaDoc params = document.createElement("params");
810
811             enumeration.appendChild(annotation);
812             annotation.appendChild(appinfo);
813             appinfo.appendChild(params);
814             params.appendChild(createTextElement(document, "title", getRandomName()));
815             params.appendChild(createTextElement(document, "description", getRandomName()));
816             params.appendChild(createTextElement(document, "categoryId", ""));
817
818             saveUpdatedDefinition(document);
819         }
820         catch(Exception JavaDoc e)
821         {
822             logger.warn("Error adding categories key: ", e);
823         }
824
825         this.initialize(getContentTypeDefinitionId());
826         return USE_EDITOR;
827     }
828
829
830
831     public String JavaDoc doUpdateAssetKey() throws Exception JavaDoc
832     {
833         initialize(getContentTypeDefinitionId());
834         try
835         {
836             Document JavaDoc document = createDocumentFromDefinition();
837             updateAssetEnumerationKey(document, ContentTypeDefinitionController.ASSET_KEYS, getAssetKey(), getNewAssetKey(), this.description, this.maximumSize, this.allowedContentTypes, this.imageWidth, this.imageHeight);
838             saveUpdatedDefinition(document);
839         }
840         catch(Exception JavaDoc e)
841         {
842             logger.warn("Error updating asset key: ", e);
843         }
844
845         initialize(getContentTypeDefinitionId());
846         return USE_EDITOR;
847     }
848
849     public String JavaDoc doUpdateCategoryKey() throws Exception JavaDoc
850     {
851         initialize(getContentTypeDefinitionId());
852
853         try
854         {
855             Document JavaDoc document = createDocumentFromDefinition();
856             Element JavaDoc enumeration = updateEnumerationKey(document, ContentTypeDefinitionController.CATEGORY_KEYS, getCategoryKey(), getNewCategoryKey());
857
858             if(enumeration != null)
859             {
860                 Element JavaDoc title = (Element JavaDoc)XPathAPI.selectSingleNode(enumeration, "xs:annotation/xs:appinfo/params/title");
861                 setTextElement(title, getSingleParameter("title"));
862
863                 Element JavaDoc description = (Element JavaDoc)XPathAPI.selectSingleNode(enumeration, "xs:annotation/xs:appinfo/params/description");
864                 setTextElement(description, getSingleParameter("description"));
865
866                 Element JavaDoc categoryId = (Element JavaDoc)XPathAPI.selectSingleNode(enumeration, "xs:annotation/xs:appinfo/params/categoryId");
867                 setTextElement(categoryId, getSingleParameter("categoryId"));
868             }
869
870             saveUpdatedDefinition(document);
871         }
872         catch(Exception JavaDoc e)
873         {
874             logger.warn("Error updating category key: ", e);
875         }
876
877         initialize(getContentTypeDefinitionId());
878         return USE_EDITOR;
879     }
880
881     public String JavaDoc doDeleteAssetKey() throws Exception JavaDoc
882     {
883         return deleteKey(ContentTypeDefinitionController.ASSET_KEYS, getAssetKey());
884     }
885
886     public String JavaDoc doDeleteCategoryKey() throws Exception JavaDoc
887     {
888         return deleteKey(ContentTypeDefinitionController.CATEGORY_KEYS, getCategoryKey());
889     }
890
891     private String JavaDoc deleteKey(String JavaDoc keyType, String JavaDoc key) throws Exception JavaDoc
892     {
893         this.initialize(getContentTypeDefinitionId());
894
895         try
896         {
897             Document JavaDoc document = createDocumentFromDefinition();
898
899             String JavaDoc attributesXPath = "/xs:schema/xs:simpleType[@name = '" + keyType + "']/xs:restriction/xs:enumeration[@value='" + key + "']";
900             NodeList JavaDoc anl = XPathAPI.selectNodeList(document.getDocumentElement(), attributesXPath);
901             if(anl != null && anl.getLength() > 0)
902             {
903                 Element JavaDoc element = (Element JavaDoc)anl.item(0);
904                 element.getParentNode().removeChild(element);
905             }
906
907             saveUpdatedDefinition(document);
908         }
909         catch(Exception JavaDoc e)
910         {
911             logger.warn("Error updating key: " + keyType, e);
912         }
913
914         this.initialize(getContentTypeDefinitionId());
915         return USE_EDITOR;
916     }
917
918     /**
919      * Returns the CategoryController, used by the ContentTypeDefinitionEditor
920      */

921     public CategoryController getCategoryController()
922     {
923         return categoryController;
924     }
925
926     /**
927      * Gets the list of all system categories.
928      */

929     public List JavaDoc getAllCategories() throws SystemException
930     {
931         return getCategoryController().findAllActiveCategories();
932     }
933
934     //-------------------------------------------------------------------------------------
935
// XML Helper Methods
936
//-------------------------------------------------------------------------------------
937
/**
938      * Consolidate the Document creation
939      */

940     private Document JavaDoc createDocumentFromDefinition() throws SAXException JavaDoc, IOException JavaDoc
941     {
942         String JavaDoc contentTypeDefinitionString = this.contentTypeDefinitionVO.getSchemaValue();
943         InputSource JavaDoc xmlSource = new InputSource JavaDoc(new StringReader JavaDoc(contentTypeDefinitionString));
944         DOMParser parser = new DOMParser();
945         parser.parse(xmlSource);
946         return parser.getDocument();
947     }
948
949     /**
950      * Consolidate the update of a ContentTypeDefinition Document to the persistence mechanism
951      */

952     private void saveUpdatedDefinition(Document JavaDoc document) throws ConstraintException, SystemException
953     {
954         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
955         XMLHelper.serializeDom(document.getDocumentElement(), sb);
956         this.contentTypeDefinitionVO.setSchemaValue(sb.toString());
957         ContentTypeDefinitionController.getController().update(contentTypeDefinitionVO);
958     }
959
960     /**
961      * Creates an <xs:enumeration> element with the specified key name
962      * @return The Element if child changes are needed, null if the element coudl not be created
963      */

964     private Element JavaDoc createNewEnumerationKey(Document JavaDoc document, String JavaDoc keyType) throws TransformerException JavaDoc
965     {
966         Element JavaDoc enumeration = null;
967         String JavaDoc assetKeysXPath = "/xs:schema/xs:simpleType[@name = '" + keyType + "']/xs:restriction";
968         NodeList JavaDoc anl = XPathAPI.selectNodeList(document.getDocumentElement(), assetKeysXPath);
969
970         Element JavaDoc keyRestriction = null;
971
972         if(anl != null && anl.getLength() > 0)
973         {
974             keyRestriction = (Element JavaDoc)anl.item(0);
975         }
976         else
977         {
978             //The key type was not defined so we create it first.
979
String JavaDoc schemaXPath = "/xs:schema";
980             NodeList JavaDoc schemaNL = XPathAPI.selectNodeList(document.getDocumentElement(), schemaXPath);
981             if(schemaNL != null && schemaNL.getLength() > 0)
982             {
983                 Element JavaDoc schemaElement = (Element JavaDoc)schemaNL.item(0);
984
985                 Element JavaDoc keySimpleType = document.createElement("xs:simpleType");
986                 keySimpleType.setAttribute("name", keyType);
987
988                 keyRestriction = document.createElement("xs:restriction");
989                 keyRestriction.setAttribute("base", "xs:string");
990
991                 keySimpleType.appendChild(keyRestriction);
992                 schemaElement.appendChild(keySimpleType);
993             }
994         }
995
996         enumeration = document.createElement("xs:enumeration");
997         enumeration.setAttribute("value", getRandomName());
998         keyRestriction.appendChild(enumeration);
999         return enumeration;
1000    }
1001
1002    /**
1003     * Find an <xs:enumeration> element and update the key value.
1004     * @return The Element if child changes are needed, null if the element is not found
1005     */

1006    private Element JavaDoc updateEnumerationKey(Document JavaDoc document, String JavaDoc keyType, String JavaDoc oldKey, String JavaDoc newKey) throws TransformerException JavaDoc
1007    {
1008        String JavaDoc attributesXPath = "/xs:schema/xs:simpleType[@name = '" + keyType + "']/xs:restriction/xs:enumeration[@value='" + oldKey + "']";
1009        NodeList JavaDoc anl = XPathAPI.selectNodeList(document.getDocumentElement(), attributesXPath);
1010        if(anl != null && anl.getLength() > 0)
1011        {
1012            Element JavaDoc enumeration = (Element JavaDoc)anl.item(0);
1013            enumeration.setAttribute("value", newKey);
1014            return enumeration;
1015        }
1016
1017        return null;
1018    }
1019
1020    /**
1021     * Find an <xs:enumeration> element and update the key value.
1022     * @return The Element if child changes are needed, null if the element is not found
1023     */

1024    private Element JavaDoc updateAssetEnumerationKey(Document JavaDoc document, String JavaDoc keyType, String JavaDoc oldKey, String JavaDoc newKey, String JavaDoc description, Integer JavaDoc maximumSize, String JavaDoc allowedContentTypes, String JavaDoc imageWidth, String JavaDoc imageHeight) throws TransformerException JavaDoc
1025    {
1026        if(description == null)
1027            description = "Undefined";
1028        if(maximumSize == null)
1029            maximumSize = new Integer JavaDoc(100);
1030        if(allowedContentTypes == null)
1031            allowedContentTypes = "*";
1032        if(imageWidth == null)
1033            imageWidth = "*";
1034        if(imageHeight == null)
1035            imageHeight = "*";
1036        
1037        
1038        String JavaDoc attributesXPath = "/xs:schema/xs:simpleType[@name = '" + keyType + "']/xs:restriction/xs:enumeration[@value='" + oldKey + "']";
1039        NodeList JavaDoc anl = XPathAPI.selectNodeList(document.getDocumentElement(), attributesXPath);
1040        if(anl != null && anl.getLength() > 0)
1041        {
1042            Element JavaDoc enumeration = (Element JavaDoc)anl.item(0);
1043            enumeration.setAttribute("value", newKey);
1044            
1045            Element JavaDoc descriptionElement = (Element JavaDoc)XPathAPI.selectSingleNode(enumeration, "xs:annotation/xs:appinfo/params/description");
1046            Element JavaDoc maximumSizeElement = (Element JavaDoc)XPathAPI.selectSingleNode(enumeration, "xs:annotation/xs:appinfo/params/maximumSize");
1047            Element JavaDoc allowedContentTypesElement = (Element JavaDoc)XPathAPI.selectSingleNode(enumeration, "xs:annotation/xs:appinfo/params/allowedContentTypes");
1048            Element JavaDoc imageWidthElement = (Element JavaDoc)XPathAPI.selectSingleNode(enumeration, "xs:annotation/xs:appinfo/params/imageWidth");
1049            Element JavaDoc imageHeightElement = (Element JavaDoc)XPathAPI.selectSingleNode(enumeration, "xs:annotation/xs:appinfo/params/imageHeight");
1050
1051            if(descriptionElement == null)
1052            {
1053                Element JavaDoc annotation = document.createElement("xs:annotation");
1054                Element JavaDoc appinfo = document.createElement("xs:appinfo");
1055                Element JavaDoc params = document.createElement("params");
1056    
1057                enumeration.appendChild(annotation);
1058                annotation.appendChild(appinfo);
1059                appinfo.appendChild(params);
1060                
1061                descriptionElement = createTextElement(document, "description", getRandomName());
1062                maximumSizeElement = createTextElement(document, "maximumSize", maximumSize.toString());
1063                allowedContentTypesElement = createTextElement(document, "allowedContentTypes", allowedContentTypes);
1064                imageWidthElement = createTextElement(document, "imageWidth", imageWidth);
1065                imageHeightElement = createTextElement(document, "imageHeight", imageHeight);
1066                
1067                params.appendChild(descriptionElement);
1068                params.appendChild(maximumSizeElement);
1069                params.appendChild(allowedContentTypesElement);
1070                params.appendChild(imageWidthElement);
1071                params.appendChild(imageHeightElement);
1072            }
1073            else
1074            {
1075                setTextElement(descriptionElement, description);
1076                setTextElement(maximumSizeElement, maximumSize.toString());
1077                setTextElement(allowedContentTypesElement, allowedContentTypes);
1078                setTextElement(imageWidthElement, imageWidth);
1079                setTextElement(imageHeightElement, imageHeight);
1080            }
1081            
1082            return enumeration;
1083        }
1084
1085        return null;
1086    }
1087    
1088    /**
1089     * Creates a new text element
1090     */

1091    private Element JavaDoc createTextElement(Document JavaDoc document, String JavaDoc tagName, String JavaDoc value)
1092    {
1093        Element JavaDoc e = document.createElement(tagName);
1094        e.appendChild(document.createTextNode(value));
1095        return e;
1096    }
1097
1098    /**
1099     * Updates the text child of an element, creating it if it needs to.
1100     */

1101    private void setTextElement(Element JavaDoc e, String JavaDoc value)
1102    {
1103        if(e.getFirstChild() != null)
1104            e.getFirstChild().setNodeValue(value);
1105        else
1106             e.appendChild(e.getOwnerDocument().createTextNode(value));
1107    }
1108
1109
1110    /**
1111     * Generates a random name
1112     */

1113    private String JavaDoc getRandomName()
1114    {
1115        return "undefined" + (int)(Math.random() * 100);
1116    }
1117
1118
1119    //-------------------------------------------------------------------------------------
1120
// Attribute Accessors
1121
//-------------------------------------------------------------------------------------
1122
public Integer JavaDoc getContentTypeDefinitionId()
1123    {
1124        return this.contentTypeDefinitionVO.getContentTypeDefinitionId();
1125    }
1126
1127    public void setContentTypeDefinitionId(Integer JavaDoc contentTypeDefinitionId) throws Exception JavaDoc
1128    {
1129        this.contentTypeDefinitionVO.setContentTypeDefinitionId(contentTypeDefinitionId);
1130    }
1131
1132    public String JavaDoc getTitle()
1133    {
1134        return this.title;
1135    }
1136
1137    public void setTitle(String JavaDoc title)
1138    {
1139        this.title = title;
1140    }
1141
1142    public String JavaDoc getName()
1143    {
1144        return this.contentTypeDefinitionVO.getName();
1145    }
1146
1147    public String JavaDoc getSchemaValue()
1148    {
1149        return this.contentTypeDefinitionVO.getSchemaValue();
1150    }
1151
1152    public Integer JavaDoc getType()
1153    {
1154        return this.contentTypeDefinitionVO.getType();
1155    }
1156
1157    /**
1158     * This method returns the attributes in the content type definition for generation.
1159     */

1160
1161    public List JavaDoc getContentTypeAttributes()
1162    {
1163        return this.attributes;
1164    }
1165
1166    public String JavaDoc getInputTypeId()
1167    {
1168        return inputTypeId;
1169    }
1170
1171    public void setInputTypeId(String JavaDoc string)
1172    {
1173        inputTypeId = string;
1174    }
1175
1176    public String JavaDoc getAttributeName()
1177    {
1178        return this.attributeName;
1179    }
1180
1181    public void setAttributeName(String JavaDoc attributeName)
1182    {
1183        this.attributeName = attributeName;
1184    }
1185
1186    public void setNewAttributeName(String JavaDoc newAttributeName)
1187    {
1188        this.newAttributeName = newAttributeName;
1189    }
1190
1191    public String JavaDoc getAttributeParameterValueId()
1192    {
1193        return attributeParameterValueId;
1194    }
1195
1196    public void setAttributeParameterValueId(String JavaDoc string)
1197    {
1198        attributeParameterValueId = string;
1199    }
1200
1201    public String JavaDoc getAttributeParameterId()
1202    {
1203        return attributeParameterId;
1204    }
1205
1206    public void setAttributeParameterId(String JavaDoc string)
1207    {
1208        attributeParameterId = string;
1209    }
1210
1211    public String JavaDoc getAttributeParameterValueLabel()
1212    {
1213        return attributeParameterValueLabel;
1214    }
1215
1216    public String JavaDoc getNewAttributeParameterValueId()
1217    {
1218        return newAttributeParameterValueId;
1219    }
1220
1221    public void setAttributeParameterValueLabel(String JavaDoc string)
1222    {
1223        attributeParameterValueLabel = string;
1224    }
1225
1226    public void setNewAttributeParameterValueId(String JavaDoc string)
1227    {
1228        newAttributeParameterValueId = string;
1229    }
1230
1231    public String JavaDoc getAttributeParameterValueLocale()
1232    {
1233        return attributeParameterValueLocale;
1234    }
1235
1236    public void setAttributeParameterValueLocale(String JavaDoc string)
1237    {
1238        attributeParameterValueLocale = string;
1239    }
1240
1241    public String JavaDoc getAttributeToExpand()
1242    {
1243        return attributeToExpand;
1244    }
1245
1246    public void setAttributeToExpand(String JavaDoc string)
1247    {
1248        attributeToExpand = string;
1249    }
1250
1251    public String JavaDoc getCurrentContentTypeEditorViewLanguageCode()
1252    {
1253        return currentContentTypeEditorViewLanguageCode;
1254    }
1255
1256    public void setCurrentContentTypeEditorViewLanguageCode(String JavaDoc string)
1257    {
1258        currentContentTypeEditorViewLanguageCode = string;
1259    }
1260
1261    public List JavaDoc getAvailableLanguages()
1262    {
1263        return availableLanguages;
1264    }
1265
1266    public String JavaDoc getAssetKey() { return assetKey; }
1267    public void setAssetKey(String JavaDoc s) { assetKey = s; }
1268
1269    public String JavaDoc getNewAssetKey() { return newAssetKey; }
1270    public void setNewAssetKey(String JavaDoc s) { newAssetKey = s; }
1271
1272    public String JavaDoc getCategoryKey() { return categoryKey; }
1273    public void setCategoryKey(String JavaDoc s) { categoryKey = s; }
1274
1275    public String JavaDoc getNewCategoryKey() { return newCategoryKey; }
1276    public void setNewCategoryKey(String JavaDoc s) { newCategoryKey = s; }
1277
1278    public String JavaDoc getErrorKey()
1279    {
1280        return "ContentTypeAttribute.updateAction";
1281    }
1282
1283    public String JavaDoc getReturnAddress()
1284    {
1285        return "ViewListContentTypeDefinition.action";
1286    }
1287
1288    public String JavaDoc getAllowedContentTypes()
1289    {
1290        return allowedContentTypes;
1291    }
1292
1293    public void setAllowedContentTypes(String JavaDoc assetContentType)
1294    {
1295        this.allowedContentTypes = assetContentType;
1296    }
1297    
1298    public String JavaDoc getImageHeight()
1299    {
1300        return imageHeight;
1301    }
1302    
1303    public void setImageHeight(String JavaDoc imageHeight)
1304    {
1305        this.imageHeight = imageHeight;
1306    }
1307    
1308    public String JavaDoc getImageWidth()
1309    {
1310        return imageWidth;
1311    }
1312    
1313    public void setImageWidth(String JavaDoc imageWidth)
1314    {
1315        this.imageWidth = imageWidth;
1316    }
1317    
1318    public Integer JavaDoc getMaximumSize()
1319    {
1320        return maximumSize;
1321    }
1322    
1323    public void setMaximumSize(Integer JavaDoc maximumSize)
1324    {
1325        this.maximumSize = maximumSize;
1326    }
1327    
1328    public void setDescription(String JavaDoc description)
1329    {
1330        this.description = description;
1331    }
1332    public List JavaDoc getActivatedName()
1333    {
1334        return activatedName;
1335    }
1336}
1337
Popular Tags