@Test public void testMerge() throws Exception { RepositoryDescriptor desc2 = (RepositoryDescriptor) xmap.load(getResource("test-repository-descriptor2.xml")); desc.merge(desc2); assertEquals(Arrays.asList("file1", "file2", "file3"), desc.sqlInitFiles); assertTrue(desc.getPathOptimizationsEnabled()); assertEquals(2, desc.getPathOptimizationsVersion()); PoolConfiguration pool = desc.pool; assertEquals(111, pool.getMinPoolSize()); assertEquals(222, pool.getMaxPoolSize()); assertEquals(3, pool.getBlockingTimeoutMillis()); assertNotNull(desc.schemaFields); assertEquals(4, desc.schemaFields.size()); FieldDescriptor fd; fd = desc.schemaFields.get(0); assertEquals("my:bignote", fd.field); assertEquals("other", fd.type); fd = desc.schemaFields.get(1); assertEquals("foo", fd.field); assertEquals("xyz", fd.type); fd = desc.schemaFields.get(2); assertEquals("bar", fd.field); assertEquals("bartype2", fd.type); assertEquals("bartable2", fd.table); assertEquals("barcol2", fd.column); fd = desc.schemaFields.get(3); assertEquals("def", fd.field); assertEquals("abc", fd.type); assertEquals("english", desc.getFulltextAnalyzer()); assertEquals("nuxeo", desc.getFulltextCatalog()); FulltextDescriptor fulltextDescriptor = desc.getFulltextDescriptor(); List<FulltextIndexDescriptor> fulltextIndexes = fulltextDescriptor.getFulltextIndexes(); assertEquals(5, fulltextIndexes.size()); FulltextIndexDescriptor fti; fti = fulltextIndexes.get(0); assertNull(fti.name); assertNull(fti.fieldType); assertEquals(new HashSet<String>(), fti.fields); assertEquals(Collections.singleton("dc:creator"), fti.excludeFields); fti = fulltextIndexes.get(1); assertEquals("titraille", fti.name); assertNull(fti.fieldType); assertEquals(new HashSet<>(Arrays.asList("dc:title", "dc:description", "my:desc")), fti.fields); assertEquals(new HashSet<String>(), fti.excludeFields); fti = fulltextIndexes.get(2); assertEquals("blobs", fti.name); assertEquals("blob", fti.fieldType); assertEquals(new HashSet<String>(), fti.fields); assertEquals(Collections.singleton("foo:bar"), fti.excludeFields); fti = fulltextIndexes.get(3); assertEquals("pictures", fti.name); assertNull(fti.fieldType); assertEquals(Collections.singleton("picture:views/*/filename"), fti.fields); assertEquals(new HashSet<String>(), fti.excludeFields); fti = fulltextIndexes.get(4); assertEquals("other", fti.name); assertNull(fti.fieldType); assertEquals(Collections.singleton("my:other"), fti.fields); assertEquals(new HashSet<String>(), fti.excludeFields); assertEquals(new HashSet<>(Arrays.asList("Folder", "Workspace", "OtherExcluded")), fulltextDescriptor.getFulltextExcludedTypes()); assertEquals(new HashSet<>(Arrays.asList("Note", "File", "OtherIncluded")), fulltextDescriptor.getFulltextIncludedTypes()); }
public void merge(RepositoryDescriptor other) { if (other.name != null) { name = other.name; } if (other.label != null) { label = other.label; } if (other.isDefault != null) { isDefault = other.isDefault; } if (other.headless != null) { headless = other.headless; } if (other.pool != null) { if (pool == null) { pool = new PoolConfiguration(other.pool); } else { pool.merge(other.pool); } } if (other.clusterInvalidatorClass != null) { clusterInvalidatorClass = other.clusterInvalidatorClass; } if (other.cachingMapperClass != null) { cachingMapperClass = other.cachingMapperClass; } if (other.cachingMapperEnabled != null) { cachingMapperEnabled = other.cachingMapperEnabled; } cachingMapperProperties.putAll(other.cachingMapperProperties); if (other.noDDL != null) { noDDL = other.noDDL; } if (other.ddlMode != null) { ddlMode = other.ddlMode; } sqlInitFiles.addAll(other.sqlInitFiles); if (other.softDeleteEnabled != null) { softDeleteEnabled = other.softDeleteEnabled; } if (other.proxiesEnabled != null) { proxiesEnabled = other.proxiesEnabled; } if (other.idType != null) { idType = other.idType; } for (FieldDescriptor of : other.schemaFields) { boolean append = true; for (FieldDescriptor f : schemaFields) { if (f.field.equals(of.field)) { f.merge(of); append = false; break; } } if (append) { schemaFields.add(of); } } if (other.arrayColumns != null) { arrayColumns = other.arrayColumns; } if (other.childNameUniqueConstraintEnabled != null) { childNameUniqueConstraintEnabled = other.childNameUniqueConstraintEnabled; } if (other.collectionUniqueConstraintEnabled != null) { collectionUniqueConstraintEnabled = other.collectionUniqueConstraintEnabled; } if (other.fulltextAnalyzer != null) { fulltextAnalyzer = other.fulltextAnalyzer; } if (other.fulltextCatalog != null) { fulltextCatalog = other.fulltextCatalog; } fulltextDescriptor.merge(other.fulltextDescriptor); neverPerInstanceMixins.addAll(other.neverPerInstanceMixins); if (other.pathOptimizationsEnabled != null) { pathOptimizationsEnabled = other.pathOptimizationsEnabled; } if (other.pathOptimizationsVersion != null) { pathOptimizationsVersion = other.pathOptimizationsVersion; } if (other.aclOptimizationsEnabled != null) { aclOptimizationsEnabled = other.aclOptimizationsEnabled; } if (other.readAclMaxSize != null) { readAclMaxSize = other.readAclMaxSize; } if (other.usersSeparatorKey != null) { usersSeparatorKey = other.usersSeparatorKey; } if (other.changeTokenEnabled != null) { changeTokenEnabled = other.changeTokenEnabled; } }
RepositoryDescriptor { public void merge(RepositoryDescriptor other) { if (other.name != null) { name = other.name; } if (other.label != null) { label = other.label; } if (other.isDefault != null) { isDefault = other.isDefault; } if (other.headless != null) { headless = other.headless; } if (other.pool != null) { if (pool == null) { pool = new PoolConfiguration(other.pool); } else { pool.merge(other.pool); } } if (other.clusterInvalidatorClass != null) { clusterInvalidatorClass = other.clusterInvalidatorClass; } if (other.cachingMapperClass != null) { cachingMapperClass = other.cachingMapperClass; } if (other.cachingMapperEnabled != null) { cachingMapperEnabled = other.cachingMapperEnabled; } cachingMapperProperties.putAll(other.cachingMapperProperties); if (other.noDDL != null) { noDDL = other.noDDL; } if (other.ddlMode != null) { ddlMode = other.ddlMode; } sqlInitFiles.addAll(other.sqlInitFiles); if (other.softDeleteEnabled != null) { softDeleteEnabled = other.softDeleteEnabled; } if (other.proxiesEnabled != null) { proxiesEnabled = other.proxiesEnabled; } if (other.idType != null) { idType = other.idType; } for (FieldDescriptor of : other.schemaFields) { boolean append = true; for (FieldDescriptor f : schemaFields) { if (f.field.equals(of.field)) { f.merge(of); append = false; break; } } if (append) { schemaFields.add(of); } } if (other.arrayColumns != null) { arrayColumns = other.arrayColumns; } if (other.childNameUniqueConstraintEnabled != null) { childNameUniqueConstraintEnabled = other.childNameUniqueConstraintEnabled; } if (other.collectionUniqueConstraintEnabled != null) { collectionUniqueConstraintEnabled = other.collectionUniqueConstraintEnabled; } if (other.fulltextAnalyzer != null) { fulltextAnalyzer = other.fulltextAnalyzer; } if (other.fulltextCatalog != null) { fulltextCatalog = other.fulltextCatalog; } fulltextDescriptor.merge(other.fulltextDescriptor); neverPerInstanceMixins.addAll(other.neverPerInstanceMixins); if (other.pathOptimizationsEnabled != null) { pathOptimizationsEnabled = other.pathOptimizationsEnabled; } if (other.pathOptimizationsVersion != null) { pathOptimizationsVersion = other.pathOptimizationsVersion; } if (other.aclOptimizationsEnabled != null) { aclOptimizationsEnabled = other.aclOptimizationsEnabled; } if (other.readAclMaxSize != null) { readAclMaxSize = other.readAclMaxSize; } if (other.usersSeparatorKey != null) { usersSeparatorKey = other.usersSeparatorKey; } if (other.changeTokenEnabled != null) { changeTokenEnabled = other.changeTokenEnabled; } } }
RepositoryDescriptor { public void merge(RepositoryDescriptor other) { if (other.name != null) { name = other.name; } if (other.label != null) { label = other.label; } if (other.isDefault != null) { isDefault = other.isDefault; } if (other.headless != null) { headless = other.headless; } if (other.pool != null) { if (pool == null) { pool = new PoolConfiguration(other.pool); } else { pool.merge(other.pool); } } if (other.clusterInvalidatorClass != null) { clusterInvalidatorClass = other.clusterInvalidatorClass; } if (other.cachingMapperClass != null) { cachingMapperClass = other.cachingMapperClass; } if (other.cachingMapperEnabled != null) { cachingMapperEnabled = other.cachingMapperEnabled; } cachingMapperProperties.putAll(other.cachingMapperProperties); if (other.noDDL != null) { noDDL = other.noDDL; } if (other.ddlMode != null) { ddlMode = other.ddlMode; } sqlInitFiles.addAll(other.sqlInitFiles); if (other.softDeleteEnabled != null) { softDeleteEnabled = other.softDeleteEnabled; } if (other.proxiesEnabled != null) { proxiesEnabled = other.proxiesEnabled; } if (other.idType != null) { idType = other.idType; } for (FieldDescriptor of : other.schemaFields) { boolean append = true; for (FieldDescriptor f : schemaFields) { if (f.field.equals(of.field)) { f.merge(of); append = false; break; } } if (append) { schemaFields.add(of); } } if (other.arrayColumns != null) { arrayColumns = other.arrayColumns; } if (other.childNameUniqueConstraintEnabled != null) { childNameUniqueConstraintEnabled = other.childNameUniqueConstraintEnabled; } if (other.collectionUniqueConstraintEnabled != null) { collectionUniqueConstraintEnabled = other.collectionUniqueConstraintEnabled; } if (other.fulltextAnalyzer != null) { fulltextAnalyzer = other.fulltextAnalyzer; } if (other.fulltextCatalog != null) { fulltextCatalog = other.fulltextCatalog; } fulltextDescriptor.merge(other.fulltextDescriptor); neverPerInstanceMixins.addAll(other.neverPerInstanceMixins); if (other.pathOptimizationsEnabled != null) { pathOptimizationsEnabled = other.pathOptimizationsEnabled; } if (other.pathOptimizationsVersion != null) { pathOptimizationsVersion = other.pathOptimizationsVersion; } if (other.aclOptimizationsEnabled != null) { aclOptimizationsEnabled = other.aclOptimizationsEnabled; } if (other.readAclMaxSize != null) { readAclMaxSize = other.readAclMaxSize; } if (other.usersSeparatorKey != null) { usersSeparatorKey = other.usersSeparatorKey; } if (other.changeTokenEnabled != null) { changeTokenEnabled = other.changeTokenEnabled; } } RepositoryDescriptor();  RepositoryDescriptor(RepositoryDescriptor other); }
RepositoryDescriptor { public void merge(RepositoryDescriptor other) { if (other.name != null) { name = other.name; } if (other.label != null) { label = other.label; } if (other.isDefault != null) { isDefault = other.isDefault; } if (other.headless != null) { headless = other.headless; } if (other.pool != null) { if (pool == null) { pool = new PoolConfiguration(other.pool); } else { pool.merge(other.pool); } } if (other.clusterInvalidatorClass != null) { clusterInvalidatorClass = other.clusterInvalidatorClass; } if (other.cachingMapperClass != null) { cachingMapperClass = other.cachingMapperClass; } if (other.cachingMapperEnabled != null) { cachingMapperEnabled = other.cachingMapperEnabled; } cachingMapperProperties.putAll(other.cachingMapperProperties); if (other.noDDL != null) { noDDL = other.noDDL; } if (other.ddlMode != null) { ddlMode = other.ddlMode; } sqlInitFiles.addAll(other.sqlInitFiles); if (other.softDeleteEnabled != null) { softDeleteEnabled = other.softDeleteEnabled; } if (other.proxiesEnabled != null) { proxiesEnabled = other.proxiesEnabled; } if (other.idType != null) { idType = other.idType; } for (FieldDescriptor of : other.schemaFields) { boolean append = true; for (FieldDescriptor f : schemaFields) { if (f.field.equals(of.field)) { f.merge(of); append = false; break; } } if (append) { schemaFields.add(of); } } if (other.arrayColumns != null) { arrayColumns = other.arrayColumns; } if (other.childNameUniqueConstraintEnabled != null) { childNameUniqueConstraintEnabled = other.childNameUniqueConstraintEnabled; } if (other.collectionUniqueConstraintEnabled != null) { collectionUniqueConstraintEnabled = other.collectionUniqueConstraintEnabled; } if (other.fulltextAnalyzer != null) { fulltextAnalyzer = other.fulltextAnalyzer; } if (other.fulltextCatalog != null) { fulltextCatalog = other.fulltextCatalog; } fulltextDescriptor.merge(other.fulltextDescriptor); neverPerInstanceMixins.addAll(other.neverPerInstanceMixins); if (other.pathOptimizationsEnabled != null) { pathOptimizationsEnabled = other.pathOptimizationsEnabled; } if (other.pathOptimizationsVersion != null) { pathOptimizationsVersion = other.pathOptimizationsVersion; } if (other.aclOptimizationsEnabled != null) { aclOptimizationsEnabled = other.aclOptimizationsEnabled; } if (other.readAclMaxSize != null) { readAclMaxSize = other.readAclMaxSize; } if (other.usersSeparatorKey != null) { usersSeparatorKey = other.usersSeparatorKey; } if (other.changeTokenEnabled != null) { changeTokenEnabled = other.changeTokenEnabled; } } RepositoryDescriptor();  RepositoryDescriptor(RepositoryDescriptor other); @XNode("@name") void setName(String name); Boolean isDefault(); Boolean isHeadless(); boolean getCachingMapperEnabled(); String getDDLMode(); boolean getNoDDL(); boolean getSoftDeleteEnabled(); boolean getProxiesEnabled(); boolean getArrayColumns(); void setArrayColumns(boolean enabled); boolean getChildNameUniqueConstraintEnabled(); boolean getCollectionUniqueConstraintEnabled(); @XNode("indexing/queryMaker@class") void setQueryMakerDeprecated(String klass); String getFulltextAnalyzer(); @XNode("indexing/fulltext@analyzer") void setFulltextAnalyzer(String fulltextAnalyzer); String getFulltextCatalog(); @XNode("indexing/fulltext@catalog") void setFulltextCatalog(String fulltextCatalog); FulltextDescriptor getFulltextDescriptor(); @XNode("indexing/fulltext@fieldSizeLimit") void setFulltextFieldSizeLimit(int fieldSizeLimit); @XNode("indexing/fulltext@disabled") void setFulltextDisabled(boolean disabled); @XNode("indexing/fulltext@storedInBlob") void setFulltextStoredInBlob(boolean storedInBlob); @XNode("indexing/fulltext@searchDisabled") void setFulltextSearchDisabled(boolean disabled); @XNodeList(value = "indexing/fulltext/index", type = ArrayList.class, componentType = FulltextIndexDescriptor.class) void setFulltextIndexes(List<FulltextIndexDescriptor> fulltextIndexes); @XNodeList(value = "indexing/excludedTypes/type", type = HashSet.class, componentType = String.class) void setFulltextExcludedTypes(Set<String> fulltextExcludedTypes); @XNodeList(value = "indexing/includedTypes/type", type = HashSet.class, componentType = String.class) void setFulltextIncludedTypes(Set<String> fulltextIncludedTypes); boolean getPathOptimizationsEnabled(); int getPathOptimizationsVersion(); boolean getAclOptimizationsEnabled(); int getReadAclMaxSize(); boolean isChangeTokenEnabled(); void setChangeTokenEnabled(boolean enabled); void merge(RepositoryDescriptor other); }
RepositoryDescriptor { public void merge(RepositoryDescriptor other) { if (other.name != null) { name = other.name; } if (other.label != null) { label = other.label; } if (other.isDefault != null) { isDefault = other.isDefault; } if (other.headless != null) { headless = other.headless; } if (other.pool != null) { if (pool == null) { pool = new PoolConfiguration(other.pool); } else { pool.merge(other.pool); } } if (other.clusterInvalidatorClass != null) { clusterInvalidatorClass = other.clusterInvalidatorClass; } if (other.cachingMapperClass != null) { cachingMapperClass = other.cachingMapperClass; } if (other.cachingMapperEnabled != null) { cachingMapperEnabled = other.cachingMapperEnabled; } cachingMapperProperties.putAll(other.cachingMapperProperties); if (other.noDDL != null) { noDDL = other.noDDL; } if (other.ddlMode != null) { ddlMode = other.ddlMode; } sqlInitFiles.addAll(other.sqlInitFiles); if (other.softDeleteEnabled != null) { softDeleteEnabled = other.softDeleteEnabled; } if (other.proxiesEnabled != null) { proxiesEnabled = other.proxiesEnabled; } if (other.idType != null) { idType = other.idType; } for (FieldDescriptor of : other.schemaFields) { boolean append = true; for (FieldDescriptor f : schemaFields) { if (f.field.equals(of.field)) { f.merge(of); append = false; break; } } if (append) { schemaFields.add(of); } } if (other.arrayColumns != null) { arrayColumns = other.arrayColumns; } if (other.childNameUniqueConstraintEnabled != null) { childNameUniqueConstraintEnabled = other.childNameUniqueConstraintEnabled; } if (other.collectionUniqueConstraintEnabled != null) { collectionUniqueConstraintEnabled = other.collectionUniqueConstraintEnabled; } if (other.fulltextAnalyzer != null) { fulltextAnalyzer = other.fulltextAnalyzer; } if (other.fulltextCatalog != null) { fulltextCatalog = other.fulltextCatalog; } fulltextDescriptor.merge(other.fulltextDescriptor); neverPerInstanceMixins.addAll(other.neverPerInstanceMixins); if (other.pathOptimizationsEnabled != null) { pathOptimizationsEnabled = other.pathOptimizationsEnabled; } if (other.pathOptimizationsVersion != null) { pathOptimizationsVersion = other.pathOptimizationsVersion; } if (other.aclOptimizationsEnabled != null) { aclOptimizationsEnabled = other.aclOptimizationsEnabled; } if (other.readAclMaxSize != null) { readAclMaxSize = other.readAclMaxSize; } if (other.usersSeparatorKey != null) { usersSeparatorKey = other.usersSeparatorKey; } if (other.changeTokenEnabled != null) { changeTokenEnabled = other.changeTokenEnabled; } } RepositoryDescriptor();  RepositoryDescriptor(RepositoryDescriptor other); @XNode("@name") void setName(String name); Boolean isDefault(); Boolean isHeadless(); boolean getCachingMapperEnabled(); String getDDLMode(); boolean getNoDDL(); boolean getSoftDeleteEnabled(); boolean getProxiesEnabled(); boolean getArrayColumns(); void setArrayColumns(boolean enabled); boolean getChildNameUniqueConstraintEnabled(); boolean getCollectionUniqueConstraintEnabled(); @XNode("indexing/queryMaker@class") void setQueryMakerDeprecated(String klass); String getFulltextAnalyzer(); @XNode("indexing/fulltext@analyzer") void setFulltextAnalyzer(String fulltextAnalyzer); String getFulltextCatalog(); @XNode("indexing/fulltext@catalog") void setFulltextCatalog(String fulltextCatalog); FulltextDescriptor getFulltextDescriptor(); @XNode("indexing/fulltext@fieldSizeLimit") void setFulltextFieldSizeLimit(int fieldSizeLimit); @XNode("indexing/fulltext@disabled") void setFulltextDisabled(boolean disabled); @XNode("indexing/fulltext@storedInBlob") void setFulltextStoredInBlob(boolean storedInBlob); @XNode("indexing/fulltext@searchDisabled") void setFulltextSearchDisabled(boolean disabled); @XNodeList(value = "indexing/fulltext/index", type = ArrayList.class, componentType = FulltextIndexDescriptor.class) void setFulltextIndexes(List<FulltextIndexDescriptor> fulltextIndexes); @XNodeList(value = "indexing/excludedTypes/type", type = HashSet.class, componentType = String.class) void setFulltextExcludedTypes(Set<String> fulltextExcludedTypes); @XNodeList(value = "indexing/includedTypes/type", type = HashSet.class, componentType = String.class) void setFulltextIncludedTypes(Set<String> fulltextIncludedTypes); boolean getPathOptimizationsEnabled(); int getPathOptimizationsVersion(); boolean getAclOptimizationsEnabled(); int getReadAclMaxSize(); boolean isChangeTokenEnabled(); void setChangeTokenEnabled(boolean enabled); void merge(RepositoryDescriptor other); @Deprecated
    static final int DEFAULT_READ_ACL_MAX_SIZE; static final int DEFAULT_PATH_OPTIM_VERSION; static final String DDL_MODE_IGNORE; static final String DDL_MODE_DUMP; static final String DDL_MODE_EXECUTE; static final String DDL_MODE_ABORT; static final String DDL_MODE_COMPAT; public String name; @XNode("@label")
    public String label; @XNode("repository")
    public RepositoryDescriptor repositoryDescriptor; @XNode("pool")
    public PoolConfiguration pool; @XNode("clusterInvalidatorClass")
    public Class<? extends VCSClusterInvalidator> clusterInvalidatorClass; @XNode("cachingMapper@class")
    public Class<? extends CachingMapper> cachingMapperClass; @XNodeMap(value = "cachingMapper/property", key = "@name", type = HashMap.class, componentType = String.class)
    public Map<String, String> cachingMapperProperties; @XNodeList(value = "sqlInitFile", type = ArrayList.class, componentType = String.class)
    public List<String> sqlInitFiles; @XNode("idType")
    public String idType; @XNodeList(value = "schema/field", type = ArrayList.class, componentType = FieldDescriptor.class)
    public List<FieldDescriptor> schemaFields; @XNodeList(value = "indexing/neverPerDocumentFacets/facet", type = HashSet.class, componentType = String.class)
    public Set<String> neverPerInstanceMixins; @XNode("usersSeparator@key")
    public String usersSeparatorKey; }