AnsweredAssumed Answered

defining your own basic data types

Question asked by multi_io on Sep 27, 2007
Latest reply on Sep 28, 2007 by davidc
I'm trying to define my own basic data types using <data-type> elements in my model schema XML file (is this supported officially?). Anyway, I'm getting a "Property type not recognised" repository fault when trying to create a node with properties having one of the newly defined data types. A stripped-down example follows:

Model definition (all data types are just mapped to java.lang.String for now):

<model name="s:simpleModel" xmlns="">

        <import uri="" prefix="cm" />

      <namespace uri="" prefix="s" />

      <data-type name="s:PN">
      <data-type name="s:SH">


      <type name="s:myObject">
            <property name="s:AccessionNumber">
            <property name="s:PatientName">



Creating an instance of s:myObject via the web service API (logged in as admin; compHome is an org.alfresco.webservice.types.Node referring to the "Company Home" folder):

String SIMPLE="";
Store STORE = new Store(Constants.WORKSPACE_STORE, "SpacesStore");

ParentReference pr = new ParentReference(STORE, null, compHome.getReference().getPath(), Constants.ASSOC_CONTAINS, Constants.createQNameString(SIMPLE, "testobj1"));
nameValue = Utils.createNamedValue(Constants.PROP_NAME, "My Test Object 1");
accNumberValue = Utils.createNamedValue(Constants.createQNameString(SIMPLE, "AccessionNumber"), "123456acc1");
patientNameValue =
Utils.createNamedValue(Constants.createQNameString(SIMPLE, "PatientName"), "John Doe");
contentProps = new NamedValue[] {nameValue, accNumberValue, patientNameValue};
createObj = new CMLCreate("ref1", pr, null, null, null, Constants.createQNameString(SIMPLE, "myObject"), contentProps);
cml = new CML();
cml.setCreate(new CMLCreate[] {createObj});
results = repoSvc.update(cml);

This results in:

faultCode: {}Server.generalException
   {}RepositoryFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>org.alfresco.error.AlfrescoRuntimeException: Property type not recognised:
   type: {}SH</ns1:message>
   at org.alfresco.repo.webservice.repository.RepositoryWebService.update(
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
   at java.lang.reflect.Method.invoke(

Why does this happen? Is defining your own data-types verboten? Are there performance penalties involved when doing this? It appears that the data-types/data-type elements aren't defined in modelSchema.xsd even though  dictionaryModel.xml uses them (to define all the standard data types).