Creating Custom Content Model for a XML file

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2011 05:32 AM
Hi. Am using Alfresco community version 3.2r.
I want to create a custom content model for the below xml file.
am able to upload xml files into alfresco using java application.while retriving i want to retrieve based on particular parameters such as address,zip,started number etc.
i have created a constants java file for creating new QNames
Normally if am using default alfresco content model we specify
but what in case of custom content model.
Anyone plz help me with this.
I want to create a custom content model for the below xml file.
<?xml version="1.0" encoding="UTF-8"?><SUBMISSION SUBMISSIONKEY="2EE"> <STARTED>1293168061201</STARTED> <FINISHED>1293168061203</FINISHED> <PROPERTIES KEY="F9"> <PROPERTY> <PROPERTYKEY>ADDRESS</PROPERTYKEY> <PROPERTYVALUE>202 HARTNELL PL</PROPERTYVALUE> </PROPERTY> <PROPERTY> <PROPERTYKEY>ZIP</PROPERTYKEY> <PROPERTYVALUE>6753</PROPERTYVALUE> </PROPERTY> </PROPERTIES></SUBMISSION>
am able to upload xml files into alfresco using java application.while retriving i want to retrieve based on particular parameters such as address,zip,started number etc.
i have created a constants java file for creating new QNames
import org.alfresco.service.namespace.QName;public class ExtractorConstants { // public static final String NAMESPACE_CONTENT_MODEL = "http://www.alfresco.org/model/content/1.0"; public static final QName DATE_STARTED = QName.createQName("", "STARTED"); public static final QName DATE_FINISHED = QName.createQName("", "FINISHED"); public static final QName ORDER_NUMBER = QName.createQName("", "SUBMISSIONKEY"); public static final QName ADDRESS=QName.createQName("", "ADDRESS"); public static final QName ZIP=QName.createQName("", "ZIP"); public static final QName FIRST_NAME=QName.createQName("", "ADRFNAME"); public static final QName LAST_NAME=QName.createQName("", "ADRLNAME");}
Normally if am using default alfresco content model we specify
public static final String PROP_NAME = createQNameString(NAMESPACE_CONTENT_MODEL, "name");
but what in case of custom content model.
Anyone plz help me with this.
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2011 05:36 AM
You would use your model rather than NAMESPACE_CONTENT_MODEL.
Typically you would define a class to contain the "constants" of you namespace/type/properties. Look at ContentModel.xml as an example.
Typically you would define a class to contain the "constants" of you namespace/type/properties. Look at ContentModel.xml as an example.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2011 02:50 AM
Hi..
i created a model customModel.xml in c:\Alfresco\tomcat\shared\classes\alfresco\extension.
Then in same directory i renamed custom-model-context.sample.xml to custom-model-context.xml.
When i start the server am getting the below error.Please help me.
i created a model customModel.xml in c:\Alfresco\tomcat\shared\classes\alfresco\extension.
Then in same directory i renamed custom-model-context.sample.xml to custom-model-context.xml.
When i start the server am getting the below error.Please help me.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extension.dictionaryBootstrap' defined in file [C:\Alfresco\tomcat\shared\classes\alfresco\extension\custom-model-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 04030001 Could not import bootstrap model alfresco/extension/customModel.xmlCaused by: org.alfresco.service.cmr.dictionary.DictionaryException: 04030001 Could not import bootstrap model alfresco/extension/customModel.xml at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:151) at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:108) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1242) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1208) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
