[TRUNK][FEATURE]
- adds ng representation for assets FileAsset, Image and SideNote - adds additional constructor to ng's class Asset to use for asset SideNote git-svn-id: https://svn.libreccm.org/ccm/trunk@5368 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
df747620ee
commit
de858421c4
|
|
@ -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.convertion;
|
||||
|
||||
import com.arsdigita.cms.portation.modules.assets.FileAsset;
|
||||
|
||||
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, FileAsset> fileAssets = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Private constructor to prevent the instantiation of this class.
|
||||
*/
|
||||
private NgCmsCollection() {}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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.assets;
|
||||
|
||||
import com.arsdigita.cms.contentassets.FileAttachment;
|
||||
import com.arsdigita.cms.portation.convertion.NgCmsCollection;
|
||||
import com.arsdigita.portation.Portable;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 4/6/18
|
||||
*/
|
||||
public class FileAsset extends BinaryAsset implements Portable {
|
||||
|
||||
/**
|
||||
* Constructor for the ng-object.
|
||||
*
|
||||
* @param trunkFileAsset the trunk object
|
||||
*/
|
||||
public FileAsset(final FileAttachment trunkFileAsset) {
|
||||
super(trunkFileAsset);
|
||||
|
||||
NgCmsCollection.fileAssets.put(this.getObjectId(), this);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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.convertion;
|
||||
|
||||
import com.arsdigita.cms.portation.modules.assets.Image;
|
||||
import com.arsdigita.cms.portation.modules.assets.LegalMetadata;
|
||||
|
||||
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, Image> images = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Private constructor to prevent the instantiation of this class.
|
||||
*/
|
||||
private NgCmsCollection() {}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* 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.assets;
|
||||
|
||||
import com.arsdigita.cms.ImageAsset;
|
||||
import com.arsdigita.cms.portation.convertion.NgCmsCollection;
|
||||
import com.arsdigita.portation.Portable;
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 4/6/18
|
||||
*/
|
||||
public class Image extends BinaryAsset implements Portable {
|
||||
private long width;
|
||||
private long height;
|
||||
@JsonIdentityReference(alwaysAsId = true)
|
||||
private LegalMetadata legalMetadata;
|
||||
|
||||
/**
|
||||
* Constructor for the ng-object.
|
||||
*
|
||||
* @param trunkImage the trunk object
|
||||
*/
|
||||
public Image(final ImageAsset trunkImage) {
|
||||
super(trunkImage);
|
||||
|
||||
this.width = trunkImage.getWidth().longValue();
|
||||
this.height = trunkImage.getHeight().longValue();
|
||||
|
||||
//this.legalMetaData
|
||||
|
||||
NgCmsCollection.images.put(this.getObjectId(), this);
|
||||
}
|
||||
|
||||
public long getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(final long width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public long getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(final long height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public LegalMetadata getLegalMetadata() {
|
||||
return legalMetadata;
|
||||
}
|
||||
|
||||
public void setLegalMetadata(final LegalMetadata legalMetadata) {
|
||||
this.legalMetadata = legalMetadata;
|
||||
}
|
||||
}
|
||||
|
|
@ -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.convertion;
|
||||
|
||||
import com.arsdigita.cms.portation.modules.assets.SideNote;
|
||||
|
||||
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, SideNote> sideNotes = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Private constructor to prevent the instantiation of this class.
|
||||
*/
|
||||
private NgCmsCollection() {}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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.assets;
|
||||
|
||||
import com.arsdigita.cms.contentassets.Note;
|
||||
import com.arsdigita.cms.portation.convertion.NgCmsCollection;
|
||||
import com.arsdigita.cms.portation.modules.contentsection.Asset;
|
||||
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/6/18
|
||||
*/
|
||||
public class SideNote extends Asset implements Portable {
|
||||
private LocalizedString text;
|
||||
|
||||
/**
|
||||
* Constructor for the ng-object.
|
||||
*
|
||||
* @param trunkNote the trunk object
|
||||
*/
|
||||
public SideNote(final Note trunkNote) {
|
||||
super("Title_" + trunkNote.getDisplayName(),
|
||||
trunkNote.getDisplayName());
|
||||
|
||||
this.text = new LocalizedString();
|
||||
final Locale language = Locale.getDefault();
|
||||
this.text.addValue(language, trunkNote.getContent());
|
||||
|
||||
NgCmsCollection.sideNotes.put(this.getObjectId(), this);
|
||||
}
|
||||
|
||||
public LocalizedString getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(final LocalizedString text) {
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
|
|
@ -18,12 +18,14 @@
|
|||
*/
|
||||
package com.arsdigita.cms.portation.modules.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ItemCollection;
|
||||
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;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
|
|
@ -41,8 +43,21 @@ public class Article extends ContentItem implements Portable {
|
|||
super(trunkArticle);
|
||||
|
||||
this.text = new LocalizedString();
|
||||
final Locale locale = Locale.getDefault();
|
||||
this.text.addValue(locale, trunkArticle.getTextAsset().getText());
|
||||
final ItemCollection languageSets = Objects.requireNonNull(trunkArticle
|
||||
.getContentBundle())
|
||||
.getInstances();
|
||||
while (languageSets.next()) {
|
||||
final Locale language = new Locale(languageSets.getLanguage());
|
||||
final com.arsdigita.cms.contenttypes.Article languageItem =
|
||||
(com.arsdigita.cms.contenttypes.Article) languageSets
|
||||
.getContentItem();
|
||||
|
||||
addName(language, languageItem.getName());
|
||||
addTitle(language, languageItem.getTitle());
|
||||
addDescription(language, languageItem.getDescription());
|
||||
|
||||
this.text.addValue(language, languageItem.getTextAsset().getText());
|
||||
}
|
||||
|
||||
NgCmsCollection.articles.put(this.getObjectId(), this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package com.arsdigita.cms.portation.modules.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ItemCollection;
|
||||
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
|
||||
import com.arsdigita.cms.portation.modules.contentsection.ContentItem;
|
||||
import com.arsdigita.portation.Portable;
|
||||
|
|
@ -25,6 +26,7 @@ import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
|
|
@ -49,29 +51,39 @@ public class Event extends ContentItem implements Portable {
|
|||
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());
|
||||
|
||||
final ItemCollection languageSets = Objects.requireNonNull(trunkEvent
|
||||
.getContentBundle())
|
||||
.getInstances();
|
||||
while (languageSets.next()) {
|
||||
final Locale language = new Locale(languageSets.getLanguage());
|
||||
final com.arsdigita.cms.contenttypes.Event languageItem =
|
||||
((com.arsdigita.cms.contenttypes.Event) languageSets
|
||||
.getContentItem());
|
||||
|
||||
addName(language, languageItem.getName());
|
||||
addTitle(language, languageItem.getTitle());
|
||||
addDescription(language, languageItem.getDescription());
|
||||
|
||||
this.text.addValue(language, languageItem.getTextAsset().getText());
|
||||
|
||||
this.eventDate.addValue(language, languageItem.getEventDate());
|
||||
this.location.addValue(language, languageItem.getLocation());
|
||||
this.mainContributor.addValue(language, languageItem
|
||||
.getMainContributor());
|
||||
this.eventType.addValue(language, languageItem.getEventType());
|
||||
|
||||
this.cost.addValue(language, languageItem.getCost());
|
||||
}
|
||||
|
||||
NgCmsCollection.events.put(this.getObjectId(), this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package com.arsdigita.cms.portation.modules.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ItemCollection;
|
||||
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
|
||||
import com.arsdigita.cms.portation.modules.contentsection.ContentItem;
|
||||
import com.arsdigita.portation.Portable;
|
||||
|
|
@ -27,6 +28,7 @@ import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
|
|
@ -46,12 +48,25 @@ public class MultiPartArticle extends ContentItem implements Portable {
|
|||
.MultiPartArticle trunkMultiPartArticle) {
|
||||
super(trunkMultiPartArticle);
|
||||
|
||||
final Locale locale = Locale.getDefault();
|
||||
this.summary = new LocalizedString();
|
||||
this.summary.addValue(locale, trunkMultiPartArticle.getSummary());
|
||||
|
||||
this.sections = new ArrayList<>();
|
||||
|
||||
final ItemCollection languageSets = Objects.requireNonNull(
|
||||
trunkMultiPartArticle.getContentBundle())
|
||||
.getInstances();
|
||||
while (languageSets.next()) {
|
||||
final Locale language = new Locale(languageSets.getLanguage());
|
||||
final com.arsdigita.cms.contenttypes.MultiPartArticle
|
||||
languageItem = (com.arsdigita.cms.contenttypes
|
||||
.MultiPartArticle) languageSets.getContentItem();
|
||||
|
||||
addName(language, languageItem.getName());
|
||||
addTitle(language, languageItem.getTitle());
|
||||
addDescription(language, languageItem.getDescription());
|
||||
|
||||
this.summary.addValue(language, languageItem.getSummary());
|
||||
}
|
||||
|
||||
NgCmsCollection.multiPartArticles.put(this.getObjectId(), this);
|
||||
}
|
||||
|
||||
|
|
@ -70,4 +85,12 @@ public class MultiPartArticle extends ContentItem implements Portable {
|
|||
public void setSections(final List<MultiPartArticleSection> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
public void addSection(final MultiPartArticleSection section) {
|
||||
this.sections.add(section);
|
||||
}
|
||||
|
||||
public void removeSection(final MultiPartArticleSection section) {
|
||||
this.sections.remove(section);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@
|
|||
*/
|
||||
package com.arsdigita.cms.portation.modules.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ItemCollection;
|
||||
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;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
|
|
@ -36,21 +38,26 @@ public class MultiPartArticleSection implements Portable {
|
|||
private boolean pageBreak;
|
||||
private LocalizedString text;
|
||||
|
||||
public MultiPartArticleSection(final com.arsdigita.cms.contenttypes
|
||||
.ArticleSection trunkMultiPartArticleSection) {
|
||||
public MultiPartArticleSection(final 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());
|
||||
|
||||
final ItemCollection languageSets = Objects.requireNonNull(
|
||||
trunkMultiPartArticleSection.getContentBundle())
|
||||
.getInstances();
|
||||
while (languageSets.next()) {
|
||||
final Locale language = new Locale(languageSets.getLanguage());
|
||||
final ArticleSection languageItem = (ArticleSection) languageSets
|
||||
.getContentItem();
|
||||
|
||||
this.title.addValue(language, languageItem.getTitle());
|
||||
this.text.addValue(language, languageItem.getText().getText());
|
||||
}
|
||||
|
||||
NgCmsCollection.multiPartArticleSections.put(this.sectionId, this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package com.arsdigita.cms.portation.modules.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ItemCollection;
|
||||
import com.arsdigita.cms.contenttypes.NewsItem;
|
||||
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
|
||||
import com.arsdigita.cms.portation.modules.contentsection.ContentItem;
|
||||
import com.arsdigita.portation.Portable;
|
||||
|
|
@ -25,6 +27,7 @@ import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
|
|
@ -40,17 +43,28 @@ public class News extends ContentItem implements Portable {
|
|||
*
|
||||
* @param trunkNews the trunk object
|
||||
*/
|
||||
public News(final com.arsdigita.cms.contenttypes.NewsItem trunkNews) {
|
||||
public News(final 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();
|
||||
|
||||
final ItemCollection languageSets = Objects.requireNonNull(trunkNews
|
||||
.getContentBundle())
|
||||
.getInstances();
|
||||
while (languageSets.next()) {
|
||||
final Locale language = new Locale(languageSets.getLanguage());
|
||||
final NewsItem languageItem = (NewsItem) languageSets
|
||||
.getContentItem();
|
||||
|
||||
addName(language, languageItem.getName());
|
||||
addTitle(language, languageItem.getTitle());
|
||||
addDescription(language, languageItem.getDescription());
|
||||
|
||||
this.text.addValue(language, languageItem.getTextAsset().getText());
|
||||
}
|
||||
|
||||
NgCmsCollection.news.put(this.getObjectId(), this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ public abstract class BinaryAsset extends Asset {
|
|||
*
|
||||
* @return the Blob content
|
||||
*/
|
||||
protected abstract byte[] getContent();
|
||||
public abstract byte[] getContent();
|
||||
|
||||
/**
|
||||
* All derived classes must implement this method. This method sets
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package com.arsdigita.cms.portation.conversion;
|
||||
|
||||
import com.arsdigita.cms.portation.modules.assets.BinaryAsset;
|
||||
import com.arsdigita.cms.portation.modules.assets.LegalMetadata;
|
||||
import com.arsdigita.cms.portation.modules.contentsection.Asset;
|
||||
import com.arsdigita.cms.portation.modules.contentsection.AttachmentList;
|
||||
import com.arsdigita.cms.portation.modules.contentsection.ContentItem;
|
||||
|
|
@ -38,6 +40,8 @@ import java.util.Map;
|
|||
*/
|
||||
public class NgCmsCollection {
|
||||
public static Map<Long, Asset> assets = new HashMap<>();
|
||||
public static Map<Long, BinaryAsset> binaryAssets = new HashMap<>();
|
||||
public static Map<Long, LegalMetadata> legalMetadatas = new HashMap<>();
|
||||
public static Map<Long, ItemAttachment> itemAttachments = new HashMap<>();
|
||||
public static Map<Long, AttachmentList> attachmentLists = new HashMap<>();
|
||||
public static Map<Long, ContentItem> contentItems = new HashMap<>();
|
||||
|
|
@ -52,6 +56,7 @@ public class NgCmsCollection {
|
|||
HashMap<>();
|
||||
public static Map<Long, PhaseDefinition> phaseDefinitions = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
* Private constructor to prevent the instantiation of this class.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* 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.assets;
|
||||
|
||||
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
|
||||
import com.arsdigita.cms.portation.modules.contentsection.Asset;
|
||||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||
|
||||
import javax.activation.MimeType;
|
||||
import javax.activation.MimeTypeParseException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 4/6/18
|
||||
*/
|
||||
public class BinaryAsset extends Asset {
|
||||
private LocalizedString description;
|
||||
private String fileName;
|
||||
private MimeType mimeType;
|
||||
private byte[] data;
|
||||
private long size;
|
||||
|
||||
/**
|
||||
* Constructor for the ng-object.
|
||||
*
|
||||
* @param trunkBinaryAsset the old trunk object
|
||||
*/
|
||||
public BinaryAsset(final com.arsdigita.cms.BinaryAsset trunkBinaryAsset) {
|
||||
super(trunkBinaryAsset);
|
||||
|
||||
this.description = new LocalizedString();
|
||||
final Locale language = new Locale(trunkBinaryAsset.getLanguage());
|
||||
this.description.addValue(language, trunkBinaryAsset.getDescription());
|
||||
|
||||
this.fileName = trunkBinaryAsset.getName();
|
||||
try {
|
||||
this.mimeType = new MimeType(trunkBinaryAsset.getMimeType()
|
||||
.getMimeType());
|
||||
} catch (MimeTypeParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.data = trunkBinaryAsset.getContent();
|
||||
this.size = trunkBinaryAsset.getSize();
|
||||
|
||||
NgCmsCollection.binaryAssets.put(this.getObjectId(), this);
|
||||
}
|
||||
|
||||
public LocalizedString getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(final LocalizedString description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void addDescription(final Locale language, final String description) {
|
||||
this.description.addValue(language, description);
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(final String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public MimeType getMimeType() {
|
||||
return mimeType;
|
||||
}
|
||||
|
||||
public void setMimeType(final MimeType mimeType) {
|
||||
this.mimeType = mimeType;
|
||||
}
|
||||
|
||||
public byte[] getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(final byte[] data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(final long size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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.assets;
|
||||
|
||||
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
|
||||
import com.arsdigita.cms.portation.modules.contentsection.Asset;
|
||||
import com.arsdigita.portation.Portable;
|
||||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 4/6/18
|
||||
*/
|
||||
public class LegalMetadata extends Asset implements Portable {
|
||||
private String rightsHolder;
|
||||
private LocalizedString rights;
|
||||
private String publisher;
|
||||
private String creator;
|
||||
private List<String> contributors;
|
||||
|
||||
public LegalMetadata() {
|
||||
super(null);
|
||||
|
||||
NgCmsCollection.legalMetadatas.put(this.getObjectId(), this);
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
package com.arsdigita.cms.portation.modules.contentsection;
|
||||
|
||||
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
|
||||
import com.arsdigita.portation.Portable;
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
|
@ -52,12 +52,29 @@ public class Asset extends CcmObject {
|
|||
this.itemAttachments = new ArrayList<>();
|
||||
|
||||
this.title = new LocalizedString();
|
||||
final Locale locale = Locale.getDefault();
|
||||
title.addValue(locale, (String) trunkAsset.get("name"));
|
||||
final Locale language = new Locale(trunkAsset.getLanguage());
|
||||
this.title.addValue(language, trunkAsset.getName());
|
||||
|
||||
NgCmsCollection.assets.put(this.getObjectId(), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific constructor for subclass SideNews.
|
||||
*
|
||||
* @param title The title of this asset
|
||||
* @param displayName The display name as the {@link CcmObject}
|
||||
*/
|
||||
public Asset(final String title, final String displayName) {
|
||||
super(displayName);
|
||||
|
||||
this.itemAttachments = new ArrayList<>();
|
||||
|
||||
this.title = new LocalizedString();
|
||||
final Locale language = Locale.getDefault();
|
||||
this.title.addValue(language, title);
|
||||
|
||||
NgCmsCollection.assets.put(this.getObjectId(), this);
|
||||
}
|
||||
|
||||
public List<ItemAttachment<?>> getItemAttachments() {
|
||||
return itemAttachments;
|
||||
|
|
@ -83,4 +100,8 @@ public class Asset extends CcmObject {
|
|||
public void setTitle(final LocalizedString title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void addTitle(final Locale language, final String title) {
|
||||
this.title.addValue(language, title);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package com.arsdigita.cms.portation.modules.contentsection;
|
|||
import com.arsdigita.cms.portation.conversion.NgCmsCollection;
|
||||
import com.arsdigita.cms.portation.modules.contentsection.util.ContentItemVersionMapper;
|
||||
import com.arsdigita.cms.portation.modules.lifecycle.Lifecycle;
|
||||
import com.arsdigita.portation.Portable;
|
||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||
import com.arsdigita.portation.modules.core.workflow.Workflow;
|
||||
|
|
@ -72,10 +71,7 @@ public class ContentItem extends CcmObject {
|
|||
this.name = new LocalizedString();
|
||||
this.title = new LocalizedString();
|
||||
this.description = new LocalizedString();
|
||||
final Locale locale = trunkContentItem.getLocale().toJavaLocale();
|
||||
name.addValue(locale, trunkContentItem.getDisplayName());
|
||||
title.addValue(locale, trunkContentItem.getName());
|
||||
description.addValue(locale, trunkContentItem.getAdditionalInfo());
|
||||
// localized string-entries will be set in subclasses e.g. Article, News
|
||||
|
||||
//this.contentType
|
||||
this.version = ContentItemVersionMapper
|
||||
|
|
@ -113,12 +109,8 @@ public class ContentItem extends CcmObject {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public ContentType getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public void setContentType(final ContentType contentType) {
|
||||
this.contentType = contentType;
|
||||
public void addName(final Locale language, final String name) {
|
||||
this.name.addValue(language, name);
|
||||
}
|
||||
|
||||
public LocalizedString getTitle() {
|
||||
|
|
@ -129,6 +121,10 @@ public class ContentItem extends CcmObject {
|
|||
this.title = title;
|
||||
}
|
||||
|
||||
public void addTitle(final Locale language, final String title) {
|
||||
this.title.addValue(language, title);
|
||||
}
|
||||
|
||||
public LocalizedString getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
|
@ -137,6 +133,18 @@ public class ContentItem extends CcmObject {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public void addDescription(final Locale language, final String description) {
|
||||
this.name.addValue(language, description);
|
||||
}
|
||||
|
||||
public ContentType getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public void setContentType(final ContentType contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
public ContentItemVersion getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,11 @@ public class Category extends CcmObject implements Portable {
|
|||
private Category parentCategory;
|
||||
private long categoryOrder;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for the ng-object.
|
||||
*
|
||||
* @param trunkCategory the trunk object
|
||||
*/
|
||||
public Category(final com.arsdigita.categorization.Category trunkCategory) {
|
||||
super(trunkCategory);
|
||||
|
||||
|
|
@ -109,8 +113,11 @@ public class Category extends CcmObject implements Portable {
|
|||
NgCoreCollection.categories.put(this.getObjectId(), this);
|
||||
}
|
||||
|
||||
// specific constructor for subclasses of category
|
||||
// e.g. Folder
|
||||
/**
|
||||
* Specific constructor for subclasses of category e.g. Folder
|
||||
*
|
||||
* @param categoryInformation the trunk object
|
||||
*/
|
||||
public Category(final CategoryInformation categoryInformation) {
|
||||
super(categoryInformation.getDisplayName());
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,11 @@ public class Domain extends CcmObject implements Portable {
|
|||
@JsonIgnore
|
||||
private List<DomainOwnership> owners;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for the ng object.
|
||||
*
|
||||
* @param trunkDomain the trunk object
|
||||
*/
|
||||
public Domain(final DataObject trunkDomain) {
|
||||
super((String) trunkDomain.get("key") + "_DName");
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class CcmObject {
|
|||
NgCoreCollection.ccmObjects.put(this.objectId, this);
|
||||
}
|
||||
|
||||
// specific constructor for ldn-terms' domain
|
||||
// specific constructor for ldn-terms' domain and Asset SideNote
|
||||
public CcmObject(final String displayName) {
|
||||
this.objectId = ACSObject.generateID().longValue();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue