public String getAuthenticationPage() { if(StringUtil.isEmpty(authenticationPage)){ // return default authentication page if it is not given in managed bean return "/sbt/loginForm.html"; } return authenticationPage; }
public static short parseShort(String s) { if(!StringUtil.isEmpty(s)) { try { return Short.parseShort(s); } catch(NumberFormatException e) {} return(short)Double.parseDouble(s); } return 0; }
protected Element element(String tagName) { if(StringUtil.isEmpty(tagName)) throw new NullPointerException("The name of an element may not be null or empty."); return doc.createElement(tagName); }
protected boolean isExceedsVersion(String version, String normalizedMinimumVersion) { version = normalizeVersion(version); if (StringUtil.isEmpty(version)) { return false; } if (!StringUtil.isEmpty(normalizedMinimumVersion)) { if (version.compareTo(normalizedMinimumVersion) >= 0) { return true; } } return false; }
private void checkKey(String key) { if(StringUtil.isEmpty(key)) { throw new IllegalArgumentException("Empty key"); // $NLS-Preferences.Emptykey-1$ } if(key.indexOf((char)0)>=0) { throw new IllegalArgumentException("Key cannot contain '\\0' character"); // $NLS-Preferences.Keycannotcontaina0character-1$ } if(key.indexOf('=')>=0) { throw new IllegalArgumentException("Key cannot contain '=' character"); // $NLS-Preferences.Keycannotcontainancharacter-1$ } }
public String toString() { StringBuffer sb = new StringBuffer(); if (!StringUtil.isEmpty(_prefix)) { sb.append(_prefix).append(":"); //$NON-NLS-1$ } sb.append(_name).append("[").append(_index).append("]"); //$NON-NLS-2$ return sb.toString(); }
public String getComment() { if (!StringUtil.isEmpty(comment)) { return comment; } return getContent(); }
@Override public boolean isAuthenticated() throws ClientServicesException { if (StringUtil.isEmpty(getCookieCache())) { return false; } else { return true; } }
protected String normalizeVersion(String version) { if (StringUtil.isEmpty(version)) { return ""; } String[] split = StringUtil.splitString(version, '.'); StringBuilder sb = new StringBuilder(); for (String part : split) { sb.append(String.format("%4s", part)); } return sb.toString(); }
private static String createSourceReferenceId(Element elt) { StringBuffer buffer = new StringBuffer(); while (StringUtil.isEmpty(elt.getAttribute("id"))) { //$NON-NLS-1$ insertElementReferenceId(buffer, elt); if (elt.getParentNode() == elt.getOwnerDocument()) { break; } elt = (Element)elt.getParentNode(); } buffer.insert(0, elt.getAttribute("id")); //$NON-NLS-1$ return buffer.toString(); }
@Override public void checkValid() throws SBTException { if(StringUtil.isEmpty(getUrl())) { throw new SBTException(null,"The Endpoint url is empty for {0}",getClass()); } }
/** * Set default values for authentication service and signature method */ protected void initDefaults() { if (StringUtil.isEmpty(getAuthenticationService())) { setAuthenticationService(AUTHENTICATION_SERVICE); } if (StringUtil.isEmpty(getSignatureMethod())) { setSignatureMethod(SIGNATURE_METHOD); } }
public static Endpoint getEndpoint(String name, String defaultName) { Endpoint e = getEndpointUnchecked(name,defaultName); if(e==null) { if(StringUtil.isEmpty(name)) { name = defaultName; } throw new SBTException(null,"Cannot find Endpoint {0}",name); } return e; }
public String getCommentId() { if (!StringUtil.isEmpty(commentId)) { return commentId; } if (getAsString(FileEntryXPath.Category) != null && !getAsString(FileEntryXPath.Category).equals("comment")) { return null; } return getAsString(FileEntryXPath.Uuid); }
@Override public void setUrl(String url) { super.setUrl(url); // set defaults for other url's if not already set if (StringUtil.isEmpty(getAuthorizationURL())) { setAuthorizationURL(url + AUTHORIZATION_PATH); } if (StringUtil.isEmpty(getAccessTokenURL())) { setAccessTokenURL(url + ACCESS_TOKEN_PATH); } }
public void deleteFlaggedFiles(String fileId) throws ClientServicesException { if (StringUtil.isEmpty(fileId)) { throw new ClientServicesException(null, Messages.Invalid_FileId); } String requestUri = getModerationUri(fileId, Categories.REVIEW.get(), ModerationContentTypes.DOCUMENTS.get()); if (StringUtil.isEmpty(requestUri)) { return; } deleteData(requestUri, null, null); }
@Override public void setUrl(String url) { super.setUrl(url); // Make the URL the service name if not already set if (StringUtil.isEmpty(oAuthHandler.getServiceName())) { oAuthHandler.setServiceName(url); } }
private String getHttpProxy(Endpoint endpoint) { String httpProxy = endpoint.getHttpProxy(); if (StringUtil.isEmpty(httpProxy)) { httpProxy = Context.get().getProperty("sbt.httpProxy"); } return httpProxy; }
@Override protected Content getFileContent(File file, long length, String fileName) { String fileExt = MIME.getFileExtension(fileName); String contentType = MIME.getMIMETypeFromExtension(fileExt); contentType = (StringUtil.isEmpty(contentType)) ? MIMETYPE_DEFAULT : contentType; Content content = new ContentFile(file, contentType); return content; }