Some bugfixes and optimizations
parent
56e53e6205
commit
224f924673
|
|
@ -53,6 +53,7 @@ public class ArticleModel {
|
||||||
|
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -60,6 +61,7 @@ public class ArticleModel {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
if (description == null) {
|
if (description == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -67,6 +69,7 @@ public class ArticleModel {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getText() {
|
public String getText() {
|
||||||
if (text == null) {
|
if (text == null) {
|
||||||
init();
|
init();
|
||||||
|
|
|
||||||
|
|
@ -98,76 +98,89 @@ public class ContentItemModel {
|
||||||
this.itemVersion = itemVersion;
|
this.itemVersion = itemVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public boolean isItemAvailable() {
|
public boolean isItemAvailable() {
|
||||||
return getOrRetrieveContentItem().isPresent();
|
return getOrRetrieveContentItem().isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public long getObjectId() {
|
public long getObjectId() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getObjectId)
|
.map(ContentItemModelData::getObjectId)
|
||||||
.orElse(0L);
|
.orElse(0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getUuid() {
|
public String getUuid() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getUuid)
|
.map(ContentItemModelData::getUuid)
|
||||||
.orElse("");
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getDisplayName)
|
.map(ContentItemModelData::getDisplayName)
|
||||||
.orElse("");
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getItemUuid() {
|
public String getItemUuid() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getItemUuid)
|
.map(ContentItemModelData::getItemUuid)
|
||||||
.orElse("");
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getName)
|
.map(ContentItemModelData::getName)
|
||||||
.orElse("");
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getTitle)
|
.map(ContentItemModelData::getTitle)
|
||||||
.orElse("");
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getDescription)
|
.map(ContentItemModelData::getDescription)
|
||||||
.orElse("");
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getVersion)
|
.map(ContentItemModelData::getVersion)
|
||||||
.orElse("");
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getCreationDate() {
|
public String getCreationDate() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getCreationDate)
|
.map(ContentItemModelData::getCreationDate)
|
||||||
.orElse("");
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getLastModified() {
|
public String getLastModified() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getLastModified)
|
.map(ContentItemModelData::getLastModified)
|
||||||
.orElse("");
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getCreationUser() {
|
public String getCreationUser() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getCreationUser)
|
.map(ContentItemModelData::getCreationUser)
|
||||||
.orElse("");
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getLastModifyingUserName() {
|
public String getLastModifyingUserName() {
|
||||||
return getOrRetrieveContentItem()
|
return getOrRetrieveContentItem()
|
||||||
.map(ContentItemModelData::getLastModifyingUserName)
|
.map(ContentItemModelData::getLastModifyingUserName)
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ public class EventModel {
|
||||||
.withZone(ZoneId.systemDefault());
|
.withZone(ZoneId.systemDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -77,6 +78,7 @@ public class EventModel {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getText() {
|
public String getText() {
|
||||||
if (text == null) {
|
if (text == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -85,6 +87,7 @@ public class EventModel {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getStartDateTime() {
|
public String getStartDateTime() {
|
||||||
if (startDateTime == null) {
|
if (startDateTime == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -93,6 +96,7 @@ public class EventModel {
|
||||||
return startDateTime;
|
return startDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getEndDateTime() {
|
public String getEndDateTime() {
|
||||||
if (endDateTime == null) {
|
if (endDateTime == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -101,6 +105,7 @@ public class EventModel {
|
||||||
return endDateTime;
|
return endDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getEventDate() {
|
public String getEventDate() {
|
||||||
if (eventDate == null) {
|
if (eventDate == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -108,6 +113,7 @@ public class EventModel {
|
||||||
return eventDate;
|
return eventDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getLocation() {
|
public String getLocation() {
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -116,6 +122,7 @@ public class EventModel {
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getEventType() {
|
public String getEventType() {
|
||||||
if (eventType == null) {
|
if (eventType == null) {
|
||||||
init();
|
init();
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ public class MultiPartArticleModel {
|
||||||
|
|
||||||
private List<MultiPartArticleSectionModel> sections;
|
private List<MultiPartArticleSectionModel> sections;
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -72,6 +73,7 @@ public class MultiPartArticleModel {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
if (summary == null) {
|
if (summary == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -80,6 +82,8 @@ public class MultiPartArticleModel {
|
||||||
return summary;
|
return summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public List<String> getSectionTitles() {
|
public List<String> getSectionTitles() {
|
||||||
if (sectionTitles == null) {
|
if (sectionTitles == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -88,6 +92,7 @@ public class MultiPartArticleModel {
|
||||||
return Collections.unmodifiableList(sectionTitles);
|
return Collections.unmodifiableList(sectionTitles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getCurrentSectionTitle() {
|
public String getCurrentSectionTitle() {
|
||||||
if (currentSectionTitle == null) {
|
if (currentSectionTitle == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -96,6 +101,7 @@ public class MultiPartArticleModel {
|
||||||
return currentSectionTitle;
|
return currentSectionTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getCurrentSectionText() {
|
public String getCurrentSectionText() {
|
||||||
if (currentSectionText == null) {
|
if (currentSectionText == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -104,6 +110,7 @@ public class MultiPartArticleModel {
|
||||||
return currentSectionText;
|
return currentSectionText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public List<MultiPartArticleSectionModel> getSections() {
|
public List<MultiPartArticleSectionModel> getSections() {
|
||||||
if (sections == null) {
|
if (sections == null) {
|
||||||
init();
|
init();
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ public class NewsModel {
|
||||||
.withZone(ZoneId.systemDefault());
|
.withZone(ZoneId.systemDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -74,6 +75,7 @@ public class NewsModel {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
if (description == null) {
|
if (description == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -82,6 +84,7 @@ public class NewsModel {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getText() {
|
public String getText() {
|
||||||
if (text == null) {
|
if (text == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -89,6 +92,7 @@ public class NewsModel {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getReleaseDateTime() {
|
public String getReleaseDateTime() {
|
||||||
if (releaseDateTime == null) {
|
if (releaseDateTime == null) {
|
||||||
init();
|
init();
|
||||||
|
|
@ -97,6 +101,7 @@ public class NewsModel {
|
||||||
return releaseDateTime;
|
return releaseDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public boolean getHomepage() {
|
public boolean getHomepage() {
|
||||||
return homepage;
|
return homepage;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,10 @@ import javax.persistence.Table;
|
||||||
+ "AND c.type = :type"),
|
+ "AND c.type = :type"),
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Categorization.findIndexObject",
|
name = "Categorization.findIndexObject",
|
||||||
query = "SELECT c.categorizedObject FROM Categorization c "
|
query = "SELECT c.categorizedObject "
|
||||||
+ "WHERE c.category = :category "
|
+ "FROM Categorization c "
|
||||||
|
+ "JOIN c.category a "
|
||||||
|
+ "WHERE a.uuid = :catuuid "
|
||||||
+ "AND c.indexObject = TRUE"),
|
+ "AND c.indexObject = TRUE"),
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Categorization.findIndexObjectCategorization",
|
name = "Categorization.findIndexObjectCategorization",
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@code CategoryManager} provides several helper methods for managing
|
* The {@code CategoryManager} provides several helper methods for managing
|
||||||
|
|
@ -58,7 +59,8 @@ public class CategoryManager implements Serializable {
|
||||||
private static final long serialVersionUID = -3354487547729008811L;
|
private static final long serialVersionUID = -3354487547729008811L;
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
private static final Logger LOGGER = LogManager.getLogger(
|
||||||
CategoryManager.class);
|
CategoryManager.class
|
||||||
|
);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private CcmObjectRepository ccmObjectRepo;
|
private CcmObjectRepository ccmObjectRepo;
|
||||||
|
|
@ -982,16 +984,13 @@ public class CategoryManager implements Serializable {
|
||||||
*/
|
*/
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public List<CcmObject> getIndexObject(final Category category) {
|
public List<CcmObject> getIndexObject(final Category category) {
|
||||||
// if (hasIndexObject(category)) {
|
final long start = System.currentTimeMillis();
|
||||||
final TypedQuery<CcmObject> query = entityManager.createNamedQuery(
|
return category
|
||||||
"Categorization.findIndexObject", CcmObject.class);
|
.getObjects()
|
||||||
query.setParameter("category", category);
|
.stream()
|
||||||
|
.filter(Categorization::isIndexObject)
|
||||||
return query.getResultList();
|
.map(Categorization::getCategorizedObject)
|
||||||
// return Optional.of(query.getSingleResult());
|
.collect(Collectors.toList());
|
||||||
// } else {
|
|
||||||
// return Optional.empty();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue