Commit af7b1846 authored by Ate Douma's avatar Ate Douma

TRIVIAL cleanup master

parent e518b2fb
* text=auto !eol
/LICENSE -text
/NOTICE -text
/pom.xml svneol=native#text/plain
src/test/resources/org/onehippo/cms7/services/contenttype/nt-file.json -text
src/test/resources/org/onehippo/cms7/services/contenttype/testNode.json -text
/*.iml
/.idea
/target
This diff is collapsed.
Hippo CMS7 Services - contenttype
Copyright 2013-2018 Hippo B.V. (http://www.onehippo.com)
This product includes software developed by:
Hippo B.V., Amsterdam, The Netherlands (http://www.onehippo.com/);
The Apache Software Foundation (http://www.apache.org/).
NOTICE: Only our own original work is licensed under the terms of the
Apache License Version 2.0. The licenses of some libraries might impose
different redistribution or general licensing terms than those stated in the
Apache License. Users and redistributors are hereby requested to verify these
conditions and agree upon them.
# This is not the branch you're looking for...
BloomReach only provides the git trees for the release tags of Hippo CMS, as explained on https://www.onehippo.org/about/open-source-release-policy.html
To checkout the code for a specific release tag, after cloning this repository, use the following:
## to show the available tags
git tag
## to checkout a specific tag
git checkout <tag name>
## to modify a project
If you want to make modifications to a project, for example to create a patch, create a new fork branch from the specific tag like this:
git checkout -b forked-<tag name> <tag name>
For the latter, also see the **Build from Source** documentation at https://www.onehippo.org/library/development/build-hippo-cms-from-scratch.html
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2014-2018 Hippo B.V. (http://www.onehippo.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-cms7-project</artifactId>
<version>29.4-SNAPSHOT</version>
</parent>
<name>Hippo CMS7 Services - contenttype</name>
<artifactId>hippo-services-contenttype</artifactId>
<version>4.3.0-SNAPSHOT</version>
<inceptionYear>2013</inceptionYear>
<properties>
<!-- use root project name for all project modules NOTICE files, should be the same as in the root NOTICE file -->
<notice.project.name>Hippo CMS7 Services - contenttype</notice.project.name>
<hippo.services.version>4.3.0-SNAPSHOT</hippo.services.version>
<hippo.repository.version>5.3.0-SNAPSHOT</hippo.repository.version>
<hippo.cms.version>5.3.0-SNAPSHOT</hippo.cms.version>
</properties>
<scm>
<connection>scm:git:https://code.onehippo.org/cms-community/hippo-services-contenttype.git</connection>
<developerConnection>scm:git:git@code.onehippo.org:cms-community/hippo-services-contenttype.git</developerConnection>
<url>https://code.onehippo.org/cms-community/hippo-services-contenttype</url>
</scm>
<repositories>
<repository>
<id>hippo</id>
<name>Hippo Maven 2</name>
<url>https://maven.onehippo.com/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-services</artifactId>
<version>${hippo.services.version}</version>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-repository-api</artifactId>
<version>${hippo.repository.version}</version>
<scope>provided</scope>
</dependency>
<!-- Jackson Java JSON-processor -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
<version>${jackson2.version}</version>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-cms-test</artifactId>
<version>${hippo.cms.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-cms-editor-repository</artifactId>
<version>${hippo.cms.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-cms-editor-repository</artifactId>
<version>${hippo.cms.version}</version>
<type>jar</type>
<classifier>tests</classifier>
<scope>test</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<!--
Hippo-Modules entry is defined in custom manifest file which will be merged at runtime. See: CMS-9885
-->
<manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<org.onehippo.repository.test.keepserver>true</org.onehippo.repository.test.keepserver>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>pedantic</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<excludes combine.children="append">
<!-- largely forked but heavily modified and simplified version of Jackrabbit 2.6 org.apache.jackrabbit.core.nodetype.BitSetENTCacheImpl.java
retaining its original AS2.0 license header
-->
<exclude>src/main/java/org/onehippo/cms7/services/contenttype/AggregatedContentTypesCache.java</exclude>
<!-- test output json file which cannot have embedded comments -->
<exclude>src/test/resources/org/onehippo/cms7/services/contenttype/nt-file.json</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
/*
* Copyright 2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onehippo.cms7.services.contenttype;
public class ContentTypeChildImpl extends ContentTypeItemImpl implements ContentTypeChild {
public ContentTypeChildImpl(String definingType, String name, String itemType) {
super(definingType, name, itemType);
}
public ContentTypeChildImpl(EffectiveNodeTypeChild child) {
super(child);
}
public ContentTypeChildImpl(ContentTypeChildImpl other) {
super(other);
}
@Override
public EffectiveNodeTypeChild getEffectiveNodeTypeItem() {
return (EffectiveNodeTypeChild)super.getEffectiveNodeTypeItem();
}
}
/*
* Copyright 2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onehippo.cms7.services.contenttype;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ContentTypeItemImpl extends Sealable implements ContentTypeItem {
private final String definingType;
private final String name;
private EffectiveNodeTypeItem nti;
private final boolean property;
private boolean derivedItem;
private final String itemType;
private final String effectiveType;
private boolean primaryItem;
private boolean multiple;
private boolean mandatory;
private boolean autoCreated;
private boolean protect;
private boolean ordered;
private boolean multiTyped;
private List<EffectiveNodeTypeItem> multiTypes = Collections.emptyList();
private List<String> validators = new ArrayList<String>();
private Map<String, List<String>> itemProperties = new HashMap<String, List<String>>();
@Override
protected void doSeal() {
validators = Collections.unmodifiableList(validators);
for (Map.Entry<String,List<String>> entry : itemProperties.entrySet()) {
entry.setValue(Collections.unmodifiableList(entry.getValue()));
}
for (EffectiveNodeTypeItem item : multiTypes) {
((Sealable)item).seal();
}
itemProperties = Collections.unmodifiableMap(itemProperties);
}
protected ContentTypeItemImpl(String definingType, String name, String itemType, String effectiveType) {
this.definingType = definingType;
this.name = name;
this.itemType = itemType;
this.effectiveType = effectiveType;
this.property = true;
}
protected ContentTypeItemImpl(String definingType, String name, String itemType) {
this.definingType = definingType;
this.name = name;
this.itemType = itemType;
this.effectiveType = itemType;
this.property = false;
}
protected ContentTypeItemImpl(EffectiveNodeTypeProperty property) {
this.definingType = property.getDefiningType();
this.nti = property;
this.primaryItem = false;
this.property = true;
this.derivedItem = true;
this.name = property.getName();
this.effectiveType = property.getType();
this.itemType = this.effectiveType;
this.multiple = property.isMultiple();
this.mandatory = property.isMandatory();
this.autoCreated = property.isAutoCreated();
this.protect = property.isProtected();
this.ordered = false;
}
protected ContentTypeItemImpl(EffectiveNodeTypeChild child) {
this.definingType = child.getDefiningType();
this.nti = child;
this.primaryItem = false;
this.property = false;
this.derivedItem = true;
this.name = child.getName();
this.effectiveType = child.getType();
this.itemType = this.effectiveType;
this.multiple = child.isMultiple();
this.mandatory = child.isMandatory();
this.autoCreated = child.isAutoCreated();
this.protect = child.isProtected();
this.ordered = false;
}
protected ContentTypeItemImpl(ContentTypeItemImpl other) {
this.definingType = other.definingType;
this.nti = other.nti;
this.primaryItem = other.primaryItem;
this.property = other.property;
this.derivedItem = other.derivedItem;
this.name = other.name;
this.effectiveType = other.effectiveType;
this.itemType = other.itemType;
this.multiple = other.multiple;
this.mandatory = other.mandatory;
this.autoCreated = other.autoCreated;
this.protect = other.protect;
this.ordered = other.ordered;
this.validators.addAll(other.validators);
this.itemProperties.putAll(other.itemProperties);
}
@Override
public EffectiveNodeTypeItem getEffectiveNodeTypeItem() {
return nti;
}
public void setEffectiveNodeTypeItem(EffectiveNodeTypeItem nti) {
checkSealed();
this.nti = nti;
}
@Override
public String getName() {
return name;
}
@Override
public String getDefiningType() {
return definingType;
}
@Override
public boolean isProperty() {
return property;
}
@Override
public boolean isDerivedItem() {
return derivedItem;
}
@Override
public String getItemType() {
return itemType;
}
@Override
public String getEffectiveType() {
return effectiveType;
}
@Override
public boolean isPrimaryItem() {
return primaryItem;
}
public void setPrimaryItem(boolean primaryItem) {
checkSealed();
this.primaryItem = primaryItem;
}
@Override
public boolean isMultiple() {
return multiple;
}
public void setMultiple(boolean multiple) {
checkSealed();
this.multiple = multiple;
}
@Override
public boolean isMandatory() {
return mandatory;
}
public void setMandatory(boolean mandatory) {
checkSealed();
this.mandatory = mandatory;
}
@Override
public boolean isAutoCreated() {
return autoCreated;
}
public void setAutoCreated(boolean autoCreated) {
checkSealed();
this.autoCreated = autoCreated;
}
@Override
public boolean isProtected() {
return protect;
}
public void setProtected(boolean protect) {
checkSealed();
this.protect = protect;
}
@Override
public boolean isOrdered() {
return ordered;
}
public void setOrdered(boolean ordered) {
checkSealed();
this.ordered = ordered;
}
@Override
public List<String> getValidators() {
return validators;
}
@Override
public Map<String, List<String>> getItemProperties() {
return itemProperties;
}
@Override
public boolean isMultiTyped() {
return !multiTypes.isEmpty();
}
public List<EffectiveNodeTypeItem> getMultiTypes() {
return multiTypes;
}
public void setMultiPropertyTypes(List<EffectiveNodeTypeProperty> types) {
checkSealed();
if (types != null) {
multiTypes = Collections.unmodifiableList(new ArrayList<EffectiveNodeTypeItem>(types));
}
else {
multiTypes = Collections.emptyList();
}
multiTyped = !multiTypes.isEmpty();
}
public void setMultiChildTypes(List<EffectiveNodeTypeChild> types) {
checkSealed();
if (types != null) {
multiTypes = Collections.unmodifiableList(new ArrayList<EffectiveNodeTypeItem>(types));
}
else {
multiTypes = Collections.emptyList();
}
multiTyped = !multiTypes.isEmpty();
}
}
/*
* Copyright 2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onehippo.cms7.services.contenttype;
public class ContentTypePropertyImpl extends ContentTypeItemImpl implements ContentTypeProperty {
public ContentTypePropertyImpl(String definingType, String name, String itemType, String effectiveType) {
super(definingType, name, itemType, effectiveType);
}
public ContentTypePropertyImpl(EffectiveNodeTypeProperty property) {
super(property);
}
public ContentTypePropertyImpl(ContentTypePropertyImpl other) {
super(other);
}
@Override
public EffectiveNodeTypeProperty getEffectiveNodeTypeItem() {
return (EffectiveNodeTypeProperty)super.getEffectiveNodeTypeItem();
}
}
/*
* Copyright 2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onehippo.cms7.services.contenttype;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import org.onehippo.repository.modules.DaemonModule;
import org.onehippo.cms7.services.HippoServiceRegistry;
public class ContentTypeServiceModule implements DaemonModule {
private HippoContentTypeService service;
@Override
public void initialize(Session session) throws RepositoryException {
service = new HippoContentTypeService(session);
HippoServiceRegistry.registerService(service, ContentTypeService.class);
}
@Override
public void shutdown() {
HippoServiceRegistry.unregisterService(service, ContentTypeService.class);
service.shutdown();
}
}
/*
* Copyright 2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onehippo.cms7.services.contenttype;
import java.util.Collections;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
public class EffectiveNodeTypeChildImpl extends EffectiveNodeTypeItemImpl implements EffectiveNodeTypeChild {
private String defaultPrimaryType;
private String type;
private SortedSet<String> requiredPrimaryTypes = new TreeSet<String>();
@Override
protected void doSeal() {
super.doSeal();
requiredPrimaryTypes = Collections.unmodifiableSortedSet(requiredPrimaryTypes);
}
public EffectiveNodeTypeChildImpl(String name, String definingType) {
super(name, definingType, true);
}
@Override
public String getDefaultPrimaryType() {
return defaultPrimaryType;
}
public void setDefaultPrimaryType(final String defaultPrimaryType) {
this.defaultPrimaryType = defaultPrimaryType;
}
@Override
public SortedSet<String> getRequiredPrimaryTypes() {
return requiredPrimaryTypes;
}
@Override
public String getType() {
if (type == null) {
Iterator<String> iterator = requiredPrimaryTypes.iterator();
StringBuilder sb = new StringBuilder(iterator.next());
while (iterator.hasNext()) {
sb.append(',');
sb.append(iterator.next());
}
type = sb.toString();
}
return type;
}
}
\ No newline at end of file
/*
* Copyright 2013-2017 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onehippo.cms7.services.contenttype;
public abstract class EffectiveNodeTypeItemImpl extends Sealable implements EffectiveNodeTypeItem {
private final String name;
private final String definingType;
private final boolean nodeType;
private final boolean residual;
private boolean multiple;
private boolean mandatory;
private boolean autoCreated;
private boolean protect;
protected void doSeal() {
}
protected EffectiveNodeTypeItemImpl(String name, String definingType, boolean nodeType) {
this.name = name;
this.definingType = definingType;
this.residual = "*".equals(name);
this.nodeType = nodeType;
}
public boolean isNodeType() {
return nodeType;