Example usage for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY

List of usage examples for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY.

Prototype

String[] EMPTY_STRING_ARRAY

To view the source code for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY.

Click Source Link

Document

An empty immutable String array.

Usage

From source file:org.exoplatform.calendar.webui.popup.UIEventForm.java

public void saveAndNoAsk(Event<UIEventForm> event, boolean isSend, boolean updateSeries) throws Exception {
    UIEventForm uiForm = event.getSource();
    UICalendarPortlet calendarPortlet = uiForm.getAncestorOfType(UICalendarPortlet.class);
    UIPopupAction uiPopupAction = uiForm.getAncestorOfType(UIPopupAction.class);
    UICalendarViewContainer uiViewContainer = calendarPortlet
            .findFirstComponentOfType(UICalendarViewContainer.class);
    CalendarSetting calSetting = calendarPortlet.getCalendarSetting();
    CalendarService calService = CalendarUtils.getCalendarService();
    String summary = uiForm.getEventSumary().trim();
    summary = CalendarUtils.enCodeTitle(summary);
    String location = uiForm.getEventPlace();
    if (!CalendarUtils.isEmpty(location))
        location = location.replaceAll(CalendarUtils.GREATER_THAN, "").replaceAll(CalendarUtils.SMALLER_THAN,
                "");
    String description = uiForm.getEventDescription();
    if (!CalendarUtils.isEmpty(description))
        description = description.replaceAll(CalendarUtils.GREATER_THAN, "")
                .replaceAll(CalendarUtils.SMALLER_THAN, "");
    if (!uiForm.isEventDetailValid(calSetting)) {
        event.getRequestContext().getUIApplication().addMessage(new ApplicationMessage(uiForm.errorMsg_, null));
        uiForm.setSelectedTab(TAB_EVENTDETAIL);
        event.getRequestContext().addUIComponentToUpdateByAjax(uiForm.getAncestorOfType(UIPopupAction.class));
        return;/*  w  ww.j  a v a 2  s.c o m*/
    }
    if (!uiForm.isReminderValid()) {
        event.getRequestContext().getUIApplication()
                .addMessage(new ApplicationMessage(uiForm.errorMsg_, new String[] { uiForm.errorValues }));
        uiForm.setSelectedTab(TAB_EVENTREMINDER);
        event.getRequestContext().addUIComponentToUpdateByAjax(uiForm.getAncestorOfType(UIPopupAction.class));
        return;
    }
    if (!uiForm.isParticipantValid()) {
        event.getRequestContext().getUIApplication()
                .addMessage(new ApplicationMessage(uiForm.errorMsg_, new String[] { uiForm.errorValues }));
        uiForm.setSelectedTab(TAB_EVENTSHARE);
        event.getRequestContext().addUIComponentToUpdateByAjax(uiForm.getAncestorOfType(UIPopupAction.class));
        return;
    }
    Date from = uiForm.getEventFromDate(calSetting.getDateFormat(), calSetting.getTimeFormat());
    Date to = uiForm.getEventToDate(calSetting.getDateFormat(), calSetting.getTimeFormat());
    if (from.after(to)) {
        event.getRequestContext().getUIApplication().addMessage(new ApplicationMessage(
                uiForm.getId() + ".msg.event-date-time-logic", null, ApplicationMessage.WARNING));
        return;
    }
    String username = CalendarUtils.getCurrentUser();
    String calendarId = uiForm.getCalendarId();
    if (from.equals(to)) {
        to = CalendarUtils.getEndDay(from).getTime();
    }
    if (uiForm.getEventAllDate()) {
        java.util.Calendar tempCal = CalendarUtils.getInstanceOfCurrentCalendar();
        tempCal.setTime(to);
        tempCal.add(java.util.Calendar.MILLISECOND, -1);
        to = tempCal.getTime();
    }
    Calendar currentCalendar = CalendarUtils.getCalendar(uiForm.calType_, calendarId);
    if (currentCalendar == null) {
        uiPopupAction.deActivate();
        event.getRequestContext().addUIComponentToUpdateByAjax(uiPopupAction);
        event.getRequestContext().getUIApplication()
                .addMessage(new ApplicationMessage("UICalendars.msg.have-no-calendar", null, 1));
        return;
    }
    boolean canEdit = false;
    if (uiForm.calType_.equals(CalendarUtils.SHARED_TYPE)) {
        canEdit = CalendarUtils.canEdit(null,
                org.exoplatform.calendar.service.Utils.getEditPerUsers(currentCalendar), username);
    } else if (uiForm.calType_.equals(CalendarUtils.PUBLIC_TYPE)) {
        // cs-4429: fix for group calendar permission
        canEdit = CalendarUtils.canEdit(CalendarUtils.getOrganizationService(),
                currentCalendar.getEditPermission(), username);
    }
    if (!canEdit && !uiForm.calType_.equals(CalendarUtils.PRIVATE_TYPE)) {
        uiPopupAction.deActivate();
        event.getRequestContext().addUIComponentToUpdateByAjax(uiPopupAction);
        event.getRequestContext().getUIApplication()
                .addMessage(new ApplicationMessage("UICalendars.msg.have-no-permission-to-edit", null, 1));
        return;
    }
    CalendarEvent calendarEvent = null;
    CalendarEvent oldCalendarEvent = null;
    String[] pars = uiForm.getParticipantValues().split(CalendarUtils.BREAK_LINE);
    String eventId = null;
    if (uiForm.isAddNew_) {
        calendarEvent = new CalendarEvent();
    } else {
        calendarEvent = uiForm.calendarEvent_;
        oldCalendarEvent = new CalendarEvent();
        oldCalendarEvent.setSummary(calendarEvent.getSummary());
        oldCalendarEvent.setDescription(calendarEvent.getDescription());
        oldCalendarEvent.setLocation(calendarEvent.getLocation());
        oldCalendarEvent.setFromDateTime(calendarEvent.getFromDateTime());
        oldCalendarEvent.setToDateTime(calendarEvent.getToDateTime());
    }
    calendarEvent.setFromDateTime(from);
    calendarEvent.setToDateTime(to);

    calendarEvent.setSendOption(uiForm.getSendOption());
    calendarEvent.setMessage(uiForm.getMessage());
    String[] parStatus = uiForm.getParticipantStatusValues().split(CalendarUtils.BREAK_LINE);

    calendarEvent.setParticipantStatus(parStatus);

    calendarEvent.setParticipant(pars);
    if (CalendarUtils.isEmpty(uiForm.getInvitationEmail()))
        calendarEvent.setInvitation(ArrayUtils.EMPTY_STRING_ARRAY);
    else if (CalendarUtils.isValidEmailAddresses(uiForm.getInvitationEmail())) {
        String addressList = uiForm.getInvitationEmail().replaceAll(CalendarUtils.SEMICOLON,
                CalendarUtils.COMMA);
        Map<String, String> emails = new LinkedHashMap<String, String>();
        for (String email : addressList.split(CalendarUtils.COMMA)) {
            String address = email.trim();
            if (!emails.containsKey(address))
                emails.put(address, address);
        }
        if (!emails.isEmpty())
            calendarEvent.setInvitation(emails.keySet().toArray(new String[emails.size()]));
    } else {
        event.getRequestContext().getUIApplication()
                .addMessage(new ApplicationMessage("UIEventForm.msg.event-email-invalid",
                        new String[] { CalendarUtils.invalidEmailAddresses(uiForm.getInvitationEmail()) }));
        uiForm.setSelectedTab(TAB_EVENTSHARE);
        event.getRequestContext().addUIComponentToUpdateByAjax(uiForm.getAncestorOfType(UIPopupAction.class));

        return;
    }
    calendarEvent.setCalendarId(uiForm.getCalendarId());
    calendarEvent.setEventType(CalendarEvent.TYPE_EVENT);
    calendarEvent.setSummary(summary);
    calendarEvent.setDescription(description);
    calendarEvent.setCalType(uiForm.calType_);
    calendarEvent.setCalendarId(calendarId);
    calendarEvent.setEventCategoryId(uiForm.getEventCategory());
    UIFormSelectBox selectBox = ((UIFormInputWithActions) uiForm.getChildById(TAB_EVENTDETAIL))
            .getUIFormSelectBox(UIEventDetailTab.FIELD_CATEGORY);
    for (SelectItemOption<String> o : selectBox.getOptions()) {
        if (o.getValue().equals(selectBox.getValue())) {
            calendarEvent.setEventCategoryName(o.getLabel());
            break;
        }
    }
    //}
    calendarEvent.setLocation(location);

    if (uiForm.getEventIsRepeat()) {
        if (repeatEvent != null) {
            // copy repeat properties from repeatEvent to calendarEvent
            calendarEvent.setRepeatType(repeatEvent.getRepeatType());
            calendarEvent.setRepeatInterval(repeatEvent.getRepeatInterval());
            calendarEvent.setRepeatCount(repeatEvent.getRepeatCount());
            calendarEvent.setRepeatUntilDate(repeatEvent.getRepeatUntilDate());
            calendarEvent.setRepeatByDay(repeatEvent.getRepeatByDay());
            calendarEvent.setRepeatByMonthDay(repeatEvent.getRepeatByMonthDay());
        }
    } else {
        calendarEvent.setRepeatType(CalendarEvent.RP_NOREPEAT);
        calendarEvent.setRepeatInterval(0);
        calendarEvent.setRepeatCount(0);
        calendarEvent.setRepeatUntilDate(null);
        calendarEvent.setRepeatByDay(null);
        calendarEvent.setRepeatByMonthDay(null);
    }

    calendarEvent.setPriority(uiForm.getEventPriority());
    calendarEvent.setPrivate(UIEventForm.ITEM_PRIVATE.equals(uiForm.getShareType()));
    calendarEvent.setEventState(uiForm.getEventState());
    calendarEvent.setAttachment(uiForm.getAttachments(calendarEvent.getId(), uiForm.isAddNew_));
    calendarEvent.setReminders(uiForm.getEventReminders(from, calendarEvent.getReminders()));
    eventId = calendarEvent.getId();
    CalendarView calendarView = (CalendarView) uiViewContainer.getRenderedChild();
    this.isChangedSignificantly = this.isSignificantChanged(calendarEvent, oldCalendarEvent);

    try {
        if (calendarEvent != null && isSend) {
            try {
                CalendarEvent tempCal = sendInvitation(event, calSetting, calendarEvent);
                calendarEvent = tempCal != null ? tempCal : calendarEvent;
            } catch (Exception e) {
                if (log.isWarnEnabled())
                    log.warn("Sending invitation failed!", e);
            }
        }
        if (uiForm.isAddNew_) {
            if (uiForm.calType_.equals(CalendarUtils.PRIVATE_TYPE)) {
                calService.saveUserEvent(username, calendarId, calendarEvent, uiForm.isAddNew_);
            } else if (uiForm.calType_.equals(CalendarUtils.SHARED_TYPE)) {
                calService.saveEventToSharedCalendar(username, calendarId, calendarEvent, uiForm.isAddNew_);
            } else if (uiForm.calType_.equals(CalendarUtils.PUBLIC_TYPE)) {
                calService.savePublicEvent(calendarId, calendarEvent, uiForm.isAddNew_);
            }
        } else {
            String fromCal = uiForm.oldCalendarId_.split(CalendarUtils.COLON)[1].trim();
            String toCal = uiForm.newCalendarId_.split(CalendarUtils.COLON)[1].trim();
            String fromType = uiForm.oldCalendarId_.split(CalendarUtils.COLON)[0].trim();
            String toType = uiForm.newCalendarId_.split(CalendarUtils.COLON)[0].trim();
            List<CalendarEvent> listEvent = new ArrayList<CalendarEvent>();
            listEvent.add(calendarEvent);

            // if the event (before change) is a virtual occurrence
            if (!uiForm.calendarEvent_.getRepeatType().equals(CalendarEvent.RP_NOREPEAT)
                    && !CalendarUtils.isEmpty(uiForm.calendarEvent_.getRecurrenceId())) {
                if (!updateSeries) {
                    calService.updateOccurrenceEvent(fromCal, toCal, fromType, toType, listEvent, username);
                } else {
                    // update series:

                    if (CalendarUtils.isSameDate(oldCalendarEvent.getFromDateTime(),
                            calendarEvent.getFromDateTime())) {
                        calService.updateRecurrenceSeries(fromCal, toCal, fromType, toType, calendarEvent,
                                username);
                    } else {
                        //calService.updateRecurrenceSeries(fromCal, toCal, fromType, toType, calendarEvent, username);
                        calService.updateOccurrenceEvent(fromCal, toCal, fromType, toType, listEvent, username);
                    }
                }
            } else {
                if (org.exoplatform.calendar.service.Utils.isExceptionOccurrence(calendarEvent_))
                    calService.updateOccurrenceEvent(fromCal, toCal, fromType, toType, listEvent, username);
                else
                    calService.moveEvent(fromCal, toCal, fromType, toType, listEvent, username);
            }
            UITaskForm.updateListView(calendarView, calendarEvent, calService, username);
        }

        if (calendarView instanceof UIListContainer) {
            UIListContainer uiListContainer = (UIListContainer) calendarView;
            if (!uiListContainer.isDisplaySearchResult()) {
                uiViewContainer.refresh();
            }
        } else {
            uiViewContainer.refresh();
        }
        calendarView.setLastUpdatedEventId(eventId);
        event.getRequestContext().addUIComponentToUpdateByAjax(uiViewContainer);
        UIMiniCalendar uiMiniCalendar = calendarPortlet.findFirstComponentOfType(UIMiniCalendar.class);
        event.getRequestContext().addUIComponentToUpdateByAjax(uiMiniCalendar);
        uiPopupAction.deActivate();
        event.getRequestContext().addUIComponentToUpdateByAjax(uiPopupAction);
    } catch (Exception e) {
        event.getRequestContext().getUIApplication()
                .addMessage(new ApplicationMessage("UIEventForm.msg.add-event-error", null));
        if (log.isDebugEnabled()) {
            log.debug("Fail to add the event", e);
        }
    }

    UIEventDetailTab uiDetailTab = uiForm.getChildById(TAB_EVENTDETAIL);
    for (Attachment att : uiDetailTab.getAttachments()) {
        UIAttachFileForm.removeUploadTemp(uiForm.getApplicationComponent(UploadService.class),
                att.getResourceId());
    }
}

From source file:org.exoplatform.social.addons.storage.RDBMSActivityStorageImpl.java

/**
 * Processes Mentioners who has been mentioned via the Activity.
 * /*from ww  w  .j a  v  a 2s . co m*/
 * @param title
 */
private String[] processMentions(String title) {
    if (title == null || title.length() == 0) {
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }

    Set<String> mentions = new HashSet<>();
    Matcher matcher = MENTION_PATTERN.matcher(title);
    while (matcher.find()) {
        String remoteId = matcher.group().substring(1);
        if (!USER_NAME_VALIDATOR_REGEX.matcher(remoteId).matches()) {
            continue;
        }
        Identity identity = identityStorage.findIdentity(OrganizationIdentityProvider.NAME, remoteId);
        // if not the right mention then ignore
        if (identity != null && !mentions.contains(identity.getId())) {
            mentions.add(identity.getId());
        }
    }
    return mentions.toArray(new String[mentions.size()]);
}

From source file:org.exoplatform.social.core.activity.model.ExoSocialActivityImpl.java

/**
 * {@inheritDoc}/*from   w  w w.ja va  2  s .com*/
 *
 * @return array of identity ids
 */
public final String[] getLikeIdentityIds() {
    if (likeIdentityIds != null) {
        return Arrays.copyOf(likeIdentityIds, likeIdentityIds.length);
    }
    return ArrayUtils.EMPTY_STRING_ARRAY;
}

From source file:org.exoplatform.social.core.activity.model.ExoSocialActivityImpl.java

/**
 * {@inheritDoc}//from   w  ww . j a v  a2s .c  o  m
 *
 * @return array of identity ids
 */
public final String[] getMentionedIds() {
    if (mentionedIds != null) {
        return Arrays.copyOf(mentionedIds, mentionedIds.length);
    }
    return ArrayUtils.EMPTY_STRING_ARRAY;
}

From source file:org.exoplatform.social.core.activity.model.ExoSocialActivityImpl.java

/**
 * {@inheritDoc}//from   w  w  w  .  java 2 s  .  co m
 *
 * @return array of identity ids
 */
public final String[] getCommentedIds() {
    if (commentedIds != null) {
        return Arrays.copyOf(commentedIds, commentedIds.length);
    }
    return ArrayUtils.EMPTY_STRING_ARRAY;
}

From source file:org.exoplatform.social.core.mysql.storage.ActivityMysqlStorageImpl.java

private String[] processMentions(String[] mentionerIds, String title, List<String> addedOrRemovedIds,
        boolean isAdded) {
    if (title == null || title.length() == 0) {
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }//from   w w w.j  a  v  a2  s  . c o  m

    Matcher matcher = MENTION_PATTERN.matcher(title);
    while (matcher.find()) {
        String remoteId = matcher.group().substring(1);
        if (!USER_NAME_VALIDATOR_REGEX.matcher(remoteId).matches()) {
            continue;
        }
        Identity identity = identityStorage.findIdentity(OrganizationIdentityProvider.NAME, remoteId);
        // if not the right mention then ignore
        if (identity != null) {
            String mentionStr = identity.getId() + MENTION_CHAR; // identityId@
            mentionerIds = isAdded ? add(mentionerIds, mentionStr, addedOrRemovedIds)
                    : remove(mentionerIds, mentionStr, addedOrRemovedIds);
        }
    }
    return mentionerIds;
}

From source file:org.exoplatform.social.core.mysql.storage.ActivityMysqlStorageImpl.java

/**
 * Processes Mentioners who has been mentioned via the Activity.
 * //from ww w  .  ja  v a  2s  .  c o  m
 * @param title
 */
private String[] processMentions(String title) {
    String[] mentionerIds = new String[0];
    if (title == null || title.length() == 0) {
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }

    Matcher matcher = MENTION_PATTERN.matcher(title);
    while (matcher.find()) {
        String remoteId = matcher.group().substring(1);
        if (!USER_NAME_VALIDATOR_REGEX.matcher(remoteId).matches()) {
            continue;
        }
        Identity identity = identityStorage.findIdentity(OrganizationIdentityProvider.NAME, remoteId);
        // if not the right mention then ignore
        if (identity != null) {
            mentionerIds = (String[]) ArrayUtils.add(mentionerIds, identity.getId());
        }
    }
    return mentionerIds;
}

From source file:org.exoplatform.social.core.storage.impl.ActivityStorageImpl.java

/**
 * Processes Mentioners who mention via the Activity.
 * /*  w  w  w  . j av  a2s .  c o m*/
 * @param mentionerIds
 * @param title
 * @param isAdded
 * @return list of added IdentityIds who mentioned
 */
private String[] processMentions(String[] mentionerIds, String title, List<String> addedOrRemovedIds,
        boolean isAdded) {
    if (title == null || title.length() == 0) {
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }

    Matcher matcher = MENTION_PATTERN.matcher(title);
    while (matcher.find()) {
        String remoteId = matcher.group().substring(1);
        if (!USER_NAME_VALIDATOR_REGEX.matcher(remoteId).matches()) {
            continue;
        }
        Identity identity = identityStorage.findIdentity(OrganizationIdentityProvider.NAME, remoteId);
        // if not the right mention then ignore
        if (identity != null) {
            String mentionStr = identity.getId() + MENTION_CHAR; // identityId@
            mentionerIds = isAdded ? add(mentionerIds, mentionStr, addedOrRemovedIds)
                    : remove(mentionerIds, mentionStr, addedOrRemovedIds);
        }
    }
    return mentionerIds;
}

From source file:org.exoplatform.social.core.storage.impl.ActivityStorageImpl.java

private String[] getNumberOfViewedOfActivities(Identity owner, ActivityFilterType type) {

    if (type.fromSinceTime() == type.toSinceTime()) {
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }/*  ww  w .jav a  2  s  .  c o m*/

    List<Identity> identities = new ArrayList<Identity>();
    identities.add(owner);

    ActivityBuilderWhere where = ActivityBuilderWhere.viewedRange();

    switch (type) {
    case CONNECTIONS_ACTIVITIES:
        identities.addAll(relationshipStorage.getConnections(owner));
        break;
    case USER_ACTIVITIES:
        where.mentioner(owner);
        //identities.addAll(relationshipStorage.getConnections(owner));
        break;
    case USER_SPACE_ACTIVITIES:
        identities.addAll(getSpacesId(owner));
        break;
    case SPACE_ACTIVITIES:
        break;
    }

    //
    JCRFilterLiteral jcrfilter = ActivityFilter.ACTIVITY_VIEWED_RANGE_FILTER;
    jcrfilter.with(ActivityFilter.ACTIVITY_FROM_UPDATED_POINT_FIELD)
            .value(TimestampType.NEWER.from(type.oldFromSinceTime()));
    jcrfilter.with(ActivityFilter.ACTIVITY_TO_UPDATED_POINT_FIELD)
            .value(TimestampType.OLDER.from(type.toSinceTime()));

    //
    QueryResult<ActivityEntity> result = getActivitiesOfIdentitiesQuery(where.owners(identities), jcrfilter)
            .objects();
    String[] excludedActivities = new String[0];

    //
    while (result.hasNext()) {
        excludedActivities = (String[]) ArrayUtils.add(excludedActivities, result.next().getId());
    }

    return excludedActivities;
}

From source file:org.exoplatform.social.core.storage.memory.InMemoryActivityStorageImpl.java

/**
 * Using to create new comment //from w w  w  .j  av a  2 s  .  co  m
 * @param activity
 * @param comment
 * @throws ActivityStorageException
 */
public void createComment(ExoSocialActivity activity, ExoSocialActivity comment)
        throws ActivityStorageException {
    try {

        //
        long currentMillis = System.currentTimeMillis();
        long commentMillis = (comment.getPostedTime() != null ? comment.getPostedTime() : currentMillis);
        ActivityEntity activityEntity = _findById(ActivityEntity.class, activity.getId());
        ActivityEntity commentEntity = activityEntity.createComment(String.valueOf(commentMillis));

        //
        List<String> mentioners = new ArrayList<String>();
        activity.setMentionedIds(
                processMentions(activity.getMentionedIds(), comment.getTitle(), mentioners, true));

        //
        List<String> commenters = new ArrayList<String>();
        activity.setCommentedIds(
                processCommenters(activity.getCommentedIds(), comment.getUserId(), commenters, true));

        //
        activityEntity.getComments().add(commentEntity);
        activityEntity.setMentioners(activity.getMentionedIds());
        activityEntity.setCommenters(activity.getCommentedIds());
        comment.setParentId(activity.getId());
        comment.setId(commentEntity.getId());
        comment.setPosterId(comment.getUserId());
        comment.isComment(true);

        //
        HidableEntity hidable = _getMixin(commentEntity, HidableEntity.class, true);
        hidable.setHidden(comment.isHidden());
        commentEntity.setTitle(comment.getTitle());
        commentEntity.setType(comment.getType());
        commentEntity.setTitleId(comment.getTitleId());
        commentEntity.setBody(comment.getBody());
        commentEntity.setIdentity(activityEntity.getIdentity());
        commentEntity.setPosterIdentity(_findById(IdentityEntity.class, comment.getUserId()));
        commentEntity.setComment(Boolean.TRUE);
        commentEntity.setPostedTime(commentMillis);
        commentEntity.setLastUpdated(commentMillis);

        commentEntity.setMentioners(processMentions(ArrayUtils.EMPTY_STRING_ARRAY, comment.getTitle(),
                new ArrayList<String>(), true));

        //
        String[] ids = activity.getReplyToId();
        List<String> listIds;
        if (ids != null) {
            listIds = new ArrayList<String>(Arrays.asList(ids));
        } else {
            listIds = new ArrayList<String>();
        }
        listIds.add(commentEntity.getId());
        activity.setReplyToId(listIds.toArray(new String[] {}));
        //
        activity.setUpdated(currentMillis);
        getSession().save();
        processActivity(comment);
    } catch (NodeNotFoundException e) {
        throw new ActivityStorageException(ActivityStorageException.Type.FAILED_TO_SAVE_COMMENT, e.getMessage(),
                e);
    } catch (ChromatticException ex) {
        Throwable throwable = ex.getCause();
        if (throwable instanceof ItemExistsException || throwable instanceof InvalidItemStateException) {
            LOG.warn("Probably was inserted activity by another session");
            LOG.debug(ex.getMessage(), ex);
        } else {
            throw new ActivityStorageException(ActivityStorageException.Type.FAILED_TO_SAVE_ACTIVITY,
                    ex.getMessage());
        }
    }
    //
    LOG.debug(String.format("Comment %s by %s (%s) created: comment size is == %s ", comment.getTitle(),
            comment.getUserId(), comment.getId(), activity.getCommentedIds().length));
}