public static CompressionStrategy[] noNoneValues() { return (CompressionStrategy[]) ArrayUtils.removeElement(CompressionStrategy.values(), NONE); }
@Override public BroadleafAttributeModifier getModifiedAttributes(String tagName, Map<String, String> tagAttributes, String attributeName, String attributeValue, BroadleafTemplateContext context) { BroadleafRequestContext blcContext = BroadleafRequestContext.getBroadleafRequestContext(); HttpServletRequest request = blcContext.getRequest(); String baseUrl = request.getRequestURL().toString(); Map<String, String[]> params = new HashMap<>(request.getParameterMap()); SearchFacetResultDTO result = (SearchFacetResultDTO) context.parseExpression(attributeValue); String key = facetService.getUrlKey(result); String value = facetService.getValue(result); String[] paramValues = params.get(key); if (ArrayUtils.contains(paramValues, facetService.getValue(result))) { paramValues = (String[]) ArrayUtils.removeElement(paramValues, facetService.getValue(result)); } else { paramValues = (String[]) ArrayUtils.add(paramValues, value); } params.remove(SearchCriteria.PAGE_NUMBER); params.put(key, paramValues); String url = ProcessorUtils.getUrl(baseUrl, params); Map<String, String> newAttributes = new HashMap<>(); newAttributes.put("href", url); return new BroadleafAttributeModifier(newAttributes); }
public static CompressionStrategy[] noNoneValues() { return (CompressionStrategy[]) ArrayUtils.removeElement(CompressionStrategy.values(), NONE); }
public static CompressionStrategy[] noNoneValues() { return (CompressionStrategy[]) ArrayUtils.removeElement(CompressionStrategy.values(), NONE); }
private String getPropertyValue(Property[] properties, String key) { String propertyValue = ""; if (properties != null && StringUtils.isNotEmpty(key)) { for (int index = 0; index < properties.length; index++) { Property property = properties[index]; if (key.equalsIgnoreCase(property.getKey())) { propertyValue = property.getValue(); ArrayUtils.removeElement(properties, property); break; } } } if (log.isDebugEnabled()) { log.debug("Returning value for key : " + key + " - " + propertyValue); } return propertyValue; }
private Property[] removeUniqueIdProperty(Property [] properties) { if (ArrayUtils.isEmpty(properties)){ return new Property[0]; } for (int i=0 ; i < properties.length; i++) { if (properties[i] == null){ continue; } if (IdentityApplicationConstants.UNIQUE_ID_CONSTANT.equals(properties[i].getName())) { Property[] propertiesTemp = properties; if (log.isDebugEnabled()){ log.debug("Removing uniqueId property: " + properties[i].getName()); } properties = (Property[])ArrayUtils.removeElement(properties, properties[i]); //Removing uniqueId property from existing properties too propertiesTemp[i] = null; } } return properties; } }
private Property[] removeUniqueIdProperty(Property [] properties) { if (ArrayUtils.isEmpty(properties)){ return new Property[0]; } for (int i=0 ; i < properties.length; i++) { if (properties[i] == null){ continue; } if (IdentityApplicationConstants.UNIQUE_ID_CONSTANT.equals(properties[i].getName())) { Property[] propertiesTemp = properties; if (log.isDebugEnabled()){ log.debug("Removing uniqueId property: " + properties[i].getName()); } properties = (Property[])ArrayUtils.removeElement(properties, properties[i]); //Removing uniqueId property from existing properties too propertiesTemp[i] = null; } } return properties; } }
/** * Removes the payload group from the list of active payload groups. * * @param payloadGroup the payload group to remove from the active list. */ public void removeActivePayloadGroup(PayloadGroup payloadGroup) { if (payloadGroup != null && ArrayUtils.contains(activePayloadGroups, payloadGroup.getDereferencedPath())) { activePayloadGroups = (String[]) ArrayUtils.removeElement(activePayloadGroups, payloadGroup.getDereferencedPath()); properties.put(PN_ACTIVE_PAYLOAD_GROUPS, activePayloadGroups); } }
public void removeActivePayload(Payload payload) { if (ArrayUtils.contains(activePayloads, payload.getDereferencedPath())) { activePayloads = (String[]) ArrayUtils.removeElement(activePayloads, payload.getDereferencedPath()); properties.put(PN_ACTIVE_PAYLOADS, activePayloads); } }
/** * Removes the payload group from the list of active payload groups. * * @param payloadGroup the payload group to remove from the active list. */ public void removeActivePayloadGroup(PayloadGroup payloadGroup) { if (payloadGroup != null && ArrayUtils.contains(activePayloadGroups, payloadGroup.getDereferencedPath())) { activePayloadGroups = (String[]) ArrayUtils.removeElement(activePayloadGroups, payloadGroup.getDereferencedPath()); properties.put(PN_ACTIVE_PAYLOAD_GROUPS, activePayloadGroups); } }
public void removeActivePayload(Payload payload) { if (ArrayUtils.contains(activePayloads, payload.getDereferencedPath())) { activePayloads = (String[]) ArrayUtils.removeElement(activePayloads, payload.getDereferencedPath()); properties.put(PN_ACTIVE_PAYLOADS, activePayloads); } }
public static void main(String[] args) { CommandLineParser parser = new DefaultParser(); HelpFormatter formatter = new HelpFormatter(); try { parser.parse(OPTIONS, args, true); if (GROUP_DIRECTION.getSelected().equals("CLI")) { CLILauncher.main((String[]) ArrayUtils.removeElement(args, "--CLI")); } else if (GROUP_DIRECTION.getSelected().equals("GUI")) { GUILauncher.main((String[]) ArrayUtils.removeElement(args, "--GUI")); } else { throw new ParseException("Unknown entry parameter..."); } } catch (Exception e) { System.err.println(e.getMessage()); formatter.printHelp("N2P-Launcher", OPTIONS); } } }
/** * Filters and sorts a list of localized elements using the given locale list; only localized elements * are returned unless no appropriate localized elements are found, in which case nonlocalized elements * are returned. If there are no nonlocalized elements, the defaultLocale attribute is used to try to find * a suitable match * * @param elements * @param locales * @param defaultLocale the default locale in case none of the supplied locales provide a match * @return the sorted and filtered set of elements */ public static ILocalized[] processElementsByLocales(ILocalized[] elements,String[] locales, String defaultLocale){ if (elements == null) return null; ILocalized[] filteredElements = processElementsByLocales(elements,locales); if (filteredElements == null || filteredElements.length == 0){ for (ILocalized element: elements){ if(element.getLang().equals(defaultLocale)){ return (ILocalized[]) ArrayUtils.removeElement(elements, element); } } } return filteredElements; }
@Ajax @Resource public Response.Content addCalendar(String calendarId) throws Exception { StringBuilder cals = new StringBuilder(); int i = 0; nonDisplayedCalendarList = (String[]) ArrayUtils.removeElement(nonDisplayedCalendarList, calendarId); while (i < nonDisplayedCalendarList.length) { if (!nonDisplayedCalendarList[i].equals(calendarId)) cals.append(nonDisplayedCalendarList[i]).append(","); i++; } settingService_.remove(Context.USER, Scope.APPLICATION, CalendarPortletUtils.HOME_PAGE_CALENDAR_SETTINGS); settingService_.set(Context.USER, Scope.APPLICATION, CalendarPortletUtils.HOME_PAGE_CALENDAR_SETTINGS, SettingValue.create("NonDisplayedCalendar:" + cals.toString())); return setting(); }
@Override public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { Set<String> idTokenNotAllowedGrantTypesSet = OAuthServerConfiguration.getInstance() .getIdTokenNotAllowedGrantTypesSet(); String grantType = tokReqMsgCtx.getOauth2AccessTokenReqDTO().getGrantType(); // validating the authorization_code grant type with openid scope ignoring the IdTokenAllowed element defined // in the identity.xml if (GrantType.AUTHORIZATION_CODE.toString().equals(grantType)) { return true; } else if (!idTokenNotAllowedGrantTypesSet.contains(grantType)) { // if id_token is allowed for requested grant type. return true; } else { // Remove openid scope from the token message context. String[] scopes = (String[]) ArrayUtils.removeElement(tokReqMsgCtx.getScope(), OAuthConstants.Scope.OPENID); tokReqMsgCtx.setScope(scopes); if (log.isDebugEnabled()) { log.debug("id_token is not allowed for requested grant type: " + grantType + ". Removing 'openid' " + "scope."); } // Returning 'true' since we are dropping openid scope and don't need to prevent issuing the token for // remaining scopes. return true; } }
@Override public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) throws UserStoreException, IdentityOAuth2Exception { String[] requestedScopes = tokReqMsgCtx.getScope(); // Remove openid scope from the list if available requestedScopes = (String[]) ArrayUtils.removeElement(requestedScopes, OPENID); //If the token is not requested for specific scopes, return true if (ArrayUtils.isEmpty(requestedScopes)) { return true; } AuthenticatedUser user = tokReqMsgCtx.getAuthorizedUser(); int tenantId = getTenantId(user); String[] userRoles = getUserRoles(user); for (String scope : requestedScopes) { if (!isScopeValid(scope, tenantId)) { //If the scope is not registered return false log.error("Requested scope " + scope + " is invalid"); return false; } if (!isUserAuthorizedForScope(scope, userRoles, tenantId)) { return false; } } return true; }
private void removeClientSecret(ServiceProvider serviceProvider) { InboundAuthenticationConfig inboundAuthenticationConfig = serviceProvider.getInboundAuthenticationConfig(); if (inboundAuthenticationConfig != null) { InboundAuthenticationRequestConfig[] inboundRequestConfigs = inboundAuthenticationConfig. getInboundAuthenticationRequestConfigs(); if (inboundRequestConfigs != null) { for (InboundAuthenticationRequestConfig inboundRequestConfig : inboundRequestConfigs) { if (inboundRequestConfig.getInboundAuthType().equals(OAUTH2)) { Property[] props = inboundRequestConfig.getProperties(); for (Property prop : props) { if (prop.getName().equalsIgnoreCase(OAUTH2_CONSUMER_SECRET)) { props = (Property[]) ArrayUtils.removeElement(props, prop); inboundRequestConfig.setProperties(props); continue; //we are interested only on this property } else { //ignore } } continue;// we are interested only on oauth2 config. Only one will be present. } else { //ignore } } } else { //ignore } } else { //nothing to do } }
@Override public void doExportServiceProvider(ServiceProvider serviceProvider, Boolean exportSecrets) throws IdentityApplicationManagementException { InboundAuthenticationConfig inboundAuthenticationConfig = serviceProvider.getInboundAuthenticationConfig(); if (inboundAuthenticationConfig != null && inboundAuthenticationConfig.getInboundAuthenticationRequestConfigs() != null) { for (InboundAuthenticationRequestConfig authConfig : inboundAuthenticationConfig.getInboundAuthenticationRequestConfigs()) { if (KERBEROS.equals(authConfig.getInboundAuthType())) { inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs( (InboundAuthenticationRequestConfig[]) ArrayUtils.removeElement (inboundAuthenticationConfig.getInboundAuthenticationRequestConfigs(), authConfig)); return; } } } } }
@Override public void onValueTouched(final InputColumn<?>[] value) { try { super.onValueTouched(value); } catch (final CoalesceUnitMissingColumnException e) { logger.warn("Missing input column for coalesce unit", e); final CoalesceUnit failingCoalesceUnit = e.getCoalesceUnit(); final CoalesceUnit[] newCoalesceUnits = (CoalesceUnit[]) ArrayUtils.removeElement(_unitPropertyWidget.getValue(), failingCoalesceUnit); for (final InputColumn<?> inputColumn : failingCoalesceUnit.getInputColumns()) { _pickedInputColumns.remove(inputColumn); } getCoalesceUnitPanels().stream() .filter(coalesceUnitPanel -> coalesceUnitPanel.getCoalesceUnit().equals(failingCoalesceUnit)) .forEach(this::removeCoalesceUnitPanel); _unitPropertyWidget.onValueTouched(newCoalesceUnits); updateAvailableInputColumns(); fireBothValuesChanged(); updateUI(); } }
@Override public void doExportServiceProvider(ServiceProvider serviceProvider, Boolean exportSecrets) throws IdentityApplicationManagementException { InboundAuthenticationConfig inboundAuthenticationConfig = serviceProvider.getInboundAuthenticationConfig(); if (inboundAuthenticationConfig != null && inboundAuthenticationConfig.getInboundAuthenticationRequestConfigs() != null) { for (InboundAuthenticationRequestConfig authConfig : inboundAuthenticationConfig.getInboundAuthenticationRequestConfigs()) { if (KERBEROS.equals(authConfig.getInboundAuthType())) { inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs( (InboundAuthenticationRequestConfig[]) ArrayUtils.removeElement (inboundAuthenticationConfig.getInboundAuthenticationRequestConfigs(), authConfig)); return; } } } } }