mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- removing templating config file
- renamed create xml content type to create form - writing xsds and xsls into the data dictionary - using search to implement TemplatingService.getTempalteTypes() - adding fields to create form screen for the root tag name to use within the schema and for a display name within the dropdown (friendly non file name name) - using aspects from the wcmModel to categorize and relate templates and templateoutputmethods git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4014 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -31,83 +31,76 @@ import org.xml.sax.SAXException;
|
||||
public class TemplateTypeImpl
|
||||
implements TemplateType
|
||||
{
|
||||
private static final Log LOGGER = LogFactory.getLog(TemplateTypeImpl.class);
|
||||
private static final Log LOGGER = LogFactory.getLog(TemplateTypeImpl.class);
|
||||
|
||||
private transient Document schema;
|
||||
private final NodeRef schemaNodeRef;
|
||||
private final String name;
|
||||
private final String rootTagName;
|
||||
private final LinkedList<TemplateOutputMethod> outputMethods =
|
||||
new LinkedList<TemplateOutputMethod>();
|
||||
private final static LinkedList<TemplateInputMethod> INPUT_METHODS =
|
||||
new LinkedList<TemplateInputMethod>();
|
||||
|
||||
static
|
||||
{
|
||||
INPUT_METHODS.add(new XFormsInputMethod());
|
||||
}
|
||||
|
||||
public TemplateTypeImpl(final String name,
|
||||
final NodeRef schemaNodeRef,
|
||||
final String rootTagName)
|
||||
{
|
||||
this.name = name;
|
||||
this.schemaNodeRef = schemaNodeRef;
|
||||
this.rootTagName = rootTagName;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
private transient Document schema;
|
||||
private final NodeRef schemaNodeRef;
|
||||
private final String name;
|
||||
private final LinkedList<TemplateOutputMethod> outputMethods =
|
||||
new LinkedList<TemplateOutputMethod>();
|
||||
private final static LinkedList<TemplateInputMethod> INPUT_METHODS =
|
||||
new LinkedList<TemplateInputMethod>();
|
||||
public String getRootTagName()
|
||||
{
|
||||
return this.rootTagName;
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
INPUT_METHODS.add(new XFormsInputMethod());
|
||||
}
|
||||
|
||||
public TemplateTypeImpl(final String name,
|
||||
final NodeRef schemaNodeRef)
|
||||
{
|
||||
this.name = name;
|
||||
this.schemaNodeRef = schemaNodeRef;
|
||||
}
|
||||
public Document getSchema()
|
||||
{
|
||||
if (this.schema == null)
|
||||
{
|
||||
final TemplatingService ts = TemplatingService.getInstance();
|
||||
try
|
||||
{
|
||||
//XXXarielb maybe cloneNode instead?
|
||||
return /* this.schema = */ ts.parseXML(this.schemaNodeRef);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
return this.schema;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
public List<TemplateInputMethod> getInputMethods()
|
||||
{
|
||||
return INPUT_METHODS;
|
||||
}
|
||||
|
||||
public String /* URI */ getSchemaURI()
|
||||
{
|
||||
final javax.faces.context.FacesContext fc =
|
||||
javax.faces.context.FacesContext.getCurrentInstance();
|
||||
final javax.servlet.http.HttpSession session = (javax.servlet.http.HttpSession)
|
||||
fc.getExternalContext().getSession(true);
|
||||
|
||||
org.alfresco.web.bean.repository.User user = (org.alfresco.web.bean.repository.User)
|
||||
session.getAttribute(org.alfresco.web.app.servlet.AuthenticationHelper.AUTHENTICATION_USER);
|
||||
public void addOutputMethod(TemplateOutputMethod output)
|
||||
{
|
||||
this.outputMethods.add(output);
|
||||
}
|
||||
|
||||
String result = DownloadContentServlet.generateDownloadURL(this.schemaNodeRef, this.name + ".xsd");
|
||||
result += "?ticket=" + user.getTicket();
|
||||
return result;
|
||||
}
|
||||
public List<TemplateOutputMethod> getOutputMethods()
|
||||
{
|
||||
return this.outputMethods;
|
||||
}
|
||||
|
||||
public Document getSchema()
|
||||
{
|
||||
if (this.schema == null)
|
||||
{
|
||||
final TemplatingService ts = TemplatingService.getInstance();
|
||||
try
|
||||
{
|
||||
//XXXarielb maybe cloneNode instead?
|
||||
return /* this.schema = */ ts.parseXML(this.schemaNodeRef);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
return this.schema;
|
||||
}
|
||||
|
||||
public List<TemplateInputMethod> getInputMethods()
|
||||
{
|
||||
return INPUT_METHODS;
|
||||
}
|
||||
|
||||
public void addOutputMethod(TemplateOutputMethod output)
|
||||
{
|
||||
this.outputMethods.add(output);
|
||||
}
|
||||
|
||||
public List<TemplateOutputMethod> getOutputMethods()
|
||||
{
|
||||
return this.outputMethods;
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
return this.getName().hashCode();
|
||||
}
|
||||
public int hashCode()
|
||||
{
|
||||
return this.getName().hashCode();
|
||||
}
|
||||
}
|
@@ -301,7 +301,7 @@ public class XFormsBean
|
||||
LOGGER.debug("building xform for schema " + tt.getName());
|
||||
final Document result = builder.buildForm(xmlContent,
|
||||
schemaDocument,
|
||||
tt.getName());
|
||||
tt.getRootTagName());
|
||||
LOGGER.debug("generated xform: " + result);
|
||||
// LOGGER.debug(ts.writeXMLToString(result));
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user