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