Esempio n. 1
0
 /**
  * Query for a single content item using the named query passed as first argument and setting the
  * query parameter "parameter" to the value "value".
  *
  * @param namedQuery the named query to use for querying in the entityManager
  * @param parameter the name of the query parameter to set (e.g. "title", "uri", ...)
  * @param value the value of the query parameter
  * @return the content item returned by the named query, or null
  */
 private ContentItem _getContentItemByQuery(String namedQuery, String parameter, String value) {
   javax.persistence.Query q = entityManager.createNamedQuery(namedQuery);
   q.setParameter(parameter, value);
   q.setMaxResults(1);
   q.setHint("org.hibernate.cacheable", true);
   try {
     ContentItem res = (ContentItem) q.getSingleResult();
     tripleStore.refresh(res, false);
     return res;
   } catch (NoResultException ex) {
     return null;
   }
 }
Esempio n. 2
0
 /** Refresh content item when metadata is updated */
 @Observer(KiWiEvents.METADATA_UPDATED)
 public void listenMetadataUpdate(ContentItem item) {
   tripleStore.refresh(item, true);
 }