Java Code Examples for java.util.LinkedHashMap#get()

The following examples show how to use java.util.LinkedHashMap#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadOverviewItem.java    From lttrs-android with Apache License 2.0 6 votes vote down vote up
private Map<String, From> calculateFromMap() {
    KeywordOverwriteEntity seenOverwrite = KeywordOverwriteEntity.getKeywordOverwrite(keywordOverwriteEntities, Keyword.SEEN);
    LinkedHashMap<String, From> fromMap = new LinkedHashMap<>();
    final List<Email> emails = getOrderedEmails();
    for (Email email : emails) {
        if (email.keywords.contains(Keyword.DRAFT)) {
            fromMap.put("", new DraftFrom());
            continue;
        }
        final boolean seen = seenOverwrite != null ? seenOverwrite.value : email.keywords.contains(Keyword.SEEN);
        for (EmailAddress emailAddress : email.emailAddresses) {
            if (emailAddress.type == EmailAddressType.FROM) {
                From from = fromMap.get(emailAddress.getEmail());
                if (from == null) {
                    from = new NamedFrom(emailAddress.getName(), seen);
                    fromMap.put(emailAddress.getEmail(), from);
                } else if (from instanceof NamedFrom) {
                    final NamedFrom namedFrom = (NamedFrom) from;
                    namedFrom.seen &= seen;
                }
            }
        }
    }
    return fromMap;
}
 
Example 2
Source File: SparklerConfiguration.java    From sparkler with Apache License 2.0 6 votes vote down vote up
public LinkedHashMap<String,Object> getPluginConfiguration(String pluginId) throws SparklerException {
    pluginId = pluginId.replace("-", ".");
    if (this.containsKey(Constants.key.PLUGINS)) {
        LinkedHashMap plugins = (LinkedHashMap) this.get(Constants.key.PLUGINS);
        if (plugins.containsKey(pluginId)) {
            return (LinkedHashMap<String, Object>) plugins.get(pluginId);
        } else {
            String[] parts = pluginId.split(":");
            if (parts.length >= 3){ // groupId:artifactId:version
                //first check without version
                String newId = parts[0] + ":" + parts[1];
                if (plugins.containsKey(newId)) {
                    return (LinkedHashMap<String, Object>) plugins.get(newId);
                } else if (plugins.containsKey(parts[1])){ // just the id, no groupId or version
                    return (LinkedHashMap<String, Object>) plugins.get(parts[1]);
                }
            }
            throw new SparklerException("No configuration found for Plugin: " + pluginId);
        }
    } else {
        throw new SparklerException("No plugin configuration found!");
    }
}
 
Example 3
Source File: RepSumByNameRoundTask.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
/**
 * Report statistics as a string, aggregate for tasks named the same, and from the same round.
 * @return the report
 */
protected Report reportSumByNameRound(List<TaskStats> taskStats) {
  // aggregate by task name and round
  LinkedHashMap<String,TaskStats> p2 = new LinkedHashMap<>();
  int reported = 0;
  for (final TaskStats stat1 : taskStats) {
    if (stat1.getElapsed()>=0) { // consider only tasks that ended
      reported++;
      String name = stat1.getTask().getName();
      String rname = stat1.getRound()+"."+name; // group by round
      TaskStats stat2 = p2.get(rname);
      if (stat2 == null) {
        try {
          stat2 = stat1.clone();
        } catch (CloneNotSupportedException e) {
          throw new RuntimeException(e);
        }
        p2.put(rname,stat2);
      } else {
        stat2.add(stat1);
      }
    }
  }
  // now generate report from secondary list p2    
  return genPartialReport(reported, p2, taskStats.size());
}
 
Example 4
Source File: Table.java    From uncode-dal-all with GNU General Public License v2.0 6 votes vote down vote up
public void setParams(LinkedHashMap<String, Object> params) {
    LinkedHashMap<String, Object> tmpParams = new LinkedHashMap<String, Object>();
    Iterator<String> keys = params.keySet().iterator();
    while(keys.hasNext()){
        String key = keys.next();
        Object value = params.get(key);
        //if(null != value){
        	if(Model.MODEL_NAME.equals(key) || Model.MODEL_ID.equals(key)){
                continue;
            }else{
                tmpParams.put(key, value);
            }
        //}
    }
    paramsLocal = tmpParams;
}
 
Example 5
Source File: LabelPainter.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private static Color[] getColors(@Nonnull Collection<RefGroup> groups) {
  LinkedHashMap<Color, Integer> usedColors = ContainerUtil.newLinkedHashMap();

  for (RefGroup group : groups) {
    List<Color> colors = group.getColors();
    for (Color color : colors) {
      Integer count = usedColors.get(color);
      if (count == null) count = 0;
      usedColors.put(color, count + 1);
    }
  }

  List<Color> result = ContainerUtil.newArrayList();
  for (Map.Entry<Color, Integer> entry : usedColors.entrySet()) {
    result.add(entry.getKey());
    if (entry.getValue() > 1) {
      result.add(entry.getKey());
    }
  }

  return result.toArray(new Color[result.size()]);
}
 
Example 6
Source File: StockMoveLineController.java    From axelor-open-suite with GNU Affero General Public License v3.0 6 votes vote down vote up
public void splitStockMoveLineByTrackingNumber(ActionRequest request, ActionResponse response) {
  Context context = request.getContext();

  if (context.get("trackingNumbers") == null) {
    response.setAlert(I18n.get(IExceptionMessage.TRACK_NUMBER_WIZARD_NO_RECORD_ADDED_ERROR));
  } else {
    @SuppressWarnings("unchecked")
    LinkedHashMap<String, Object> stockMoveLineMap =
        (LinkedHashMap<String, Object>) context.get("_stockMoveLine");
    Integer stockMoveLineId = (Integer) stockMoveLineMap.get("id");
    StockMoveLine stockMoveLine =
        Beans.get(StockMoveLineRepository.class).find(new Long(stockMoveLineId));

    @SuppressWarnings("unchecked")
    ArrayList<LinkedHashMap<String, Object>> trackingNumbers =
        (ArrayList<LinkedHashMap<String, Object>>) context.get("trackingNumbers");

    Beans.get(StockMoveLineService.class)
        .splitStockMoveLineByTrackingNumber(stockMoveLine, trackingNumbers);
    response.setCanClose(true);
  }
}
 
Example 7
Source File: SaltStateGeneratorTest.java    From uyuni with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test basic tree before the payload of the SLS
 *
 * @throws IOException
 */
@SuppressWarnings("unchecked")
public void testSLSTestBasicTree() throws IOException {
    SaltPkgInstalled obj = new SaltPkgInstalled();
    obj.addPackage("emacs");
    this.generator.generate(obj);

    LinkedHashMap<String, Object> data = (LinkedHashMap<String, Object>)
            this.yaml.load(this.writer.getBuffer().toString());
    LinkedHashMap<String, Object> sub = (LinkedHashMap<String, Object>)
            data.get("pkg_installed");
    assertNotNull(sub);
    assertNotNull(sub.get("pkg.installed"));
    assertEquals(((List<Map<String, Object>>) sub.get("pkg.installed"))
            .get(0).get("refresh"), true);
}
 
Example 8
Source File: AbstractChartTest.java    From beakerx with Apache License 2.0 5 votes vote down vote up
@Test
public void setCrosshair_hasCrosshair() {
  //given
  AbstractChart chart =createWidget();
  Crosshair crosshair = new Crosshair();
  //when
  chart.setCrosshair(crosshair);
  //then
  assertThat(chart.getCrosshair()).isNotNull();
  LinkedHashMap model = getModelUpdate();
  assertThat(model.size()).isEqualTo(1);
  Map actual = (Map)model.get(CROSSHAIR);
  assertThat(actual.get(CrosshairSerializer.TYPE)).isEqualTo(Crosshair.class.getSimpleName());
}
 
Example 9
Source File: CommonJdbcSupport.java    From uncode-dal-all with GNU General Public License v2.0 5 votes vote down vote up
private Object[] buildPrimaryKeyParameters(final Table table) {
    Object[] objs = null;
    LinkedHashMap<String, Object> params = table.getConditions();
    List<String> names = table.getPrimaryKey().getFields();
    if (names != null) {
        objs = new Object[names.size()];
        for (int i = 0; i < names.size(); i++) {
            objs[i] = params.get(names.get(i));
        }
    }
    return objs;
}
 
Example 10
Source File: SqlQueryBuilder.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
public PreparedStatement createfindByParamsStatementWithLimit(Connection connection,
    Class<? extends AbstractEntity> entityClass, Predicate predicate, Long limit, Long offset) throws Exception {
  String tableName = entityMappingHolder.tableToEntityNameMap.inverse().get(entityClass.getSimpleName());
  BiMap<String, String> entityNameToDBNameMapping =
      entityMappingHolder.columnMappingPerTable.get(tableName).inverse();
  StringBuilder sqlBuilder = new StringBuilder("SELECT * FROM " + tableName);
  StringBuilder whereClause = new StringBuilder(" WHERE ");
  List<Pair<String, Object>> parametersList = new ArrayList<>();
  generateWhereClause(entityNameToDBNameMapping, predicate, parametersList, whereClause);
  sqlBuilder.append(whereClause.toString());
  sqlBuilder.append(" ORDER BY id DESC");
  if (limit != null) {
    sqlBuilder.append(" LIMIT ").append(limit);
  }
  if (offset != null) {
    sqlBuilder.append(" OFFSET ").append(offset);
  }
  PreparedStatement prepareStatement = connection.prepareStatement(sqlBuilder.toString());
  int parameterIndex = 1;
  LinkedHashMap<String, ColumnInfo> columnInfoMap =
      entityMappingHolder.columnInfoPerTable.get(tableName);
  for (Pair<String, Object> pair : parametersList) {
    String dbFieldName = pair.getKey();
    ColumnInfo info = columnInfoMap.get(dbFieldName);
    Preconditions.checkNotNull(info, String.format("Found field '%s' but expected %s", dbFieldName, columnInfoMap.keySet()));
    prepareStatement.setObject(parameterIndex++, pair.getValue(), info.sqlType);
    LOG.debug("Setting {} to {}", pair.getKey(), pair.getValue());
  }
  return prepareStatement;
}
 
Example 11
Source File: WorkingUnitIndexer.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
		SearchContext searchContext) throws Exception {

	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.WORKINGUNIT_ID, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.GROUP_ID, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.COMPANY_ID, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.USER_ID, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.USER_NAME, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.CREATE_DATE, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.MODIFIED_DATE, false);
	
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.NAME, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.ENNAME, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.GOV_AGENCY_CODE, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.PARENT_WORKING_UNIT_ID, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.SIBLING, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.TREEINDEX, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.ADDRESS, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.TEL_NO, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.FAX_NO, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.EMAIL, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.WEBSITE, true);
	
	@SuppressWarnings("unchecked")
	LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

	if (params != null) {
		String expandoAttributes = (String) params.get("expandoAttributes");

		if (Validator.isNotNull(expandoAttributes)) {
			addSearchExpando(searchQuery, searchContext, expandoAttributes);
		}
	}
}
 
Example 12
Source File: RouteByStepName.java    From jesterj with Apache License 2.0 5 votes vote down vote up
@Override
public Step[] route(Document doc, LinkedHashMap<String, Step> nextSteps) {
  Step dest = nextSteps.get(doc.getFirstValue(JESTERJ_NEXT_STEP_NAME));
  if (dest == null) {
    log.warn("Document " + doc.getId() + " dropped! no value for " + JESTERJ_NEXT_STEP_NAME +
        " You probably want to either set a different router or provide a value.");
  }
  return new Step[]{dest};
}
 
Example 13
Source File: NotificationMap.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void add( JobConfiguration jobConfiguration, Notification notification )
{
    String uid = jobConfiguration.getUid();

    LinkedHashMap<String, LinkedList<Notification>> uidNotifications = notificationsWithType
        .get( jobConfiguration.getJobType() );

    LinkedList<Notification> notifications;
    if ( uidNotifications.containsKey( uid ) )
    {
        notifications = uidNotifications.get( uid );
    }
    else
    {
        notifications = new LinkedList<>();
    }

    notifications.addFirst( notification );

    if ( uidNotifications.size() >= MAX_POOL_TYPE_SIZE )
    {
        String key = (String) uidNotifications.keySet().toArray()[0];
        uidNotifications.remove( key );
    }

    uidNotifications.put( uid, notifications );

    notificationsWithType.put( jobConfiguration.getJobType(), uidNotifications );
}
 
Example 14
Source File: Translation.java    From ezScrum with GNU General Public License v2.0 5 votes vote down vote up
public static String translateBurndownChartDataToJson(
		LinkedHashMap<Date, Double> ideal, LinkedHashMap<Date, Double> real) {
	JSONObject responseText = new JSONObject();
	try {
		responseText.put("success", true);

		JSONArray array = new JSONArray();
		DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
		Object[] idealPointArray = ideal.keySet().toArray();

		for (int i = 0; i < idealPointArray.length; i++) {
			JSONObject obj = new JSONObject();
			obj.put("Date", formatter.format(idealPointArray[i]));
			obj.put("IdealPoint", ideal.get(idealPointArray[i]));

			
			if (real.get(idealPointArray[i]) != null) {
				obj.put("RealPoint", real.get(idealPointArray[i]));
			}
			else {
				obj.put("RealPoint", "null");
			}
			if (i == 0) {
				obj.put("RealPoint", ideal.get(idealPointArray[0]));
			}

			array.put(obj);
		}
		responseText.put("Points", array);
	} catch (JSONException e) {
		e.printStackTrace();
	}
	return responseText.toString();
}
 
Example 15
Source File: MMImportCoupling.java    From JDeodorant with MIT License 5 votes vote down vote up
private double getClassAverageCoupling(String className) {
	LinkedHashMap<String, Integer> map = importCouplingMap.get(className);
	int sum = 0;
	Set<String> keySet = map.keySet();
	for(String key : keySet) {
		if(!key.equals(className))
			sum += map.get(key);
	}
	return (double)sum/(double)(keySet.size()-1);
}
 
Example 16
Source File: TransactionsDAO.java    From fingen with Apache License 2.0 4 votes vote down vote up
public synchronized LinkedHashMap<Long, List<DateEntry>> getCommonDateReport(String datePattern, String dateFormat, FilterListHelper filterListHelper, Context context) throws Exception {
    LinkedHashMap<Long, List<DateEntry>> map = new LinkedHashMap<>();
    List<AbstractFilter> filterList = filterListHelper.getFilters();
    Date date;
    BigDecimal income;
    BigDecimal expense;
    long cabbageID;
    List<DateEntry> entries;
    @SuppressLint("SimpleDateFormat") DateFormat df = new SimpleDateFormat(dateFormat);

    createTempTransactionsTable(filterList, context);

    String sql = "SELECT \n" +
            "Currency, \n" +
            "strftime('" + datePattern + "', DateTime/1000, 'unixepoch', 'localtime') AS Date,\n" +
            "TOTAL(CASE WHEN Income = 1 THEN Amount ELSE 0 END) AS InAmountSum,\n" +
            "TOTAL(CASE WHEN Income = 0 THEN Amount ELSE 0 END) AS OutAmountSum\n" +
            "FROM temp_all_Transactions\n" +
            "WHERE  ExcludeTransfer != 1\n" +
            "GROUP BY Currency, strftime('" + datePattern + "', DateTime/1000, 'unixepoch', 'localtime');";
    if (BuildConfig.DEBUG) {
        Log.d(SQLTAG, sql);
    }

    Cursor cursor = mDatabase.rawQuery(sql, null);
    if (cursor != null) {
        try {
            if (cursor.moveToFirst()) {
                while (!cursor.isAfterLast()) {
                    cabbageID = cursor.getLong(0);
                    date = df.parse(cursor.getString(1));
                    income = new BigDecimal(cursor.getDouble(2)).abs();
                    expense = new BigDecimal(cursor.getDouble(3)).abs();
                    if (!map.containsKey(cabbageID)) {
                        map.put(cabbageID, new ArrayList<>());
                    }
                    entries = map.get(cabbageID);
                    entries.add(new DateEntry(date, income, expense));
                    cursor.moveToNext();
                }
            }
        } finally {
            cursor.close();
        }
    }

    return map;
}
 
Example 17
Source File: VpcNetworkHelperImpl.java    From cosmic with Apache License 2.0 4 votes vote down vote up
@Override
public void reallocateRouterNetworks(final RouterDeploymentDefinition vpcRouterDeploymentDefinition, final VirtualRouter router, final VMTemplateVO template, final
HypervisorType hType)
        throws ConcurrentOperationException, InsufficientCapacityException {

    final TreeSet<String> publicVlans = new TreeSet<>();
    if (vpcRouterDeploymentDefinition.needsPublicNic()) {
        publicVlans.add(vpcRouterDeploymentDefinition.getSourceNatIP().getVlanTag());
    } else {
        s_logger.debug("VPC " + vpcRouterDeploymentDefinition.getVpc().getName() + " does not need a public nic.");
    }

    //1) allocate nic for control and source nat public ip
    final LinkedHashMap<Network, List<? extends NicProfile>> networks = configureDefaultNics(vpcRouterDeploymentDefinition);

    final Long vpcId = vpcRouterDeploymentDefinition.getVpc().getId();
    //2) allocate nic for private gateways if needed
    final List<PrivateGateway> privateGateways = vpcMgr.getVpcPrivateGateways(vpcId);
    if (privateGateways != null && !privateGateways.isEmpty()) {
        for (final PrivateGateway privateGateway : privateGateways) {
            final NicProfile privateNic = nicProfileHelper.createPrivateNicProfileForGateway(privateGateway, router);
            final Network privateNetwork = _networkModel.getNetwork(privateGateway.getNetworkId());
            networks.put(privateNetwork, new ArrayList<>(Arrays.asList(privateNic)));
        }
    }

    //3) allocate nic for guest gateway if needed
    final List<? extends Network> guestNetworks = vpcMgr.getVpcNetworks(vpcId);
    for (final Network guestNetwork : guestNetworks) {
        if (_networkModel.isPrivateGateway(guestNetwork.getId())) {
            continue;
        }
        if (guestNetwork.getState() == Network.State.Implemented || guestNetwork.getState() == Network.State.Setup) {
            final NicProfile guestNic = nicProfileHelper.createGuestNicProfileForVpcRouter(vpcRouterDeploymentDefinition, guestNetwork);
            networks.put(guestNetwork, new ArrayList<>(Arrays.asList(guestNic)));
        }
    }

    //4) allocate nic for additional public network(s)
    final List<IPAddressVO> ips = _ipAddressDao.listByVpc(vpcId, false);
    final List<NicProfile> publicNics = new ArrayList<>();
    Network publicNetwork = null;
    for (final IPAddressVO ip : ips) {
        final PublicIp publicIp = PublicIp.createFromAddrAndVlan(ip, _vlanDao.findById(ip.getVlanId()));
        if ((ip.getState() == IpAddress.State.Allocated || ip.getState() == IpAddress.State.Allocating) && vpcMgr.isIpAllocatedToVpc(ip) &&
                !publicVlans.contains(publicIp.getVlanTag())) {
            s_logger.debug("Allocating nic for router in vlan " + publicIp.getVlanTag());
            final NicProfile publicNic = new NicProfile();
            publicNic.setDefaultNic(false);
            publicNic.setIPv4Address(publicIp.getAddress().addr());
            publicNic.setIPv4Gateway(publicIp.getGateway());
            publicNic.setIPv4Netmask(publicIp.getNetmask());
            publicNic.setMacAddress(publicIp.getMacAddress());
            publicNic.setBroadcastType(BroadcastDomainType.Vlan);
            publicNic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(publicIp.getVlanTag()));
            publicNic.setIsolationUri(IsolationType.Vlan.toUri(publicIp.getVlanTag()));
            final NetworkOffering publicOffering = _networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemPublicNetwork).get(0);
            if (publicNetwork == null) {
                final List<? extends Network> publicNetworks = _networkMgr.setupNetwork(s_systemAccount, publicOffering, vpcRouterDeploymentDefinition.getPlan(), null, null,
                        false);
                publicNetwork = publicNetworks.get(0);
            }
            publicNics.add(publicNic);
            publicVlans.add(publicIp.getVlanTag());
        }
    }
    if (publicNetwork != null) {
        if (networks.get(publicNetwork) != null) {
            final List<NicProfile> publicNicProfiles = (List<NicProfile>) networks.get(publicNetwork);
            publicNicProfiles.addAll(publicNics);
            networks.put(publicNetwork, publicNicProfiles);
        } else {
            networks.put(publicNetwork, publicNics);
        }
    }

    final ServiceOfferingVO routerOffering = _serviceOfferingDao.findById(vpcRouterDeploymentDefinition.getServiceOfferingId());

    _itMgr.allocate(router.getInstanceName(), template, routerOffering, networks, vpcRouterDeploymentDefinition.getPlan(), hType);
}
 
Example 18
Source File: Stats.java    From cucumber-performance with MIT License 4 votes vote down vote up
public Double getStatistic(String name,String group, String scenario)
{
	LinkedHashMap<String,Double> s = stats.get(group+SEP+scenario);
	return s!=null?s.get(name):null;
}
 
Example 19
Source File: OfficeSiteLocalServiceImpl.java    From opencps-v2 with GNU Affero General Public License v3.0 4 votes vote down vote up
public Hits luceneSearchEngine(LinkedHashMap<String, Object> params, Sort[] sorts, int start, int end,
		SearchContext searchContext) throws ParseException, SearchException {
	// TODO
	MultiMatchQuery query = null;
	String keywords = (String) params.get("keywords");
	String groupId = (String) params.get("groupId");
	String userId = (String) params.get("userId");
	Indexer<OfficeSite> indexer = IndexerRegistryUtil.nullSafeGetIndexer(OfficeSite.class);

	searchContext.addFullQueryEntryClassName(OfficeSite.class.getName());
	searchContext.setEntryClassNames(new String[] { OfficeSite.class.getName() });
	searchContext.setAttribute("paginationType", "regular");
	searchContext.setLike(true);
	searchContext.setStart(start);
	searchContext.setEnd(end);
	searchContext.setAndSearch(true);
	searchContext.setSorts(sorts);

	BooleanQuery booleanQuery = null;

	booleanQuery = Validator.isNotNull((String) keywords)
			? BooleanQueryFactoryUtil.create((SearchContext) searchContext)
			: indexer.getFullQuery(searchContext);

	if (Validator.isNotNull(groupId)) {
		query = new MultiMatchQuery(groupId);

		query.addFields(OfficeSiteTerm.GROUP_ID);

		booleanQuery.add(query, BooleanClauseOccur.MUST);
	}

	if (Validator.isNotNull(userId)) {
		query = new MultiMatchQuery(userId);

		query.addFields(OfficeSiteTerm.USER_ID);

		booleanQuery.add(query, BooleanClauseOccur.MUST);
	}

	booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, OfficeSite.class.getName());

	return IndexSearcherHelperUtil.search(searchContext, booleanQuery);
}
 
Example 20
Source File: NamedParameterHelper.java    From groovy with Apache License 2.0 4 votes vote down vote up
public static String myJavaMethod(@NamedParams({
        @NamedParam(value = "foo", type = String.class, required = true),
        @NamedParam(value = "bar", type = Integer.class)
}) LinkedHashMap params, int num) {
    return "foo = " + params.get("foo") + ", bar = " + params.get("bar") + ", num = " + num;
}