mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (4.3/Cloud)
74253: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (5.0/Cloud) 74025: Merged DEV to V4.2-BUG-FIX (4.2.3) 74013: MNT-11653 : Content Model <override> doesnt allow overriding "enforcement" Changed the mandatory type validation. Added model validation against xsd in the test. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@74886 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://www.alfresco.org/model/dictionary/1.0"
|
||||
xmlns:dd="http://www.alfresco.org/model/dictionary/1.0"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://www.alfresco.org/model/dictionary/1.0"
|
||||
xmlns:dd="http://www.alfresco.org/model/dictionary/1.0"
|
||||
elementFormDefault="qualified" version="0.1">
|
||||
|
||||
<xs:annotation>
|
||||
<xs:documentation>Alfresco Data Dictionary Schema for Alfresco M2Model
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
<xs:element name="model">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
@@ -65,15 +65,15 @@
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="constraints" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="constraint" type="dd:constraint"
|
||||
maxOccurs="unbounded" minOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="constraints" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="constraint" type="dd:constraint"
|
||||
maxOccurs="unbounded" minOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="types" maxOccurs="1" minOccurs="0">
|
||||
<xs:complexType>
|
||||
@@ -91,7 +91,7 @@
|
||||
maxOccurs="unbounded" minOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="dd:name" />
|
||||
</xs:complexType>
|
||||
@@ -101,10 +101,10 @@
|
||||
<xs:sequence>
|
||||
<xs:group ref="dd:TextualDescription"></xs:group>
|
||||
<xs:element name="parent" type="xs:string"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="archive" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="includedInSuperTypeQuery" type="xs:boolean"
|
||||
<xs:element name="archive" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="includedInSuperTypeQuery" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="properties" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
@@ -125,7 +125,7 @@
|
||||
maxOccurs="unbounded" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="overrides" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
@@ -136,17 +136,17 @@
|
||||
minOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="mandatory-aspects" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="aspect" type="xs:string"
|
||||
maxOccurs="unbounded" minOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="mandatory-aspects" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="aspect" type="xs:string"
|
||||
maxOccurs="unbounded" minOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="dd:name" />
|
||||
</xs:complexType>
|
||||
@@ -154,11 +154,11 @@
|
||||
<xs:complexType name="property">
|
||||
<xs:sequence>
|
||||
<xs:group ref="dd:TextualDescription" />
|
||||
<xs:element name="type" type="xs:string"/>
|
||||
<xs:element name="type" type="xs:string"/>
|
||||
<xs:element name="protected" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="mandatory"
|
||||
maxOccurs="1" minOccurs="0" type="dd:mandatoryDef" >
|
||||
maxOccurs="1" minOccurs="0" type="dd:mandatoryDef" >
|
||||
</xs:element>
|
||||
<xs:element name="multiple" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
@@ -172,32 +172,32 @@
|
||||
<xs:element name="stored" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="tokenised"
|
||||
maxOccurs="1" minOccurs="0" >
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="true"/>
|
||||
<xs:enumeration value="false"/>
|
||||
<xs:enumeration value="both"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
maxOccurs="1" minOccurs="0" >
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="true"/>
|
||||
<xs:enumeration value="false"/>
|
||||
<xs:enumeration value="both"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="enabled" type="xs:boolean"
|
||||
use="required" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="constraints" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="constraint" type="dd:constraint"
|
||||
maxOccurs="unbounded" minOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="encrypted" maxOccurs="1" minOccurs="0" type="xs:boolean">
|
||||
|
||||
<xs:element name="constraints" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="constraint" type="dd:constraint"
|
||||
maxOccurs="unbounded" minOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="encrypted" maxOccurs="1" minOccurs="0" type="xs:boolean">
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="dd:name" />
|
||||
@@ -207,78 +207,84 @@
|
||||
<xs:complexContent>
|
||||
<xs:extension base="dd:class">
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
|
||||
<xs:complexType name="aspect">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="dd:class"></xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="constraint">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Constraint for Alfresco M2Model
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:sequence>
|
||||
<xs:element name="parameter" maxOccurs="unbounded" type="dd:namedValue"
|
||||
minOccurs="0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Parameter for Alfresco M2Model
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="type" use="optional">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
|
||||
<xs:attribute name="ref" use="optional" type="xs:string" />
|
||||
<xs:attribute name="name" use="optional" type="xs:string" />
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="namedValue">
|
||||
<xs:choice>
|
||||
<xs:element name="value" type="xs:string" maxOccurs="1"
|
||||
minOccurs="0" />
|
||||
<xs:element name="list" maxOccurs="1" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="value" type="xs:string"
|
||||
maxOccurs="unbounded" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
<xs:attributeGroup ref="dd:name" />
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="constraint">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Constraint for Alfresco M2Model
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:sequence>
|
||||
<xs:element name="parameter" maxOccurs="unbounded" type="dd:namedValue"
|
||||
minOccurs="0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Parameter for Alfresco M2Model
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="type" use="optional">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
|
||||
<xs:attribute name="ref" use="optional" type="xs:string" />
|
||||
<xs:attribute name="name" use="optional" type="xs:string" />
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="namedValue">
|
||||
<xs:choice>
|
||||
<xs:element name="value" type="xs:string" maxOccurs="1"
|
||||
minOccurs="0" />
|
||||
<xs:element name="list" maxOccurs="1" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="value" type="xs:string"
|
||||
maxOccurs="unbounded" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
<xs:attributeGroup ref="dd:name" />
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="association">
|
||||
<xs:sequence>
|
||||
<xs:group ref="dd:TextualDescription"></xs:group>
|
||||
<xs:element name="source" maxOccurs="1" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="role" type="xs:string" maxOccurs="1"
|
||||
minOccurs="0" />
|
||||
<xs:element name="mandatory" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="many" type="xs:boolean"
|
||||
<xs:element name="source" maxOccurs="1" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="role" type="xs:string" maxOccurs="1"
|
||||
minOccurs="0" />
|
||||
<xs:element name="mandatory" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="many" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="target">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="class" type="xs:string" maxOccurs="1" minOccurs="1" />
|
||||
<xs:element name="role" type="xs:string" maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="target">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="class" type="xs:string" maxOccurs="1" minOccurs="1" />
|
||||
<xs:element name="role" type="xs:string" maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="mandatory" type="dd:mandatoryDef"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="many" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="dd:name" />
|
||||
@@ -291,8 +297,8 @@
|
||||
<xs:element name="child-name" type="xs:string"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="duplicate" type="xs:boolean"
|
||||
<xs:complexContent>
|
||||
<xs:extension base="dd:association">
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="propagateTimestamps" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
@@ -301,18 +307,18 @@
|
||||
|
||||
<xs:complexType name="propertyOverride">
|
||||
<xs:sequence>
|
||||
</xs:extension>
|
||||
<xs:element name="mandatory" type="dd:mandatoryDef"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="default" type="xs:string"
|
||||
|
||||
<xs:complexType name="propertyOverride">
|
||||
<xs:sequence>
|
||||
<xs:element name="mandatory" type="xs:boolean"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="default" type="xs:string"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="constraints" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
<xs:element name="constraints" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="constraint" type="dd:constraint"
|
||||
maxOccurs="unbounded" minOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="dd:name" />
|
||||
@@ -334,10 +340,10 @@
|
||||
<xs:element name="description" type="xs:string"
|
||||
maxOccurs="1" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string" maxOccurs="1"
|
||||
minOccurs="0" />
|
||||
<xs:element name="description" type="xs:string"
|
||||
</xs:group>
|
||||
|
||||
<xs:complexType name="mandatoryDef" mixed="true">
|
||||
<xs:attribute name="enforced" use="optional" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
|
||||
</xs:schema>
|
||||
|
@@ -25,6 +25,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
@@ -36,6 +43,7 @@ import org.alfresco.service.cmr.dictionary.ConstraintDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryException;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
@@ -46,6 +54,7 @@ import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||
import org.alfresco.util.BaseAlfrescoSpringTest;
|
||||
import org.alfresco.util.PropertyMap;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
/**
|
||||
* Dictionary model type unit test
|
||||
@@ -975,6 +984,22 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
setComplete();
|
||||
endTransaction();
|
||||
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// Validate the model
|
||||
ContentReader reader = DictionaryModelTypeTest.this.contentService.getReader(modelNode, ContentModel.PROP_CONTENT);
|
||||
Source transferReportSource = new StreamSource(reader.getContentInputStream());
|
||||
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
||||
final String schemaLocation = "classpath:alfresco/model/modelSchema.xsd";
|
||||
Schema schema = sf.newSchema(ResourceUtils.getURL(schemaLocation));
|
||||
Validator validator = schema.newValidator();
|
||||
validator.validate(transferReportSource);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// create node using new type
|
||||
final NodeRef node1 = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
|
Reference in New Issue
Block a user