code
stringlengths
73
34.1k
label
stringclasses
1 value
public boolean hasValue(String fieldName) { return resultMap.containsKey(fieldName) && resultMap.get(fieldName) != null; }
java
public <T> T fetchObject(String objectId, Class<T> type) { URI uri = URIBuilder.fromUri(getBaseGraphApiUrl() + objectId).build(); return getRestTemplate().getForObject(uri, type); }
java
@RequestMapping(value="/{subscription}", method=GET, params="hub.mode=subscribe") public @ResponseBody String verifySubscription( @PathVariable("subscription") String subscription, @RequestParam("hub.challenge") String challenge, @RequestParam("hub.verify_token") String verifyToken) { logger.debug("Received...
java
void handleFacebookError(HttpStatus statusCode, FacebookError error) { if (error != null && error.getCode() != null) { int code = error.getCode(); if (code == UNKNOWN) { throw new UncategorizedApiException(FACEBOOK_PROVIDER_ID, error.getMessage(), null); } else if (code == SERVICE) { throw new Se...
java
private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(R.string.app_name); }
java
public String getGroup(String groupId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_GROUP); parameters.put("group_id", groupId); Response response = transport.get(transport.getPath(), parameters, apiK...
java
public String getUserProfile(String userId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_USER_PROFILE); parameters.put("user_id", userId); Response response = transport.get(transport.getPath(), parame...
java
public Group lookupGroup(String url) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_LOOKUP_GROUP); parameters.put("url", url); Response response = transport.get(transport.getPath(), parameters, apiKey, shar...
java
public String lookupUser(String url) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_LOOKUP_USER); parameters.put("url", url); Response response = transport.get(transport.getPath(), parameters, apiKey, share...
java
public Gallery lookupGallery(String galleryId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_LOOKUP_GALLERY); parameters.put("url", galleryId); Response response = transport.get(transport.getPath(), parame...
java
public void add(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ADD); parameters.put("photo_id", photoId); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sha...
java
public PhotoContext getContext(String photoId, String userId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_CONTEXT); parameters.put("photo_id", photoId); parameters.put("user_id", userId); Re...
java
public void editCoords(String photoId, String userId, Rectangle bounds) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_COORDS); parameters.put("photo_id", photoId); parameters.put("user_id", userId); ...
java
@Override public AuthInterface getAuthInterface() { if (authInterface == null) { authInterface = new AuthInterface(apiKey, sharedSecret, transport); } return authInterface; }
java
@Override public ActivityInterface getActivityInterface() { if (activityInterface == null) { activityInterface = new ActivityInterface(apiKey, sharedSecret, transport); } return activityInterface; }
java
@Override public TagsInterface getTagsInterface() { if (tagsInterface == null) { tagsInterface = new TagsInterface(apiKey, sharedSecret, transport); } return tagsInterface; }
java
@Override public SuggestionsInterface getSuggestionsInterface() { if (suggestionsInterface == null) { suggestionsInterface = new SuggestionsInterface(apiKey, sharedSecret, transport); } return suggestionsInterface; }
java
@Override public GroupDiscussInterface getDiscussionInterface() { if (discussionInterface == null) { discussionInterface = new GroupDiscussInterface(apiKey, sharedSecret, transport); } return discussionInterface; }
java
public Collection<Service> getServices() throws FlickrException { List<Service> list = new ArrayList<Service>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_SERVICES); Response response = transportAPI.get(transportAPI.getPath(...
java
public void postPhoto(Photo photo, String blogId, String blogPassword) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_POST_PHOTO); parameters.put("blog_id", blogId); parameters.put("photo_id", photo.getId());...
java
public void postPhoto(Photo photo, String blogId) throws FlickrException { postPhoto(photo, blogId, null); }
java
public Collection<Blog> getList() throws FlickrException { List<Blog> blogs = new ArrayList<Blog>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST); Response response = transportAPI.post(transportAPI.getPath(), parameters...
java
private static String getAttribute(String name, Element firstElement, Element secondElement) { String val = firstElement.getAttribute(name); if (val.length() == 0 && secondElement != null) { val = secondElement.getAttribute(name); } return val; }
java
public static final PhotoList<Photo> createPhotoList(Element photosElement) { PhotoList<Photo> photos = new PhotoList<Photo>(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perp...
java
public OAuth1RequestToken getRequestToken(String callbackUrl) { String callback = (callbackUrl != null) ? callbackUrl : OUT_OF_BOUND_AUTH_METHOD; OAuth10aService service = new ServiceBuilder(apiKey) .apiSecret(sharedSecret) .callback(callback) .buil...
java
public String getAuthorizationUrl(OAuth1RequestToken oAuthRequestToken, Permission permission) { OAuth10aService service = new ServiceBuilder(apiKey) .apiSecret(sharedSecret) .build(FlickrApi.instance()); String authorizationUrl = service.getAuthorizationUrl(oAuthRe...
java
@SuppressWarnings("boxing") public OAuth1Token getAccessToken(OAuth1RequestToken oAuthRequestToken, String verifier) { OAuth10aService service = new ServiceBuilder(apiKey) .apiSecret(sharedSecret) .build(FlickrApi.instance()); // Flickr seems to return invalid ...
java
public OAuth1RequestToken exchangeAuthToken(String authToken) throws FlickrException { // Use TreeMap so keys are automatically sorted alphabetically Map<String, String> parameters = new TreeMap<String, String>(); parameters.put("method", METHOD_EXCHANGE_TOKEN); parameters.put(Flic...
java
private OAuth1RequestToken constructToken(Response response) { Element authElement = response.getPayload(); String oauthToken = XMLUtilities.getChildValue(authElement, "oauth_token"); String oauthTokenSecret = XMLUtilities.getChildValue(authElement, "oauth_token_secret"); OAuth1Req...
java
private String getSignature(String sharedSecret, Map<String, String> params) { StringBuffer buffer = new StringBuffer(); buffer.append(sharedSecret); for (Map.Entry<String, String> entry : params.entrySet()) { buffer.append(entry.getKey()); buffer.append(entry.getVal...
java
@Deprecated public static URL buildUrl(String host, int port, String path, Map<String, String> parameters) throws MalformedURLException { return buildUrl("http", port, path, parameters); }
java
public static URL buildUrl(String scheme, String host, int port, String path, Map<String, String> parameters) throws MalformedURLException { checkSchemeAndPort(scheme, port); StringBuilder buffer = new StringBuilder(); if (!host.startsWith(scheme + "://")) { buffer.append(scheme)...
java
@Override public String upload(byte[] data, UploadMetaData metaData) throws FlickrException { Payload payload = new Payload(data); return sendUploadRequest(metaData, payload); }
java
@Override public String upload(File file, UploadMetaData metaData) throws FlickrException { Payload payload = new Payload(file); return sendUploadRequest(metaData, payload); }
java
@Override public String upload(InputStream in, UploadMetaData metaData) throws FlickrException { Payload payload = new Payload(in); return sendUploadRequest(metaData, payload); }
java
@Override public String replace(File file, String flickrId, boolean async) throws FlickrException { Payload payload = new Payload(file, flickrId); return sendReplaceRequest(async, payload); }
java
private String getResponseString(boolean async, UploaderResponse response) { return async ? response.getTicketId() : response.getPhotoId(); }
java
@Deprecated public void setViews(String views) { if (views != null) { try { setViews(Integer.parseInt(views)); } catch (NumberFormatException e) { setViews(-1); } } }
java
public void setRotation(String rotation) { if (rotation != null) { try { setRotation(Integer.parseInt(rotation)); } catch (NumberFormatException e) { setRotation(-1); } } }
java
@Deprecated public InputStream getOriginalAsStream() throws IOException, FlickrException { if (originalFormat != null) { return getOriginalImageAsStream("_o." + originalFormat); } return getOriginalImageAsStream(DEFAULT_ORIGINAL_IMAGE_SUFFIX); }
java
public String getOriginalUrl() throws FlickrException { if (originalSize == null) { if (originalFormat != null) { return getOriginalBaseImageUrl() + "_o." + originalFormat; } return getOriginalBaseImageUrl() + DEFAULT_ORIGINAL_IMAGE_SUFFIX; } els...
java
@Deprecated private BufferedImage getImage(String suffix) throws IOException { StringBuffer buffer = getBaseImageUrl(); buffer.append(suffix); return _getImage(buffer.toString()); }
java
@Deprecated private BufferedImage getOriginalImage(String suffix) throws IOException, FlickrException { StringBuffer buffer = getOriginalBaseImageUrl(); buffer.append(suffix); return _getImage(buffer.toString()); }
java
@Deprecated private InputStream getImageAsStream(String suffix) throws IOException { StringBuffer buffer = getBaseImageUrl(); buffer.append(suffix); return _getImageAsStream(buffer.toString()); }
java
public void setSizes(Collection<Size> sizes) { for (Size size : sizes) { if (size.getLabel() == Size.SMALL) { smallSize = size; } else if (size.getLabel() == Size.SQUARE) { squareSize = size; } else if (size.getLabel() == Size.THUMB) { ...
java
public void rotate(String photoId, int degrees) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ROTATE); parameters.put("photo_id", photoId); parameters.put("degrees", String.valueOf(degrees)); Resp...
java
public Map<String, String> getUploadParameters() { Map<String, String> parameters = new TreeMap<>(); String title = getTitle(); if (title != null) { parameters.put("title", title); } String description = getDescription(); if (description != null) ...
java
public void deleteComment(String commentId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_DELETE_COMMENT); parameters.put("comment_id", commentId); // Note: This method requires an HTTP POST request. ...
java
public void editComment(String commentId, String commentText) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_COMMENT); parameters.put("comment_id", commentId); parameters.put("comment_text", commentText)...
java
public MembersList<Member> getList(String groupId, Set<String> memberTypes, int perPage, int page) throws FlickrException { MembersList<Member> members = new MembersList<Member>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST); ...
java
public void setLabel(String label) { int ix = lstSizes.indexOf(label); if (ix != -1) { setLabel(ix); } }
java
public Photoset create(String title, String description, String primaryPhotoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_CREATE); parameters.put("title", title); parameters.put("description", descriptio...
java
public void editMeta(String photosetId, String title, String description) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_META); parameters.put("photoset_id", photosetId); parameters.put("title", title); ...
java
public void editPhotos(String photosetId, String primaryPhotoId, String[] photoIds) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_PHOTOS); parameters.put("photoset_id", photosetId); parameters.put("prim...
java
public Photoset getInfo(String photosetId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); parameters.put("photoset_id", photosetId); Response response = transportAPI.get(transportAPI.getPath(), p...
java
public PhotoList<Photo> getPhotos(String photosetId, Set<String> extras, int privacy_filter, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PH...
java
public void orderSets(String[] photosetIds) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ORDER_SETS); ; parameters.put("photoset_ids", StringUtilities.join(photosetIds, ",")); Response response =...
java
public Collection<Contact> getList() throws FlickrException { ContactList<Contact> contacts = new ContactList<Contact>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST); Response response = transportAPI.get(transpor...
java
public Collection<Contact> getListRecentlyUploaded(Date lastUpload, String filter) throws FlickrException { List<Contact> contacts = new ArrayList<Contact>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST_RECENTLY_UPLOADED); ...
java
public Collection<Contact> getPublicList(String userId) throws FlickrException { List<Contact> contacts = new ArrayList<Contact>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PUBLIC_LIST); parameters.put("user_id", userId); ...
java
public Collection<String> getMethods() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_METHODS); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isErr...
java
public PhotoContext getContext(String photoId, String groupId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_CONTEXT); parameters.put("photo_id", photoId); parameters.put("group_id", groupId); ...
java
public Collection<Group> getGroups() throws FlickrException { GroupList<Group> groups = new GroupList<Group>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_GROUPS); Response response = transport.get(transport.getPath(), para...
java
public PhotoList<Photo> getPhotos(String groupId, String userId, String[] tags, Set<String> extras, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METH...
java
public int getGeoPerms() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_GEO_PERMS); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) ...
java
public boolean getHidden() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_HIDDEN); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) {...
java
public String getSafetyLevel() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_SAFETY_LEVEL); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.is...
java
public int getPrivacy() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PRIVACY); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { ...
java
@Deprecated public Category browse(String catId) throws FlickrException { List<Subcategory> subcategories = new ArrayList<Subcategory>(); List<Group> groups = new ArrayList<Group>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHO...
java
public Collection<Group> search(String text, int perPage, int page) throws FlickrException { GroupList<Group> groupList = new GroupList<Group>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SEARCH); parameters.put("text", text); ...
java
public void join(String groupId, Boolean acceptRules) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_JOIN); parameters.put("group_id", groupId); if (acceptRules != null) { parameters.put("accept_...
java
public void joinRequest(String groupId, String message, boolean acceptRules) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_JOIN_REQUEST); parameters.put("group_id", groupId); parameters.put("message", message)...
java
public void leave(String groupId, Boolean deletePhotos) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_LEAVE); parameters.put("group_id", groupId); parameters.put("delete_photos", deletePhotos); Resp...
java
private void setNsid() throws FlickrException { if (username != null && !username.equals("")) { Auth auth = null; if (authStore != null) { auth = authStore.retrieve(username); // assuming FileAuthStore is enhanced else need to // keep in user-level files....
java
private Auth constructAuth(String authToken, String tokenSecret, String username) throws IOException { Auth auth = new Auth(); auth.setToken(authToken); auth.setTokenSecret(tokenSecret); // Prompt to ask what permission is needed: read, update or delete. auth.setPermission(Perm...
java
public PlacesList<Place> find(String query) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); PlacesList<Place> placesList = new PlacesList<Place>(); parameters.put("method", METHOD_FIND); parameters.put("query", query); Response re...
java
public Location getInfo(String placeId, String woeId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); if (placeId != null) { parameters.put("place_id", placeId); } if (woeId !=...
java
public PlacesList<Place> placesForUser(int placeType, String woeId, String placeId, String threshold, Date minUploadDate, Date maxUploadDate, Date minTakenDate, Date maxTakenDate) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); PlacesList<Place> pl...
java
@Deprecated public Location resolvePlaceId(String placeId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_RESOLVE_PLACE_ID); parameters.put("place_id", placeId); Response response = transportAPI.get(tr...
java
@Deprecated public Location resolvePlaceURL(String flickrPlacesUrl) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_RESOLVE_PLACE_URL); parameters.put("url", flickrPlacesUrl); Response response = transp...
java
public TopicList<Topic> getTopicsList(String groupId, int perPage, int page) throws FlickrException { TopicList<Topic> topicList = new TopicList<Topic>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_TOPICS_GET_LIST); parameters.pu...
java
public Topic getTopicInfo(String topicId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_TOPICS_GET_INFO); parameters.put("topic_id", topicId); Response response = transportAPI.get(transportAPI.getPath(), par...
java
public ReplyObject getReplyList(String topicId, int perPage, int page) throws FlickrException { ReplyList<Reply> reply = new ReplyList<Reply>(); TopicList<Topic> topic = new TopicList<Topic>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", M...
java
public Reply getReplyInfo(String topicId, String replyId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REPLIES_GET_INFO); parameters.put("topic_id", topicId); parameters.put("reply_id", replyId); R...
java
public NamespacesList<Namespace> getNamespaces(String predicate, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); NamespacesList<Namespace> nsList = new NamespacesList<Namespace>(); parameters.put("method", METHOD_GET_NAMESPACES);...
java
public NamespacesList<Pair> getPairs(String namespace, String predicate, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); NamespacesList<Pair> nsList = new NamespacesList<Pair>(); parameters.put("method", METHOD_GET_PAIRS); ...
java
public NamespacesList<Value> getValues(String namespace, String predicate, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); NamespacesList<Value> valuesList = new NamespacesList<Value>(); parameters.put("method", METHOD_GET_VALUES...
java
public static String join(Collection<String> s, String delimiter, boolean doQuote) { StringBuffer buffer = new StringBuffer(); Iterator<String> iter = s.iterator(); while (iter.hasNext()) { if (doQuote) { buffer.append("\"" + iter.next() + "\""); } e...
java
public static String join(Collection<String> s, String delimiter) { return join(s, delimiter, false); }
java
public DomainList getCollectionDomains(Date date, String collectionId, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_COLLECTION_DOMAINS, "collection_id", collectionId, date, perPage, page); }
java
public ReferrerList getCollectionReferrers(Date date, String domain, String collectionId, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_COLLECTION_REFERRERS, domain, "collection_id", collectionId, date, perPage, page); }
java
public Stats getCollectionStats(String collectionId, Date date) throws FlickrException { return getStats(METHOD_GET_COLLECTION_STATS, "collection_id", collectionId, date); }
java
public DomainList getPhotoDomains(Date date, String photoId, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_PHOTO_DOMAINS, "photo_id", photoId, date, perPage, page); }
java
public ReferrerList getPhotoReferrers(Date date, String domain, String photoId, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_PHOTO_REFERRERS, domain, "photo_id", photoId, date, perPage, page); }
java
public Stats getPhotoStats(String photoId, Date date) throws FlickrException { return getStats(METHOD_GET_PHOTO_STATS, "photo_id", photoId, date); }
java
public DomainList getPhotosetDomains(Date date, String photosetId, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_PHOTOSET_DOMAINS, "photoset_id", photosetId, date, perPage, page); }
java
public ReferrerList getPhotosetReferrers(Date date, String domain, String photosetId, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_PHOTOSET_REFERRERS, domain, "photoset_id", photosetId, date, perPage, page); }
java
public Stats getPhotosetStats(String photosetId, Date date) throws FlickrException { return getStats(METHOD_GET_PHOTOSET_STATS, "photoset_id", photosetId, date); }
java
public DomainList getPhotostreamDomains(Date date, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_PHOTOSTREAM_DOMAINS, null, null, date, perPage, page); }
java
public ReferrerList getPhotostreamReferrers(Date date, String domain, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_PHOTOSTREAM_REFERRERS, domain, null, null, date, perPage, page); }
java