[TRUNK][FEATURE]

- adds ng representation for contenttypes article, event, multipartarticle + section and news 
- adds missing java doc for construtors to classes in portation/modules/...

git-svn-id: https://svn.libreccm.org/ccm/trunk@5363 8810af33-2d31-482b-a856-94f89814c4df
master
tosmers 2018-04-04 16:11:27 +00:00
parent d21d7629d2
commit afc7c924da
19 changed files with 652 additions and 5 deletions

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.cms.portation.conversion;
import com.arsdigita.cms.portation.modules.contenttypes.Article;
import java.util.HashMap;
import java.util.Map;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 4/3/18
*/
public class NgCmsCollection {
public static Map<Long, Article> articles = new HashMap<>();
/**
* Private constructor to prevent the instantiation of this class.
*/
private NgCmsCollection() {}
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.cms.portation.modules.contenttypes;
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
import com.arsdigita.cms.portation.modules.contentsection.ContentItem;
import com.arsdigita.portation.Portable;
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
import java.util.Locale;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 4/3/18
*/
public class Article extends ContentItem implements Portable {
private LocalizedString text;
/**
* Constructor for the ng-object.
*
* @param trunkArticle the trunk object
*/
public Article(final com.arsdigita.cms.contenttypes.Article trunkArticle) {
super(trunkArticle);
this.text = new LocalizedString();
final Locale locale = Locale.getDefault();
this.text.addValue(locale, trunkArticle.getTextAsset().getText());
NgCmsCollection.articles.put(this.getObjectId(), this);
}
public LocalizedString getText() {
return text;
}
public void setText(final LocalizedString text) {
this.text = text;
}
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.cms.portation.conversion;
import com.arsdigita.cms.portation.modules.contenttypes.Event;
import java.util.HashMap;
import java.util.Map;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 4/3/18
*/
public class NgCmsCollection {
public static Map<Long, Event> events = new HashMap<>();
/**
* Private constructor to prevent the instantiation of this class.
*/
private NgCmsCollection() {}
}

View File

@ -0,0 +1,150 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.cms.portation.modules.contenttypes;
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
import com.arsdigita.cms.portation.modules.contentsection.ContentItem;
import com.arsdigita.portation.Portable;
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
import java.util.Date;
import java.util.Locale;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 4/3/18
*/
public class Event extends ContentItem implements Portable {
private LocalizedString text;
private Date startDate;
private Date endDate;
private LocalizedString eventDate;
private LocalizedString location;
private LocalizedString mainContributor;
private LocalizedString eventType;
private String mapLink;
private LocalizedString cost;
/**
* Constructor for the ng-object.
*
* @param trunkEvent the trunk object
*/
public Event(final com.arsdigita.cms.contenttypes.Event trunkEvent) {
super(trunkEvent);
final Locale locale = Locale.getDefault();
this.text = new LocalizedString();
this.text.addValue(locale, trunkEvent.getTextAsset().getText());
this.startDate = trunkEvent.getStartDate();
this.endDate = trunkEvent.getEndDate();
this.eventDate = new LocalizedString();
this.eventDate.addValue(locale, trunkEvent.getEventDate());
this.location = new LocalizedString();
this.location.addValue(locale, trunkEvent.getLocation());
this.mainContributor = new LocalizedString();
this.mainContributor.addValue(locale, trunkEvent.getMainContributor());
this.eventType = new LocalizedString();
this.eventType.addValue(locale, trunkEvent.getEventType());
this.mapLink = trunkEvent.getMapLink();
this.cost = new LocalizedString();
this.cost.addValue(locale, trunkEvent.getCost());
NgCmsCollection.events.put(this.getObjectId(), this);
}
public LocalizedString getText() {
return text;
}
public void setText(final LocalizedString text) {
this.text = text;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(final Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(final Date endDate) {
this.endDate = endDate;
}
public LocalizedString getEventDate() {
return eventDate;
}
public void setEventDate(final LocalizedString eventDate) {
this.eventDate = eventDate;
}
public LocalizedString getLocation() {
return location;
}
public void setLocation(final LocalizedString location) {
this.location = location;
}
public LocalizedString getMainContributor() {
return mainContributor;
}
public void setMainContributor(final LocalizedString mainContributor) {
this.mainContributor = mainContributor;
}
public LocalizedString getEventType() {
return eventType;
}
public void setEventType(final LocalizedString eventType) {
this.eventType = eventType;
}
public String getMapLink() {
return mapLink;
}
public void setMapLink(final String mapLink) {
this.mapLink = mapLink;
}
public LocalizedString getCost() {
return cost;
}
public void setCost(final LocalizedString cost) {
this.cost = cost;
}
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.cms.portation.conversion;
import com.arsdigita.bebop.FormData;
import com.arsdigita.cms.portation.modules.contenttypes.MultiPartArticle;
import com.arsdigita.cms.portation.modules.contenttypes.MultiPartArticleSection;
import java.util.HashMap;
import java.util.Map;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 4/3/18
*/
public class NgCmsCollection {
public static Map<Long, MultiPartArticle> multiPartArticles
= new HashMap<>();
public static Map<Long, MultiPartArticleSection> multiPartArticleSections
= new HashMap<>();
/**
* Private constructor to prevent the instantiation of this class.
*/
private NgCmsCollection() {}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.cms.portation.modules.contenttypes;
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
import com.arsdigita.cms.portation.modules.contentsection.ContentItem;
import com.arsdigita.portation.Portable;
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 4/3/18
*/
public class MultiPartArticle extends ContentItem implements Portable {
private LocalizedString summary;
@JsonIdentityReference(alwaysAsId = true)
private List<MultiPartArticleSection> sections;
/**
* Constructor for the ng-object.
*
* @param trunkMultiPartArticle the trunk object
*/
public MultiPartArticle(final com.arsdigita.cms.contenttypes
.MultiPartArticle trunkMultiPartArticle) {
super(trunkMultiPartArticle);
final Locale locale = Locale.getDefault();
this.summary = new LocalizedString();
this.summary.addValue(locale, trunkMultiPartArticle.getSummary());
this.sections = new ArrayList<>();
NgCmsCollection.multiPartArticles.put(this.getObjectId(), this);
}
public LocalizedString getSummary() {
return summary;
}
public void setSummary(final LocalizedString summary) {
this.summary = summary;
}
public List<MultiPartArticleSection> getSections() {
return sections;
}
public void setSections(final List<MultiPartArticleSection> sections) {
this.sections = sections;
}
}

View File

@ -0,0 +1,97 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.cms.portation.modules.contenttypes;
import com.arsdigita.cms.contenttypes.ArticleSection;
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
import com.arsdigita.portation.Portable;
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
import java.util.Locale;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 4/4/18
*/
public class MultiPartArticleSection implements Portable {
private long sectionId;
private LocalizedString title;
private int rank;
private boolean pageBreak;
private LocalizedString text;
public MultiPartArticleSection(final com.arsdigita.cms.contenttypes
.ArticleSection trunkMultiPartArticleSection) {
this.sectionId = trunkMultiPartArticleSection.getID().longValue();
final Locale locale = Locale.getDefault();
this.title = new LocalizedString();
this.title.addValue(locale, trunkMultiPartArticleSection
.getPageTitle());
this.rank = trunkMultiPartArticleSection.getRank();
this.pageBreak = trunkMultiPartArticleSection.isPageBreak();
this.text = new LocalizedString();
this.text.addValue(locale, trunkMultiPartArticleSection.getText()
.getText());
NgCmsCollection.multiPartArticleSections.put(this.sectionId, this);
}
public long getSectionId() {
return sectionId;
}
public void setSectionId(final long sectionId) {
this.sectionId = sectionId;
}
public LocalizedString getTitle() {
return title;
}
public void setTitle(final LocalizedString title) {
this.title = title;
}
public int getRank() {
return rank;
}
public void setRank(final int rank) {
this.rank = rank;
}
public boolean isPageBreak() {
return pageBreak;
}
public void setPageBreak(final boolean pageBreak) {
this.pageBreak = pageBreak;
}
public LocalizedString getText() {
return text;
}
public void setText(final LocalizedString text) {
this.text = text;
}
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.cms.portation.conversion;
import com.arsdigita.cms.portation.modules.contenttypes.News;
import java.util.HashMap;
import java.util.Map;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 4/3/18
*/
public class NgCmsCollection {
public static Map<Long, News> news = new HashMap<>();
/**
* Private constructor to prevent the instantiation of this class.
*/
private NgCmsCollection() {}
}

View File

@ -0,0 +1,80 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.cms.portation.modules.contenttypes;
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
import com.arsdigita.cms.portation.modules.contentsection.ContentItem;
import com.arsdigita.portation.Portable;
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
import java.util.Date;
import java.util.Locale;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 4/3/18
*/
public class News extends ContentItem implements Portable {
private LocalizedString text;
private Date releaseDate;
private boolean homepage;
/**
* Constructor for the ng-object.
*
* @param trunkNews the trunk object
*/
public News(final com.arsdigita.cms.contenttypes.NewsItem trunkNews) {
super(trunkNews);
final Locale locale = Locale.getDefault();
this.text = new LocalizedString();
this.text.addValue(locale, trunkNews.getTextAsset().getText());
this.releaseDate = trunkNews.getLaunchDate();
this.homepage = trunkNews.isHomepage();
NgCmsCollection.news.put(this.getObjectId(), this);
}
public LocalizedString getText() {
return text;
}
public void setText(final LocalizedString text) {
this.text = text;
}
public Date getReleaseDate() {
return releaseDate;
}
public void setReleaseDate(final Date releaseDate) {
this.releaseDate = releaseDate;
}
public boolean isHomepage() {
return homepage;
}
public void setHomepage(final boolean homepage) {
this.homepage = homepage;
}
}

View File

@ -36,7 +36,7 @@ import java.util.Locale;
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 2/21/18
*/
public class Asset extends CcmObject implements Portable {
public class Asset extends CcmObject {
@JsonIgnore
private List<ItemAttachment<?>> itemAttachments;
private LocalizedString title;

View File

@ -38,7 +38,7 @@ import java.util.UUID;
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 2/21/18
*/
public class ContentItem extends CcmObject implements Portable {
public class ContentItem extends CcmObject {
private String itemUuid;
private LocalizedString name;
private LocalizedString title;

View File

@ -47,13 +47,18 @@ public class ContentSection extends CcmApplication {
@JsonIdentityReference(alwaysAsId = true)
private List<Role> roles;
private Locale defaultLocale;
@JsonIgnore
@JsonIdentityReference(alwaysAsId = true)
private List<ContentType> contentTypes;
@JsonIdentityReference(alwaysAsId = true)
private List<LifecycleDefinition> lifecycleDefinitions;
@JsonIdentityReference(alwaysAsId = true)
private List<Workflow> workflowTemplates;
/**
* Constructor for the ng-object.
*
* @param trunkContentSection the trunk object
*/
public ContentSection(final com.arsdigita.cms.ContentSection
trunkContentSection) {
super(trunkContentSection);

View File

@ -26,6 +26,7 @@ import com.arsdigita.portation.modules.core.core.CcmObject;
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
import com.arsdigita.portation.modules.core.workflow.Workflow;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.Locale;
@ -35,7 +36,7 @@ import java.util.Locale;
*/
public class ContentType extends CcmObject implements Portable {
private String contentItemClass;
@JsonIdentityReference(alwaysAsId = true)
@JsonIgnore
private ContentSection contentSection;
private LocalizedString label;
private LocalizedString description;
@ -47,6 +48,11 @@ public class ContentType extends CcmObject implements Portable {
@JsonIdentityReference(alwaysAsId = true)
private Workflow defaultWorkflow;
/**
* Constructor for the ng-object.
*
* @param trunkContentType the trunk object
*/
public ContentType(final com.arsdigita.cms.ContentType trunkContentType) {
super(trunkContentType);

View File

@ -31,6 +31,11 @@ public class Folder extends Category {
private ContentSection section;
private FolderType type;
/**
* Constructor for the ng-object.
*
* @param trunkFolder the trunk object
*/
public Folder(final com.arsdigita.cms.Folder trunkFolder) {
super(new CategoryInformation(
trunkFolder.getDisplayName(),
@ -43,6 +48,7 @@ public class Folder extends Category {
false,
0)
);
this.type = FolderType.DOCUMENTS_FOLDER;
//this.section
//this.type

View File

@ -43,6 +43,11 @@ public class Lifecycle implements Portable {
@JsonIgnore
private List<Phase> phases;
/**
* Constructor for the ng-object.
*
* @param trunkLifecycle the trunk object
*/
public Lifecycle(final com.arsdigita.cms.lifecycle.Lifecycle
trunkLifecycle) {
this.lifecycleId = trunkLifecycle.getID().longValue();

View File

@ -39,6 +39,11 @@ public class LifecycleDefinition implements Portable {
@JsonIdentityReference(alwaysAsId = true)
private List<PhaseDefinition> phaseDefinitions;
/**
* Constructor for the ng-object.
*
* @param trunkLifecycleDefinition the trunk object
*/
public LifecycleDefinition(final com.arsdigita.cms.lifecycle
.LifecycleDefinition trunkLifecycleDefinition) {
this.definitionId = trunkLifecycleDefinition.getID().longValue();

View File

@ -40,6 +40,11 @@ public class Phase implements Portable {
@JsonIdentityReference(alwaysAsId = true)
private PhaseDefinition phaseDefinition;
/**
* Constructor for the ng-object.
*
* @param trunkPhase the trunk object
*/
public Phase(final com.arsdigita.cms.lifecycle.Phase trunkPhase) {
this.phaseId = trunkPhase.getID().longValue();

View File

@ -36,6 +36,11 @@ public class PhaseDefinition implements Portable {
private long defaultDuration;
private String defaultListener;
/**
* Constructor for the ng-object.
*
* @param trunkPhaseDefinition the trunk object
*/
public PhaseDefinition(final com.arsdigita.cms.lifecycle.PhaseDefinition
trunkPhaseDefinition) {
this.definitionId = trunkPhaseDefinition.getID().longValue();

View File

@ -65,7 +65,7 @@ public class Domain extends CcmObject implements Portable {
private List<DomainOwnership> owners;
public Domain(DataObject trunkDomain) {
public Domain(final DataObject trunkDomain) {
super((String) trunkDomain.get("key") + "_DName");
this.domainKey = (String) trunkDomain.get("key");