SEARCH-2454 Remove old lucene (#23)

This PR removes legacy Lucene code and dependency to the lucene 2.4.1 library.
The data type analysers were removed with an exception of the definitions in models (datadictionaryModel.xml and cmisModel.xml) to be backwards compatible with existing components (like older versions of Search Services) and to ensure the current old-style models can still work with repository and pass validation.
This commit is contained in:
Alex Mukha
2020-10-19 14:15:27 +01:00
committed by GitHub
parent 88cb7a0be2
commit 7ddb31d5e8
161 changed files with 2738 additions and 16852 deletions

View File

@@ -117,12 +117,6 @@ public class CustomModelDefinitionImpl implements CustomModelDefinition
return this.active;
}
@Override
public String getAnalyserResourceBundleName()
{
return m2ModelDefinition.getAnalyserResourceBundleName();
}
@Override
public String getAuthor()
{

View File

@@ -280,11 +280,6 @@ public interface DictionaryDAO extends ModelQuery
// MT-specific
boolean isModelInherited(QName name);
/**
* @return String
*/
String getDefaultAnalyserResourceBundleName();
/**
* @return ClassLoader
*/

View File

@@ -101,18 +101,6 @@ public class DictionaryDAOImpl implements DictionaryDAO, NamespaceDAO,
this.dictionaryRegistryCache = dictionaryRegistryCache;
}
@Override
public String getDefaultAnalyserResourceBundleName()
{
return defaultAnalyserResourceBundleName;
}
public void setDefaultAnalyserResourceBundleName(
String defaultAnalyserResourceBundleName)
{
this.defaultAnalyserResourceBundleName = defaultAnalyserResourceBundleName;
}
/**
* Construct
*

View File

@@ -234,15 +234,6 @@ import org.alfresco.service.namespace.QName;
return Collections.unmodifiableMap(childassociations);
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.dictionary.ClassDefinition#getAnalyserResourceBundleName()
*/
@Override
public String getAnalyserResourceBundleName()
{
return type.getAnalyserResourceBundleName();
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.dictionary.ClassDefinition#getParentClassDefinition()
*/

View File

@@ -48,7 +48,7 @@ public abstract class M2Class
private Boolean archive = null;
private Boolean includedInSuperTypeQuery = null;
private String analyserResourceBundleName = null;
private List<M2Property> properties = new ArrayList<M2Property>();
private List<M2PropertyOverride> propertyOverrides = new ArrayList<M2PropertyOverride>();
private List<M2ClassAssociation> associations = new ArrayList<M2ClassAssociation>();
@@ -270,19 +270,6 @@ public abstract class M2Class
{
return Collections.unmodifiableList(mandatoryAspects);
}
/**
* @return String
*/
public String getAnalyserResourceBundleName()
{
return analyserResourceBundleName;
}
public void setAnalyserResourceBundleName(String analyserResourceBundleName)
{
this.analyserResourceBundleName = analyserResourceBundleName;
}
public void setConfigProperties(Properties configProperties)
{

View File

@@ -206,8 +206,6 @@ import org.alfresco.util.EqualsHelper;
defaultAspectNames.add(name);
}
}
this.analyserResourceBundleName = m2Class.getAnalyserResourceBundleName();
}
@Override
@@ -761,15 +759,6 @@ import org.alfresco.util.EqualsHelper;
return modelDiffs;
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.dictionary.ClassDefinition#getAnalyserResourceBundleName()
*/
@Override
public String getAnalyserResourceBundleName()
{
return analyserResourceBundleName;
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.dictionary.ClassDefinition#getParentClassDefinition()
*/

View File

@@ -40,86 +40,50 @@ public class M2DataType
private String defaultAnalyserClassName = null;
private String javaClassName = null;
private String analyserResourceBundleName = null;
/*package*/ M2DataType()
{
super();
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDefaultAnalyserClassName()
{
return defaultAnalyserClassName;
}
public void setDefaultAnalyserClassName(String defaultAnalyserClassName)
{
this.defaultAnalyserClassName = defaultAnalyserClassName;;
}
public String getJavaClassName()
{
return javaClassName;
}
public void setJavaClassName(String javaClassName)
{
this.javaClassName = javaClassName;;
}
/**
* @return String
*/
public String getAnalyserResourceBundleName()
{
return analyserResourceBundleName;
}
public void setAnalyserResourceBundleName(String analyserResourceBundleName)
{
this.analyserResourceBundleName = analyserResourceBundleName;
}
}

View File

@@ -67,7 +67,6 @@ import org.alfresco.service.namespace.QName;
throw new DictionaryException(ERR_NOT_DEFINED_NAMESPACE, name.toPrefixString(), name.getNamespaceURI(), model.getName().toPrefixString());
}
this.dataType = propertyType;
this.analyserResourceBundleName = dataType.getAnalyserResourceBundleName();
}
@@ -146,108 +145,9 @@ import org.alfresco.service.namespace.QName;
return value;
}
@Override
public String getDefaultAnalyserClassName()
{
return dataType.getDefaultAnalyserClassName();
}
@Override
public String getJavaClassName()
{
return dataType.getJavaClassName();
}
@Override
public String getAnalyserResourceBundleName()
{
return analyserResourceBundleName;
}
@Override
public String resolveAnalyserClassName()
{
return resolveAnalyserClassName(I18NUtil.getLocale());
}
/**
* @param locale Locale
* @return String
*/
@Override
public String resolveAnalyserClassName(Locale locale)
{
ClassLoader resourceBundleClassLoader = getModel().getDictionaryDAO().getResourceClassLoader();
if(resourceBundleClassLoader == null)
{
resourceBundleClassLoader = this.getClass().getClassLoader();
}
StringBuilder keyBuilder = new StringBuilder(64);
keyBuilder.append(getModel().getName().toPrefixString());
keyBuilder.append(".datatype");
keyBuilder.append(".").append(getName().toPrefixString());
keyBuilder.append(".analyzer");
String key = StringUtils.replace(keyBuilder.toString(), ":", "_");
String analyserClassName = null;
String defaultAnalyserResourceBundleName = this.getModel().getDictionaryDAO().getDefaultAnalyserResourceBundleName();
if(defaultAnalyserResourceBundleName != null)
{
ResourceBundle bundle = ResourceBundle.getBundle(defaultAnalyserResourceBundleName, locale, resourceBundleClassLoader);
if(bundle.containsKey(key))
{
analyserClassName = bundle.getString(key);
}
}
String analyserResourceBundleName;
if(analyserClassName == null)
{
analyserResourceBundleName = dataType.getAnalyserResourceBundleName();
if(analyserResourceBundleName != null)
{
ResourceBundle bundle = ResourceBundle.getBundle(analyserResourceBundleName, locale, resourceBundleClassLoader);
if(bundle.containsKey(key))
{
analyserClassName = bundle.getString(key);
}
}
}
if(analyserClassName == null)
{
analyserResourceBundleName = getModel().getAnalyserResourceBundleName();
if(analyserResourceBundleName != null)
{
ResourceBundle bundle = ResourceBundle.getBundle(analyserResourceBundleName, locale, resourceBundleClassLoader);
if(bundle.containsKey(key))
{
analyserClassName = bundle.getString(key);
}
}
}
if(analyserClassName == null)
{
// MLTEXT should fall back to TEXT for analysis
if(name.equals(DataTypeDefinition.MLTEXT))
{
analyserClassName = model.getDictionaryDAO().getDataType(DataTypeDefinition.TEXT).resolveAnalyserClassName(locale);
if(analyserClassName == null)
{
analyserClassName = dataType.getDefaultAnalyserClassName();
}
}
else
{
analyserClassName = dataType.getDefaultAnalyserClassName();
}
}
return analyserClassName;
}
}

View File

@@ -469,21 +469,6 @@ public class M2Model
return new ArrayList();
}
/**
* @return String
*/
public String getAnalyserResourceBundleName()
{
return analyserResourceBundleName;
}
public void setAnalyserResourceBundleName(String analyserResourceBundleName)
{
this.analyserResourceBundleName = analyserResourceBundleName;
}
public void setConfigProperties(Properties configProperties)
{
if (types != null)

View File

@@ -55,7 +55,6 @@ public class M2ModelDefinition implements ModelDefinition
{
this.name = QName.createQName(model.getName(), resolver);
this.model = model;
this.analyserResourceBundleName = model.getAnalyserResourceBundleName();
this.dictionaryDAO = dictionaryDAO;
}
@@ -175,17 +174,6 @@ public class M2ModelDefinition implements ModelDefinition
return model.getChecksum(bindingType);
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.dictionary.ModelDefinition#getAnalyserResourceBundleName()
*/
@Override
public String getAnalyserResourceBundleName()
{
return analyserResourceBundleName;
}
@Override
public DictionaryDAO getDictionaryDAO()
{

View File

@@ -312,20 +312,6 @@ public class M2Property
}
}
}
/**
* @return String
*/
public String getAnalyserResourceBundleName()
{
return analyserResourceBundleName;
}
public void setAnalyserResourceBundleName(String analyserResourceBundleName)
{
this.analyserResourceBundleName = analyserResourceBundleName;
}
public void setConfigProperties(Properties configProperties)
{

View File

@@ -78,7 +78,6 @@ import org.springframework.util.StringUtils;
// Resolve Names
this.name = QName.createQName(m2Property.getName(), prefixResolver);
this.propertyTypeName = QName.createQName(m2Property.getType(), prefixResolver);
this.analyserResourceBundleName = m2Property.getAnalyserResourceBundleName();
}
@@ -689,119 +688,4 @@ import org.springframework.util.StringUtils;
return modelDiffs;
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.dictionary.PropertyDefinition#getAnalyserResourceBundleName()
*/
@Override
public String getAnalyserResourceBundleName()
{
return analyserResourceBundleName;
}
@Override
public String resolveAnalyserClassName()
{
return resolveAnalyserClassName(I18NUtil.getLocale());
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.dictionary.PropertyDefinition#getAnalyserClassName(java.lang.String, java.util.Locale)
*/
@Override
public String resolveAnalyserClassName(Locale locale
)
{
ClassLoader resourceBundleClassLoader = getModel().getDictionaryDAO().getResourceClassLoader();
if(resourceBundleClassLoader == null)
{
resourceBundleClassLoader = this.getClass().getClassLoader();
}
StringBuilder keyBuilder = new StringBuilder(64);
keyBuilder.append(getDataType().getModel().getName().toPrefixString());
keyBuilder.append(".datatype");
keyBuilder.append(".").append(getDataType().getName().toPrefixString());
keyBuilder.append(".analyzer");
String key = StringUtils.replace(keyBuilder.toString(), ":", "_");
String analyserClassName = null;
String analyserResourceBundleName = getAnalyserResourceBundleName();
if(analyserResourceBundleName != null)
{
ResourceBundle bundle = ResourceBundle.getBundle(analyserResourceBundleName, locale, resourceBundleClassLoader);
if(bundle.containsKey(key))
{
analyserClassName = bundle.getString(key);
}
}
// walk containing class and its hierarchy
ClassDefinition classDefinition = null;
ClassDefinition parentClassDefinition = null;
while(analyserClassName == null)
{
if(classDefinition == null)
{
classDefinition = getContainerClass();
}
else
{
if(parentClassDefinition == null)
{
break;
}
else
{
classDefinition = parentClassDefinition;
}
}
parentClassDefinition = classDefinition.getParentClassDefinition();
analyserResourceBundleName = classDefinition.getAnalyserResourceBundleName();
if(analyserResourceBundleName != null)
{
ResourceBundle bundle = ResourceBundle.getBundle(analyserResourceBundleName, locale, resourceBundleClassLoader);
if(bundle.containsKey(key))
{
analyserClassName = bundle.getString(key);
}
}
if(analyserClassName == null)
{
if((parentClassDefinition == null) || !classDefinition.getModel().getName().equals(parentClassDefinition.getModel().getName()))
{
analyserResourceBundleName = classDefinition.getModel().getAnalyserResourceBundleName();
if(analyserResourceBundleName != null)
{
ResourceBundle bundle = ResourceBundle.getBundle(analyserResourceBundleName, locale, resourceBundleClassLoader);
if(bundle.containsKey(key))
{
analyserClassName = bundle.getString(key);
}
}
}
}
}
String defaultAnalyserResourceBundleName = this.getContainerClass().getModel().getDictionaryDAO().getDefaultAnalyserResourceBundleName();
if(analyserClassName == null)
{
if(defaultAnalyserResourceBundleName != null)
{
ResourceBundle bundle = ResourceBundle.getBundle(defaultAnalyserResourceBundleName, locale, resourceBundleClassLoader);
if(bundle.containsKey(key))
{
analyserClassName = bundle.getString(key);
}
}
}
if(analyserClassName == null)
{
analyserClassName = getDataType().resolveAnalyserClassName(locale);
}
return analyserClassName;
}
}

View File

@@ -12,7 +12,7 @@
<value name="published" field="published" usage="optional"/>
<value name="version" field="version" usage="optional"/>
<value name="analyserResourceBundleName" field="analyserResourceBundleName" usage="optional"/>
<structure name="imports" usage="optional">
<collection field="imports" factory="org.alfresco.repo.dictionary.M2Model.createList">
<structure name="import" type="org.alfresco.repo.dictionary.M2Namespace" usage="optional">
@@ -37,7 +37,7 @@
<value style="attribute" name="name" field="name"/>
<value name="title" field="title" usage="optional"/>
<value name="description" field="description" usage="optional"/>
<value name="default-analyser-class" field="defaultAnalyserClassName"/>
<value name="default-analyser-class" field="defaultAnalyserClassName" usage="optional"/>
<value name="analyserResourceBundleName" field="analyserResourceBundleName" usage="optional"/>
<value name="java-class" field="javaClassName"/>
</structure>
@@ -179,4 +179,4 @@
<value name="propagateTimestamps" field="propagateTimestamps" usage="optional"/>
</mapping>
</binding>
</binding>

View File

@@ -149,12 +149,6 @@ public interface ClassDefinition
*/
public List<AspectDefinition> getDefaultAspects(boolean inherited);
/**
* Get the name of the property bundle that defines analyser mappings for this class (keyed by the type of the property)
* @return the resource or null if not set.
*/
public String getAnalyserResourceBundleName();
/**
* Get the parent class definition
*

View File

@@ -98,33 +98,8 @@ public interface DataTypeDefinition
*/
public String getDescription(MessageLookup messageLookup);
/**
* Get the name of the property bundle that defines analyser mappings for this data type (keyed by the type of the property)
* @return the resource or null if not set.
*/
public String getAnalyserResourceBundleName();
/**
* @return the equivalent java class name (or null, if not mapped)
*/
public String getJavaClassName();
/**
* Get the default analyser class - used when no resource bundles can be found and no repository default is set.
* @return String
*/
public String getDefaultAnalyserClassName();
/**
* @param locale
* @return String
*/
public String resolveAnalyserClassName(Locale locale);
/**
*
* @return String
*/
public String resolveAnalyserClassName();
}

View File

@@ -105,12 +105,6 @@ public interface ModelDefinition
public long getChecksum(XMLBindingType bindingType);
/**
* Get the name of the property bundle that defines analyser mappings for this model (keyed by the type of the property)
* @return the resource or null if not set.
*/
public String getAnalyserResourceBundleName();
/**
* @return DictionaryDAO
*/

View File

@@ -161,22 +161,4 @@ public interface PropertyDefinition extends ClassAttributeDefinition
* @return Returns a list of property constraint definitions
*/
public List<ConstraintDefinition> getConstraints();
/**
* Get the name of the property bundle that defines analyser mappings for this class.
* @return the resource or null if not set.
*/
public String getAnalyserResourceBundleName();
/**
* @param locale Locale
* @return String
*/
public String resolveAnalyserClassName(Locale locale);
/**
*
* @return String
*/
public String resolveAnalyserClassName();
}

View File

@@ -41,9 +41,6 @@
<property name="dictionaryRegistryCache">
<ref bean="compiledModelsCache"/>
</property>
<property name="defaultAnalyserResourceBundleName">
<value>${lucene.defaultAnalyserResourceBundleName}</value>
</property>
</bean>
<bean id="threadFactory" class="org.alfresco.util.TraceableThreadFactory">

View File

@@ -16,16 +16,19 @@
<data-types>
<data-type name="cmis:id">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>java.lang.String</java-class>
</data-type>
<data-type name="cmis:uri">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>java.lang.String</java-class>
</data-type>
<data-type name="cmis:html">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>java.lang.String</java-class>
</data-type>
@@ -436,4 +439,4 @@
</types>
</model>
</model>

View File

@@ -1,18 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_any.analyzer=org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
d_dictionary.datatype.d_text.analyzer=org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
d_dictionary.datatype.d_content.analyzer=org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
d_dictionary.datatype.d_int.analyzer=org.alfresco.repo.search.impl.lucene.analysis.IntegerAnalyser
d_dictionary.datatype.d_long.analyzer=org.alfresco.repo.search.impl.lucene.analysis.LongAnalyser
d_dictionary.datatype.d_float.analyzer=org.alfresco.repo.search.impl.lucene.analysis.FloatAnalyser
d_dictionary.datatype.d_double.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DoubleAnalyser
d_dictionary.datatype.d_date.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DateAnalyser
d_dictionary.datatype.d_datetime.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DateAnalyser
d_dictionary.datatype.d_boolean.analyzer=org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
d_dictionary.datatype.d_qname.analyzer=org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
d_dictionary.datatype.d_guid.analyzer=org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
d_dictionary.datatype.d_category.analyzer=org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
d_dictionary.datatype.d_noderef.analyzer=org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
d_dictionary.datatype.d_path.analyzer=org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
d_dictionary.datatype.d_locale.analyzer=org.alfresco.repo.search.impl.lucene.analysis.LowerCaseVerbatimAnalyser

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.cz.CzechAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.cz.CzechAnalyzer

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DanishSnowballAnalyser
d_dictionary.datatype.d_content.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DanishSnowballAnalyser

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.de.GermanAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.de.GermanAnalyzer

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.el.GreekAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.el.GreekAnalyzer

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
d_dictionary.datatype.d_content.analyzer=org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.alfresco.repo.search.impl.lucene.analysis.SpanishSnowballAnalyser
d_dictionary.datatype.d_content.analyzer=org.alfresco.repo.search.impl.lucene.analysis.SpanishSnowballAnalyser

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.alfresco.repo.search.impl.lucene.analysis.FinnishSnowballAnalyser
d_dictionary.datatype.d_content.analyzer=org.alfresco.repo.search.impl.lucene.analysis.FinnishSnowballAnalyser

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.fr.FrenchAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.fr.FrenchAnalyzer

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.alfresco.repo.search.impl.lucene.analysis.ItalianSnowballAnalyser
d_dictionary.datatype.d_content.analyzer=org.alfresco.repo.search.impl.lucene.analysis.ItalianSnowballAnalyser

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.cjk.CJKAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.cjk.CJKAnalyzer

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.cjk.CJKAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.cjk.CJKAnalyzer

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.nl.DutchAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.nl.DutchAnalyzer

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.alfresco.repo.search.impl.lucene.analysis.NorwegianSnowballAnalyser
d_dictionary.datatype.d_content.analyzer=org.alfresco.repo.search.impl.lucene.analysis.NorwegianSnowballAnalyser

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.alfresco.repo.search.impl.lucene.analysis.PortugueseSnowballAnalyser
d_dictionary.datatype.d_content.analyzer=org.alfresco.repo.search.impl.lucene.analysis.PortugueseSnowballAnalyser

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.br.BrazilianAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.br.BrazilianAnalyzer

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.ru.RussianAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.ru.RussianAnalyzer

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.alfresco.repo.search.impl.lucene.analysis.SwedishSnowballAnalyser
d_dictionary.datatype.d_content.analyzer=org.alfresco.repo.search.impl.lucene.analysis.SwedishSnowballAnalyser

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.th.ThaiAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.th.ThaiAnalyzer

View File

@@ -1,4 +0,0 @@
# Data Type Index Analyzers
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.cn.ChineseAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.cn.ChineseAnalyzer

View File

@@ -4,8 +4,9 @@
<author>Alfresco</author>
<published>2005-09-29</published>
<version>1.0</version>
<!-- Analysers are EOLed, left here for backwards compatibility -->
<analyserResourceBundleName>alfresco/model/dataTypeAnalyzers</analyserResourceBundleName>
<namespaces>
<!-- Default Namespace -->
<namespace uri="" prefix=""/>
@@ -20,11 +21,13 @@
<data-types>
<data-type name="d:any">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>java.lang.Object</java-class>
</data-type>
<data-type name="d:encrypted">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.EmptyAnalyser</default-analyser-class>
<java-class>javax.crypto.SealedObject</java-class>
</data-type>
@@ -35,91 +38,109 @@
</data-type>
<data-type name="d:mltext">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>org.alfresco.service.cmr.repository.MLText</java-class>
</data-type>
<data-type name="d:content">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>org.alfresco.service.cmr.repository.ContentData</java-class>
</data-type>
<data-type name="d:int">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.IntegerAnalyser</default-analyser-class>
<java-class>java.lang.Integer</java-class>
</data-type>
<data-type name="d:long">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.LongAnalyser</default-analyser-class>
<java-class>java.lang.Long</java-class>
</data-type>
<data-type name="d:float">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.FloatAnalyser</default-analyser-class>
<java-class>java.lang.Float</java-class>
</data-type>
<data-type name="d:double">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.DoubleAnalyser</default-analyser-class>
<java-class>java.lang.Double</java-class>
</data-type>
<data-type name="d:date">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.DateAnalyser</default-analyser-class>
<java-class>java.util.Date</java-class>
</data-type>
<data-type name="d:datetime">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.DateTimeAnalyser</default-analyser-class>
<java-class>java.util.Date</java-class>
</data-type>
<data-type name="d:boolean">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>java.lang.Boolean</java-class>
</data-type>
<data-type name="d:qname">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>org.alfresco.service.namespace.QName</java-class>
</data-type>
<data-type name="d:noderef">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>org.alfresco.service.cmr.repository.NodeRef</java-class>
</data-type>
<data-type name="d:childassocref">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>org.alfresco.service.cmr.repository.ChildAssociationRef</java-class>
</data-type>
<data-type name="d:assocref">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>org.alfresco.service.cmr.repository.AssociationRef</java-class>
</data-type>
<data-type name="d:path">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>org.alfresco.service.cmr.repository.Path</java-class>
</data-type>
<data-type name="d:category">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<java-class>org.alfresco.service.cmr.repository.NodeRef</java-class>
</data-type>
<data-type name="d:locale">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.VerbatimAnalyser</default-analyser-class>
<java-class>java.util.Locale</java-class>
</data-type>
<data-type name="d:version">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.VerbatimAnalyser</default-analyser-class>
<java-class>org.alfresco.util.VersionNumber</java-class>
</data-type>
<data-type name="d:period">
<data-type name="d:period">
<!-- Analysers are EOLed, left here for backwards compatibility -->
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.VerbatimAnalyser</default-analyser-class>
<java-class>org.alfresco.service.cmr.repository.Period</java-class>
</data-type>
@@ -128,5 +149,5 @@
<!-- TODO: Define dictionary meta model -->
</model>

View File

@@ -4,21 +4,21 @@
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -36,7 +36,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -69,7 +68,7 @@ import org.junit.Test;
import org.springframework.extensions.surf.util.I18NUtil;
/**
*
*
* @author sglover
*
*/
@@ -80,6 +79,7 @@ public class DictionaryDAOTest
private static final String TEST_URL = "http://www.alfresco.org/test/dictionarydaotest/1.0";
private static final String TEST2_URL = "http://www.alfresco.org/test/dictionarydaotest2/1.0";
private static final String TEST_MODEL = "org/alfresco/repo/dictionary/dictionarydaotest_model.xml";
private static final String TEST_MODEL_NEW_FORMAT = "org/alfresco/repo/dictionary/dictionarydaotest_model_new_format.xml";
private static final String TEST_NS_CLASH_MODEL = "org/alfresco/repo/dictionary/nstest_model.xml";
private static final String TEST_BUNDLE = "org/alfresco/repo/dictionary/dictionarydaotest_model";
private static final String TEST_COMMON_NS_PARENT_MODEL = "org/alfresco/repo/dictionary/commonpropertynsparent_model.xml";
@@ -90,7 +90,7 @@ public class DictionaryDAOTest
@Before
public void setUp() throws Exception
{
{
// register resource bundles for messages
I18NUtil.registerResourceBundle(TEST_RESOURCE_MESSAGES);
@@ -119,7 +119,7 @@ public class DictionaryDAOTest
component.setMessageLookup(new StaticMessageLookup());
service = component;
}
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService)
{
CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
@@ -140,17 +140,17 @@ public class DictionaryDAOTest
@Test
public void testBootstrap()
{
TenantService tenantService = new SingleTServiceImpl();
TenantService tenantService = new SingleTServiceImpl();
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
dictionaryDAO.setTenantService(tenantService);
initDictionaryCaches(dictionaryDAO, tenantService);
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
List<String> bootstrapModels = new ArrayList<String>();
bootstrapModels.add("alfresco/model/dictionaryModel.xml");
bootstrap.setModels(bootstrapModels);
bootstrap.setDictionaryDAO(dictionaryDAO);
bootstrap.setTenantService(tenantService);
@@ -168,10 +168,10 @@ public class DictionaryDAOTest
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
dictionaryDAO.setTenantService(tenantService);
initDictionaryCaches(dictionaryDAO, tenantService);
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
List<String> bootstrapModels = new ArrayList<String>();
bootstrapModels.add("alfresco/model/dictionaryModel.xml");
bootstrapModels.add(TEST_MODEL);
bootstrapModels.add(TEST_NS_CLASH_MODEL);
@@ -191,6 +191,37 @@ public class DictionaryDAOTest
// Good!
}
}
@Test
public void testNamespaceClashResultsInSensibleErrorWithNewFormat()
{
TenantService tenantService = new SingleTServiceImpl();
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
dictionaryDAO.setTenantService(tenantService);
initDictionaryCaches(dictionaryDAO, tenantService);
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
List<String> bootstrapModels = new ArrayList<String>();
bootstrapModels.add("alfresco/model/dictionaryModel_new_format.xml");
bootstrapModels.add(TEST_MODEL_NEW_FORMAT);
bootstrapModels.add(TEST_NS_CLASH_MODEL);
bootstrap.setModels(bootstrapModels);
bootstrap.setDictionaryDAO(dictionaryDAO);
bootstrap.setTenantService(tenantService);
try
{
bootstrap.bootstrap();
fail("Expected "+NamespaceException.class.getName()+" to be thrown, but it was not.");
}
catch (NamespaceException e)
{
System.out.println(e.getMessage());
// Good!
}
}
@Test
public void testUseImportedNamespaces()
@@ -200,14 +231,36 @@ public class DictionaryDAOTest
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
dictionaryDAO.setTenantService(tenantService);
initDictionaryCaches(dictionaryDAO, tenantService);
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
List<String> bootstrapModels = new ArrayList<String>();
bootstrapModels.add("alfresco/model/dictionaryModel.xml");
bootstrapModels.add(TEST_COMMON_NS_PARENT_MODEL);
bootstrapModels.add(TEST_COMMON_NS_CHILD_MODEL);
bootstrap.setModels(bootstrapModels);
bootstrap.setDictionaryDAO(dictionaryDAO);
bootstrap.setTenantService(tenantService);
bootstrap.bootstrap();
}
@Test
public void testUseImportedNamespacesWithNewFormat()
{
TenantService tenantService = new SingleTServiceImpl();
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
dictionaryDAO.setTenantService(tenantService);
initDictionaryCaches(dictionaryDAO, tenantService);
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
List<String> bootstrapModels = new ArrayList<String>();
bootstrapModels.add("alfresco/model/dictionaryModel_new_format.xml");
bootstrapModels.add(TEST_COMMON_NS_PARENT_MODEL);
bootstrapModels.add(TEST_COMMON_NS_CHILD_MODEL);
bootstrap.setModels(bootstrapModels);
bootstrap.setDictionaryDAO(dictionaryDAO);
bootstrap.setTenantService(tenantService);
@@ -220,32 +273,31 @@ public class DictionaryDAOTest
QName model = QName.createQName(TEST_URL, "dictionarydaotest");
ModelDefinition modelDef = service.getModel(model);
assertEquals("Model Description", modelDef.getDescription(service));
QName type = QName.createQName(TEST_URL, "base");
TypeDefinition typeDef = service.getType(type);
assertEquals("Base Title", typeDef.getTitle(service));
assertEquals("Base Description", typeDef.getDescription(service));
QName prop = QName.createQName(TEST_URL, "prop1");
PropertyDefinition propDef = service.getProperty(prop);
assertEquals("Prop1 Title", propDef.getTitle(service));
assertEquals("Prop1 Description", propDef.getDescription(service));
QName assoc = QName.createQName(TEST_URL, "assoc1");
AssociationDefinition assocDef = service.getAssociation(assoc);
assertEquals("Assoc1 Title", assocDef.getTitle(service));
assertEquals("Assoc1 Description", assocDef.getDescription(service));
QName datatype = QName.createQName(TEST_URL, "datatype");
DataTypeDefinition datatypeDef = service.getDataType(datatype);
assertEquals("alfresco/model/dataTypeAnalyzers", datatypeDef.getAnalyserResourceBundleName());
QName constraint = QName.createQName(TEST_URL, "list1");
ConstraintDefinition constraintDef = service.getConstraint(constraint);
assertEquals("List1 title", constraintDef.getTitle(service));
assertEquals("List1 description", constraintDef.getDescription(service));
// Localisation of List Of Values Constraint.
// 1. LoV defined at the top of the model.
ListOfValuesConstraint lovConstraint = (ListOfValuesConstraint)constraintDef.getConstraint();
@@ -254,7 +306,7 @@ public class DictionaryDAOTest
assertEquals("Wrong localised lov value.", "VALUE WITH SPACES display", lovConstraint.getDisplayLabel("VALUE WITH SPACES", service)); // Keys with spaces.
assertEquals("Wrong localised lov value.", "VALUE WITH TRAILING SPACE display", lovConstraint.getDisplayLabel("VALUE WITH TRAILING SPACE ", service)); // Keys with trailing space.
assertNull(lovConstraint.getDisplayLabel("nosuchLOV", service));
// 2. A named LoV defined within a specific property "non-Ref".
QName constrainedPropName = QName.createQName(TEST_URL, "constrainedProp");
PropertyDefinition constrainedPropDef = service.getProperty(constrainedPropName);
@@ -267,23 +319,23 @@ public class DictionaryDAOTest
assertEquals("Wrong localised lov value.", "GAMMA, DELTA display", lovConstraint.getDisplayLabel("GAMMA, DELTA", service)); // Keys with commas
assertEquals("Wrong localised lov value.", "OMEGA", lovConstraint.getDisplayLabel("OMEGA", service));
assertNull(lovConstraint.getDisplayLabel("nosuchLOV", service));
// Localisation of unnamed LoV defined within a specific property are not supported.
}
@Test
public void testConstraints()
{
{
QName model = QName.createQName(TEST_URL, "dictionarydaotest");
Collection<ConstraintDefinition> modelConstraints = service.getConstraints(model);
assertEquals(23, modelConstraints.size()); // 10 + 7 + 6
QName conRegExp1QName = QName.createQName(TEST_URL, "regex1");
boolean found1 = false;
QName conStrLen1QName = QName.createQName(TEST_URL, "stringLength1");
boolean found2 = false;
for (ConstraintDefinition constraintDef : modelConstraints)
{
if (constraintDef.getName().equals(conRegExp1QName))
@@ -292,7 +344,7 @@ public class DictionaryDAOTest
assertEquals("Regex1 description", constraintDef.getDescription(service));
found1 = true;
}
if (constraintDef.getName().equals(conStrLen1QName))
{
assertNull(constraintDef.getTitle(service));
@@ -302,12 +354,12 @@ public class DictionaryDAOTest
}
assertTrue(found1);
assertTrue(found2);
// get the constraints for a property without constraints
QName propNoConstraintsQName = QName.createQName(TEST_URL, "fileprop");
PropertyDefinition propNoConstraintsDef = service.getProperty(propNoConstraintsQName);
assertNotNull("Property without constraints returned null list", propNoConstraintsDef.getConstraints());
// get the constraints defined for the property
QName prop1QName = QName.createQName(TEST_URL, "prop1");
PropertyDefinition propDef = service.getProperty(prop1QName);
@@ -317,21 +369,21 @@ public class DictionaryDAOTest
assertTrue("Constraint instance incorrect", constraints.get(0).getConstraint() instanceof RegexConstraint);
assertTrue("Constraint instance incorrect", constraints.get(1).getConstraint() instanceof StringLengthConstraint);
assertTrue("Constraint instance incorrect", constraints.get(2).getConstraint() instanceof RegisteredConstraint);
// check the individual constraints
ConstraintDefinition constraintDef = constraints.get(0);
assertTrue("Constraint anonymous name incorrect", constraintDef.getName().getLocalName().equals("dictionarydaotest_base_prop1_anon_0"));
// inherit title / description for reference constraint
assertTrue("Constraint title incorrect", constraintDef.getTitle(service).equals("Regex1 title"));
assertTrue("Constraint description incorrect", constraintDef.getDescription(service).equals("Regex1 description"));
constraintDef = constraints.get(1);
assertTrue("Constraint anonymous name incorrect", constraintDef.getName().getLocalName().equals("dictionarydaotest_base_prop1_anon_1"));
assertTrue("Constraint title incorrect", constraintDef.getTitle(service).equals("Prop1 Strlen1 title"));
assertTrue("Constraint description incorrect", constraintDef.getDescription(service).equals("Prop1 Strlen1 description"));
// check that the constraint implementation is valid (it used a reference)
Constraint constraint = constraintDef.getConstraint();
assertNotNull("Reference constraint has no implementation", constraint);
@@ -406,7 +458,7 @@ public class DictionaryDAOTest
allowedValues = constraint.getAllowedValues();
assertEquals("Expected 1 allowed values", 1, allowedValues.size());
assertEquals("HIJ", allowedValues.get(0));
// check the inherited property on second derived aspect
propDef = service.getProperty(aspectTwoQName, propQName);
assertNotNull(propDef);
@@ -425,7 +477,7 @@ public class DictionaryDAOTest
allowedValues = constraint.getAllowedValues();
assertEquals("Wrong number of allowed values", 1, allowedValues.size());
assertEquals("HIJ", allowedValues.get(0));
// check the cross-namespace inheritance
propDef = service.getProperty(aspectThreeQName, propQName);
assertNotNull(propDef);
@@ -466,7 +518,7 @@ public class DictionaryDAOTest
QName testEnforcedQName = QName.createQName(TEST_URL, "enforced");
ClassDefinition testEnforcedClassDef = service.getClass(testEnforcedQName);
Map<QName, PropertyDefinition> testEnforcedPropertyDefs = testEnforcedClassDef.getProperties();
PropertyDefinition propertyDef = null;
QName testMandatoryEnforcedQName = QName.createQName(TEST_URL, "mandatory-enforced");
@@ -508,12 +560,12 @@ public class DictionaryDAOTest
// Test invalid args
boolean testI1 = service.isSubClass(invalid, referenceable);
assertFalse(testI1);
boolean testI2 = service.isSubClass(referenceable, invalid);
assertFalse(testI2);
boolean testI3 = service.isSubClass(invalid, invalid);
assertFalse(testI3);
@@ -529,7 +581,7 @@ public class DictionaryDAOTest
boolean test5 = service.isSubClass(base, folder); // reversed test
assertFalse(test5);
}
@Test
public void testPropertyOverride()
{
@@ -538,7 +590,7 @@ public class DictionaryDAOTest
PropertyDefinition prop1 = props1.get(QName.createQName(TEST_URL, "propoverride"));
String def1 = prop1.getDefaultValue();
assertEquals("one", def1);
TypeDefinition type2 = service.getType(QName.createQName(TEST_URL, "overridetype2"));
Map<QName, PropertyDefinition> props2 = type2.getProperties();
PropertyDefinition prop2 = props2.get(QName.createQName(TEST_URL, "propoverride"));
@@ -569,541 +621,6 @@ public class DictionaryDAOTest
childAssocDef = (ChildAssociationDefinition) assocDef;
assertTrue("Expected 'true' for timestamp propagation", childAssocDef.getPropagateTimestamps());
}
@Test
public void testDataTypeAnlyserResolution()
{
// Stuff to configure/
TenantService tenantService = new SingleTServiceImpl();
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
dictionaryDAO.setTenantService(tenantService);
initDictionaryCaches(dictionaryDAO, tenantService);
ModelDefinition modelDefinition;
DataTypeDefinition dataTypeDefinition;
//
dictionaryDAO.putModel(createModel(dictionaryDAO, false, false, false));
QName modeQName = QName.createQName("test:analyzerModel", dictionaryDAO);
QName dataTypeQName = QName.createQName("test:analyzerDataType", dictionaryDAO);
modelDefinition = dictionaryDAO.getModel(modeQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), null);
dataTypeDefinition = dictionaryDAO.getDataType(dataTypeQName);
assertEquals(dataTypeDefinition.getAnalyserResourceBundleName(), null);
assertEquals(dataTypeDefinition.getDefaultAnalyserClassName(), null);
assertNull(dataTypeDefinition.resolveAnalyserClassName());
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("defaultBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modeQName);
//
dictionaryDAO.putModel(createModel(dictionaryDAO, false, false, true));
modelDefinition = dictionaryDAO.getModel(modeQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), null);
dataTypeDefinition = dictionaryDAO.getDataType(dataTypeQName);
assertEquals(dataTypeDefinition.getAnalyserResourceBundleName(), null);
assertEquals(dataTypeDefinition.getDefaultAnalyserClassName(), "java.lang.String");
assertEquals(dataTypeDefinition.resolveAnalyserClassName(), "java.lang.String");
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("defaultBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modeQName);
//
dictionaryDAO.putModel(createModel(dictionaryDAO, false, true, false));
modelDefinition = dictionaryDAO.getModel(modeQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), null);
dataTypeDefinition = dictionaryDAO.getDataType(dataTypeQName);
assertEquals(dataTypeDefinition.getAnalyserResourceBundleName(), "dataTypeResourceBundle");
assertEquals(dataTypeDefinition.getDefaultAnalyserClassName(), null);
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("dataTypeResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("defaultBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modeQName);
//
dictionaryDAO.putModel(createModel(dictionaryDAO, false, true, true));
modelDefinition = dictionaryDAO.getModel(modeQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), null);
dataTypeDefinition = dictionaryDAO.getDataType(dataTypeQName);
assertEquals(dataTypeDefinition.getAnalyserResourceBundleName(), "dataTypeResourceBundle");
assertEquals(dataTypeDefinition.getDefaultAnalyserClassName(), "java.lang.String");
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("dataTypeResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("defaultBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modeQName);
dictionaryDAO.putModel(createModel(dictionaryDAO, true, false, false));
modelDefinition = dictionaryDAO.getModel(modeQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), "dataTypeModelResourceBundle");
dataTypeDefinition = dictionaryDAO.getDataType(dataTypeQName);
assertEquals(dataTypeDefinition.getAnalyserResourceBundleName(), null);
assertEquals(dataTypeDefinition.getDefaultAnalyserClassName(), null);
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("dataTypeModelResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("defaultBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modeQName);
//
dictionaryDAO.putModel(createModel(dictionaryDAO, true, false, true));
modelDefinition = dictionaryDAO.getModel(modeQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), "dataTypeModelResourceBundle");
dataTypeDefinition = dictionaryDAO.getDataType(dataTypeQName);
assertEquals(dataTypeDefinition.getAnalyserResourceBundleName(), null);
assertEquals(dataTypeDefinition.getDefaultAnalyserClassName(), "java.lang.String");
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("dataTypeModelResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("defaultBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modeQName);
//
dictionaryDAO.putModel(createModel(dictionaryDAO, true, true, false));
modelDefinition = dictionaryDAO.getModel(modeQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), "dataTypeModelResourceBundle");
dataTypeDefinition = dictionaryDAO.getDataType(dataTypeQName);
assertEquals(dataTypeDefinition.getAnalyserResourceBundleName(), "dataTypeResourceBundle");
assertEquals(dataTypeDefinition.getDefaultAnalyserClassName(), null);
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("dataTypeResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("defaultBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modeQName);
//
dictionaryDAO.putModel(createModel(dictionaryDAO, true, true, true));
modelDefinition = dictionaryDAO.getModel(modeQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), "dataTypeModelResourceBundle");
dataTypeDefinition = dictionaryDAO.getDataType(dataTypeQName);
assertEquals(dataTypeDefinition.getAnalyserResourceBundleName(), "dataTypeResourceBundle");
assertEquals(dataTypeDefinition.getDefaultAnalyserClassName(), "java.lang.String");
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("dataTypeResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
dataTypeDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("defaultBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modeQName);
}
private M2Model createModel(DictionaryDAO dictionaryDAO, boolean withModelBundle, boolean withDataTypeBundle, boolean withTypeAnalyserClss)
{
String testNamespace = "http://www.alfresco.org/test/analyserResolution";
M2Model model = M2Model.createModel("test:analyzerModel");
model.createNamespace(testNamespace, "test");
if(withModelBundle)
{
model.setAnalyserResourceBundleName("dataTypeModelResourceBundle");
}
M2DataType dataTypeWithAnalyserBundleName = model.createPropertyType("test:analyzerDataType");
dataTypeWithAnalyserBundleName.setJavaClassName("java.lang.String");
if(withTypeAnalyserClss)
{
dataTypeWithAnalyserBundleName.setDefaultAnalyserClassName("java.lang.String");
}
if(withDataTypeBundle)
{
dataTypeWithAnalyserBundleName.setAnalyserResourceBundleName("dataTypeResourceBundle");
}
return model;
}
@Test
public void testTypeAnalyserResolution()
{
// Stuff to configure/
TenantService tenantService = new SingleTServiceImpl();
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
dictionaryDAO.setTenantService(tenantService);
initDictionaryCaches(dictionaryDAO, tenantService);
// build data model - typical settings
dictionaryDAO.putModel(createModel(dictionaryDAO, true, false, true));
// check simple stack - all defined keep removing the end
ModelDefinition modelDefinition;
ClassDefinition superDefinition;
ClassDefinition classDefinition;
PropertyDefinition propertyDefinition;
dictionaryDAO.putModel(createTypeModel(dictionaryDAO, true, true, true, true));
QName modelQName = QName.createQName("test2:analyzerClassModel", dictionaryDAO);
QName superQName = QName.createQName("test2:analyzerSuperType", dictionaryDAO);
QName typeQName = QName.createQName("test2:analyzerType", dictionaryDAO);
QName propertyQName = QName.createQName("test2:analyzerProperty", dictionaryDAO);
modelDefinition = dictionaryDAO.getModel(modelQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), "typeModelResourceBundle");
superDefinition = dictionaryDAO.getType(superQName);
assertEquals(superDefinition.getAnalyserResourceBundleName(), "superTypeResourceBundle");
classDefinition = dictionaryDAO.getType(typeQName);
assertEquals(classDefinition.getAnalyserResourceBundleName(), "typeResourceBundle");
propertyDefinition = dictionaryDAO.getProperty(propertyQName);
assertEquals(propertyDefinition.getAnalyserResourceBundleName(), "propertyResourceBundle");
try
{
propertyDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("propertyResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
propertyDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("propertyResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modelQName);
//
dictionaryDAO.putModel(createTypeModel(dictionaryDAO, true, true, true, false));
modelDefinition = dictionaryDAO.getModel(modelQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), "typeModelResourceBundle");
superDefinition = dictionaryDAO.getType(superQName);
assertEquals(superDefinition.getAnalyserResourceBundleName(), "superTypeResourceBundle");
classDefinition = dictionaryDAO.getType(typeQName);
assertEquals(classDefinition.getAnalyserResourceBundleName(), "typeResourceBundle");
propertyDefinition = dictionaryDAO.getProperty(propertyQName);
assertEquals(propertyDefinition.getAnalyserResourceBundleName(), null);
try
{
propertyDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("typeResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
propertyDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("typeResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modelQName);
//
dictionaryDAO.putModel(createTypeModel(dictionaryDAO, true, true, false, false));
modelDefinition = dictionaryDAO.getModel(modelQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), "typeModelResourceBundle");
superDefinition = dictionaryDAO.getType(superQName);
assertEquals(superDefinition.getAnalyserResourceBundleName(), "superTypeResourceBundle");
classDefinition = dictionaryDAO.getType(typeQName);
assertEquals(classDefinition.getAnalyserResourceBundleName(), null);
propertyDefinition = dictionaryDAO.getProperty(propertyQName);
assertEquals(propertyDefinition.getAnalyserResourceBundleName(), null);
try
{
propertyDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("superTypeResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
propertyDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("superTypeResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modelQName);
//
dictionaryDAO.putModel(createTypeModel(dictionaryDAO, true, false, false, false));
modelDefinition = dictionaryDAO.getModel(modelQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), "typeModelResourceBundle");
superDefinition = dictionaryDAO.getType(superQName);
assertEquals(superDefinition.getAnalyserResourceBundleName(), null);
classDefinition = dictionaryDAO.getType(typeQName);
assertEquals(classDefinition.getAnalyserResourceBundleName(), null);
propertyDefinition = dictionaryDAO.getProperty(propertyQName);
assertEquals(propertyDefinition.getAnalyserResourceBundleName(), null);
try
{
propertyDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("typeModelResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
propertyDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("typeModelResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modelQName);
//
dictionaryDAO.putModel(createTypeModel(dictionaryDAO, false, false, false, false));
modelDefinition = dictionaryDAO.getModel(modelQName);
assertEquals(modelDefinition.getAnalyserResourceBundleName(), null);
superDefinition = dictionaryDAO.getType(superQName);
assertEquals(superDefinition.getAnalyserResourceBundleName(), null);
classDefinition = dictionaryDAO.getType(typeQName);
assertEquals(classDefinition.getAnalyserResourceBundleName(), null);
propertyDefinition = dictionaryDAO.getProperty(propertyQName);
assertEquals(propertyDefinition.getAnalyserResourceBundleName(), null);
try
{
propertyDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("dataTypeModelResourceBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName("defaultBundle");
try
{
propertyDefinition.resolveAnalyserClassName();
fail();
}
catch(MissingResourceException mre)
{
assertTrue(mre.getMessage().contains("defaultBundle"));
}
dictionaryDAO.setDefaultAnalyserResourceBundleName(null);
dictionaryDAO.removeModel(modelQName);
}
/**
* @param dictionaryDAO DictionaryDAOImpl
* @param withModelBundle boolean
* @param withInheritedTypeBundle boolean
* @param withTypeBundle boolean
* @param withPropertyBundle boolean
* @return M2Model
*/
private M2Model createTypeModel(DictionaryDAOImpl dictionaryDAO, boolean withModelBundle, boolean withInheritedTypeBundle, boolean withTypeBundle, boolean withPropertyBundle)
{
String testNamespace = "http://www.alfresco.org/test/analyserResolutionType";
M2Model model = M2Model.createModel("test2:analyzerClassModel");
model.createNamespace(testNamespace, "test2");
model.createImport("http://www.alfresco.org/test/analyserResolution", "test");
if(withModelBundle)
{
model.setAnalyserResourceBundleName("typeModelResourceBundle");
}
M2Type superTypeWithAnalyserBundleName = model.createType("test2:analyzerSuperType");
if(withInheritedTypeBundle)
{
superTypeWithAnalyserBundleName.setAnalyserResourceBundleName("superTypeResourceBundle");
}
M2Type typeWithAnalyserBundleName = model.createType("test2:analyzerType");
typeWithAnalyserBundleName.setParentName("test2:analyzerSuperType");
if(withTypeBundle)
{
typeWithAnalyserBundleName.setAnalyserResourceBundleName("typeResourceBundle");
}
M2Property propertyWithAnalyserBundelName = typeWithAnalyserBundleName.createProperty("test2:analyzerProperty");
propertyWithAnalyserBundelName.setType("test:analyzerDataType");
if(withPropertyBundle)
{
propertyWithAnalyserBundelName.setAnalyserResourceBundleName("propertyResourceBundle");
}
return model;
}
//testing a model containing circular dependency cannot be imported with bootstrap
@Test
@@ -1147,7 +664,6 @@ public class DictionaryDAOTest
String testNamespace = "http://www.alfresco.org/model/dictionary/1.0/my";
M2Model model = M2Model.createModel("my:circularModel");
model.createNamespace(testNamespace, "my");
model.setAnalyserResourceBundleName("typeModelResourceBundle");
M2Type typeA = model.createType("my:circularA");
typeA.setParentName("my:circularC");
M2Type typeB = model.createType("my:circularB");

View File

@@ -0,0 +1,436 @@
<model name="cmis:cmismodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<description>CMIS Model Definitions</description>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
</imports>
<namespaces>
<namespace uri="http://www.alfresco.org/model/cmis/1.0/cs01" prefix="cmis" />
<namespace uri="http://www.alfresco.org/model/cmis/1.0/cs01ext" prefix="cmisext" />
<namespace uri="http://www.alfresco.org/model/cmis/1.0/alfcmis" prefix="alfcmis" />
</namespaces>
<data-types>
<data-type name="cmis:id">
<java-class>java.lang.String</java-class>
</data-type>
<data-type name="cmis:uri">
<java-class>java.lang.String</java-class>
</data-type>
<data-type name="cmis:html">
<java-class>java.lang.String</java-class>
</data-type>
</data-types>
<constraints>
<constraint name="cmis:allowedValuesForContentStreamAllowed" type="LIST">
<parameter name="allowedValues">
<list>
<value>notallowed</value>
<value>allowed</value>
<value>required</value>
</list>
</parameter>
</constraint>
</constraints>
<types>
<type name="cmisext:object">
<properties>
<property name="cmis:objectId">
<title>Object Id</title>
<description>The unique object id (a node ref)</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:objectTypeId">
<title>Object Type Id</title>
<description>Id of the objects type</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory>true</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:baseTypeId">
<title>Base Type Id</title>
<description>Id of the base object type for the object</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>true</tokenised>
</index>
</property>
<property name="cmis:name">
<title>Name</title>
<description>Name</description>
<type>d:text</type>
<protected>false</protected>
<mandatory>true</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>both</tokenised>
</index>
</property>
<property name="cmis:createdBy">
<title>Created by</title>
<description>The authority who created this object</description>
<type>d:text</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:creationDate">
<title>Creation Date</title>
<description>The object creation date</description>
<type>d:datetime</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:lastModifiedBy">
<title>Last Modified By</title>
<description>The authority who last modified this object</description>
<type>d:text</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:lastModificationDate">
<title>Last Modified Date</title>
<description>The date this object was last modified</description>
<type>d:datetime</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:changeToken">
<title>Change token</title>
<description>Change Token</description>
<type>d:text</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="alfcmis:nodeRef">
<title>Alfresco Node Ref</title>
<description>Alfresco Node Ref</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<!-- V1.1 -->
<property name="cmis:description">
<title>Description</title>
<description>Description</description>
<type>d:text</type>
<protected>false</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>true</tokenised>
</index>
</property>
<property name="cmis:secondaryObjectTypeIds">
<title>Secondary Object Type Ids</title>
<description>Ids of the secondary object types for the object</description>
<type>cmis:id</type>
<protected>false</protected>
<mandatory>false</mandatory>
<multiple>true</multiple>
<index enabled="true">
<tokenised>true</tokenised>
</index>
</property>
</properties>
</type>
<type name="cmis:document">
<title>Document</title>
<description>Document Type</description>
<parent>cmisext:object</parent>
<properties>
<property name="cmis:isImmutable">
<title>Is Immutable</title>
<description>Is the document immutable?</description>
<type>d:boolean</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:isLatestVersion">
<title>Is Latest Version</title>
<description>Is this the latest version of the document?</description>
<type>d:boolean</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:isMajorVersion">
<title>Is Major Version</title>
<description>Is this a major version of the document?</description>
<type>d:boolean</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:isLatestMajorVersion">
<title>Is Latest Major Version</title>
<description>Is this the latest major version of the document?</description>
<type>d:boolean</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:versionLabel">
<title>Version Label</title>
<description>The version label</description>
<type>d:text</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false"/>
</property>
<property name="cmis:versionSeriesId">
<title>Version series id</title>
<description>The version series id</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false"/>
</property>
<property name="cmis:isVersionSeriesCheckedOut">
<title>Is Version Series Checked Out</title>
<description>Is the version series checked out?</description>
<type>d:boolean</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:versionSeriesCheckedOutBy">
<title>Version Series Checked Out By</title>
<description>The authority who checked out this document version series</description>
<type>d:text</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:versionSeriesCheckedOutId">
<title>Version Series Checked Out Id</title>
<description>The checked out version series id</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:checkinComment">
<title>Checkin Comment</title>
<description>The checkin comment</description>
<type>d:text</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:contentStreamLength">
<title>Content Stream Length</title>
<description>The length of the content stream</description>
<type>d:long</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:contentStreamMimeType">
<title>Content Stream MIME Type</title>
<description>The content stream MIME type</description>
<type>d:text</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:contentStreamFileName">
<title>Content Stream Filename</title>
<description>The content stream filename</description>
<type>d:text</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>true</tokenised>
</index>
</property>
<property name="cmis:contentStreamId">
<title>Content Stream Id</title>
<description>Id of the stream</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<!-- V1.1 -->
<property name="cmis:isPrivateWorkingCopy">
<title>Is private working copy</title>
<description>Indicates if this instance is a private working copy</description>
<type>d:boolean</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
</properties>
</type>
<type name="cmis:folder">
<title>Folder</title>
<description>Folder Type</description>
<parent>cmisext:object</parent>
<properties>
<property name="cmis:parentId">
<title>Parent Id</title>
<description>The parent id of the folder</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:path">
<title>Path</title>
<description>The fully qualified path to this folder/description</description>
<type>d:text</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="false"/>
</property>
<property name="cmis:allowedChildObjectTypeIds">
<title>Allowed Child Object Types Ids</title>
<description>The allowed child object type ids</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory>false</mandatory>
<multiple>true</multiple>
<index enabled="false" />
</property>
</properties>
</type>
<type name="cmis:relationship">
<title>Relationship</title>
<description>Relationship Type</description>
<parent>cmisext:object</parent>
<properties>
<property name="cmis:sourceId">
<title>Source Id</title>
<description>The source id for the relationship</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory enforced="true">true</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:targetId">
<title>Target Id</title>
<description>The target id for the relationship</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory enforced="true">true</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
</properties>
</type>
<type name="cmis:policy">
<title>Policy</title>
<description>Policy Type</description>
<parent>cmisext:object</parent>
<properties>
<property name="cmis:policyText">
<title>Policy Text</title>
<description>The policy text</description>
<type>d:text</type>
<protected>true</protected>
<mandatory enforced="true">true</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
</properties>
</type>
<type name="cmis:secondary">
<title>Secondary Type</title>
<description>Secondary Type</description>
<parent>cmisext:object</parent>
<properties>
</properties>
</type>
<type name="cmis:item">
<title>Item Type</title>
<description>CMIS Item</description>
<parent>cmisext:object</parent>
<properties>
</properties>
</type>
<type name="cmisext:aspects">
<title>Aspects</title>
<description>Aspects Type</description>
<parent>cmis:policy</parent>
</type>
</types>
</model>

View File

@@ -0,0 +1,111 @@
<model name="d:dictionary" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<description>Alfresco Dictionary Model</description>
<author>Alfresco</author>
<published>2005-09-29</published>
<version>1.0</version>
<analyserResourceBundleName>alfresco/model/dataTypeAnalyzers</analyserResourceBundleName>
<namespaces>
<!-- Default Namespace -->
<namespace uri="" prefix=""/>
<!-- Default Alfresco Namespace -->
<namespace uri="http://www.alfresco.org" prefix="alf"/>
<!-- Dictionary Namespace -->
<namespace uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- View Namespace -->
<namespace uri="http://www.alfresco.org/view/repository/1.0" prefix="view"/>
</namespaces>
<data-types>
<data-type name="d:any">
<java-class>java.lang.Object</java-class>
</data-type>
<data-type name="d:encrypted">
<java-class>javax.crypto.SealedObject</java-class>
</data-type>
<data-type name="d:text">
<java-class>java.lang.String</java-class>
</data-type>
<data-type name="d:mltext">
<java-class>org.alfresco.service.cmr.repository.MLText</java-class>
</data-type>
<data-type name="d:content">
<java-class>org.alfresco.service.cmr.repository.ContentData</java-class>
</data-type>
<data-type name="d:int">
<java-class>java.lang.Integer</java-class>
</data-type>
<data-type name="d:long">
<java-class>java.lang.Long</java-class>
</data-type>
<data-type name="d:float">
<java-class>java.lang.Float</java-class>
</data-type>
<data-type name="d:double">
<java-class>java.lang.Double</java-class>
</data-type>
<data-type name="d:date">
<java-class>java.util.Date</java-class>
</data-type>
<data-type name="d:datetime">
<java-class>java.util.Date</java-class>
</data-type>
<data-type name="d:boolean">
<java-class>java.lang.Boolean</java-class>
</data-type>
<data-type name="d:qname">
<java-class>org.alfresco.service.namespace.QName</java-class>
</data-type>
<data-type name="d:noderef">
<java-class>org.alfresco.service.cmr.repository.NodeRef</java-class>
</data-type>
<data-type name="d:childassocref">
<java-class>org.alfresco.service.cmr.repository.ChildAssociationRef</java-class>
</data-type>
<data-type name="d:assocref">
<java-class>org.alfresco.service.cmr.repository.AssociationRef</java-class>
</data-type>
<data-type name="d:path">
<java-class>org.alfresco.service.cmr.repository.Path</java-class>
</data-type>
<data-type name="d:category">
<java-class>org.alfresco.service.cmr.repository.NodeRef</java-class>
</data-type>
<data-type name="d:locale">
<java-class>java.util.Locale</java-class>
</data-type>
<data-type name="d:version">
<java-class>org.alfresco.util.VersionNumber</java-class>
</data-type>
<data-type name="d:period">
<java-class>org.alfresco.service.cmr.repository.Period</java-class>
</data-type>
</data-types>
<!-- TODO: Define dictionary meta model -->
</model>

View File

@@ -9,8 +9,6 @@ test_dictionarydaotest.property.test_prop1.description=Prop1 Description
test_dictionarydaotest.association.test_assoc1.title=Assoc1 Title
test_dictionarydaotest.association.test_assoc1.description=Assoc1 Description
test_dictionarydaotest.datatype.test_datatype.analyzer=Datatype Analyser
listconstraint.test_list1.ABC=ABC display
listconstraint.test_list1.DEF=DEF display
listconstraint.test_list1.VALUE\ WITH\ SPACES=VALUE WITH SPACES display

View File

@@ -4,11 +4,11 @@
<author>Alfresco</author>
<published>2005-05-30</published>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
</imports>
<namespaces>
<namespace uri="http://www.alfresco.org/test/dictionarydaotest/1.0" prefix="test"/>
<namespace uri="http://www.alfresco.org/test/dictionarydaotest2/1.0" prefix="test2"/>
@@ -18,12 +18,12 @@
<data-type name="test:datatype">
<default-analyser-class>org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser</default-analyser-class>
<analyserResourceBundleName>alfresco/model/dataTypeAnalyzers</analyserResourceBundleName>
<analyserResourceBundleName>alfresco/model/dataTypeAnalyzers</analyserResourceBundleName>
<java-class>java.lang.Object</java-class>
</data-type>
</data-types>
<constraints>
<constraint name="test:registered1" type="REGISTERED">
<parameter name="registeredName"><value>cm:reg1</value></parameter>
@@ -57,40 +57,40 @@
<title>List1 title</title>
<description>List1 description</description>
<parameter name="allowedValues">
<list>
<value>ABC</value>
<value>DEF</value>
<value>VALUE WITH SPACES</value>
<value>VALUE WITH TRAILING SPACE </value>
</list>
<list>
<value>ABC</value>
<value>DEF</value>
<value>VALUE WITH SPACES</value>
<value>VALUE WITH TRAILING SPACE </value>
</list>
</parameter>
<parameter name="caseSensitive"><value>true</value></parameter>
</constraint>
<constraint name="test:list2" type="LIST">
<parameter name="allowedValues">
<list>
<value>HIJ</value>
</list>
<list>
<value>HIJ</value>
</list>
</parameter>
<parameter name="caseSensitive"><value>true</value></parameter>
</constraint>
<constraint name="test2:list3" type="LIST">
<parameter name="allowedValues">
<list>
<value>XYZ</value>
</list>
<list>
<value>XYZ</value>
</list>
</parameter>
<parameter name="caseSensitive"><value>true</value></parameter>
</constraint>
</constraints>
<types>
<type name="test:base">
<title>Base</title>
<description>The Base Type</description>
<parent></parent>
<properties>
<property name="test:prop1">
<type>d:text</type>
@@ -99,14 +99,14 @@
<constraints>
<constraint ref="test:regex1"/>
<constraint ref="test:stringLength1">
<title>Prop1 Strlen1 title</title>
<description>Prop1 Strlen1 description</description>
<title>Prop1 Strlen1 title</title>
<description>Prop1 Strlen1 description</description>
</constraint>
<constraint ref="test:registered1"/>
</constraints>
</property>
</properties>
<associations>
<association name="test:assoc1">
<source>
@@ -158,16 +158,16 @@
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
<mandatory-aspects>
<aspect>test:referenceable</aspect>
</mandatory-aspects>
</type>
<type name="test:file">
<parent>test:base</parent>
<archive>true</archive>
<properties>
<property name="test:fileprop">
<type>d:text</type>
@@ -202,12 +202,12 @@
<type name="test:file-derived">
<parent>test:file</parent>
</type>
<type name="test:file-derived-no-archive">
<parent>test:file</parent>
<archive>false</archive>
</type>
<type name="test:folder">
<parent>test:base</parent>
<properties>
@@ -218,7 +218,7 @@
</property>
</properties>
</type>
<type name="test:enforced">
<parent>test:base</parent>
<properties>
@@ -236,39 +236,39 @@
</property>
</properties>
</type>
<type name="test:overridetype1">
<properties>
<properties>
<property name="test:propoverride">
<type>d:text</type>
<default>one</default>
<type>d:text</type>
<default>one</default>
</property>
</properties>
</properties>
</type>
<type name="test:overridetype2">
<parent>test:overridetype1</parent>
<overrides>
<parent>test:overridetype1</parent>
<overrides>
<property name="test:propoverride">
<default>two</default>
<default>two</default>
</property>
</overrides>
</overrides>
</type>
<type name="test:overridetype3">
<parent>test:overridetype2</parent>
<overrides>
<parent>test:overridetype2</parent>
<overrides>
<property name="test:propoverride">
<default>three</default>
<default>three</default>
</property>
</overrides>
</overrides>
</type>
<type name="test:typeWithNamedPropConstraint">
<title>Type with named property-defined constraint.</title>
<description>A type with a named constraint defined within one of its properties.</description>
<parent></parent>
<properties>
<property name="test:constrainedProp">
<type>d:text</type>
@@ -278,28 +278,28 @@
<constraint name="test:inlineConstraint" type="LIST">
<title>Inline constraint</title>
<description>An inline constraint</description>
<parameter name="allowedValues">
<list>
<value>ALPHA</value>
<value>BETA</value>
<value>GAMMA, DELTA</value>
<value>OMEGA</value>
</list>
</parameter>
<parameter name="caseSensitive"><value>true</value></parameter>
<parameter name="allowedValues">
<list>
<value>ALPHA</value>
<value>BETA</value>
<value>GAMMA, DELTA</value>
<value>OMEGA</value>
</list>
</parameter>
<parameter name="caseSensitive"><value>true</value></parameter>
</constraint>
</constraints>
</property>
</properties>
</type>
</types>
<aspects>
<aspect name="test:referenceable">
<title>Referenceable</title>
<description>The referenceable aspect</description>
<parent></parent>
<properties>
<property name="test:id">
<type>d:int</type>
@@ -362,5 +362,5 @@
</overrides>
</aspect>
</aspects>
</model>

View File

@@ -9,8 +9,6 @@ test_dictionarydaotest.property.test_prop1.description=Prop1 Description
test_dictionarydaotest.association.test_assoc1.title=Assoc1 Title
test_dictionarydaotest.association.test_assoc1.description=Assoc1 Description
test_dictionarydaotest.datatype.test_datatype.analyzer=Datatype Analyser
listconstraint.test_list1.ABC=ABC display
listconstraint.test_list1.DEF=DEF display
listconstraint.test_list1.VALUE\ WITH\ SPACES=VALUE WITH SPACES display

View File

@@ -0,0 +1,364 @@
<model name="test:dictionarydaotest" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<description>Alfresco Content Model</description>
<author>Alfresco</author>
<published>2005-05-30</published>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
</imports>
<namespaces>
<namespace uri="http://www.alfresco.org/test/dictionarydaotest/1.0" prefix="test"/>
<namespace uri="http://www.alfresco.org/test/dictionarydaotest2/1.0" prefix="test2"/>
</namespaces>
<data-types>
<data-type name="test:datatype">
<java-class>java.lang.Object</java-class>
</data-type>
</data-types>
<constraints>
<constraint name="test:registered1" type="REGISTERED">
<parameter name="registeredName"><value>cm:reg1</value></parameter>
</constraint>
<constraint name="test:registered2" type="REGISTERED">
<parameter name="registeredName"><value>cm:reg2</value></parameter>
</constraint>
<constraint name="test:regex1" type="REGEX">
<title>Regex1 title</title>
<description>Regex1 description</description>
<parameter name="expression"><value>[A-Z]*</value></parameter>
<parameter name="requiresMatch"><value>false</value></parameter>
</constraint>
<constraint name="test:regex2" type="REGEX">
<parameter name="expression"><value>[a-z]*</value></parameter>
<parameter name="requiresMatch"><value>false</value></parameter>
</constraint>
<constraint name="test:stringLength1" type="LENGTH">
<parameter name="minLength"><value>0</value></parameter>
<parameter name="maxLength"><value>256</value></parameter>
</constraint>
<constraint name="test:stringLength2" type="LENGTH">
<parameter name="minLength"><value>0</value></parameter>
<parameter name="maxLength"><value>128</value></parameter>
</constraint>
<constraint name="test:minMax1" type="MINMAX">
<parameter name="minValue"><value>0</value></parameter>
<parameter name="maxValue"><value>256</value></parameter>
</constraint>
<constraint name="test:list1" type="LIST">
<title>List1 title</title>
<description>List1 description</description>
<parameter name="allowedValues">
<list>
<value>ABC</value>
<value>DEF</value>
<value>VALUE WITH SPACES</value>
<value>VALUE WITH TRAILING SPACE </value>
</list>
</parameter>
<parameter name="caseSensitive"><value>true</value></parameter>
</constraint>
<constraint name="test:list2" type="LIST">
<parameter name="allowedValues">
<list>
<value>HIJ</value>
</list>
</parameter>
<parameter name="caseSensitive"><value>true</value></parameter>
</constraint>
<constraint name="test2:list3" type="LIST">
<parameter name="allowedValues">
<list>
<value>XYZ</value>
</list>
</parameter>
<parameter name="caseSensitive"><value>true</value></parameter>
</constraint>
</constraints>
<types>
<type name="test:base">
<title>Base</title>
<description>The Base Type</description>
<parent></parent>
<properties>
<property name="test:prop1">
<type>d:text</type>
<protected>true</protected>
<default></default>
<constraints>
<constraint ref="test:regex1"/>
<constraint ref="test:stringLength1">
<title>Prop1 Strlen1 title</title>
<description>Prop1 Strlen1 description</description>
</constraint>
<constraint ref="test:registered1"/>
</constraints>
</property>
</properties>
<associations>
<association name="test:assoc1">
<source>
<mandatory>true</mandatory>
<many>false</many>
</source>
<target>
<class>test:base</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
<association name="test:assoc2">
<source>
<mandatory>true</mandatory>
<many>true</many>
</source>
<target>
<class>test:referenceable</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
<child-association name="test:childassoc1">
<source>
<mandatory>true</mandatory>
<many>true</many>
</source>
<target>
<class>test:referenceable</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
<child-name>fred</child-name>
<duplicate>true</duplicate>
</child-association>
<child-association name="test:childassocPropagate">
<source>
<mandatory>true</mandatory>
<many>true</many>
</source>
<target>
<class>test:referenceable</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
<child-name>fred</child-name>
<duplicate>true</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
<mandatory-aspects>
<aspect>test:referenceable</aspect>
</mandatory-aspects>
</type>
<type name="test:file">
<parent>test:base</parent>
<archive>true</archive>
<properties>
<property name="test:fileprop">
<type>d:text</type>
<protected>true</protected>
<default></default>
</property>
</properties>
<associations>
<child-association name="test:childassoc2">
<target>
<class>test:referenceable</class>
</target>
<child-name>fred</child-name>
<duplicate>true</duplicate>
</child-association>
</associations>
<overrides>
<property name="test:prop1">
<default>an overriden default value</default>
<constraints>
<constraint ref="test:stringLength2"/>
<constraint ref="test:regex2"/>
<constraint ref="test:registered2"/>
</constraints>
</property>
</overrides>
</type>
<type name="test:file-derived">
<parent>test:file</parent>
</type>
<type name="test:file-derived-no-archive">
<parent>test:file</parent>
<archive>false</archive>
</type>
<type name="test:folder">
<parent>test:base</parent>
<properties>
<property name="test:folderprop">
<type>d:text</type>
<protected>true</protected>
<default></default>
</property>
</properties>
</type>
<type name="test:enforced">
<parent>test:base</parent>
<properties>
<property name="test:mandatory-enforced">
<type>d:text</type>
<mandatory enforced="true">true</mandatory>
</property>
<property name="test:mandatory-not-enforced">
<type>d:text</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="test:mandatory-default-enforced">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
</type>
<type name="test:overridetype1">
<properties>
<property name="test:propoverride">
<type>d:text</type>
<default>one</default>
</property>
</properties>
</type>
<type name="test:overridetype2">
<parent>test:overridetype1</parent>
<overrides>
<property name="test:propoverride">
<default>two</default>
</property>
</overrides>
</type>
<type name="test:overridetype3">
<parent>test:overridetype2</parent>
<overrides>
<property name="test:propoverride">
<default>three</default>
</property>
</overrides>
</type>
<type name="test:typeWithNamedPropConstraint">
<title>Type with named property-defined constraint.</title>
<description>A type with a named constraint defined within one of its properties.</description>
<parent></parent>
<properties>
<property name="test:constrainedProp">
<type>d:text</type>
<protected>true</protected>
<default></default>
<constraints>
<constraint name="test:inlineConstraint" type="LIST">
<title>Inline constraint</title>
<description>An inline constraint</description>
<parameter name="allowedValues">
<list>
<value>ALPHA</value>
<value>BETA</value>
<value>GAMMA, DELTA</value>
<value>OMEGA</value>
</list>
</parameter>
<parameter name="caseSensitive"><value>true</value></parameter>
</constraint>
</constraints>
</property>
</properties>
</type>
</types>
<aspects>
<aspect name="test:referenceable">
<title>Referenceable</title>
<description>The referenceable aspect</description>
<parent></parent>
<properties>
<property name="test:id">
<type>d:int</type>
<protected>true</protected>
<mandatory>true</mandatory>
<index enabled="true">
<atomic>true</atomic>
<stored>false</stored>
</index>
<constraints>
<constraint ref="test:minMax1"/>
</constraints>
</property>
</properties>
</aspect>
<aspect name="test:aspect-base">
<title>Aspect Base</title>
<parent></parent>
<properties>
<property name="test:aspect-base-p1">
<type>d:text</type>
<constraints>
<constraint ref="test:list1"/>
</constraints>
</property>
</properties>
</aspect>
<aspect name="test:aspect-one">
<title>Aspect One</title>
<parent>test:aspect-base</parent>
<overrides>
<property name="test:aspect-base-p1">
<constraints>
<constraint ref="test:list2"/>
</constraints>
</property>
</overrides>
</aspect>
<aspect name="test:aspect-two">
<title>Aspect Two</title>
<parent>test:aspect-base</parent>
<overrides>
<property name="test:aspect-base-p1">
<constraints>
<constraint ref="test:list1"/>
<constraint ref="test:list2"/>
</constraints>
</property>
</overrides>
</aspect>
<aspect name="test2:aspect-three">
<title>Aspect derived from other namespace</title>
<parent>test:aspect-base</parent>
<overrides>
<property name="test:aspect-base-p1">
<constraints>
<constraint ref="test2:list3"/>
</constraints>
</property>
</overrides>
</aspect>
</aspects>
</model>