https://issues.apache.org/jira/browse/LUCENE-1343?focusedCommentId=12858907&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12858907).
558137
public static String stripAccents(final String str) {
        if (N.isNullOrEmpty(str)) {
            return str;
        }

        final String decomposed = Normalizer.normalize(str, Normalizer.Form.NFD);
        // Note that this doesn't correctly remove ligatures...
        return pattern_accent.matcher(decomposed).replaceAll("");//$NON-NLS-1$
    }
118208
public boolean isPanelsComment(QueryQuestionComment comment, Panel panel) {
    Panel queryPanel = resourceController.getResourcePanel(comment.getQueryPage().getQuerySection().getQuery());
    if (queryPanel == null || panel == null) {
      return false;
    }
    
    return queryPanel.getId().equals(panel.getId());
  }
289142
private void ensureIndex(DS session, EntityTypeMetadata<NodeMetadata<L>> entityTypeMetadata,
            IndexedPropertyMethodMetadata<IndexedPropertyMetadata> indexedProperty) {
        if (indexedProperty != null) {
            IndexedPropertyMetadata datastoreMetadata = indexedProperty.getDatastoreMetadata();
            if (datastoreMetadata.isCreate()) {
                L label = entityTypeMetadata.getDatastoreMetadata().getDiscriminator();
                PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata = indexedProperty.getPropertyMethodMetadata();
                if (label != null && propertyMethodMetadata != null) {
                    ensureIndex(session, label, propertyMethodMetadata, datastoreMetadata.isUnique());
                }
            }
        }
    }
1053748
@Override
	public Response issue(String CorpNum, int ItemCode, String MgtKey,
			String Memo) throws PopbillException {
		return issue(CorpNum, ItemCode, MgtKey, Memo, null, null); 
	}
1059062
private void defineTabbedPanes(UIDefaults d) {
        
        // copied from nimbus
        
        d.put("TabbedPane.contentMargins", new InsetsUIResource(0, 0, 0, 0));
        d.put("TabbedPane.tabAreaStatesMatchSelectedTab", Boolean.TRUE);
        d.put("TabbedPane.nudgeSelectedLabel", Boolean.FALSE);
        d.put("TabbedPane.tabRunOverlay", new Integer(2));
        d.put("TabbedPane.tabOverlap", new Integer(-1));
        d.put("TabbedPane.extendTabsToBase", Boolean.TRUE);
        d.put("TabbedPane.useBasicArrows", Boolean.TRUE);
        addColor(d, "TabbedPane.shadow", "seaGlassDisabledText", 0.0f, 0.0f, 0.0f, 0);
        addColor(d, "TabbedPane.darkShadow", "text", 0.0f, 0.0f, 0.0f, 0);
        addColor(d, "TabbedPane.highlight", "seaGlassLightBackground", 0.0f, 0.0f, 0.0f, 0);
        d.put("TabbedPane:TabbedPaneTab.contentMargins", new InsetsUIResource(2, 8, 3, 8));
        addColor(d, "TabbedPane:TabbedPaneTab[Disabled].textForeground", "seaGlassDisabledText", 0.0f, 0.0f, 0.0f, 0);
        addColor(d, "TabbedPane:TabbedPaneTab[Pressed+Selected].textForeground", 255, 255, 255, 255);
        addColor(d, "TabbedPane:TabbedPaneTab[Focused+Pressed+Selected].textForeground", 255, 255, 255, 255);
        d.put("TabbedPane:TabbedPaneTabArea.contentMargins", new InsetsUIResource(3, 10, 4, 10));
        d.put("TabbedPane:TabbedPaneContent.contentMargins", new InsetsUIResource(0, 0, 0, 0));
        
        // Below starts seaglass
        d.put("tabbedPaneTabAreaBackLineEnabled", new Color(0x647595));
        d.put("tabbedPaneTabAreaLightShadow", new Color(0x55eeeeee, true));
        d.put("tabbedPaneTabAreaDarkShadow", new Color(0x55aaaaaa, true));

        d.put("seaGlassTabbedPaneTabCloseGraphicInnerShadowBase", new Color(0x2a509b));
        d.put("seaGlassTabbedPaneTabCloseGraphicBase", Color.WHITE);
        d.put("seaGlassTabbedPaneTabCloseGraphicDropShadowBase", Color.BLACK);
        d.put("seaGlassTabbedPaneTabCloseBorderBase", new Color(0x20448e));

        String p = "TabbedPane";

        d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
        d.put(p + ".tabRunOverlay", new Integer(0));
        d.put(p + ".useBasicArrows", Boolean.FALSE);
        d.put(p + ".closeButtonMargins", new Rectangle(2, 2, 2, 2));
        d.put(p + ".closeButtonSize", new Integer(11));

        String c = PAINTER_PREFIX + "TabbedPaneTabPainter";

        p = "TabbedPane:TabbedPaneTab";
        d.put(p + ".States", "Enabled,Pressed,Disabled,MouseOver,Focused,Selected,Default");
        d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TabbedPaneTabPainter.Which.BACKGROUND_ENABLED));
        d.put(p + "[Enabled+Pressed].backgroundPainter", new LazyPainter(c, TabbedPaneTabPainter.Which.BACKGROUND_PRESSED));
        d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TabbedPaneTabPainter.Which.BACKGROUND_DISABLED));
        d.put(p + "[Disabled+Selected].backgroundPainter", new LazyPainter(c, TabbedPaneTabPainter.Which.BACKGROUND_DISABLED_SELECTED));
        d.put(p + "[Selected].backgroundPainter", new LazyPainter(c, TabbedPaneTabPainter.Which.BACKGROUND_SELECTED));
        d.put(p + "[Selected+MouseOver].backgroundPainter", new LazyPainter(c, TabbedPaneTabPainter.Which.BACKGROUND_SELECTED));
        d.put(p + "[Pressed+Selected].backgroundPainter", new LazyPainter(c, TabbedPaneTabPainter.Which.BACKGROUND_PRESSED_SELECTED));
        d.put(p + "[Focused+Selected].backgroundPainter", new LazyPainter(c, TabbedPaneTabPainter.Which.BACKGROUND_SELECTED_FOCUSED));
        d.put(p + "[Focused+Pressed+Selected].backgroundPainter", new LazyPainter(c, TabbedPaneTabPainter.Which.BACKGROUND_PRESSED_SELECTED_FOCUSED));
        d.put(p + "[Disabled].textForeground", d.get("seaGlassDisabledText"));
        d.put(p + "[Pressed+Selected].textForeground", Color.BLACK);
        d.put(p + "[Focused+Pressed+Selected].textForeground", Color.BLACK);

        // Initialize tabbed pane "close" button.
        // Note that we co-opt MouseOver to mean mousing over the tab,
        // whereas Focused means mousing over the actual close button.
        p = "TabbedPane:TabbedPaneTab:TabbedPaneTabClaseButton";
        c = PAINTER_PREFIX + "TabbedPaneTabCloseButtonPainter";
        d.put(p + ".States", "Enabled,Pressed,Disabled,MouseOver,Focused");
        d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
        d.put(p + "[Disabled].foregroundPainter", new LazyPainter(c, TabbedPaneTabCloseButtonPainter.Which.DISABLED));
        d.put(p + "[Enabled].foregroundPainter", new LazyPainter(c, TabbedPaneTabCloseButtonPainter.Which.ENABLED));
        d.put(p + "[MouseOver].foregroundPainter", new LazyPainter(c, TabbedPaneTabCloseButtonPainter.Which.MOUSEOVER));
        d.put(p + "[Focused].foregroundPainter", new LazyPainter(c, TabbedPaneTabCloseButtonPainter.Which.FOCUSED));
        d.put(p + "[Pressed].foregroundPainter", new LazyPainter(c, TabbedPaneTabCloseButtonPainter.Which.PRESSED));

        p = "TabbedPane:TabbedPaneTabArea";
        c = PAINTER_PREFIX + "TabbedPaneTabAreaPainter";
        d.put(p + ".contentMargins", new InsetsUIResource(3, 10, 3, 10));
        d.put(p + ".States", "Enabled,Disabled,Top,Left,Bottom,Right");
        d.put(p + ".Top", new TabbedPaneTopTabState());
        d.put(p + ".Left", new TabbedPaneLeftTabState());
        d.put(p + ".Bottom", new TabbedPaneBottomTabState());
        d.put(p + ".Right", new TabbedPaneRightTabState());
        d.put(p + "[Enabled+Top].backgroundPainter", new LazyPainter(c, TabbedPaneTabAreaPainter.Which.BACKGROUND_ENABLED_TOP));
        d.put(p + "[Disabled+Top].backgroundPainter", new LazyPainter(c, TabbedPaneTabAreaPainter.Which.BACKGROUND_DISABLED_TOP));
        d.put(p + "[Enabled+Left].backgroundPainter", new LazyPainter(c, TabbedPaneTabAreaPainter.Which.BACKGROUND_ENABLED_LEFT));
        d.put(p + "[Disabled+Left].backgroundPainter", new LazyPainter(c, TabbedPaneTabAreaPainter.Which.BACKGROUND_DISABLED_LEFT));
        d.put(p + "[Enabled+Bottom].backgroundPainter", new LazyPainter(c, TabbedPaneTabAreaPainter.Which.BACKGROUND_ENABLED_BOTTOM));
        d.put(p + "[Disabled+Bottom].backgroundPainter", new LazyPainter(c, TabbedPaneTabAreaPainter.Which.BACKGROUND_DISABLED_BOTTOM));
        d.put(p + "[Enabled+Right].backgroundPainter", new LazyPainter(c, TabbedPaneTabAreaPainter.Which.BACKGROUND_ENABLED_RIGHT));
        d.put(p + "[Disabled+Right].backgroundPainter", new LazyPainter(c, TabbedPaneTabAreaPainter.Which.BACKGROUND_DISABLED_RIGHT));

        // Buttons
        c = PAINTER_PREFIX + "ArrowButtonPainter";
        p = "TabbedPane:TabbedPaneTabArea:\"TabbedPaneTabArea.button\"";
        d.put(p + ".States", "Enabled,Pressed,MouseOver,Disabled");
        d.put(p + "[Disabled].foreground", new ColorUIResource(0x9ba8cf));
        d.put(p + "[Enabled].foreground", new ColorUIResource(Color.BLACK));
        d.put(p + "[Pressed].foreground", new ColorUIResource(0x134D8C));
        d.put(p + "[Disabled].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_DISABLED));
        d.put(p + "[Enabled].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_ENABLED));
        d.put(p + "[MouseOver].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_ENABLED));
        d.put(p + "[Pressed].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_PRESSED));

        p = "TabbedPane:TabbedPaneContent";
        d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
    }
370761
int getAbsoluteOffset(int index) throws JMFUninitializedAccessException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "getAbsoluteOffset", new Object[]{Integer.valueOf(index)});

    MessageMap.Remap remap = map.fields[index];

    if (remap == null) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "getAbsoluteOffset", "JMFUninitializedAccessException");
      throw new JMFUninitializedAccessException(schema.getPathName(fields[index]) + " Schema: " + schema.getName());
    }

    int varOffset = remap.offsetIndex;
    varOffset = (varOffset < 0) ? 0 : oTable[varOffset];

    int result = dataOffset + varOffset + remap.fixedIncr;

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "getAbsoluteOffset", Integer.valueOf(result));
    return result;
  }
122209
@Override
    public List<QueryRow> regularQuery(final QueryOptions options) throws CouchbaseLiteException {

        final Predicate<QueryRow> postFilter = options.getPostFilter();

        int tmpLimit = QueryOptions.QUERY_OPTIONS_DEFAULT_LIMIT;
        int tmpSkip = 0;
        if (postFilter != null) {
            // #574: Custom post-filter means skip/limit apply to the filtered rows, not to the
            // underlying query, so handle them specially:
            tmpLimit = options.getLimit();
            tmpSkip = options.getSkip();
            if (tmpLimit == 0)
                return new ArrayList<QueryRow>(); // empty result set
            options.setLimit(QueryOptions.QUERY_OPTIONS_DEFAULT_LIMIT);
            options.setSkip(0);
        }

        final CountDown skip = new CountDown(tmpSkip);
        final CountDown limit = new CountDown(tmpLimit);

        final List<QueryRow> rows = new ArrayList<QueryRow>();

        Status status = runQuery(options, new QueryRowBlock() {
            @Override
            public Status onRow(byte[] keyData, byte[] valueData, String docID, Cursor cursor) {
                JsonDocument keyDoc = new JsonDocument(keyData);
                JsonDocument valueDoc = new JsonDocument(valueData);
                long sequence = Long.parseLong(cursor.getString(3));
                RevisionInternal docRevision = null;
                if (options.isIncludeDocs()) {
                    Object valueObject = valueDoc.jsonObject();
                    String linkedID = null;
                    if (valueObject instanceof Map)
                        linkedID = (String) ((Map) valueObject).get("_id");
                    if (linkedID != null) {
                        // Linked document: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views#Linked_documents
                        String linkedRev = (String) ((Map) valueObject).get("_rev");
                        Status linkedStatus = new Status();
                        docRevision = store.getDocument(linkedID, linkedRev, true, linkedStatus);
                        sequence = docRevision.getSequence();
                    } else {
                        String revID = cursor.getString(4);
                        byte[] json = cursor.getBlob(5);
                        Map<String, Object> properties = store.documentPropertiesFromJSON(
                                json,
                                docID,
                                revID,
                                false,
                                sequence);
                        docRevision = SQLiteStore.revision(
                                docID,    // docID
                                revID,    // revID
                                false,    // deleted
                                sequence, // sequence
                                properties// properties
                        );
                    }
                }
                QueryRow row = new QueryRow(docID, sequence,
                        keyDoc.jsonObject(), valueDoc.jsonObject(),
                        docRevision);
                if (postFilter != null) {
                    if (!postFilter.apply(row)) {
                        return new Status(Status.OK);
                    }
                    if (skip.getCount() > 0) {
                        skip.countDown();
                        return new Status(Status.OK);
                    }

                }
                rows.add(row);

                if (limit.countDown() == 0)
                    return new Status(0); /// stops the iteration
                return new Status(Status.OK);
            }
        });

        // If given keys, sort the output into that order, and add entries for missing keys:
        if (options.getKeys() != null && options.getKeys().size() > 0) {
            // Group rows by key:
            Map<Object, List<QueryRow>> rowsByKey = new HashMap<Object, List<QueryRow>>();
            for (QueryRow row : rows) {
                List<QueryRow> rs = rowsByKey.get(row.getKey());
                if (rs == null) {
                    rs = new ArrayList<QueryRow>();
                    rowsByKey.put(row.getKey(), rs);
                }
                rs.add(row);
            }

            // Now concatenate them in the order the keys are given in options:
            final List<QueryRow> sortedRows = new ArrayList<QueryRow>();
            for (Object key : options.getKeys()) {
                JsonDocument jsonDoc = null;
                try {
                    byte[] keyBytes = Manager.getObjectMapper().writeValueAsBytes(key);
                    jsonDoc = new JsonDocument(keyBytes);
                } catch (JsonProcessingException e) {
                    throw new CouchbaseLiteException(Status.INTERNAL_SERVER_ERROR);
                }
                List<QueryRow> rs = rowsByKey.get(jsonDoc.jsonObject());
                if (rs != null)
                    sortedRows.addAll(rs);
            }

            return sortedRows;
        }

        return rows;
    }
636209
void doFindNext()
    {
        String query = searchPanel.getQuery();
        if (query.isEmpty())
        {
            return;
        }
        
        String text = getDocumentText();
        boolean ignoreCase = !searchPanel.isCaseSensitive();

        int caretPosition = textComponent.getCaretPosition();
        int textLength = text.length();
        int newCaretPosition = (caretPosition + 1) % textLength;
        Point match = JTextComponents.findNext(
            text, query, newCaretPosition, ignoreCase);
        if (match == null)
        {
            match = JTextComponents.findNext(
                text, query, 0, ignoreCase);
        }
        handleMatch(match);
    }
458318
@Override
    public Map<String, SegmentData> getTRSegments(String trId,
        DocumentType type, String documentId, String language)
            throws ServiceException {
        if (trId == null || trId.isEmpty()) {
            throw new IllegalArgumentException("Non-empty trId must be specified.");
        }
        if (documentId == null || documentId.isEmpty()) {
            throw new IllegalArgumentException("Non-empty documentId must be specified.");
        }
        if (language == null || language.isEmpty()) {
            throw new IllegalArgumentException("Non-empty languageId must be specified.");
        }

        GetSegmentsResponse resp = invokeApiJson(
                "GET",
                escapePathSegment(account.getInstanceId()) + "/v2/doc-trs/"
                    + escapePathSegment(trId) + "/" + type.toString().toLowerCase() + "/"
                    + escapePathSegment(documentId) + "/" + language,
                null,
                GetSegmentsResponse.class);

        if (resp.getStatus() == Status.ERROR) {
            throw new ServiceException(resp.getMessage());
        }

        Map<String, SegmentData> resultEntries = new TreeMap<String, SegmentData>();
        if (resp.segments != null && !resp.segments.isEmpty()) {
            for (Entry<String, RestSegmentData> entry : resp.segments.entrySet()) {
                resultEntries.put(entry.getKey(),
                        new SegmentDataImpl(entry.getValue()));
            }
        }
        return resultEntries;
    }
773347
public  void showBooleanActionResultInTextInfo(String title, BooleanOWLResultSet result) throws OWLException {

		AskQueryInfoSetter alter_result_panel = new AskQueryInfoSetter(title, result);
		SwingUtilities.invokeLater(alter_result_panel);
	}
1303998
public TitanManagement.IndexJobFuture updateIndex(TitanIndex index, SchemaAction updateAction)
            throws BackendException {

        Preconditions.checkNotNull(index, "Index parameter must not be null", index);
        Preconditions.checkNotNull(updateAction, "%s parameter must not be null", SchemaAction.class.getSimpleName());
        Preconditions.checkArgument(SUPPORTED_ACTIONS.contains(updateAction),
                "Only these %s parameters are supported: %s (was given %s)",
                SchemaAction.class.getSimpleName(), SUPPORTED_ACTIONS_STRING, updateAction);
        Preconditions.checkArgument(
                RelationTypeIndex.class.isAssignableFrom(index.getClass()) ||
                        TitanGraphIndex.class.isAssignableFrom(index.getClass()),
                "Index %s has class %s: must be a %s or %s (or subtype)",
                index.getClass(), RelationTypeIndex.class.getSimpleName(), TitanGraphIndex.class.getSimpleName());

        org.apache.hadoop.conf.Configuration hadoopConf = new org.apache.hadoop.conf.Configuration();
        ModifiableHadoopConfiguration titanmrConf =
                ModifiableHadoopConfiguration.of(TitanHadoopConfiguration.MAPRED_NS, hadoopConf);

        // The job we'll execute to either REINDEX or REMOVE_INDEX
        final Class<? extends IndexUpdateJob> indexJobClass;
        final Class<? extends Mapper> mapperClass;

        // The class of the IndexUpdateJob and the Mapper that will be used to run it (VertexScanJob vs ScanJob)
        if (updateAction.equals(SchemaAction.REINDEX)) {
            indexJobClass = IndexRepairJob.class;
            mapperClass = HadoopVertexScanMapper.class;
        } else if (updateAction.equals(SchemaAction.REMOVE_INDEX)) {
            indexJobClass = IndexRemoveJob.class;
            mapperClass = HadoopScanMapper.class;
        } else {
            // Shouldn't get here -- if this exception is ever thrown, update SUPPORTED_ACTIONS
            throw new IllegalStateException("Unrecognized " + SchemaAction.class.getSimpleName() + ": " + updateAction);
        }

        // The column family that serves as input to the IndexUpdateJob
        final String readCF;
        if (RelationTypeIndex.class.isAssignableFrom(index.getClass())) {
            readCF = Backend.EDGESTORE_NAME;
        } else {
            TitanGraphIndex gindex = (TitanGraphIndex)index;
            if (gindex.isMixedIndex() && !updateAction.equals(SchemaAction.REINDEX))
                throw new UnsupportedOperationException("External mixed indexes must be removed in the indexing system directly.");

            Preconditions.checkState(TitanGraphIndex.class.isAssignableFrom(index.getClass()));
            if (updateAction.equals(SchemaAction.REMOVE_INDEX))
                readCF = Backend.INDEXSTORE_NAME;
            else
                readCF = Backend.EDGESTORE_NAME;
        }
        titanmrConf.set(TitanHadoopConfiguration.COLUMN_FAMILY_NAME, readCF);

        // The MapReduce InputFormat class based on the open graph's store manager
        final Class<? extends InputFormat> inputFormat;
        final Class<? extends KeyColumnValueStoreManager> storeManagerClass =
                graph.getBackend().getStoreManagerClass();
        if (CASSANDRA_STORE_MANAGER_CLASSES.contains(storeManagerClass)) {
            inputFormat = CassandraBinaryInputFormat.class;
            // Set the partitioner
            IPartitioner part =
                    ((AbstractCassandraStoreManager)graph.getBackend().getStoreManager()).getCassandraPartitioner();
            hadoopConf.set("cassandra.input.partitioner.class", part.getClass().getName());
        } else if (HBASE_STORE_MANAGER_CLASSES.contains(storeManagerClass)) {
            inputFormat = HBaseBinaryInputFormat.class;
        } else {
            throw new IllegalArgumentException("Store manager class " + storeManagerClass + "is not supported");
        }

        // The index name and relation type name (if the latter is applicable)
        final String indexName = index.name();
        final String relationTypeName =
                RelationTypeIndex.class.isAssignableFrom(index.getClass()) ?
                ((RelationTypeIndex)index).getType().name() :
                "";
        Preconditions.checkNotNull(indexName);

        // Set the class of the IndexUpdateJob
        titanmrConf.set(TitanHadoopConfiguration.SCAN_JOB_CLASS, indexJobClass.getName());
        // Set the configuration of the IndexUpdateJob
        copyIndexJobKeys(hadoopConf, indexName, relationTypeName);
        titanmrConf.set(TitanHadoopConfiguration.SCAN_JOB_CONFIG_ROOT,
                GraphDatabaseConfiguration.class.getName() + "#JOB_NS");
        // Copy the StandardTitanGraph configuration under TitanHadoopConfiguration.GRAPH_CONFIG_KEYS
        org.apache.commons.configuration.Configuration localbc = graph.getConfiguration().getLocalConfiguration();
        localbc.clearProperty(Graph.GRAPH);
        copyInputKeys(hadoopConf, localbc);

        String jobName = HadoopScanMapper.class.getSimpleName() + "[" + indexJobClass.getSimpleName() + "]";

        try {
            return new CompletedJobFuture(HadoopScanRunner.runJob(hadoopConf, inputFormat, jobName, mapperClass));
        } catch (Exception e) {
            return new FailedJobFuture(e);
        }
    }
824189
public String findTextByQueryReplyAndQueryField(QueryReply queryReply, QueryField queryField) {
    EntityManager entityManager = getEntityManager();

    CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
    CriteriaQuery<String> criteria = criteriaBuilder.createQuery(String.class);
    Root<QueryQuestionOptionAnswer> root = criteria.from(QueryQuestionOptionAnswer.class);
    Join<QueryQuestionOptionAnswer, QueryOptionFieldOption> option = root.join(QueryQuestionOptionAnswer_.option);
    
    criteria.select(option.get(QueryOptionFieldOption_.text));
    
    criteria.where(
      criteriaBuilder.and(
        criteriaBuilder.equal(root.get(QueryQuestionOptionAnswer_.queryField), queryField),
        criteriaBuilder.equal(root.get(QueryQuestionOptionAnswer_.queryReply), queryReply)
      )
    );
    
    return getSingleResult(entityManager.createQuery(criteria));
  }
236193
private void doGetAll() throws PageException {
	if (name == null) throw new ApplicationException("attribute name is required for tag registry, when action is [getAll]");

	try {
	    RegistryEntry[] entries = RegistryQuery.getValues(branch, type);
	    if (entries != null) {
		lucee.runtime.type.Query qry = new QueryImpl(new String[] { "entry", "type", "value" }, new String[] { "VARCHAR", "VARCHAR", "OTHER" }, entries.length, "query");
		for (int i = 0; i < entries.length; i++) {
		    RegistryEntry e = entries[i];
		    int row = i + 1;
		    qry.setAt(KeyConstants._entry, row, e.getKey());
		    qry.setAt(KeyConstants._type, row, RegistryEntry.toCFStringType(e.getType()));
		    qry.setAt(KeyConstants._value, row, e.getValue());
		}

		// sort
		if (sort != null) {
		    String[] arr = sort.toLowerCase().split(",");
		    for (int i = arr.length - 1; i >= 0; i--) {
			String[] col = arr[i].trim().split("\\s+");
			if (col.length == 1) qry.sort(KeyImpl.init(col[0].trim()));
			else if (col.length == 2) {
			    String order = col[1].toLowerCase().trim();
			    if (order.equals("asc")) qry.sort(KeyImpl.init(col[0]), lucee.runtime.type.Query.ORDER_ASC);
			    else if (order.equals("desc")) qry.sort(KeyImpl.init(col[0]), lucee.runtime.type.Query.ORDER_DESC);
			    else throw new ApplicationException("invalid order type [" + col[1] + "]");
			}
		    }
		}

		pageContext.setVariable(name, qry);
	    }
	}
	catch (Exception e) {
	    throw Caster.toPageException(e);
	}

    }
859109
@Override
    public void actionPerformed(JTextComponent target, SyntaxDocument sDoc, int dot, ActionEvent e) {
        int pos = target.getCaretPosition();
        int start = sDoc.getParagraphElement(pos).getStartOffset();
        String line = ActionUtils.getLine(target);
        String lineToPos = line.substring(0, pos - start);
        String prefix = getIndent(line);
        Token t = sDoc.getTokenAt(pos);
        if (TokenType.isComment(t)) {
            if (line.trim().endsWith("*/")) {
                prefix = prefix.substring(0, prefix.length() - 1);
            } else if (line.trim().startsWith("*")) {
                prefix += "# ";
            } else if (line.trim().startsWith("##")) {
                prefix += "#";
            }
        } else if (lineToPos.trim().endsWith(":")) {
            // check if current line is not comment
            prefix += getTab(target);
        } else {

            String noComment = sDoc.getUncommentedText(start, pos);
            // skip EOL comments
            if (noComment.trim().endsWith(":")) {
                prefix += getTab(target);
            }
            if ((lineToPos.length() > 0) && (line.equals(prefix))) {
                if (prefix.length() > 0) {
                    prefix = prefix.substring(1);
                }
            }
            if ((lineToPos.length() == 0)) {
                if (prefix.length() > 0) {
                    prefix = "";
                }
            }
        }
        target.replaceSelection("\n" + prefix);
    }
78297
private void buildIndex(CveDB cve) throws IndexException {
        try (Analyzer analyzer = createSearchingAnalyzer();
                IndexWriter indexWriter = new IndexWriter(index,
                        new IndexWriterConfig(analyzer))) {

            final FieldType ft = new FieldType(TextField.TYPE_STORED);
            //ignore term frequency
            ft.setIndexOptions(IndexOptions.DOCS);
            //ignore field length normalization
            ft.setOmitNorms(true);
            // Tip: reuse the Document and Fields for performance...
            // See "Re-use Document and Field instances" from
            // http://wiki.apache.org/lucene-java/ImproveIndexingSpeed
            final Document doc = new Document();
            final Field v = new Field(Fields.VENDOR, Fields.VENDOR, ft);
            final Field p = new Field(Fields.PRODUCT, Fields.PRODUCT, ft);

            doc.add(v);
            doc.add(p);

            final Set<Pair<String, String>> data = cve.getVendorProductList();
            for (Pair<String, String> pair : data) {
                if (pair.getLeft() != null && pair.getRight() != null) {
                    v.setStringValue(pair.getLeft());
                    p.setStringValue(pair.getRight());
                    indexWriter.addDocument(doc);
                    resetAnalyzers();
                }
            }
            indexWriter.commit();

        } catch (DatabaseException ex) {
            LOGGER.debug("", ex);
            throw new IndexException("Error reading CPE data", ex);
        } catch (IOException ex) {
            throw new IndexException("Unable to close an in-memory index", ex);
        }
    }
743456
private void doGetCFXTags() throws PageException {
	Map map = config.getCFXTagPool().getClasses();
	lucee.runtime.type.Query qry = new QueryImpl(
		new String[] { "displayname", "sourcename", "readonly", "isvalid", "name", "procedure_class", "procedure_bundleName", "procedure_bundleVersion", "keep_alive" },
		map.size(), "query");
	Iterator it = map.keySet().iterator();

	int row = 0;
	while (it.hasNext()) {
	    row++;
	    CFXTagClass tag = (CFXTagClass) map.get(it.next());

	    qry.setAt("displayname", row, tag.getDisplayType());
	    qry.setAt("sourcename", row, tag.getSourceName());
	    qry.setAt("readonly", row, Caster.toBoolean(tag.isReadOnly()));
	    qry.setAt("isvalid", row, Caster.toBoolean(tag.isValid()));

	    if (tag instanceof JavaCFXTagClass) {
		JavaCFXTagClass jtag = (JavaCFXTagClass) tag;
		qry.setAt(KeyConstants._name, row, jtag.getName());
		qry.setAt("procedure_class", row, jtag.getClassDefinition().getClassName());
		qry.setAt("procedure_bundleName", row, jtag.getClassDefinition().getName());
		qry.setAt("procedure_bundleVersion", row, jtag.getClassDefinition().getVersionAsString());
	    }

	}
	pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
    }
900703
public function actionIndex()
	{
		$criteria=new CDbCriteria(array(
			'condition'=>'status='.Post::STATUS_PUBLISHED,
			'order'=>'update_time DESC',
			'with'=>'commentCount',
		));
		if(isset($_GET['tag']))
			$criteria->addSearchCondition('tags',$_GET['tag']);

		$dataProvider=new CActiveDataProvider('Post', array(
			'pagination'=>array(
				'pageSize'=>Yii::app()->params['postsPerPage'],
			),
			'criteria'=>$criteria,
		));

		$this->render('index',array(
			'dataProvider'=>$dataProvider,
		));
	}