Example usage for org.apache.commons.lang3 StringUtils abbreviate

List of usage examples for org.apache.commons.lang3 StringUtils abbreviate

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils abbreviate.

Prototype

public static String abbreviate(final String str, final int maxWidth) 

Source Link

Document

Abbreviates a String using ellipses.

Usage

From source file:com.vilt.minium.impl.BaseWebElementsImpl.java

public Object invoke(Method method, Object... args) {
    if (method.isVarArgs()) {
        args = expandVarArgs(args);//from   w ww.  j a v  a 2 s  .  com
    }
    String expression = computeExpression(this, isAsyncMethod(method), method.getName(), args);

    if (method.getReturnType() != Object.class && method.getReturnType().isAssignableFrom(this.getClass())) {
        T webElements = WebElementsFactoryHelper.createExpressionWebElements(factory, myself, expression);
        return webElements;
    } else {
        Object result = null;

        boolean async = isAsyncMethod(method);

        Iterable<WebElementsDriver<T>> webDrivers = candidateWebDrivers();

        if (method.getReturnType() == Void.TYPE) {
            for (WebElementsDriver<T> wd : webDrivers) {
                factory.getInvoker().invokeExpression(wd, async, expression);
            }
        } else {
            if (Iterables.size(webDrivers) == 0) {
                throw new WebElementsException("The expression has no frame or window to be evaluated to");
            } else if (Iterables.size(webDrivers) == 1) {
                WebElementsDriver<T> wd = Iterables.get(webDrivers, 0);
                result = factory.getInvoker().invokeExpression(wd, async, expression);
            } else {
                String sizeExpression = computeExpression(this, false, "size");
                WebElementsDriver<T> webDriverWithResults = null;

                for (WebElementsDriver<T> wd : webDrivers) {
                    long size = (Long) factory.getInvoker().invokeExpression(wd, async, sizeExpression);
                    if (size > 0) {
                        if (webDriverWithResults == null) {
                            webDriverWithResults = wd;
                        } else {
                            throw new WebElementsException(
                                    "Several frames or windows match the same expression, so value cannot be computed");
                        }
                    }
                }

                if (webDriverWithResults != null) {
                    result = factory.getInvoker().invokeExpression(webDriverWithResults, async, expression);
                }
            }
        }

        if (logger.isDebugEnabled()) {
            String val;
            if (method.getReturnType() == Void.TYPE) {
                val = "void";
            } else {
                val = StringUtils.abbreviate(argToStringFunction.apply(result), 40);
                if (val.startsWith("'") && !val.endsWith("'"))
                    val += "(...)'";
            }
            logger.debug("[Value: {}] {}", argToStringFunction.apply(result), expression);
        }

        // let's handle numbers when return type is int
        if (method.getReturnType() == Integer.TYPE) {
            return result == null ? 0 : ((Number) result).intValue();
        } else {
            return result;
        }
    }
}

From source file:net.longfalcon.newsj.service.MovieService.java

private MovieInfo fetchDataFromTmdb(int imdbId) {
    MovieInfo movieInfo;/*from   w w w .  ja  v a2 s .c o m*/
    _log.info("querying TMDB for imdbId " + imdbId);
    TmdbFindResults tmdbFindResults = tmdbService.findResultsByImdbId(imdbId);
    List<TmdbMovieResults> movieResults = tmdbFindResults.getMovieResults();
    _log.info("TMDB returned " + movieResults.size() + " results");
    if (movieResults != null && !movieResults.isEmpty()) {
        TmdbMovieResults tmdbMovieResults = movieResults.get(0);
        movieInfo = new MovieInfo();
        movieInfo.setImdbId(imdbId);
        movieInfo.setTmdbId(tmdbMovieResults.getId());
        movieInfo.setTitle(tmdbMovieResults.getTitle());
        movieInfo.setPlot(StringUtils.abbreviate(tmdbMovieResults.getOverview(), 250));
        movieInfo.setCreateDate(new Date());
        movieInfo.setUpdateDate(new Date());
        Date releaseDate = tmdbMovieResults.getReleaseDate();
        if (releaseDate != null) {
            int year = new DateTime(releaseDate).getYear();
            movieInfo.setYear(String.valueOf(year));
        }
        int rating = tmdbMovieResults.getVoteAverage().intValue();
        movieInfo.setRating(String.valueOf(rating));
        movieInfo.setLanguage(tmdbMovieResults.getOriginalLanguage());
        movieInfo.setTagline("");
        movieInfo.setBackdrop(false);
        movieInfo.setCover(false);
        movieInfo.setActors("");
        movieInfo.setDirector("");
        movieInfo.setGenre("");

        return movieInfo;
    }

    return null;
}

From source file:cc.arduino.plugins.wifi101.flashers.Flasher.java

public String toString() {
    String names = modulename + " (" + version + ") (";
    for (String lname : compatibleBoard) {
        names = names.concat(lname).concat(", ");
    }//from   ww  w  . java 2 s .  c o m
    names = names.substring(0, (names.length() - 2)).concat(")");
    names = StringUtils.abbreviate(names, 75);
    return names;
}

From source file:edu.kit.dama.ui.repo.components.EntryRenderPanel.java

/**
 * Build the main layout of the representation of one digital object.
 *
 * @param pContext The authorization context used to decide whether special
 * administrative features are available or not.
 *//* w ww.j  a va2s.  c  om*/
private void buildMainLayout(IAuthorizationContext pContext) {
    //check if the object could be obtained or not, e.g. due to missing permissions. If not, show an error message.
    if (ERROR_PLACEHOLDER.equals(object.getLabel())) {
        Label warnLabel = new Label("<h3>Failed to obtain entry with identifier '"
                + object.getDigitalObjectIdentifier() + "' from database.</h3>", ContentMode.HTML);
        final Button cleanup = new Button("Cleanup");
        cleanup.setDescription("Click to remove object from search index.");
        cleanup.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {
                cleanup.setEnabled(false);
                new Notification("Information", "Cleanup not implemented, yet.",
                        Notification.Type.TRAY_NOTIFICATION).show(Page.getCurrent());
            }
        });
        if (pContext.getRoleRestriction().atLeast(Role.ADMINISTRATOR)) {
            //show cleanup button
            mainLayout = new HorizontalLayout(warnLabel, cleanup);
        } else {
            //no cleanup available
            mainLayout = new HorizontalLayout(warnLabel);
        }
        mainLayout.setSizeFull();
        return;
    }

    //initialize image field
    typeImage = new Image();
    typeImage.setSizeFull();
    setImage(object);

    //initialize title label/field
    titleField = UIUtils7.factoryTextField(null, "dc:title");
    titleField.addStyleName("basic_title");
    titleLabel = new Label("dc:title");
    titleLabel.setWidth("100%");
    titleLabel.addStyleName("basic_title");

    //initialize creator label
    if (object.getUploader() != null) {
        creatorLabel = new Label(StringUtils.abbreviate(object.getUploader().getFullname(), 100));
        creatorLabel.setEnabled(true);
    } else {
        creatorLabel = new Label("dc:creator");
        creatorLabel.setEnabled(false);
    }
    creatorLabel.setWidth("100%");
    creatorLabel.addStyleName("basic_left");

    //initialize creation label
    if (object.getStartDate() != null) {
        creationLabel = new Label(new SimpleDateFormat().format(object.getStartDate()));
        creationLabel.setEnabled(true);
    } else {
        creationLabel = new Label("dc:date");
        creationLabel.setEnabled(false);
    }

    creationLabel.setWidth("100%");

    //initialize identifier label
    objectIdLabel = new Label(StringUtils.abbreviate(object.getDigitalObjectIdentifier(), 100));
    objectIdLabel.setWidth("100%");
    //initialize description label/area
    descriptionLabel = new Label("dc:description");
    descriptionArea = UIUtils7.factoryTextArea(null, "dc:description");
    descriptionArea.setHeight("50px");
    descriptionLabel.setHeight("50px");
    descriptionLabel.setWidth("100%");

    //action buttons
    downloadButton = new NativeButton("Download");
    downloadButton.setIcon(new ThemeResource("img/32x32/download.png"));
    downloadButton.setStyleName(BaseTheme.BUTTON_LINK);
    downloadButton.setDescription("Download the data of this digital object.");
    downloadButton.setWidth("100%");

    shareButton = new NativeButton("Share");
    shareButton.setIcon(new ThemeResource("img/16x16/share.png"));
    shareButton.setStyleName(BaseTheme.BUTTON_LINK);
    shareButton.setDescription("Share this digital object.");
    Role eligibleRole = Role.GUEST;
    if (parent.getParentUI().isUserLoggedIn()) {
        //obtain role only if a user is logged in and we are not in ingest mode.
        //Otherwise, the dummy context of MyVaadinUI would be used and will cause unwanted access.
        try {
            //Determine eligible role of currently logged in user
            eligibleRole = ResourceServiceLocal.getSingleton().getGrantRole(object.getSecurableResourceId(),
                    parent.getParentUI().getAuthorizationContext().getUserId(),
                    AuthorizationContext.factorySystemContext());
        } catch (EntityNotFoundException | UnauthorizedAccessAttemptException ex) {
            LOGGER.warn("Failed to determine eligable role for context "
                    + parent.getParentUI().getAuthorizationContext() + ". Continue with GUEST permissions.",
                    ex);
        }
    }

    //Update share button depending on role. Only possessing the role MANAGER (being the owner) entitles to share an object. 
    if (eligibleRole.atLeast(Role.MANAGER)) {
        shareButton.setEnabled(true);
        shareButton.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {
                if (parent != null) {
                    parent.showSharingPopup(object);
                }
            }
        });
    } else {
        shareButton.setEnabled(false);
        shareButton.setDescription("Only the object owner is allowed to change sharing information.");
    }

    editButton = new NativeButton("Edit Metadata");
    editButton.setIcon(new ThemeResource("img/16x16/edit.png"));
    editButton.setStyleName(BaseTheme.BUTTON_LINK);
    editButton.setDescription("Edit this digital object's metadata.");

    //Update edit button depending on role. If the object is shared with or owned by the logged in user, editing will be allowed.
    if (eligibleRole.atLeast(Role.MEMBER)) {
        editButton.setEnabled(true);
        editButton.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {
                switchEditMode();
            }
        });
    } else {
        editButton.setEnabled(false);
        editButton.setDescription(
                "Only the object owner and users the object is shared with are allowed to change metadata information.");
    }

    starButton = new NativeButton("Favorite");
    starButton.setImmediate(true);
    starButton.setIcon(new ThemeResource("img/16x16/unstarred.png"));
    starButton.setStyleName(BaseTheme.BUTTON_LINK);
    starButton.setDescription("Add/remove digital object to/from favorites.");

    //Update star button depending on role. If the object is shared with or owned by the logged in user, "star'ing" will be allowed.
    if (eligibleRole.atLeast(Role.MEMBER)) {
        starButton.setEnabled(true);
        starButton.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {
                IMetaDataManager mdm = MetaDataManagement.getMetaDataManagement().getMetaDataManager();
                mdm.setAuthorizationContext(AuthorizationContext.factorySystemContext());

                try {
                    DigitalObjectType favoriteType = mdm
                            .findSingleResult("SELECT t FROM DigitalObjectType t WHERE t.identifier='"
                                    + MyVaadinUI.FAVORITE_TYPE_IDENTIFIER + "' AND t.typeDomain='"
                                    + MyVaadinUI.FAVORITE_TYPE_DOMAIN + "'", DigitalObjectType.class);
                    if (DigitalObjectTypeHelper.isTypeAssignedToObject(object, favoriteType,
                            AuthorizationContext.factorySystemContext())) {
                        //remove favorite status
                        DigitalObjectTypeHelper.removeTypeFromObject(object, favoriteType,
                                AuthorizationContext.factorySystemContext());
                        starButton.setIcon(new ThemeResource("img/16x16/unstarred.png"));
                        new Notification("Information",
                                "Successfully removed favorite tag from object "
                                        + object.getDigitalObjectIdentifier() + ".",
                                Notification.Type.TRAY_NOTIFICATION).show(Page.getCurrent());
                    } else {
                        //assign favorite status
                        DigitalObjectTypeHelper.assignTypeToObject(object, favoriteType,
                                AuthorizationContext.factorySystemContext());
                        starButton.setIcon(new ThemeResource("img/16x16/starred.png"));
                        new Notification("Information",
                                "Successfully added favorite tag to object "
                                        + object.getDigitalObjectIdentifier() + ".",
                                Notification.Type.TRAY_NOTIFICATION).show(Page.getCurrent());
                    }
                } catch (Exception e) {
                    LOGGER.error("Failed to change 'favorite' status of digital object.", e);
                    new Notification("Warning", "Failed to update favorite status.",
                            Notification.Type.WARNING_MESSAGE).show(Page.getCurrent());
                }
            }
        });
    } else {
        starButton.setEnabled(false);
        starButton.setDescription(
                "Only the object owner and users the object is shared with are allowed to change the favorite state.");
    }

    dcLayout = new UIUtils7.GridLayoutBuilder(3, 5).addComponent(titleLabel, 0, 0, 2, 1)
            .addComponent(creationLabel, 2, 0, 1, 1).addComponent(creatorLabel, 0, 1, 3, 1)
            .addComponent(objectIdLabel, 0, 2, 3, 1).fill(descriptionLabel, 0, 3).getLayout();
    dcLayout.setSizeFull();

    Button.ClickListener saveCancelButtonListener = new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (saveEditButton.equals(event.getButton())) {
                //do save
                IMetaDataManager mdm = MetaDataManagement.getMetaDataManagement().getMetaDataManager();
                mdm.setAuthorizationContext(AuthorizationContext.factorySystemContext());
                try {
                    String title = titleField.getValue();
                    String description = descriptionArea.getValue();
                    Investigation investigation = object.getInvestigation();
                    boolean wasError = false;
                    if (description != null && description.length() <= 1024 && investigation != null) {
                        if (!description.equals(investigation.getDescription())) {
                            investigation.setDescription(description);
                            //store investigation
                            mdm.save(investigation);
                        }
                    } else {
                        LOGGER.warn(
                                "Failed to commit updated description '{}'. Either length is exceeded or investigation '{}' is null.",
                                description, investigation);
                        wasError = true;
                    }
                    //store object
                    if (title != null && title.length() >= 3 && title.length() <= 255) {
                        if (!title.equals(object.getLabel())) {
                            //store object
                            object.setLabel(title);
                            object = mdm.save(object);
                        }
                    } else {
                        LOGGER.warn("Failed to commit updated title '{}'. Length is invalid (3<=l<=255).",
                                title);
                        wasError = true;
                    }
                    if (wasError) {
                        new Notification("Warning",
                                "Failed to update title and/or description. See logfile for details.",
                                Notification.Type.WARNING_MESSAGE).show(Page.getCurrent());
                    }

                    //As there is not automatic sync between database and search index the entry has to be reindexed at this point in order
                    //to keep both systems consistent. However, changes taking place in between are lost.
                    LOGGER.debug("Object committed to database. Updating index.");
                    ElasticsearchHelper.indexEntry(object);
                } catch (UnauthorizedAccessAttemptException ex) {
                    LOGGER.error("Failed to commit changes.", ex);
                    new Notification("Warning", "Failed to commit changes. See logfile for details.",
                            Notification.Type.WARNING_MESSAGE).show(Page.getCurrent());

                } finally {
                    mdm.close();
                }
            }
            //do cancel/reload and switch back to read-mode
            reset();
            switchEditMode();
        }
    };

    //save/cancel buttons
    saveEditButton = new NativeButton("Commit Update");
    saveEditButton.setIcon(new ThemeResource("img/16x16/save.png"));
    saveEditButton.setStyleName(BaseTheme.BUTTON_LINK);
    saveEditButton.setDescription("Save changes to this digital object's metadata.");
    saveEditButton.addClickListener(saveCancelButtonListener);
    cancelEditButton = new NativeButton("Cancel Update");
    cancelEditButton.setIcon(new ThemeResource("img/16x16/cancel.png"));
    cancelEditButton.setStyleName(BaseTheme.BUTTON_LINK);
    cancelEditButton.setDescription("Withdraw all changes to this digital object's metadata.");
    cancelEditButton.addClickListener(saveCancelButtonListener);

    //default action layout
    Label spacerMiscActionLayout = new Label();
    miscActionLayout = new HorizontalLayout(editButton, shareButton, starButton, spacerMiscActionLayout);
    miscActionLayout.setWidth("100%");
    miscActionLayout.setHeight("18px");
    miscActionLayout.setSpacing(false);
    miscActionLayout.setMargin(false);
    miscActionLayout.setExpandRatio(spacerMiscActionLayout, .9f);

    //edit action layout
    Label spacerEditActionLayout = new Label();
    editActionLayout = new HorizontalLayout(saveEditButton, cancelEditButton, spacerEditActionLayout);
    editActionLayout.setWidth("100%");
    editActionLayout.setHeight("18px");
    editActionLayout.setSpacing(false);
    editActionLayout.setMargin(false);
    editActionLayout.setExpandRatio(spacerEditActionLayout, .9f);

    //divider generation
    Label dividerTop = new Label();
    dividerTop.setHeight("5px");
    dividerTop.addStyleName("horizontal-line");
    dividerTop.setWidth("90%");
    Label dividerBottom = new Label();
    dividerBottom.setHeight("5px");
    dividerBottom.addStyleName("horizontal-line");
    dividerBottom.setWidth("90%");
    Label dividerLeft = new Label();
    dividerLeft.addStyleName("vertical-line");
    dividerLeft.setWidth("5px");
    dividerLeft.setHeight("90%");
    Label dividerRight = new Label();
    dividerRight.addStyleName("vertical-line");
    dividerRight.setWidth("5px");
    dividerRight.setHeight("90%");

    //build content layout
    HorizontalLayout contentLayout = new HorizontalLayout(typeImage, dividerLeft, dcLayout, dividerRight,
            downloadButton);
    contentLayout.setSizeFull();
    contentLayout.setSpacing(true);
    contentLayout.setComponentAlignment(typeImage, Alignment.TOP_RIGHT);
    contentLayout.setComponentAlignment(dividerLeft, Alignment.MIDDLE_CENTER);
    contentLayout.setComponentAlignment(dcLayout, Alignment.MIDDLE_CENTER);
    contentLayout.setComponentAlignment(dividerRight, Alignment.MIDDLE_CENTER);
    contentLayout.setComponentAlignment(downloadButton, Alignment.BOTTOM_CENTER);
    contentLayout.setExpandRatio(typeImage, .1f);
    contentLayout.setExpandRatio(dcLayout, .8f);
    contentLayout.setExpandRatio(downloadButton, .1f);

    //build main layout
    mainLayout = new VerticalLayout(dividerTop, contentLayout, dividerBottom, miscActionLayout);
    mainLayout.setExpandRatio(dividerTop, .05f);
    mainLayout.setComponentAlignment(dividerTop, Alignment.TOP_LEFT);
    mainLayout.setExpandRatio(contentLayout, .80f);
    mainLayout.setExpandRatio(dividerBottom, .05f);
    mainLayout.setComponentAlignment(dividerBottom, Alignment.BOTTOM_RIGHT);
    mainLayout.setExpandRatio(miscActionLayout, .1f);
    mainLayout.setSpacing(true);
    mainLayout.setMargin(true);
    mainLayout.addStyleName("basic");
    mainLayout.setWidth("100%");
    mainLayout.setHeight("185px");
    //do reset to load title and description
    reset();
    LOGGER.debug("Layout successfully build up.");
}

From source file:com.raise.orgs.impl.persistence.entity.AttributeInstanceEntity.java

@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("VariableInstanceEntity[");
    sb.append("id=").append(id);
    sb.append(", name=").append(name);
    sb.append(", type=").append(type != null ? type.getTypeName() : "null");
    if (longValue != null) {
        sb.append(", longValue=").append(longValue);
    }//from  ww  w .  ja va2 s. c o  m
    if (doubleValue != null) {
        sb.append(", doubleValue=").append(doubleValue);
    }
    if (textValue != null) {
        sb.append(", textValue=").append(StringUtils.abbreviate(textValue, 40));
    }
    if (textValue2 != null) {
        sb.append(", textValue2=").append(StringUtils.abbreviate(textValue2, 40));
    }
    if (byteArrayRef.getId() != null) {
        sb.append(", byteArrayValueId=").append(byteArrayRef.getId());
    }
    sb.append("]");
    return sb.toString();
}

From source file:de.fau.cs.osr.hddiff.perfsuite.EditScriptAnalysis.java

private Object printNodeStatsByOp(GenericEditOp needle) {
    HashSet<String> tmp = new HashSet<>(editsByLabel.keySet());
    tmp.remove(null);//  w  w w  .  j a v a 2s .  co  m
    LinkedList<String> keys = new LinkedList<>(tmp);
    Collections.sort(keys);
    keys.add(null);
    StringBuilder b = new StringBuilder();
    b.append(String.format("    %s by label:\n", needle));
    boolean empty = true;
    for (String key : keys) {
        int count = 0;
        List<Edit> ops = editsByLabel.get(key);
        if (ops != null)
            for (Edit op : ops) {
                if (op.op == needle)
                    ++count;
            }
        if (count > 0) {
            empty = false;
            if (key == null)
                key = "#text";
            String paddedKey = StringUtils.rightPad(StringUtils.abbreviate(key, 16) + ":", 17);
            b.append(String.format("      %s %4d\n", paddedKey, count));
        }
    }
    return empty ? "" : b.toString();
}

From source file:edu.kit.dama.staging.entities.download.DownloadInformation.java

@Override
public void setErrorMessage(String pErrorMessage) {
    this.errorMessage = StringUtils.abbreviate(pErrorMessage, 255);
}

From source file:com.l2jfree.gameserver.communitybbs.Manager.MailBBSManager.java

private String abbreviate(String s, int maxWidth) {
    return StringUtils.abbreviate(s, maxWidth);
}

From source file:controllers.IssueApp.java

@With(NullProjectCheckAction.class)
public static Result issue(String ownerName, String projectName, Long number) {
    Project project = Project.findByOwnerAndProjectName(ownerName, projectName);

    Issue issueInfo = Issue.findByNumber(project, number);

    response().setHeader("Vary", "Accept");

    if (issueInfo == null) {
        if (HttpUtil.isJSONPreferred(request())) {
            ObjectNode result = Json.newObject();
            result.put("title", number);
            result.put("body", Messages.get("error.notfound.issue_post"));
            return ok(result);
        } else {/*w ww  .j  av  a 2  s.c  o m*/
            return notFound(
                    ErrorViews.NotFound.render("error.notfound", project, ResourceType.ISSUE_POST.resource()));
        }
    }

    if (!AccessControl.isAllowed(UserApp.currentUser(), issueInfo.asResource(), Operation.READ)) {
        return forbidden(ErrorViews.Forbidden.render("error.forbidden", project));
    }

    for (IssueLabel label : issueInfo.labels) {
        label.refresh();
    }

    Form<Comment> commentForm = new Form<>(Comment.class);
    Form<Issue> editForm = new Form<>(Issue.class).fill(Issue.findByNumber(project, number));
    UserApp.currentUser().visits(project);
    // Determine response type with Accept header
    if (HttpUtil.isJSONPreferred(request())) {
        ObjectNode result = Json.newObject();
        result.put("id", issueInfo.getNumber());
        result.put("title", issueInfo.title);
        result.put("state", issueInfo.state.toString());
        result.put("body", StringUtils.abbreviate(issueInfo.body, 1000));
        result.put("createdDate", issueInfo.createdDate.toString());
        result.put("link",
                routes.IssueApp.issue(project.owner, project.name, issueInfo.getNumber()).toString());
        return ok(result);
    } else {
        return ok(view.render("title.issueDetail", issueInfo, editForm, commentForm, project));
    }
}

From source file:gov.nih.nci.caintegrator.web.action.study.management.EditAuthorizedGroupAction.java

private Query createQuery(Long descriptorId, List<String> values) {
    AnnotationFieldDescriptor descriptor = new AnnotationFieldDescriptor();
    descriptor.setId(descriptorId);//from w w w  .  j av  a 2s .  co  m
    descriptor = getStudyManagementService().getRefreshedEntity(descriptor);

    Query query = new Query();
    // query name is 100 chars in the DB, so make sure the generated name isn't too long by abbreviated
    query.setName("Authorized Query created for "
            + StringUtils.abbreviate(descriptor.getDisplayName(), MAX_QUERY_NAME_LENGTH));
    query.setLastModifiedDate(new Date());
    query.setCompoundCriterion(new CompoundCriterion());
    query.getCompoundCriterion().setBooleanOperator(BooleanOperatorEnum.OR);

    AnnotationTypeEnum descriptorType = descriptor.getDefinition().getDataType();

    for (String value : values) {
        if (descriptorType == AnnotationTypeEnum.NUMERIC) {
            query.getCompoundCriterion().getCriterionCollection()
                    .add(QueryUtil.createNumericComparisonCriterion(descriptor, value));
        } else if (descriptorType == AnnotationTypeEnum.DATE) {
            query.getCompoundCriterion().getCriterionCollection()
                    .add(QueryUtil.createDateComparisonCriterion(descriptor, value));
        } else {
            query.getCompoundCriterion().getCriterionCollection()
                    .add(QueryUtil.createStringComparisonCriterion(descriptor, value));
        }
    }
    return query;
}