Java Code Examples for org.apache.commons.lang3.StringUtils#equalsIgnoreCase()

The following examples show how to use org.apache.commons.lang3.StringUtils#equalsIgnoreCase() . 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: StudioAbstractAccessDecisionVoter.java    From studio with GNU General Public License v3.0 6 votes vote down vote up
protected boolean isAdmin(User user) {
    List<Group> userGroups = null;
    try {
        userGroups = userServiceInternal.getUserGroups(-1, user.getUsername());
    } catch (ServiceLayerException | UserNotFoundException e) {
        logger.error("Error getting user memberships", e);
        return false;
    }
    boolean toRet = false;
    if (CollectionUtils.isNotEmpty(userGroups)) {
        for (Group group : userGroups) {
            if (StringUtils.equalsIgnoreCase(group.getGroupName(), SYSTEM_ADMIN_GROUP)) {
                toRet = true;
                break;
            }
        }
    }
    return toRet;
}
 
Example 2
Source File: ValidateCodeFilter.java    From FEBS-Cloud with Apache License 2.0 6 votes vote down vote up
@Override
protected void doFilterInternal(@Nonnull HttpServletRequest httpServletRequest, @Nonnull HttpServletResponse httpServletResponse,
                                @Nonnull FilterChain filterChain) throws ServletException, IOException {
    String header = httpServletRequest.getHeader(HttpHeaders.AUTHORIZATION);

    RequestMatcher matcher = new AntPathRequestMatcher(EndpointConstant.OAUTH_TOKEN, HttpMethod.POST.toString());
    if (matcher.matches(httpServletRequest)
            && StringUtils.equalsIgnoreCase(httpServletRequest.getParameter(ParamsConstant.GRANT_TYPE), GrantTypeConstant.PASSWORD)) {
        try {
            validateCode(httpServletRequest);
            filterChain.doFilter(httpServletRequest, httpServletResponse);
        } catch (Exception e) {
            FebsResponse febsResponse = new FebsResponse();
            FebsUtil.makeFailureResponse(httpServletResponse, febsResponse.message(e.getMessage()));
            log.error(e.getMessage(), e);
        }
    } else {
        filterChain.doFilter(httpServletRequest, httpServletResponse);
    }
}
 
Example 3
Source File: DBusRouterEncodeBolt.java    From DBus with Apache License 2.0 6 votes vote down vote up
public DataType obtainDataType(String type) {
    if (StringUtils.equalsIgnoreCase(type, DataType.INT.toString()))
        return DataType.INT;
    if (StringUtils.equalsIgnoreCase(type, DataType.LONG.toString()))
        return DataType.LONG;
    if (StringUtils.equalsIgnoreCase(type, DataType.FLOAT.toString()))
        return DataType.FLOAT;
    if (StringUtils.equalsIgnoreCase(type, DataType.DOUBLE.toString()))
        return DataType.DOUBLE;
    if (StringUtils.equalsIgnoreCase(type, DataType.BOOLEAN.toString()))
        return DataType.BOOLEAN;
    if (StringUtils.equalsIgnoreCase(type, DataType.DATE.toString()))
        return DataType.DATE;
    if (StringUtils.equalsIgnoreCase(type, DataType.DATETIME.toString()))
        return DataType.DATETIME;
    if (StringUtils.equalsIgnoreCase(type, DataType.DECIMAL.toString()))
        return DataType.DECIMAL;
    if (StringUtils.equalsIgnoreCase(type, DataType.BINARY.toString()))
        return DataType.BINARY;
    if (StringUtils.equalsIgnoreCase(type, DataType.RAW.toString()))
        return DataType.RAW;
    return DataType.STRING;
}
 
Example 4
Source File: PriceTag.java    From website with GNU Affero General Public License v3.0 6 votes vote down vote up
public void doTag() throws JspException, IOException {

		Currency oCurrency = getCurrency(currency);
		Currency oDisplayCurrency = getDisplayCurrency(displayCurrency);

		if (oCurrency == null || oDisplayCurrency == null) {
			throw new JspException();
		}

		String price = "";
		if (!StringUtils.equalsIgnoreCase(oDisplayCurrency.getCode(), oCurrency.getCode())) {
			price = buildPriceTag(oDisplayCurrency, currencyService.convert(amount, oCurrency, oDisplayCurrency).setScale(2, RoundingMode.UP));
		} else {
			price = buildPriceTag(oCurrency, amount.setScale(2, RoundingMode.UP));
		}

		// write out price
		try {
			getJspContext().getOut().write(price);
		} catch (IOException e) {
			throw new JspException();
		}

		return;
	}
 
Example 5
Source File: ActionCrawlWorkCompleted.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private String attachment(Business business, WorkCompleted workCompleted) throws Exception {
	StringBuffer buffer = new StringBuffer();
	for (Attachment o : business.entityManagerContainer().listEqual(Attachment.class, WorkCompleted.job_FIELDNAME,
			workCompleted.getJob())) {
		if ((!Config.query().getCrawlWorkCompleted().getExcludeAttachment().contains(o.getName()))
				&& (!Config.query().getCrawlWorkCompleted().getExcludeSite().contains(o.getSite()))
				&& (!StringUtils.equalsIgnoreCase(o.getName(),
						Config.processPlatform().getDocToWordDefaultFileName()))
				&& (!StringUtils.equalsIgnoreCase(o.getSite(),
						Config.processPlatform().getDocToWordDefaultSite()))) {
			if (StringUtils.isNotEmpty(o.getText())) {
				buffer.append(o.getText());
			} else {
				buffer.append(this.storageObjectToText(o));
			}
		}
	}
	return StringUtils.deleteWhitespace(buffer.toString());
}
 
Example 6
Source File: BarbarianAssaultPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onInteractingChanged(InteractingChanged event)
{
	if (!isInGame() || getRole() != Role.HEALER)
	{
		return;
	}

	Actor source = event.getSource();

	if (source != client.getLocalPlayer())
	{
		return;
	}

	Actor opponent = event.getTarget();

	if (opponent == null)
	{
		if (lastInteracted != -1 && StringUtils.equalsIgnoreCase(poisonUsed, getRole().getListen(client)) && healers.containsKey(lastInteracted))
		{
			Healer healer = healers.get(lastInteracted);
			healer.setFoodRemaining(healer.getFoodRemaining() - 1);
			healer.setTimeLastPoisoned(Instant.now());
		}

		lastInteracted = -1;
		poisonUsed = null;
	}
	else if (StringUtils.equals(opponent.getName(), "Penance Healer"))
	{
		lastInteracted = ((NPC) opponent).getIndex();
	}

}
 
Example 7
Source File: ContractDataServiceImpl.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public boolean doesContractHaveFunctionality(Contract contract, String functionnalityKey) {
    for (Functionality functionality : contract.getFunctionalitySet()) {
        if (StringUtils.equalsIgnoreCase(functionality.getCode(), functionnalityKey)) {
            return true;
        }
    }
    return false;
}
 
Example 8
Source File: IdenticalLinkWithDifferentTargetChecker.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * 
 * @param elements
 * @param testSolutionHandler
 */
private void searchIdenticalLinkWithDifferentTarget (
        Elements elements,
        TestSolutionHandler testSolutionHandler){

    if (elements.isEmpty()) {
        testSolutionHandler.addTestSolution(TestSolution.NOT_APPLICABLE);
        return;
    }

    // We first search the identical links in the node selected set
    Collection<List<Link>> identicalLinks = 
            sortLinksByIdenticalTextTarget(elements);

    // If identical link have been found
    if (identicalLinks != null && !identicalLinks.isEmpty()) {
        // for each list of identical links
        for (List<Link> links : identicalLinks) {
            boolean identicalTarget = true;
            for (int i=1 ; i<links.size() ;i++){
                // we check whether the href value of each node is different
                // from the href value of the previous one
                if (!StringUtils.equalsIgnoreCase(
                        links.get(i-1).href, links.get(i).href)) {
                    identicalTarget = false;
                    break;
                }
            }
            computeSolution(identicalTarget, links, testSolutionHandler);
        }
    }
}
 
Example 9
Source File: ValidateCodeServiceImpl.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
private void setHeader(HttpServletResponse response, String type) {
    if (StringUtils.equalsIgnoreCase(type, "gif")) {
        response.setContentType(MediaType.IMAGE_GIF_VALUE);
    } else {
        response.setContentType(MediaType.IMAGE_PNG_VALUE);
    }
    response.setHeader(HttpHeaders.PRAGMA, "No-cache");
    response.setHeader(HttpHeaders.CACHE_CONTROL, "No-cache");
    response.setDateHeader(HttpHeaders.EXPIRES, 0L);
}
 
Example 10
Source File: ContrastHelper.java    From Asqatasun with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * 
 * @param color
 * @return whether the color is testable, i.e defined as a rgb color
 */
public static boolean isColorTestable(final String color) {
    return !StringUtils.contains(color, BACKGROUND_IMAGE_KEY) &&
           !StringUtils.contains(color, GRADIENT_KEY) && 
           !StringUtils.contains(color, ALPHA_COLOR_KEY) && 
           !StringUtils.equalsIgnoreCase(color, TRANSPARENT_KEY) &&
           StringUtils.startsWith(color, RGB_COLOR_KEY);
}
 
Example 11
Source File: DubboRemoteCoordinator.java    From ByteJTA with GNU Lesser General Public License v3.0 5 votes vote down vote up
private String getParticipantsIdentifier(Object proxy, Method method, Object[] args) throws Throwable {
	if (this.invocationContext == null) {
		return null;
	}

	String serverHost = this.invocationContext == null ? null : this.invocationContext.getServerHost();
	String serviceKey = this.invocationContext == null ? null : this.invocationContext.getServiceKey();
	int serverPort = this.invocationContext == null ? 0 : this.invocationContext.getServerPort();
	if (StringUtils.isNotBlank(serviceKey) && StringUtils.equalsIgnoreCase(serviceKey, "null") == false) {
		return String.format("%s:%s:%s", serverHost, serviceKey, serverPort);
	} else {
		Object application = this.getParticipantsApplication(proxy, method, args);
		return String.format("%s:%s:%s", serverHost, application, serverPort);
	}
}
 
Example 12
Source File: CreditNonQualifyingCorrelation.java    From simm-lib with MIT License 5 votes vote down vote up
@Override
public BigDecimal getSensitivityCorrelation(WeightingClass si, WeightingClass sk) {
  if (StringUtils.equalsIgnoreCase(DefaultSensitivity.RESIDUAL, si.getBucket())
    || StringUtils.equalsIgnoreCase(DefaultSensitivity.RESIDUAL, sk.getBucket())) {
    return RESIDUAL;
  } else if (StringUtils.equalsIgnoreCase(si.getLabel2(), sk.getLabel2())) {
    return AGGREGATE_SAME;
  } else {
    return AGGREGATE_DIFF;
  }
}
 
Example 13
Source File: MinAggregationParser.java    From elasticsearch-sql with MIT License 5 votes vote down vote up
@Override
public void parseAggregateItemClauseContext(AggregateQuery aggregateQuery, ElasticsearchParser.AggregateItemClauseContext aggregateItemClauseContext) {
    if (StringUtils.equalsIgnoreCase(aggregateItemClauseContext.ID().getText(), AGG_MIN_METHOD)) {
        try {
            String field= aggregateItemClauseContext.collection().identity(0).getText();
            aggregateQuery.setAggregationBuilder(AggregationBuilders.min(AGG_MIN_METHOD).field(field));
        }catch (IllegalArgumentException e){
            throw new ElasticSql2DslException(e);
        }
    }
}
 
Example 14
Source File: SentenceQuiz.java    From 10000sentences with Apache License 2.0 5 votes vote down vote up
public boolean guessWord(String word) {
    if (isFinished()) {
        return false;
    }
    boolean guessed = StringUtils.equalsIgnoreCase(chunks.get(currentChunk).word, word);
    if (guessed) {
        ++ currentChunk;
        resetRandomAnswers();
        notifyChange();
        ++ correctAnswersGiven;
    } else {
        ++ incorrectAnswersGiven;
    }
    return guessed;
}
 
Example 15
Source File: TagTypeServiceImpl.java    From herd with Apache License 2.0 4 votes vote down vote up
@Override
public TagType updateTagType(TagTypeKey tagTypeKey, TagTypeUpdateRequest request)
{
    // Perform validation and trim.
    tagTypeHelper.validateTagTypeKey(tagTypeKey);

    // Perform validation and trim the alternate key parameters.
    validateTagTypeUpdateRequest(request);

    // Retrieve and ensure that a tag type already exists with the specified key.
    TagTypeEntity tagTypeEntity = tagTypeDaoHelper.getTagTypeEntity(tagTypeKey);

    // Validate the display name does not already exist for another tag type.
    if (!StringUtils.equalsIgnoreCase(tagTypeEntity.getDisplayName(), request.getDisplayName()))
    {
        // Validate that the description is different.
        tagTypeDaoHelper.assertTagTypeDisplayNameDoesNotExist(request.getDisplayName());
    }

    // Update and persist the tag type entity.
    updateTagTypeEntity(tagTypeEntity, request);

    // Notify the search index that a business object definition must be updated.
    List<TagEntity> tagEntities = tagDao.getTagsByTagTypeEntityAndParentTagCode(tagTypeEntity, null, null);
    List<BusinessObjectDefinitionEntity> businessObjectDefinitionEntities = businessObjectDefinitionDao.getBusinessObjectDefinitions(tagEntities);
    LOGGER.info("Modify the business object definitions in the search index associated with the tag type being updated." +
            " tagTypeCode=\"{}\", businessObjectDefinitionIds=[{}], searchIndexUpdateType=\"{}\"", tagTypeEntity.getCode(),
        businessObjectDefinitionEntities.stream().map(businessObjectDefinitionEntity -> String.valueOf(businessObjectDefinitionEntity.getId()))
            .collect(Collectors.joining(", ")), SEARCH_INDEX_UPDATE_TYPE_UPDATE);
    searchIndexUpdateHelper.modifyBusinessObjectDefinitionsInSearchIndex(businessObjectDefinitionEntities, SEARCH_INDEX_UPDATE_TYPE_UPDATE);

    // Notify the tag search index that tags must be updated.
    LOGGER.info(
        "Modify the tags in the search index associated with the tag type being updated. tagTypeCode=\"{}\", tagIds=[{}], searchIndexUpdateType=\"{}\"",
        tagTypeEntity.getCode(),
        tagEntities.stream().map(tag -> String.format("{tagTypeCode=\"%s\", tagCode=\"%s\"}", tag.getTagType().getCode(), tag.getTagCode()))
            .collect(Collectors.joining(", ")), SEARCH_INDEX_UPDATE_TYPE_UPDATE);
    searchIndexUpdateHelper.modifyTagsInSearchIndex(tagEntities, SEARCH_INDEX_UPDATE_TYPE_UPDATE);

    // Create and return the tag type from the persisted entity.
    return createTagTypeFromEntity(tagTypeEntity);
}
 
Example 16
Source File: FdfsConfig2Properties.java    From seppb with MIT License 4 votes vote down vote up
public Properties initByFdfsClientConfig() {
    Properties prop = new Properties();
    Class<?> clazz = clientConfig.getClass();
    Method[] methods = clazz.getMethods();
    for (Method method : methods) {
        String name = method.getName();
        if (name.startsWith("get")) {
            name = name.substring("get".length());
            if (StringUtils.isBlank(name)) {
                continue;
            }
            name = StringUtils.lowerCase(camelToUnderline(name));
            if (name.startsWith("fastdfs")) {
                name = name.substring("fastdfs".length());
            }
            if (name.startsWith("_")) {
                name = name.substring(1);
            }
            if (StringUtils.equalsIgnoreCase("class", name)) {
                continue;
            }
            name = propPrefix + name;
            try {
                Object result = method.invoke(clientConfig);
                if (result != null) {
                    if (result instanceof String) {
                        if (StringUtils.isNotBlank((CharSequence) result)) {
                            prop.put(name, result);
                        }
                    } else {
                        prop.put(name, result);
                    }
                }
            } catch (IllegalAccessException | InvocationTargetException e) {
                e.printStackTrace();
            }
        }
    }

    return prop;
}
 
Example 17
Source File: ActionListStmForPersonPrevWithFilter.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
protected ActionResult<List<Wo>> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id, Integer count, JsonElement jsonElement ) throws Exception {
	ActionResult<List<Wo>> result = new ActionResult<>();
	List<Wo> wraps = null;
	EffectivePerson currentPerson = this.effectivePerson(request);
	long total = 0;
	List<StatisticPersonForMonth> statisticList = null;
	WrapInFilterStatisticPersonForMonth wrapIn = null;
	Boolean check = true;
	
	try {
		wrapIn = this.convertToWrapIn( jsonElement, WrapInFilterStatisticPersonForMonth.class );
	} catch (Exception e ) {
		check = false;
		Exception exception = new ExceptionWrapInConvert( e, jsonElement );
		result.error( exception );
		logger.error( e, currentPerson, request, null);
	}
	if(check ){
		try {
			EntityManagerContainer emc = EntityManagerContainerFactory.instance().create();
			Business business = new Business(emc);

			// 查询出ID对应的记录的sequence
			Object sequence = null;
			if (id == null || "(0)".equals(id) || id.isEmpty()) {
			} else {
				if (!StringUtils.equalsIgnoreCase(id, StandardJaxrsAction.EMPTY_SYMBOL)) {
					sequence = PropertyUtils.getProperty(
							emc.find(id, StatisticPersonForMonth.class ),  JpaObject.sequence_FIELDNAME);
				}
			}

			//将下级组织的数据纳入组织统计数据查询范围
			List<String> unitNameList = getUnitNameList(wrapIn.getTopUnitName(), wrapIn.getUnitName(), effectivePerson.getDebugger() );			
			wrapIn.setUnitName(unitNameList);
			// 从数据库中查询符合条件的一页数据对象
			statisticList = business.getStatisticPersonForMonthFactory().listIdsNextWithFilter(id, count, sequence, wrapIn);

			// 从数据库中查询符合条件的对象总数
			total = business.getStatisticPersonForMonthFactory().getCountWithFilter(wrapIn);

			// 将所有查询出来的有状态的对象转换为可以输出的过滤过属性的对象
			wraps = Wo.copier.copy(statisticList);
		} catch (Throwable th) {
			th.printStackTrace();
			result.error(th);
		}
	}
	result.setCount(total);
	result.setData(wraps);
	return result;
}
 
Example 18
Source File: EnterpriseChannelValidation.java    From botbuilder-java with MIT License 4 votes vote down vote up
/**
 * Validates a {@link ClaimsIdentity}.
 *
 * @param identity    The ClaimsIdentity to validate.
 * @param credentials The user defined set of valid credentials, such as the
 *                    AppId.
 * @param serviceUrl  The service url from the request.
 * @return A valid ClaimsIdentity.
 *
 *         On join:
 * @throws AuthenticationException A token issued by the Bot Framework will FAIL
 *                                 this check. Only Emulator tokens will pass.
 */
public static CompletableFuture<ClaimsIdentity> validateIdentity(
    ClaimsIdentity identity,
    CredentialProvider credentials,
    String serviceUrl
) {

    CompletableFuture<ClaimsIdentity> result = new CompletableFuture<>();

    // Validate the identity

    if (identity == null || !identity.isAuthenticated()) {
        result.completeExceptionally(new AuthenticationException("Invalid Identity"));
        return result;
    }

    if (
        !StringUtils.equalsIgnoreCase(
            identity.getIssuer(), AuthenticationConstants.TO_BOT_FROM_CHANNEL_TOKEN_ISSUER
        )
    ) {

        result.completeExceptionally(new AuthenticationException("Wrong Issuer"));
        return result;
    }

    // The AppId from the claim in the token must match the AppId specified by the
    // developer. Note that
    // the Bot Framework uses the Audience claim ("aud") to pass the AppID.
    String appIdFromAudienceClaim =
        identity.claims().get(AuthenticationConstants.AUDIENCE_CLAIM);
    if (StringUtils.isEmpty(appIdFromAudienceClaim)) {
        // Claim is present, but doesn't have a value. Not Authorized.
        result.completeExceptionally(new AuthenticationException("No Audience Claim"));
        return result;
    }

    // Now check that the AppID in the claim set matches
    // what we're looking for. Note that in a multi-tenant bot, this value
    // comes from developer code that may be reaching out to a service, hence the
    // Async validation.

    return credentials.isValidAppId(appIdFromAudienceClaim).thenApply(isValid -> {
        if (!isValid) {
            throw new AuthenticationException(
                String.format("Invalid AppId passed on token: '%s'.", appIdFromAudienceClaim)
            );
        }

        String serviceUrlClaim =
            identity.claims().get(AuthenticationConstants.SERVICE_URL_CLAIM);
        if (StringUtils.isEmpty(serviceUrl)) {
            throw new AuthenticationException(
                String.format("Invalid serviceurl passed on token: '%s'.", serviceUrlClaim)
            );
        }

        if (!StringUtils.equals(serviceUrl, serviceUrlClaim)) {
            throw new AuthenticationException(
                String.format("serviceurl doesn't match claim: '%s'.", serviceUrlClaim)
            );
        }

        return identity;
    });
}
 
Example 19
Source File: ActionListStdForUnitNextWithFilter.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
protected ActionResult<List<Wo>> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id, Integer count, JsonElement jsonElement ) throws Exception {
	ActionResult<List<Wo>> result = new ActionResult<>();
	List<Wo> wraps = null;
	EffectivePerson currentPerson = this.effectivePerson(request);
	long total = 0;
	List<StatisticUnitForDay> statisticList = null;
	WrapInFilterStatisticUnitForDay wrapIn = null;
	Boolean check = true;
	
	try {
		wrapIn = this.convertToWrapIn( jsonElement, WrapInFilterStatisticUnitForDay.class );
	} catch (Exception e ) {
		check = false;
		Exception exception = new ExceptionWrapInConvert( e, jsonElement );
		result.error( exception );
		logger.error( e, currentPerson, request, null);
	}
	if(check ){
		try {
			EntityManagerContainer emc = EntityManagerContainerFactory.instance().create();
			Business business = new Business(emc);

			// 查询出ID对应的记录的sequence
			Object sequence = null;
			if (id == null || "(0)".equals(id) || id.isEmpty()) {
			} else {
				if (!StringUtils.equalsIgnoreCase(id, StandardJaxrsAction.EMPTY_SYMBOL)) {
					sequence = PropertyUtils.getProperty(
							emc.find(id, StatisticUnitForDay.class ),  JpaObject.sequence_FIELDNAME);
				}
			}

			//将下级组织的数据纳入组织统计数据查询范围
			List<String> unitNameList = getUnitNameList(wrapIn.getTopUnitName(), wrapIn.getUnitName(), effectivePerson.getDebugger() );			
			wrapIn.setUnitName(unitNameList);
			// 从数据库中查询符合条件的一页数据对象
			statisticList = business.getStatisticUnitForDayFactory().listIdsNextWithFilter(id, count, sequence,
					wrapIn);

			// 从数据库中查询符合条件的对象总数
			total = business.getStatisticUnitForDayFactory().getCountWithFilter(wrapIn);

			// 将所有查询出来的有状态的对象转换为可以输出的过滤过属性的对象
			wraps = Wo.copier.copy(statisticList);
		} catch (Throwable th) {
			th.printStackTrace();
			result.error(th);
		}
	}
	result.setCount(total);
	result.setData(wraps);
	return result;
}
 
Example 20
Source File: ReplicaMutator.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public ZkWriteCommand addReplicaProperty(ClusterState clusterState, ZkNodeProps message) {
  if (!checkKeyExistence(message, ZkStateReader.COLLECTION_PROP) ||
      !checkKeyExistence(message, ZkStateReader.SHARD_ID_PROP) ||
      !checkKeyExistence(message, ZkStateReader.REPLICA_PROP) ||
      !checkKeyExistence(message, ZkStateReader.PROPERTY_PROP) ||
      !checkKeyExistence(message, ZkStateReader.PROPERTY_VALUE_PROP)) {
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
        "Overseer ADDREPLICAPROP requires " +
            ZkStateReader.COLLECTION_PROP + " and " + ZkStateReader.SHARD_ID_PROP + " and " +
            ZkStateReader.REPLICA_PROP + " and " + ZkStateReader.PROPERTY_PROP + " and " +
            ZkStateReader.PROPERTY_VALUE_PROP + " no action taken.");
  }

  String collectionName = message.getStr(ZkStateReader.COLLECTION_PROP);
  String sliceName = message.getStr(ZkStateReader.SHARD_ID_PROP);
  String replicaName = message.getStr(ZkStateReader.REPLICA_PROP);
  String property = message.getStr(ZkStateReader.PROPERTY_PROP).toLowerCase(Locale.ROOT);
  if (StringUtils.startsWith(property, OverseerCollectionMessageHandler.COLL_PROP_PREFIX) == false) {
    property = OverseerCollectionMessageHandler.COLL_PROP_PREFIX + property;
  }
  property = property.toLowerCase(Locale.ROOT);
  String propVal = message.getStr(ZkStateReader.PROPERTY_VALUE_PROP);
  String shardUnique = message.getStr(OverseerCollectionMessageHandler.SHARD_UNIQUE);

  boolean isUnique = false;

  if (SliceMutator.SLICE_UNIQUE_BOOLEAN_PROPERTIES.contains(property)) {
    if (StringUtils.isNotBlank(shardUnique) && Boolean.parseBoolean(shardUnique) == false) {
      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Overseer ADDREPLICAPROP for " +
          property + " cannot have " + OverseerCollectionMessageHandler.SHARD_UNIQUE + " set to anything other than" +
          "'true'. No action taken");
    }
    isUnique = true;
  } else {
    isUnique = Boolean.parseBoolean(shardUnique);
  }

  DocCollection collection = clusterState.getCollection(collectionName);
  Replica replica = collection.getReplica(replicaName);

  if (replica == null) {
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Could not find collection/slice/replica " +
        collectionName + "/" + sliceName + "/" + replicaName + " no action taken.");
  }
  log.info("Setting property {} with value {} for collection {}", property, propVal, collectionName);
  log.debug("Full message: {}", message);
  if (StringUtils.equalsIgnoreCase(replica.getStr(property), propVal))
    return ZkStateWriter.NO_OP; // already the value we're going to set

  // OK, there's no way we won't change the cluster state now
  Map<String, Replica> replicas = collection.getSlice(sliceName).getReplicasCopy();
  if (isUnique == false) {
    replicas.get(replicaName).getProperties().put(property, propVal);
  } else { // Set prop for this replica, but remove it for all others.
    for (Replica rep : replicas.values()) {
      if (rep.getName().equalsIgnoreCase(replicaName)) {
        rep.getProperties().put(property, propVal);
      } else {
        rep.getProperties().remove(property);
      }
    }
  }
  Slice newSlice = new Slice(sliceName, replicas, collection.getSlice(sliceName).shallowCopy(),collectionName);
  DocCollection newCollection = CollectionMutator.updateSlice(collectionName, collection,
      newSlice);
  return new ZkWriteCommand(collectionName, newCollection);
}