Пример #1
0
 /* (non-Javadoc)
  * @see kiwi.api.history.HistoryService#getLastVisitedPage()
  */
 public String getLastVisitedPage() {
   VisitActivity visityActivity = listLastVisitByUser(currentUser);
   if (visityActivity != null) {
     KiWiUriResource kiwiUriResource =
         (KiWiUriResource) visityActivity.getContentItem().getResource();
     if (kiwiUriResource.isUriResource()) {
       return kiwiUriResource.getUri();
     } else {
       return configurationService.getStartPage();
     }
   } else {
     return configurationService.getStartPage();
   }
 }
Пример #2
0
  /**
   * Create a new content item with the current system's base URI and the uriPostfix appended. The
   * actual creation of the content item is currently performed by tripleStore.createUriResource ...
   *
   * @param uriPostfix the postfix of the URI to use; should not start with /
   * @return a newly initialised content item that can be used for further operations
   */
  @Insert(ContentItem.class)
  public ContentItem createContentItem(String uriPostfix) {
    ContentItem result = getContentItemByUri(configurationService.getBaseUri() + "/" + uriPostfix);
    if (result == null) {
      result =
          tripleStore
              .createUriResource(configurationService.getBaseUri() + "/" + uriPostfix)
              .getContentItem();
      result.setAuthor(currentUser);

      // TODO: workaround, needs to be fixed properly (KIWI-684)
      //			transactionService.getCurrentTransactionData().setCurrentContentItem(result);

      Events.instance().raiseEvent(KiWiEvents.ACTIVITY_CREATECONTENTITEM, currentUser, result);
      Events.instance().raiseTransactionSuccessEvent(KiWiEvents.ITEM_CREATED, result);
    }
    return result;
  }