CCM NG/ccm-cms: Typos in JavaDoc etc.

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4648 8810af33-2d31-482b-a856-94f89814c4df
ccm-docs
jensp 2017-03-29 08:26:11 +00:00
parent bad486241c
commit 131e8f6622
1 changed files with 31 additions and 14 deletions

View File

@ -25,6 +25,7 @@ import org.librecms.contentsection.ContentType;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.ServiceLoader; import java.util.ServiceLoader;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
@ -34,6 +35,7 @@ import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
/** /**
* Provides informations about the available content types.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -55,29 +57,30 @@ public class ContentTypesManager {
*/ */
@PostConstruct @PostConstruct
protected void initialize() { protected void initialize() {
final ServiceLoader<CcmModule> modules = ServiceLoader.load( final ServiceLoader<CcmModule> modules = ServiceLoader
CcmModule.class); .load(CcmModule.class);
final SortedSet<Class<? extends ContentItem>> types = new TreeSet<>( final SortedSet<Class<? extends ContentItem>> contentTypes
(type1, type2) -> type1.getName().compareTo(type2.getName()) = new TreeSet<>(
(type1, type2) -> {
return type1.getName().compareTo(type2.getName());
}
); );
for (final CcmModule module : modules) { for (final CcmModule module : modules) {
final ContentTypes annotation = module.getClass().getAnnotation( final ContentTypes annotation = module
ContentTypes.class); .getClass()
.getAnnotation(ContentTypes.class);
if (annotation == null) { if (annotation == null) {
continue; continue;
} }
final List<Class<? extends ContentItem>> moduleTypes = Arrays contentTypes.addAll(Arrays.asList(annotation.value()));
.stream(annotation.value())
.collect(Collectors.toList());
types.addAll(moduleTypes);
} }
availableContentTypes = types.stream() availableContentTypes = contentTypes
.stream()
.filter(type -> type.getAnnotation(AuthoringKit.class) != null) .filter(type -> type.getAnnotation(AuthoringKit.class) != null)
.map(contentTypeClass -> createContentTypeInfo(contentTypeClass)) .map(contentTypeClass -> createContentTypeInfo(contentTypeClass))
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -94,12 +97,14 @@ public class ContentTypesManager {
private ContentTypeInfo createContentTypeInfo( private ContentTypeInfo createContentTypeInfo(
final Class<? extends ContentItem> contentTypeClass) { final Class<? extends ContentItem> contentTypeClass) {
Objects.requireNonNull(contentTypeClass);
final ContentTypeInfo contentTypeInfo = new ContentTypeInfo(); final ContentTypeInfo contentTypeInfo = new ContentTypeInfo();
contentTypeInfo.setContentItemClass(contentTypeClass); contentTypeInfo.setContentItemClass(contentTypeClass);
final String defaultBundleName = String.join( final String defaultBundleName = String.join(
"", "",
contentTypeClass.getClass().getName(), contentTypeClass.getName(),
"Bundle"); "Bundle");
final ContentTypeDescription typeDesc = contentTypeClass.getAnnotation( final ContentTypeDescription typeDesc = contentTypeClass.getAnnotation(
ContentTypeDescription.class); ContentTypeDescription.class);
@ -169,6 +174,9 @@ public class ContentTypesManager {
final Class<? extends ContentItem> contentTypeClass, final Class<? extends ContentItem> contentTypeClass,
final AuthoringStep authoringStep) { final AuthoringStep authoringStep) {
Objects.requireNonNull(contentTypeClass);
Objects.requireNonNull(authoringStep);
final AuthoringStepInfo stepInfo = new AuthoringStepInfo(); final AuthoringStepInfo stepInfo = new AuthoringStepInfo();
stepInfo.setComponent(authoringStep.component()); stepInfo.setComponent(authoringStep.component());
@ -231,6 +239,8 @@ public class ContentTypesManager {
public ContentTypeInfo getContentTypeInfo( public ContentTypeInfo getContentTypeInfo(
final Class<? extends ContentItem> contentTypeClass) { final Class<? extends ContentItem> contentTypeClass) {
Objects.requireNonNull(contentTypeClass);
return createContentTypeInfo(contentTypeClass); return createContentTypeInfo(contentTypeClass);
} }
@ -242,9 +252,16 @@ public class ContentTypesManager {
* type. * type.
* *
* @return A {@link ContentTypeInfo} describing the content type. * @return A {@link ContentTypeInfo} describing the content type.
*
* @throws IllegalArgumentException If no class with the provided name
* exists or the class is not a subclass of
* {@link ContentItem}.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public ContentTypeInfo getContentTypeInfo(final String contentTypeClass) { public ContentTypeInfo getContentTypeInfo(final String contentTypeClass) {
Objects.requireNonNull(contentTypeClass);
final Class<?> clazz; final Class<?> clazz;
try { try {
clazz = Class.forName(contentTypeClass); clazz = Class.forName(contentTypeClass);