Reworked inhertiance hierarchy for PublicationItems, CreateForms for
PublicationItemspull/1/head
parent
5d653ee61b
commit
cf5d3fb5e3
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
import com.arsdigita.cms.ui.authoring.PageCreateForm;
|
||||
|
||||
import org.librecms.contentsection.ContentItemInitializer;
|
||||
import org.scientificcms.publications.Publication;
|
||||
import org.scientificcms.publications.contenttypes.PublicationItem;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
* @param <P>
|
||||
* @param <T>
|
||||
*/
|
||||
public abstract class AbstractPublicationCreateForm<P extends Publication, T extends PublicationItem<P>>
|
||||
extends PageCreateForm {
|
||||
|
||||
public AbstractPublicationCreateForm(
|
||||
final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam
|
||||
) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected ContentItemInitializer<?> getItemInitializer(
|
||||
final FormData data, final PageState state) {
|
||||
|
||||
return item -> ((T) item).setPublication(
|
||||
createPublication(data)
|
||||
);
|
||||
}
|
||||
|
||||
protected P createPublication(final FormData data) {
|
||||
|
||||
final Locale locale = new Locale((String) data.get(LANGUAGE));
|
||||
final String title = (String) data.get(TITLE);
|
||||
|
||||
final P publication = createPublication();
|
||||
publication.getTitle().addValue(locale, title);
|
||||
|
||||
return publication;
|
||||
}
|
||||
|
||||
protected abstract P createPublication();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
|
||||
import org.scientificcms.publications.ArticleInCollectedVolume;
|
||||
import org.scientificcms.publications.contenttypes.ArticleInCollectedVolumeItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ArticleInCollectedVolumeCreateForm
|
||||
extends AbstractPublicationCreateForm<ArticleInCollectedVolume, ArticleInCollectedVolumeItem> {
|
||||
|
||||
public ArticleInCollectedVolumeCreateForm(
|
||||
final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam
|
||||
) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArticleInCollectedVolume createPublication() {
|
||||
return new ArticleInCollectedVolume();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
|
||||
import org.scientificcms.publications.ArticleInJournal;
|
||||
import org.scientificcms.publications.contenttypes.ArticleInJournalItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ArticleInJournalCreateForm
|
||||
extends AbstractPublicationCreateForm<ArticleInJournal, ArticleInJournalItem> {
|
||||
|
||||
public ArticleInJournalCreateForm(
|
||||
final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam
|
||||
) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArticleInJournal createPublication() {
|
||||
return new ArticleInJournal();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
|
||||
import org.scientificcms.publications.CollectedVolume;
|
||||
import org.scientificcms.publications.Publication;
|
||||
import org.scientificcms.publications.contenttypes.CollectedVolumeItem;
|
||||
import org.scientificcms.publications.contenttypes.PublicationItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class CollectedVolumeCreateForm
|
||||
extends AbstractPublicationCreateForm<CollectedVolume, CollectedVolumeItem> {
|
||||
|
||||
public CollectedVolumeCreateForm(
|
||||
final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam
|
||||
) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CollectedVolume createPublication() {
|
||||
return new CollectedVolume();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
|
||||
import org.scientificcms.publications.Expertise;
|
||||
import org.scientificcms.publications.contenttypes.ExpertiseItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ExpertiseCreateForm
|
||||
extends AbstractPublicationCreateForm<Expertise, ExpertiseItem>{
|
||||
|
||||
public ExpertiseCreateForm(final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Expertise createPublication() {
|
||||
return new Expertise();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
|
||||
import org.scientificcms.publications.GreyLiterature;
|
||||
import org.scientificcms.publications.contenttypes.GreyLiteratureItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class GreyLiteratureCreateForm
|
||||
extends AbstractPublicationCreateForm<GreyLiterature, GreyLiteratureItem> {
|
||||
|
||||
public GreyLiteratureCreateForm(
|
||||
final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam
|
||||
) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GreyLiterature createPublication() {
|
||||
return new GreyLiterature();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
|
||||
import org.scientificcms.publications.InProceedings;
|
||||
import org.scientificcms.publications.contenttypes.InProceedingsItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class InProceedingsCreateForm
|
||||
extends AbstractPublicationCreateForm<InProceedings, InProceedingsItem> {
|
||||
|
||||
public InProceedingsCreateForm(final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InProceedings createPublication() {
|
||||
return new InProceedings();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
|
||||
import org.scientificcms.publications.InternetArticle;
|
||||
import org.scientificcms.publications.contenttypes.InternetArticleItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class InternetArticleCreateForm
|
||||
extends AbstractPublicationCreateForm<InternetArticle, InternetArticleItem> {
|
||||
|
||||
public InternetArticleCreateForm(
|
||||
final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam
|
||||
) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InternetArticle createPublication() {
|
||||
return new InternetArticle();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
|
||||
import org.scientificcms.publications.Monograph;
|
||||
import org.scientificcms.publications.contenttypes.MonographItem;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class MonographCreateForm
|
||||
extends AbstractPublicationCreateForm<Monograph, MonographItem> {
|
||||
|
||||
public MonographCreateForm(final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Monograph createPublication() {
|
||||
return new Monograph();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
|
||||
import org.scientificcms.publications.Proceedings;
|
||||
import org.scientificcms.publications.contenttypes.ProceedingsItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ProceedingsCreateForm
|
||||
extends AbstractPublicationCreateForm<Proceedings, ProceedingsItem>{
|
||||
|
||||
public ProceedingsCreateForm(final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Proceedings createPublication() {
|
||||
return new Proceedings();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
|
||||
import org.scientificcms.publications.Talk;
|
||||
import org.scientificcms.publications.contenttypes.TalkItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class TalkCreateForm
|
||||
extends AbstractPublicationCreateForm<Talk, TalkItem> {
|
||||
|
||||
public TalkCreateForm(final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Talk createPublication() {
|
||||
return new Talk();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
|
||||
import org.scientificcms.publications.WorkingPaper;
|
||||
import org.scientificcms.publications.contenttypes.WorkingPaperItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class WorkingPaperCreateForm
|
||||
extends AbstractPublicationCreateForm<WorkingPaper, WorkingPaperItem> {
|
||||
|
||||
public WorkingPaperCreateForm(final ItemSelectionModel itemModel,
|
||||
final CreationSelector creationSelector,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
super(itemModel, creationSelector, selectedLanguageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WorkingPaper createPublication() {
|
||||
return new WorkingPaper();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -169,7 +169,7 @@ public class PublicationManager {
|
|||
.filter(authorship -> authorship.getAuthor().equals(author))
|
||||
.findAny();
|
||||
|
||||
if (result.isEmpty()) {
|
||||
if (!result.isPresent()) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"Person %s is not an author of the publication %s.",
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class CollectedVolumeAsset extends Asset {
|
|||
return collectedVolume;
|
||||
}
|
||||
|
||||
protected void setCollectedVolume(final CollectedVolume collectedVolume) {
|
||||
public void setCollectedVolume(final CollectedVolume collectedVolume) {
|
||||
this.collectedVolume = collectedVolume;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class JournalAsset extends Asset {
|
|||
return journal;
|
||||
}
|
||||
|
||||
protected void setJournal(final Journal journal) {
|
||||
public void setJournal(final Journal journal) {
|
||||
this.journal = journal;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class PublisherAsset extends Asset {
|
|||
return publisher;
|
||||
}
|
||||
|
||||
protected void setPublisher(final Publisher publisher) {
|
||||
public void setPublisher(final Publisher publisher) {
|
||||
this.publisher = publisher;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,32 +26,32 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Table(name = "ARTICLE_IN_COLLECTED_VOLUME_ITEMS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class ArticleInCollectedVolumeItem
|
||||
extends AbstractPublicationItem<ArticleInCollectedVolume> {
|
||||
extends PublicationItem<ArticleInCollectedVolume> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH
|
||||
})
|
||||
@JoinColumn(name = "ARTICLE_ID")
|
||||
private ArticleInCollectedVolume article;
|
||||
|
||||
@Override
|
||||
public ArticleInCollectedVolume getPublication() {
|
||||
return article;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPublication(final ArticleInCollectedVolume article) {
|
||||
this.article = article;
|
||||
}
|
||||
// @OneToOne(cascade = {CascadeType.DETACH,
|
||||
// CascadeType.MERGE,
|
||||
// CascadeType.PERSIST,
|
||||
// CascadeType.REFRESH
|
||||
// })
|
||||
// @JoinColumn(name = "ARTICLE_ID")
|
||||
// private ArticleInCollectedVolume article;
|
||||
//
|
||||
// @Override
|
||||
// public ArticleInCollectedVolume getPublication() {
|
||||
// return article;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPublication(final ArticleInCollectedVolume article) {
|
||||
// this.article = article;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 67 * hash + Objects.hashCode(article);
|
||||
// hash = 67 * hash + Objects.hashCode(article);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -71,10 +71,11 @@ public class ArticleInCollectedVolumeItem
|
|||
}
|
||||
final ArticleInCollectedVolumeItem other
|
||||
= (ArticleInCollectedVolumeItem) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(article, other.getPublication());
|
||||
// if (!other.canEqual(this)) {
|
||||
// return false;
|
||||
// }
|
||||
// return Objects.equals(article, other.getPublication());
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,11 +83,11 @@ public class ArticleInCollectedVolumeItem
|
|||
return obj instanceof ArticleInCollectedVolumeItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", article = %s%s",
|
||||
Objects.toString(article),
|
||||
data));
|
||||
}
|
||||
// @Override
|
||||
// public String toString(final String data) {
|
||||
// return super.toString(String.format(", article = %s%s",
|
||||
// Objects.toString(article),
|
||||
// data));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,7 @@ package org.scientificcms.publications.contenttypes;
|
|||
import org.hibernate.envers.Audited;
|
||||
import org.scientificcms.publications.ArticleInJournal;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||
|
|
@ -25,33 +20,30 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "ARTICLE_IN_COLLECTED_VOLUME_ITEMS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class ArticleInJournalItem
|
||||
extends AbstractPublicationItem<ArticleInJournal> {
|
||||
public class ArticleInJournalItem extends PublicationItem<ArticleInJournal> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH
|
||||
})
|
||||
@JoinColumn(name = "ARTICLE_ID")
|
||||
private ArticleInJournal article;
|
||||
|
||||
@Override
|
||||
public ArticleInJournal getPublication() {
|
||||
return article;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPublication(final ArticleInJournal article) {
|
||||
this.article = article;
|
||||
}
|
||||
|
||||
// @OneToOne(cascade = {CascadeType.DETACH,
|
||||
// CascadeType.MERGE,
|
||||
// CascadeType.PERSIST,
|
||||
// CascadeType.REFRESH
|
||||
// })
|
||||
// @JoinColumn(name = "ARTICLE_ID")
|
||||
// private ArticleInJournal article;
|
||||
// @Override
|
||||
// public ArticleInJournal getPublication() {
|
||||
// return article;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPublication(final ArticleInJournal article) {
|
||||
// this.article = article;
|
||||
// }
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 67 * hash + Objects.hashCode(this.article);
|
||||
// hash = 67 * hash + Objects.hashCode(this.article);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -70,11 +62,12 @@ public class ArticleInJournalItem
|
|||
return false;
|
||||
}
|
||||
final ArticleInJournalItem other
|
||||
= (ArticleInJournalItem) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(this.article, other.getPublication());
|
||||
= (ArticleInJournalItem) obj;
|
||||
// if (!other.canEqual(this)) {
|
||||
// return false;
|
||||
// }
|
||||
// return Objects.equals(this.article, other.getPublication());
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,11 +75,11 @@ public class ArticleInJournalItem
|
|||
return obj instanceof ArticleInJournalItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", article = %s%s",
|
||||
Objects.toString(article),
|
||||
data));
|
||||
}
|
||||
// @Override
|
||||
// public String toString(final String data) {
|
||||
// return super.toString(String.format(", article = %s%s",
|
||||
// Objects.toString(article),
|
||||
// data));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,32 +27,32 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Table(name = "COLLECTED_VOLUME_ITEMS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class CollectedVolumeItem
|
||||
extends AbstractPublicationWithPublisherItem<CollectedVolume> {
|
||||
extends PublicationWithPublisherItem<CollectedVolume> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH
|
||||
})
|
||||
@JoinColumn(name = "COLLECTED_VOLUME_ID")
|
||||
private CollectedVolume collectedVolume;
|
||||
|
||||
@Override
|
||||
public CollectedVolume getPublication() {
|
||||
return collectedVolume;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPublication(final CollectedVolume collectedVolume) {
|
||||
this.collectedVolume = collectedVolume;
|
||||
}
|
||||
// @OneToOne(cascade = {CascadeType.DETACH,
|
||||
// CascadeType.MERGE,
|
||||
// CascadeType.PERSIST,
|
||||
// CascadeType.REFRESH
|
||||
// })
|
||||
// @JoinColumn(name = "COLLECTED_VOLUME_ID")
|
||||
// private CollectedVolume collectedVolume;
|
||||
//
|
||||
// @Override
|
||||
// public CollectedVolume getPublication() {
|
||||
// return collectedVolume;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPublication(final CollectedVolume collectedVolume) {
|
||||
// this.collectedVolume = collectedVolume;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 59 * hash + Objects.hashCode(collectedVolume);
|
||||
// hash = 59 * hash + Objects.hashCode(collectedVolume);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -71,10 +71,11 @@ public class CollectedVolumeItem
|
|||
return false;
|
||||
}
|
||||
final CollectedVolumeItem other = (CollectedVolumeItem) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(collectedVolume, other.getPublication());
|
||||
// if (!other.canEqual(this)) {
|
||||
// return false;
|
||||
// }
|
||||
// return Objects.equals(collectedVolume, other.getPublication());
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,11 +83,11 @@ public class CollectedVolumeItem
|
|||
return obj instanceof CollectedVolumeItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", collectedVolume = %s%s",
|
||||
Objects.toString(collectedVolume),
|
||||
data));
|
||||
}
|
||||
// @Override
|
||||
// public String toString(final String data) {
|
||||
// return super.toString(String.format(", collectedVolume = %s%s",
|
||||
// Objects.toString(collectedVolume),
|
||||
// data));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,33 +25,32 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "EXPERTISE_ITEMS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class ExpertiseItem
|
||||
extends AbstractPublicationItem<Expertise> {
|
||||
public class ExpertiseItem extends PublicationItem<Expertise> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH
|
||||
})
|
||||
@JoinColumn(name = "EXPERTISE_ID")
|
||||
private Expertise expertise;
|
||||
|
||||
@Override
|
||||
public Expertise getPublication() {
|
||||
return expertise;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPublication(final Expertise expertise) {
|
||||
this.expertise = expertise;
|
||||
}
|
||||
// @OneToOne(cascade = {CascadeType.DETACH,
|
||||
// CascadeType.MERGE,
|
||||
// CascadeType.PERSIST,
|
||||
// CascadeType.REFRESH
|
||||
// })
|
||||
// @JoinColumn(name = "EXPERTISE_ID")
|
||||
// private Expertise expertise;
|
||||
//
|
||||
// @Override
|
||||
// public Expertise getPublication() {
|
||||
// return expertise;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPublication(final Expertise expertise) {
|
||||
// this.expertise = expertise;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 67 * hash + Objects.hashCode(expertise);
|
||||
// hash = 67 * hash + Objects.hashCode(expertise);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -71,10 +70,11 @@ public class ExpertiseItem
|
|||
}
|
||||
final ExpertiseItem other
|
||||
= (ExpertiseItem) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(this.expertise, other.getPublication());
|
||||
// if (!other.canEqual(this)) {
|
||||
// return false;
|
||||
// }
|
||||
// return Objects.equals(this.expertise, other.getPublication());
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,11 +82,11 @@ public class ExpertiseItem
|
|||
return obj instanceof ExpertiseItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", expertise = %s%s",
|
||||
Objects.toString(expertise),
|
||||
data));
|
||||
}
|
||||
// @Override
|
||||
// public String toString(final String data) {
|
||||
// return super.toString(String.format(", expertise = %s%s",
|
||||
// Objects.toString(expertise),
|
||||
// data));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,33 +25,31 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "GREY_LITERATURE_ITEMS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class GreyLiteratureItem
|
||||
extends AbstractPublicationItem<GreyLiterature> {
|
||||
public class GreyLiteratureItem extends PublicationItem<GreyLiterature> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH
|
||||
})
|
||||
@JoinColumn(name = "GREY_LITERATURE_ID")
|
||||
private GreyLiterature greyLiterature;
|
||||
|
||||
@Override
|
||||
public GreyLiterature getPublication() {
|
||||
return greyLiterature;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPublication(final GreyLiterature greyLiterature) {
|
||||
this.greyLiterature = greyLiterature;
|
||||
}
|
||||
|
||||
// @OneToOne(cascade = {CascadeType.DETACH,
|
||||
// CascadeType.MERGE,
|
||||
// CascadeType.PERSIST,
|
||||
// CascadeType.REFRESH
|
||||
// })
|
||||
// @JoinColumn(name = "GREY_LITERATURE_ID")
|
||||
// private GreyLiterature greyLiterature;
|
||||
//
|
||||
// @Override
|
||||
// public GreyLiterature getPublication() {
|
||||
// return greyLiterature;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPublication(final GreyLiterature greyLiterature) {
|
||||
// this.greyLiterature = greyLiterature;
|
||||
// }
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 67 * hash + Objects.hashCode(greyLiterature);
|
||||
// hash = 67 * hash + Objects.hashCode(greyLiterature);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -70,11 +68,12 @@ public class GreyLiteratureItem
|
|||
return false;
|
||||
}
|
||||
final GreyLiteratureItem other
|
||||
= (GreyLiteratureItem) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(this.greyLiterature, other.getPublication());
|
||||
= (GreyLiteratureItem) obj;
|
||||
// if (!other.canEqual(this)) {
|
||||
// return false;
|
||||
// }
|
||||
// return Objects.equals(this.greyLiterature, other.getPublication());
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,11 +81,11 @@ public class GreyLiteratureItem
|
|||
return obj instanceof GreyLiteratureItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", greyLiterature = %s%s",
|
||||
Objects.toString(greyLiterature),
|
||||
data));
|
||||
}
|
||||
// @Override
|
||||
// public String toString(final String data) {
|
||||
// return super.toString(String.format(", greyLiterature = %s%s",
|
||||
// Objects.toString(greyLiterature),
|
||||
// data));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,33 +25,32 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "INPROCEEDINGS_ITEMS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class InProceedingsItem
|
||||
extends AbstractPublicationItem<InProceedings> {
|
||||
public class InProceedingsItem extends PublicationItem<InProceedings> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH
|
||||
})
|
||||
@JoinColumn(name = "INPROCEEDINGS_ID")
|
||||
private InProceedings inProcedings;
|
||||
|
||||
@Override
|
||||
public InProceedings getPublication() {
|
||||
return inProcedings;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPublication(final InProceedings inProceedings) {
|
||||
this.inProcedings = inProceedings;
|
||||
}
|
||||
// @OneToOne(cascade = {CascadeType.DETACH,
|
||||
// CascadeType.MERGE,
|
||||
// CascadeType.PERSIST,
|
||||
// CascadeType.REFRESH
|
||||
// })
|
||||
// @JoinColumn(name = "INPROCEEDINGS_ID")
|
||||
// private InProceedings inProcedings;
|
||||
//
|
||||
// @Override
|
||||
// public InProceedings getPublication() {
|
||||
// return inProcedings;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPublication(final InProceedings inProceedings) {
|
||||
// this.inProcedings = inProceedings;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 67 * hash + Objects.hashCode(inProcedings);
|
||||
// hash = 67 * hash + Objects.hashCode(inProcedings);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -70,11 +69,12 @@ public class InProceedingsItem
|
|||
return false;
|
||||
}
|
||||
final InProceedingsItem other
|
||||
= (InProceedingsItem) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(this.inProcedings, other.getPublication());
|
||||
= (InProceedingsItem) obj;
|
||||
// if (!other.canEqual(this)) {
|
||||
// return false;
|
||||
// }
|
||||
// return Objects.equals(this.inProcedings, other.getPublication());
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,11 +82,11 @@ public class InProceedingsItem
|
|||
return obj instanceof InProceedingsItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", inProceedings = %s%s",
|
||||
Objects.toString(inProcedings),
|
||||
data));
|
||||
}
|
||||
// @Override
|
||||
// public String toString(final String data) {
|
||||
// return super.toString(String.format(", inProceedings = %s%s",
|
||||
// Objects.toString(inProcedings),
|
||||
// data));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,33 +25,31 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "INTERNET_ARTICLE_ITEMS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class InternetArticleItem
|
||||
extends AbstractPublicationItem<InternetArticle> {
|
||||
public class InternetArticleItem extends PublicationItem<InternetArticle> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH
|
||||
})
|
||||
@JoinColumn(name = "EXPERTISE_ID")
|
||||
private InternetArticle expertise;
|
||||
|
||||
@Override
|
||||
public InternetArticle getPublication() {
|
||||
return expertise;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPublication(final InternetArticle internetArticle) {
|
||||
this.expertise = internetArticle;
|
||||
}
|
||||
|
||||
// @OneToOne(cascade = {CascadeType.DETACH,
|
||||
// CascadeType.MERGE,
|
||||
// CascadeType.PERSIST,
|
||||
// CascadeType.REFRESH
|
||||
// })
|
||||
// @JoinColumn(name = "EXPERTISE_ID")
|
||||
// private InternetArticle expertise;
|
||||
//
|
||||
// @Override
|
||||
// public InternetArticle getPublication() {
|
||||
// return expertise;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPublication(final InternetArticle internetArticle) {
|
||||
// this.expertise = internetArticle;
|
||||
// }
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 67 * hash + Objects.hashCode(expertise);
|
||||
// hash = 67 * hash + Objects.hashCode(expertise);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -71,10 +69,11 @@ public class InternetArticleItem
|
|||
}
|
||||
final InternetArticleItem other
|
||||
= (InternetArticleItem) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(this.expertise, other.getPublication());
|
||||
// if (!other.canEqual(this)) {
|
||||
// return false;
|
||||
// }
|
||||
// return Objects.equals(this.expertise, other.getPublication());
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,11 +81,11 @@ public class InternetArticleItem
|
|||
return obj instanceof InternetArticleItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", internetArticle = %s%s",
|
||||
Objects.toString(expertise),
|
||||
data));
|
||||
}
|
||||
// @Override
|
||||
// public String toString(final String data) {
|
||||
// return super.toString(String.format(", internetArticle = %s%s",
|
||||
// Objects.toString(expertise),
|
||||
// data));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,7 @@ package org.scientificcms.publications.contenttypes;
|
|||
|
||||
import org.scientificcms.publications.Monograph;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||
|
|
@ -23,33 +18,31 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
*/
|
||||
@Entity
|
||||
@Table(name = "MONOGRAPH_ITEMS", schema = DB_SCHEMA)
|
||||
public class MonographItem
|
||||
extends AbstractPublicationWithPublisherItem<Monograph> {
|
||||
public class MonographItem extends PublicationWithPublisherItem<Monograph> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH
|
||||
})
|
||||
@JoinColumn(name = "MONOGRAPH_ID")
|
||||
private Monograph monograph;
|
||||
|
||||
@Override
|
||||
public Monograph getPublication() {
|
||||
return monograph;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPublication(final Monograph monograph) {
|
||||
this.monograph = monograph;
|
||||
}
|
||||
|
||||
// @OneToOne(cascade = {CascadeType.DETACH,
|
||||
// CascadeType.MERGE,
|
||||
// CascadeType.PERSIST,
|
||||
// CascadeType.REFRESH
|
||||
// })
|
||||
// @JoinColumn(name = "MONOGRAPH_ID")
|
||||
// private Monograph monograph;
|
||||
//
|
||||
// @Override
|
||||
// public Monograph getPublication() {
|
||||
// return monograph;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPublication(final Monograph monograph) {
|
||||
// this.monograph = monograph;
|
||||
// }
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 29 * hash + Objects.hashCode(monograph);
|
||||
// hash = 29 * hash + Objects.hashCode(monograph);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -68,10 +61,11 @@ public class MonographItem
|
|||
return false;
|
||||
}
|
||||
final MonographItem other = (MonographItem) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(monograph, other.getPublication());
|
||||
// if (!other.canEqual(this)) {
|
||||
// return false;
|
||||
// }
|
||||
// return Objects.equals(monograph, other.getPublication());
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -79,11 +73,11 @@ public class MonographItem
|
|||
return obj instanceof MonographItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", publication = %s%s",
|
||||
Objects.toString(monograph),
|
||||
data));
|
||||
}
|
||||
// @Override
|
||||
// public String toString(final String data) {
|
||||
// return super.toString(String.format(", publication = %s%s",
|
||||
// Objects.toString(monograph),
|
||||
// data));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,7 @@ package org.scientificcms.publications.contenttypes;
|
|||
|
||||
import org.scientificcms.publications.Proceedings;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||
|
|
@ -23,33 +18,31 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
*/
|
||||
@Entity
|
||||
@Table(name = "PROCEEDINGS_ITEMS", schema = DB_SCHEMA)
|
||||
public class ProceedingsItem
|
||||
extends AbstractPublicationWithPublisherItem<Proceedings> {
|
||||
public class ProceedingsItem extends PublicationWithPublisherItem<Proceedings> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH
|
||||
})
|
||||
@JoinColumn(name = "PROCEEDINGS_ID")
|
||||
private Proceedings article;
|
||||
|
||||
@Override
|
||||
public Proceedings getPublication() {
|
||||
return article;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPublication(final Proceedings article) {
|
||||
this.article = article;
|
||||
}
|
||||
|
||||
// @OneToOne(cascade = {CascadeType.DETACH,
|
||||
// CascadeType.MERGE,
|
||||
// CascadeType.PERSIST,
|
||||
// CascadeType.REFRESH
|
||||
// })
|
||||
// @JoinColumn(name = "PROCEEDINGS_ID")
|
||||
// private Proceedings article;
|
||||
//
|
||||
// @Override
|
||||
// public Proceedings getPublication() {
|
||||
// return article;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPublication(final Proceedings article) {
|
||||
// this.article = article;
|
||||
// }
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 67 * hash + Objects.hashCode(article);
|
||||
// hash = 67 * hash + Objects.hashCode(article);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -69,10 +62,11 @@ public class ProceedingsItem
|
|||
}
|
||||
final ProceedingsItem other
|
||||
= (ProceedingsItem) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(this.article, other.getPublication());
|
||||
// if (!other.canEqual(this)) {
|
||||
// return false;
|
||||
// }
|
||||
// return Objects.equals(this.article, other.getPublication());
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -80,11 +74,11 @@ public class ProceedingsItem
|
|||
return obj instanceof ProceedingsItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", proceedings = %s%s",
|
||||
Objects.toString(article),
|
||||
data));
|
||||
}
|
||||
// @Override
|
||||
// public String toString(final String data) {
|
||||
// return super.toString(String.format(", proceedings = %s%s",
|
||||
// Objects.toString(article),
|
||||
// data));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,18 @@ import org.hibernate.envers.Audited;
|
|||
import org.librecms.contentsection.ContentItem;
|
||||
import org.scientificcms.publications.Publication;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||
|
||||
/**
|
||||
* Base Item for Publications.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
* @param <T>
|
||||
|
|
@ -22,14 +28,32 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "PUBLICATION_ITEMS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public abstract class AbstractPublicationItem<T extends Publication>
|
||||
extends ContentItem {
|
||||
@NamedQueries({
|
||||
@NamedQuery(
|
||||
name = "PublicationItem.findForPublication",
|
||||
query = "SELECT i FROM PublicationItem i WHERE i.publication = :publication"
|
||||
)
|
||||
})
|
||||
public class PublicationItem<T extends Publication> extends ContentItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public abstract T getPublication();
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH},
|
||||
fetch = FetchType.LAZY,
|
||||
targetEntity = Publication.class
|
||||
)
|
||||
private T publication;
|
||||
|
||||
protected abstract void setPublication(T publication);
|
||||
public T getPublication() {
|
||||
return publication;
|
||||
}
|
||||
|
||||
public void setPublication(final T publication) {
|
||||
this.publication = publication;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
|
@ -49,18 +73,17 @@ public abstract class AbstractPublicationItem<T extends Publication>
|
|||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof AbstractPublicationItem)) {
|
||||
if (!(obj instanceof PublicationItem)) {
|
||||
return false;
|
||||
}
|
||||
final AbstractPublicationItem<?> other
|
||||
= (AbstractPublicationItem<?>) obj;
|
||||
final PublicationItem<?> other = (PublicationItem<?>) obj;
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
|
||||
return obj instanceof AbstractPublicationItem;
|
||||
return obj instanceof PublicationItem;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.publications.contenttypes;
|
||||
|
||||
import org.librecms.contentsection.ContentItemRepository;
|
||||
import org.scientificcms.publications.Publication;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.persistence.NoResultException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class PublicationItemRepository extends ContentItemRepository {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Publication> Optional<PublicationItem<T>> findForPublication(
|
||||
final T publication, final Class<T> publicationType
|
||||
) {
|
||||
try {
|
||||
return Optional.of(
|
||||
(PublicationItem<T>) getEntityManager()
|
||||
.createNamedQuery("PublicationItem.findForPublication",
|
||||
PublicationItem.class)
|
||||
.setParameter("publication", publication)
|
||||
.getSingleResult()
|
||||
);
|
||||
} catch (NoResultException ex) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -21,8 +21,8 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "PUBLICATION_WITH_PUBLISHER_ITEMS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public abstract class AbstractPublicationWithPublisherItem<T extends PublicationWithPublisher>
|
||||
extends AbstractPublicationItem<T> {
|
||||
public class PublicationWithPublisherItem<T extends PublicationWithPublisher>
|
||||
extends PublicationItem<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
@ -44,17 +44,17 @@ public abstract class AbstractPublicationWithPublisherItem<T extends Publication
|
|||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof AbstractPublicationWithPublisherItem)) {
|
||||
if (!(obj instanceof PublicationWithPublisherItem)) {
|
||||
return false;
|
||||
}
|
||||
final AbstractPublicationWithPublisherItem<?> other
|
||||
= (AbstractPublicationWithPublisherItem<?>) obj;
|
||||
final PublicationWithPublisherItem<?> other
|
||||
= (PublicationWithPublisherItem<?>) obj;
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
return obj instanceof AbstractPublicationWithPublisherItem;
|
||||
return obj instanceof PublicationWithPublisherItem;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -25,33 +25,31 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "TALK_ITEMS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class TalkItem
|
||||
extends AbstractPublicationItem<Talk> {
|
||||
public class TalkItem extends PublicationItem<Talk> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH
|
||||
})
|
||||
@JoinColumn(name = "TALK_ID")
|
||||
private Talk talk;
|
||||
|
||||
@Override
|
||||
public Talk getPublication() {
|
||||
return talk;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPublication(final Talk talk) {
|
||||
this.talk = talk;
|
||||
}
|
||||
|
||||
// @OneToOne(cascade = {CascadeType.DETACH,
|
||||
// CascadeType.MERGE,
|
||||
// CascadeType.PERSIST,
|
||||
// CascadeType.REFRESH
|
||||
// })
|
||||
// @JoinColumn(name = "TALK_ID")
|
||||
// private Talk talk;
|
||||
//
|
||||
// @Override
|
||||
// public Talk getPublication() {
|
||||
// return talk;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPublication(final Talk talk) {
|
||||
// this.talk = talk;
|
||||
// }
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 67 * hash + Objects.hashCode(talk);
|
||||
// hash = 67 * hash + Objects.hashCode(talk);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -71,10 +69,11 @@ public class TalkItem
|
|||
}
|
||||
final TalkItem other
|
||||
= (TalkItem) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(this.talk, other.getPublication());
|
||||
// if (!other.canEqual(this)) {
|
||||
// return false;
|
||||
// }
|
||||
// return Objects.equals(this.talk, other.getPublication());
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,11 +81,11 @@ public class TalkItem
|
|||
return obj instanceof TalkItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", talk = %s%s",
|
||||
Objects.toString(talk),
|
||||
data));
|
||||
}
|
||||
// @Override
|
||||
// public String toString(final String data) {
|
||||
// return super.toString(String.format(", talk = %s%s",
|
||||
// Objects.toString(talk),
|
||||
// data));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,7 @@ package org.scientificcms.publications.contenttypes;
|
|||
import org.hibernate.envers.Audited;
|
||||
import org.scientificcms.publications.WorkingPaper;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||
|
|
@ -25,33 +20,31 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "WORKING_PAPER_ITEMS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class WorkingPaperItem
|
||||
extends AbstractPublicationItem<WorkingPaper> {
|
||||
public class WorkingPaperItem extends PublicationItem<WorkingPaper> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = {CascadeType.DETACH,
|
||||
CascadeType.MERGE,
|
||||
CascadeType.PERSIST,
|
||||
CascadeType.REFRESH
|
||||
})
|
||||
@JoinColumn(name = "EXPERTISE_ID")
|
||||
private WorkingPaper workingPaper;
|
||||
|
||||
@Override
|
||||
public WorkingPaper getPublication() {
|
||||
return workingPaper;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPublication(final WorkingPaper workingPaper) {
|
||||
this.workingPaper = workingPaper;
|
||||
}
|
||||
|
||||
// @OneToOne(cascade = {CascadeType.DETACH,
|
||||
// CascadeType.MERGE,
|
||||
// CascadeType.PERSIST,
|
||||
// CascadeType.REFRESH
|
||||
// })
|
||||
// @JoinColumn(name = "EXPERTISE_ID")
|
||||
// private WorkingPaper workingPaper;
|
||||
//
|
||||
// @Override
|
||||
// public WorkingPaper getPublication() {
|
||||
// return workingPaper;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPublication(final WorkingPaper workingPaper) {
|
||||
// this.workingPaper = workingPaper;
|
||||
// }
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 67 * hash + Objects.hashCode(workingPaper);
|
||||
// hash = 67 * hash + Objects.hashCode(workingPaper);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -71,10 +64,11 @@ public class WorkingPaperItem
|
|||
}
|
||||
final WorkingPaperItem other
|
||||
= (WorkingPaperItem) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(this.workingPaper, other.getPublication());
|
||||
// if (!other.canEqual(this)) {
|
||||
// return false;
|
||||
// }
|
||||
// return Objects.equals(this.workingPaper, other.getPublication());
|
||||
return other.canEqual(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,11 +76,11 @@ public class WorkingPaperItem
|
|||
return obj instanceof WorkingPaperItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", workingPaper = %s%s",
|
||||
Objects.toString(workingPaper),
|
||||
data));
|
||||
}
|
||||
// @Override
|
||||
// public String toString(final String data) {
|
||||
// return super.toString(String.format(", workingPaper = %s%s",
|
||||
// Objects.toString(workingPaper),
|
||||
// data));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue