public void addFilterClasses(Map<String, Class<? extends Filter>> classes) { if (Collections.isEmpty(classes)) { return; } this.configuredFilters.putAll(classes); }
public void addFilterClasses(Map<String, Class<? extends Filter>> classes) { if (Collections.isEmpty(classes)) { return; } this.configuredFilters.putAll(classes); }
@Override public void putAll(Map<? extends String, ?> m) { if (com.stormpath.sdk.lang.Collections.isEmpty(m)) { return; } writeLock.lock(); try { this.backingMap.putAll(m); } finally { writeLock.unlock(); } }
protected void setAttributes(HttpServletRequest request, Map<String, ?> model) { if (Collections.isEmpty(model)) { return; } for (String key : model.keySet()) { Object value = model.get(key); if (value != null) { request.setAttribute(key, value); } } } }
@Override public Map<String,String> getProperties() { Map<String,String> envVars = System.getenv(); if (!Collections.isEmpty(envVars)) { return new LinkedHashMap<String, String>(envVars); } return java.util.Collections.emptyMap(); } }
@Override public Map<String,String> getProperties() { Map<String,String> envVars = System.getenv(); if (!Collections.isEmpty(envVars)) { return new LinkedHashMap<String, String>(envVars); } return java.util.Collections.emptyMap(); } }
protected String getCacheKey(String href, QueryString query, Class<? extends Resource> clazz) { String key = href; if (collectionCachingEnabled && CollectionResource.class.isAssignableFrom(clazz) && !Collections.isEmpty(query)) { key = href + "?" + query.toString(); } return key; }
@Override public String get(HttpServletRequest request, HttpServletResponse response) { List<String> subdomains = subdomainResolver.get(request, null); String subdomain = null; if (!Collections.isEmpty(subdomains)) { subdomain = subdomains.get(0); } return subdomain; } }
private static String getOktaHref(Map<String, Object> properties) { // _links.self.href -> href Map<String, Object> linksMap = getPropertyMap(properties,OKTA_LINKS); if (!Collections.isEmpty(linksMap)) { Map<String, Object> self = getPropertyMap(linksMap, OKTA_SELF); if (!Collections.isEmpty(self)) { return (String) self.get(OKTA_HREF); } } return null; }
public QueryString(Map<String,?> source) { super(); if (!Collections.isEmpty(source)) { for(Map.Entry<String,?> entry : source.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); String sValue = value != null ? String.valueOf(value) : null; put(key, sValue); } } }
@Override public String getLinkBaseUrl() { Map<String, String> defaultModel = getDefaultModel(false); if(Collections.isEmpty(defaultModel)){ return null; } return defaultModel.get(LINK_BASE_URL); }
public String getUserId() { Map<String, Object> embedded = getMap(EMBEDDED); Map<String, Object> user = (Map<String, Object>) embedded.get("user"); if (!Collections.isEmpty(user)) { return (String) user.get("id"); } return null; } }
private String getProtocol(Map<String, Object> item) { String type = null; Map<String, Object> protocol = getSubMap(item, "protocol"); if (!Collections.isEmpty(protocol)) { type = (String) protocol.get("type"); } return type; }
private static String getOktaHref(Map<String, Object> properties) { // _links.self.href -> href Map<String, Object> linksMap = getPropertyMap(properties,OKTA_LINKS); if (!Collections.isEmpty(linksMap)) { Map<String, Object> self = getPropertyMap(linksMap, OKTA_SELF); if (!Collections.isEmpty(self)) { return (String) self.get(OKTA_HREF); } } return null; }
public Set<DispatcherType> stormpathFilterDispatcherTypes() { Set<String> names = Strings.commaDelimitedListToSet(stormpathFilterDispatcherTypes); if (Collections.isEmpty(names)) { return java.util.Collections.emptySet(); } Set<DispatcherType> types = new LinkedHashSet<>(names.size()); for (String name : names) { types.add(DispatcherType.valueOf(name)); } return types; }
public Saver<AuthenticationResult> stormpathAuthenticationResultSaver() { List<Saver<AuthenticationResult>> savers = stormpathAuthenticationResultSavers(); if (Collections.isEmpty(savers)) { String msg = "No Saver<AuthenticationResult> instances have been enabled or configured. This is " + "required to save authentication result state."; throw new IllegalStateException(msg); } return new AuthenticationResultSaver(savers); }
@Override public String getUsername() { Map credMap = getMap(CREDENTIALS); if (!Collections.isEmpty(credMap)) { return (String) credMap.get(USERNAME.getName()); } return null; }
@Override public ResourceDataResult filter(final ResourceDataRequest req) { CanonicalUri uri = req.getUri(); Request getRequest = new DefaultRequest(HttpMethod.GET, uri.getAbsolutePath(), uri.getQuery()); Response getResponse = execute(getRequest); Map<String,?> body = getBody(getResponse); if (Collections.isEmpty(body)) { throw new IllegalStateException("Unable to obtain resource data from the API server or from cache."); } return new DefaultResourceDataResult(req.getAction(), uri, req.getResourceClass(), (Map<String,Object>)body); } });
@Override public ResourceDataResult filter(final ResourceDataRequest req) { CanonicalUri uri = req.getUri(); Request getRequest = new DefaultRequest(HttpMethod.GET, uri.getAbsolutePath(), uri.getQuery()); Response getResponse = execute(getRequest); Map<String,?> body = getBody(getResponse); if (Collections.isEmpty(body)) { throw new IllegalStateException("Unable to obtain resource data from the API server or from cache."); } return new DefaultResourceDataResult(req.getAction(), uri, req.getResourceClass(), (Map<String,Object>)body); } });
private void apply(FormController controller, ControllerConfig cr) { controller.setUri(cr.getUri()); controller.setNextUri(cr.getNextUri()); controller.setView(cr.getView()); controller.setControllerKey(cr.getControllerKey()); List<Field> fields = cr.getFormFields(); if (!Collections.isEmpty(fields)) { //might be empty if the fields are static / configured within the controller controller.setFormFields(fields); } }