repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/stats/StatsInterface.java | StatsInterface.getPhotostreamStats | public Stats getPhotostreamStats(Date date) throws FlickrException {
return getStats(METHOD_GET_PHOTOSTREAM_STATS, null, null, date);
} | java | public Stats getPhotostreamStats(Date date) throws FlickrException {
return getStats(METHOD_GET_PHOTOSTREAM_STATS, null, null, date);
} | [
"public",
"Stats",
"getPhotostreamStats",
"(",
"Date",
"date",
")",
"throws",
"FlickrException",
"{",
"return",
"getStats",
"(",
"METHOD_GET_PHOTOSTREAM_STATS",
",",
"null",
",",
"null",
",",
"date",
")",
";",
"}"
] | Get the number of views, comments and favorites on a photostream for a given date.
@param date
(Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will
automatically be rounded down to the start of the day.
@see "http://www.flickr.com/services/api/flickr.stats.getPhotostreamStats.htm" | [
"Get",
"the",
"number",
"of",
"views",
"comments",
"and",
"favorites",
"on",
"a",
"photostream",
"for",
"a",
"given",
"date",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L301-L303 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/stats/StatsInterface.java | StatsInterface.getPopularPhotos | public PhotoList<Photo> getPopularPhotos(Date date, StatsSort sort, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_POPULAR_PHOTOS);
if (date != null) {
parameters.put("date", String.valueOf(date.getTime() / 1000L));
}
if (sort != null) {
parameters.put("sort", sort.name());
}
addPaginationParameters(parameters, perPage, page);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
return parsePopularPhotos(response);
} | java | public PhotoList<Photo> getPopularPhotos(Date date, StatsSort sort, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_POPULAR_PHOTOS);
if (date != null) {
parameters.put("date", String.valueOf(date.getTime() / 1000L));
}
if (sort != null) {
parameters.put("sort", sort.name());
}
addPaginationParameters(parameters, perPage, page);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
return parsePopularPhotos(response);
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"getPopularPhotos",
"(",
"Date",
"date",
",",
"StatsSort",
"sort",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new... | List the photos with the most views, comments or favorites.
@param date
(Optional) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will
automatically be rounded down to the start of the day. If no date is provided, all time view counts will be returned.
@param sort
(Optional) The order in which to sort returned photos. Defaults to views. The possible values are views, comments and favorites. Other sort
options are available through flickr.photos.search.
@param perPage
(Optional) Number of referrers to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.
@param page
(Optional) The page of results to return. If this argument is omitted, it defaults to 1.
@throws FlickrException
@see "http://www.flickr.com/services/api/flickr.stats.getPopularPhotos.html" | [
"List",
"the",
"photos",
"with",
"the",
"most",
"views",
"comments",
"or",
"favorites",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L321-L339 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getGeoInterface | public synchronized GeoInterface getGeoInterface() {
if (geoInterface == null) {
geoInterface = new GeoInterface(apiKey, sharedSecret, transport);
}
return geoInterface;
} | java | public synchronized GeoInterface getGeoInterface() {
if (geoInterface == null) {
geoInterface = new GeoInterface(apiKey, sharedSecret, transport);
}
return geoInterface;
} | [
"public",
"synchronized",
"GeoInterface",
"getGeoInterface",
"(",
")",
"{",
"if",
"(",
"geoInterface",
"==",
"null",
")",
"{",
"geoInterface",
"=",
"new",
"GeoInterface",
"(",
"apiKey",
",",
"sharedSecret",
",",
"transport",
")",
";",
"}",
"return",
"geoInterf... | Get the geo interface.
@return Access class to the flickr.photos.geo methods. | [
"Get",
"the",
"geo",
"interface",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L124-L129 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.addTags | public void addTags(String photoId, String[] tags) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_ADD_TAGS);
parameters.put("photo_id", photoId);
parameters.put("tags", StringUtilities.join(tags, " ", true));
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void addTags(String photoId, String[] tags) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_ADD_TAGS);
parameters.put("photo_id", photoId);
parameters.put("tags", StringUtilities.join(tags, " ", true));
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"addTags",
"(",
"String",
"photoId",
",",
"String",
"[",
"]",
"tags",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
"... | Add tags to a photo.
This method requires authentication with 'write' permission.
@param photoId
The photo ID
@param tags
The tags
@throws FlickrException | [
"Add",
"tags",
"to",
"a",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L142-L153 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.delete | public void delete(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_DELETE);
parameters.put("photo_id", photoId);
// Note: This method requires an HTTP POST request.
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// This method has no specific response - It returns an empty
// sucess response if it completes without error.
} | java | public void delete(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_DELETE);
parameters.put("photo_id", photoId);
// Note: This method requires an HTTP POST request.
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// This method has no specific response - It returns an empty
// sucess response if it completes without error.
} | [
"public",
"void",
"delete",
"(",
"String",
"photoId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
"(",
... | Delete a photo from flickr.
This method requires authentication with 'delete' permission.
@param photoId
@throws FlickrException | [
"Delete",
"a",
"photo",
"from",
"flickr",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L163-L176 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getAllContexts | public PhotoAllContext getAllContexts(String photoId) throws FlickrException {
PhotoSetList<PhotoSet> setList = new PhotoSetList<PhotoSet>();
PoolList<Pool> poolList = new PoolList<Pool>();
PhotoAllContext allContext = new PhotoAllContext();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_ALL_CONTEXTS);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Collection<Element> photosElement = response.getPayloadCollection();
for (Element setElement : photosElement) {
if (setElement.getTagName().equals("set")) {
PhotoSet pset = new PhotoSet();
pset.setTitle(setElement.getAttribute("title"));
pset.setSecret(setElement.getAttribute("secret"));
pset.setId(setElement.getAttribute("id"));
pset.setFarm(setElement.getAttribute("farm"));
pset.setPrimary(setElement.getAttribute("primary"));
pset.setServer(setElement.getAttribute("server"));
pset.setViewCount(Integer.parseInt(setElement.getAttribute("view_count")));
pset.setCommentCount(Integer.parseInt(setElement.getAttribute("comment_count")));
pset.setCountPhoto(Integer.parseInt(setElement.getAttribute("count_photo")));
pset.setCountVideo(Integer.parseInt(setElement.getAttribute("count_video")));
setList.add(pset);
allContext.setPhotoSetList(setList);
} else if (setElement.getTagName().equals("pool")) {
Pool pool = new Pool();
pool.setTitle(setElement.getAttribute("title"));
pool.setId(setElement.getAttribute("id"));
pool.setUrl(setElement.getAttribute("url"));
pool.setIconServer(setElement.getAttribute("iconserver"));
pool.setIconFarm(setElement.getAttribute("iconfarm"));
pool.setMemberCount(Integer.parseInt(setElement.getAttribute("members")));
pool.setPoolCount(Integer.parseInt(setElement.getAttribute("pool_count")));
poolList.add(pool);
allContext.setPoolList(poolList);
}
}
return allContext;
} | java | public PhotoAllContext getAllContexts(String photoId) throws FlickrException {
PhotoSetList<PhotoSet> setList = new PhotoSetList<PhotoSet>();
PoolList<Pool> poolList = new PoolList<Pool>();
PhotoAllContext allContext = new PhotoAllContext();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_ALL_CONTEXTS);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Collection<Element> photosElement = response.getPayloadCollection();
for (Element setElement : photosElement) {
if (setElement.getTagName().equals("set")) {
PhotoSet pset = new PhotoSet();
pset.setTitle(setElement.getAttribute("title"));
pset.setSecret(setElement.getAttribute("secret"));
pset.setId(setElement.getAttribute("id"));
pset.setFarm(setElement.getAttribute("farm"));
pset.setPrimary(setElement.getAttribute("primary"));
pset.setServer(setElement.getAttribute("server"));
pset.setViewCount(Integer.parseInt(setElement.getAttribute("view_count")));
pset.setCommentCount(Integer.parseInt(setElement.getAttribute("comment_count")));
pset.setCountPhoto(Integer.parseInt(setElement.getAttribute("count_photo")));
pset.setCountVideo(Integer.parseInt(setElement.getAttribute("count_video")));
setList.add(pset);
allContext.setPhotoSetList(setList);
} else if (setElement.getTagName().equals("pool")) {
Pool pool = new Pool();
pool.setTitle(setElement.getAttribute("title"));
pool.setId(setElement.getAttribute("id"));
pool.setUrl(setElement.getAttribute("url"));
pool.setIconServer(setElement.getAttribute("iconserver"));
pool.setIconFarm(setElement.getAttribute("iconfarm"));
pool.setMemberCount(Integer.parseInt(setElement.getAttribute("members")));
pool.setPoolCount(Integer.parseInt(setElement.getAttribute("pool_count")));
poolList.add(pool);
allContext.setPoolList(poolList);
}
}
return allContext;
} | [
"public",
"PhotoAllContext",
"getAllContexts",
"(",
"String",
"photoId",
")",
"throws",
"FlickrException",
"{",
"PhotoSetList",
"<",
"PhotoSet",
">",
"setList",
"=",
"new",
"PhotoSetList",
"<",
"PhotoSet",
">",
"(",
")",
";",
"PoolList",
"<",
"Pool",
">",
"poo... | Returns all visble sets and pools the photo belongs to.
This method does not require authentication.
@param photoId
The photo to return information for.
@return a list of {@link PhotoContext} objects
@throws FlickrException | [
"Returns",
"all",
"visble",
"sets",
"and",
"pools",
"the",
"photo",
"belongs",
"to",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L188-L235 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getContactsPhotos | public PhotoList<Photo> getContactsPhotos(int count, boolean justFriends, boolean singlePhoto, boolean includeSelf) throws FlickrException {
PhotoList<Photo> photos = new PhotoList<Photo>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CONTACTS_PHOTOS);
if (count > 0) {
parameters.put("count", Integer.toString(count));
}
if (justFriends) {
parameters.put("just_friends", "1");
}
if (singlePhoto) {
parameters.put("single_photo", "1");
}
if (includeSelf) {
parameters.put("include_self", "1");
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
NodeList photoNodes = photosElement.getElementsByTagName("photo");
photos.setPage("1");
photos.setPages("1");
photos.setPerPage("" + photoNodes.getLength());
photos.setTotal("" + photoNodes.getLength());
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | java | public PhotoList<Photo> getContactsPhotos(int count, boolean justFriends, boolean singlePhoto, boolean includeSelf) throws FlickrException {
PhotoList<Photo> photos = new PhotoList<Photo>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CONTACTS_PHOTOS);
if (count > 0) {
parameters.put("count", Integer.toString(count));
}
if (justFriends) {
parameters.put("just_friends", "1");
}
if (singlePhoto) {
parameters.put("single_photo", "1");
}
if (includeSelf) {
parameters.put("include_self", "1");
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
NodeList photoNodes = photosElement.getElementsByTagName("photo");
photos.setPage("1");
photos.setPages("1");
photos.setPerPage("" + photoNodes.getLength());
photos.setTotal("" + photoNodes.getLength());
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"getContactsPhotos",
"(",
"int",
"count",
",",
"boolean",
"justFriends",
",",
"boolean",
"singlePhoto",
",",
"boolean",
"includeSelf",
")",
"throws",
"FlickrException",
"{",
"PhotoList",
"<",
"Photo",
">",
"photos",
"=",... | Get photos from the user's contacts.
This method requires authentication with 'read' permission.
@param count
The number of photos to return
@param justFriends
Set to true to only show friends photos
@param singlePhoto
Set to true to get a single photo
@param includeSelf
Set to true to include self
@return The Collection of photos
@throws FlickrException | [
"Get",
"photos",
"from",
"the",
"user",
"s",
"contacts",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L253-L287 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getContactsPublicPhotos | public PhotoList<Photo> getContactsPublicPhotos(String userId, int count, boolean justFriends, boolean singlePhoto, boolean includeSelf)
throws FlickrException {
return getContactsPublicPhotos(userId, Extras.MIN_EXTRAS, count, justFriends, singlePhoto, includeSelf);
} | java | public PhotoList<Photo> getContactsPublicPhotos(String userId, int count, boolean justFriends, boolean singlePhoto, boolean includeSelf)
throws FlickrException {
return getContactsPublicPhotos(userId, Extras.MIN_EXTRAS, count, justFriends, singlePhoto, includeSelf);
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"getContactsPublicPhotos",
"(",
"String",
"userId",
",",
"int",
"count",
",",
"boolean",
"justFriends",
",",
"boolean",
"singlePhoto",
",",
"boolean",
"includeSelf",
")",
"throws",
"FlickrException",
"{",
"return",
"getCon... | Get public photos from the user's contacts.
This method does not require authentication.
@see com.flickr4java.flickr.photos.Extras
@param userId
The user ID
@param count
The number of photos to return
@param justFriends
True to include friends
@param singlePhoto
True to get a single photo
@param includeSelf
True to include self
@return A collection of Photo objects
@throws FlickrException | [
"Get",
"public",
"photos",
"from",
"the",
"user",
"s",
"contacts",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L308-L311 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getContext | public PhotoContext getContext(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CONTEXT);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
PhotoContext photoContext = new PhotoContext();
Collection<Element> payload = response.getPayloadCollection();
for (Element payloadElement : payload) {
String tagName = payloadElement.getTagName();
if (tagName.equals("prevphoto")) {
Photo photo = new Photo();
photo.setId(payloadElement.getAttribute("id"));
photo.setSecret(payloadElement.getAttribute("secret"));
photo.setTitle(payloadElement.getAttribute("title"));
photo.setFarm(payloadElement.getAttribute("farm"));
photo.setUrl(payloadElement.getAttribute("url"));
photoContext.setPreviousPhoto(photo);
} else if (tagName.equals("nextphoto")) {
Photo photo = new Photo();
photo.setId(payloadElement.getAttribute("id"));
photo.setSecret(payloadElement.getAttribute("secret"));
photo.setTitle(payloadElement.getAttribute("title"));
photo.setFarm(payloadElement.getAttribute("farm"));
photo.setUrl(payloadElement.getAttribute("url"));
photoContext.setNextPhoto(photo);
}
}
return photoContext;
} | java | public PhotoContext getContext(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CONTEXT);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
PhotoContext photoContext = new PhotoContext();
Collection<Element> payload = response.getPayloadCollection();
for (Element payloadElement : payload) {
String tagName = payloadElement.getTagName();
if (tagName.equals("prevphoto")) {
Photo photo = new Photo();
photo.setId(payloadElement.getAttribute("id"));
photo.setSecret(payloadElement.getAttribute("secret"));
photo.setTitle(payloadElement.getAttribute("title"));
photo.setFarm(payloadElement.getAttribute("farm"));
photo.setUrl(payloadElement.getAttribute("url"));
photoContext.setPreviousPhoto(photo);
} else if (tagName.equals("nextphoto")) {
Photo photo = new Photo();
photo.setId(payloadElement.getAttribute("id"));
photo.setSecret(payloadElement.getAttribute("secret"));
photo.setTitle(payloadElement.getAttribute("title"));
photo.setFarm(payloadElement.getAttribute("farm"));
photo.setUrl(payloadElement.getAttribute("url"));
photoContext.setNextPhoto(photo);
}
}
return photoContext;
} | [
"public",
"PhotoContext",
"getContext",
"(",
"String",
"photoId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"pu... | Get the context for the specified photo.
This method does not require authentication.
@param photoId
The photo ID
@return The PhotoContext
@throws FlickrException | [
"Get",
"the",
"context",
"for",
"the",
"specified",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L374-L407 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getCounts | public Collection<Photocount> getCounts(Date[] dates, Date[] takenDates) throws FlickrException {
List<Photocount> photocounts = new ArrayList<Photocount>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_COUNTS);
if (dates == null && takenDates == null) {
throw new IllegalArgumentException("You must provide a value for either dates or takenDates");
}
if (dates != null) {
List<String> dateList = new ArrayList<String>();
for (int i = 0; i < dates.length; i++) {
dateList.add(String.valueOf(dates[i].getTime() / 1000L));
}
parameters.put("dates", StringUtilities.join(dateList, ","));
}
if (takenDates != null) {
List<String> takenDateList = new ArrayList<String>();
for (int i = 0; i < takenDates.length; i++) {
takenDateList.add(String.valueOf(takenDates[i].getTime() / 1000L));
}
parameters.put("taken_dates", StringUtilities.join(takenDateList, ","));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photocountsElement = response.getPayload();
NodeList photocountNodes = photocountsElement.getElementsByTagName("photocount");
for (int i = 0; i < photocountNodes.getLength(); i++) {
Element photocountElement = (Element) photocountNodes.item(i);
Photocount photocount = new Photocount();
photocount.setCount(photocountElement.getAttribute("count"));
photocount.setFromDate(photocountElement.getAttribute("fromdate"));
photocount.setToDate(photocountElement.getAttribute("todate"));
photocounts.add(photocount);
}
return photocounts;
} | java | public Collection<Photocount> getCounts(Date[] dates, Date[] takenDates) throws FlickrException {
List<Photocount> photocounts = new ArrayList<Photocount>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_COUNTS);
if (dates == null && takenDates == null) {
throw new IllegalArgumentException("You must provide a value for either dates or takenDates");
}
if (dates != null) {
List<String> dateList = new ArrayList<String>();
for (int i = 0; i < dates.length; i++) {
dateList.add(String.valueOf(dates[i].getTime() / 1000L));
}
parameters.put("dates", StringUtilities.join(dateList, ","));
}
if (takenDates != null) {
List<String> takenDateList = new ArrayList<String>();
for (int i = 0; i < takenDates.length; i++) {
takenDateList.add(String.valueOf(takenDates[i].getTime() / 1000L));
}
parameters.put("taken_dates", StringUtilities.join(takenDateList, ","));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photocountsElement = response.getPayload();
NodeList photocountNodes = photocountsElement.getElementsByTagName("photocount");
for (int i = 0; i < photocountNodes.getLength(); i++) {
Element photocountElement = (Element) photocountNodes.item(i);
Photocount photocount = new Photocount();
photocount.setCount(photocountElement.getAttribute("count"));
photocount.setFromDate(photocountElement.getAttribute("fromdate"));
photocount.setToDate(photocountElement.getAttribute("todate"));
photocounts.add(photocount);
}
return photocounts;
} | [
"public",
"Collection",
"<",
"Photocount",
">",
"getCounts",
"(",
"Date",
"[",
"]",
"dates",
",",
"Date",
"[",
"]",
"takenDates",
")",
"throws",
"FlickrException",
"{",
"List",
"<",
"Photocount",
">",
"photocounts",
"=",
"new",
"ArrayList",
"<",
"Photocount"... | Gets a collection of photo counts for the given date ranges for the calling user.
This method requires authentication with 'read' permission.
@param dates
An array of dates, denoting the periods to return counts for. They should be specified smallest first.
@param takenDates
An array of dates, denoting the periods to return counts for. They should be specified smallest first.
@return A Collection of Photocount objects | [
"Gets",
"a",
"collection",
"of",
"photo",
"counts",
"for",
"the",
"given",
"date",
"ranges",
"for",
"the",
"calling",
"user",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L420-L461 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getExif | public Collection<Exif> getExif(String photoId, String secret) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_EXIF);
parameters.put("photo_id", photoId);
if (secret != null) {
parameters.put("secret", secret);
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
List<Exif> exifs = new ArrayList<Exif>();
Element photoElement = response.getPayload();
NodeList exifElements = photoElement.getElementsByTagName("exif");
for (int i = 0; i < exifElements.getLength(); i++) {
Element exifElement = (Element) exifElements.item(i);
Exif exif = new Exif();
exif.setTagspace(exifElement.getAttribute("tagspace"));
exif.setTagspaceId(exifElement.getAttribute("tagspaceid"));
exif.setTag(exifElement.getAttribute("tag"));
exif.setLabel(exifElement.getAttribute("label"));
exif.setRaw(XMLUtilities.getChildValue(exifElement, "raw"));
exif.setClean(XMLUtilities.getChildValue(exifElement, "clean"));
exifs.add(exif);
}
return exifs;
} | java | public Collection<Exif> getExif(String photoId, String secret) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_EXIF);
parameters.put("photo_id", photoId);
if (secret != null) {
parameters.put("secret", secret);
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
List<Exif> exifs = new ArrayList<Exif>();
Element photoElement = response.getPayload();
NodeList exifElements = photoElement.getElementsByTagName("exif");
for (int i = 0; i < exifElements.getLength(); i++) {
Element exifElement = (Element) exifElements.item(i);
Exif exif = new Exif();
exif.setTagspace(exifElement.getAttribute("tagspace"));
exif.setTagspaceId(exifElement.getAttribute("tagspaceid"));
exif.setTag(exifElement.getAttribute("tag"));
exif.setLabel(exifElement.getAttribute("label"));
exif.setRaw(XMLUtilities.getChildValue(exifElement, "raw"));
exif.setClean(XMLUtilities.getChildValue(exifElement, "clean"));
exifs.add(exif);
}
return exifs;
} | [
"public",
"Collection",
"<",
"Exif",
">",
"getExif",
"(",
"String",
"photoId",
",",
"String",
"secret",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",... | Get the Exif data for the photo.
The calling user must have permission to view the photo.
This method does not require authentication.
@param photoId
The photo ID
@param secret
The secret
@return A collection of Exif objects
@throws FlickrException | [
"Get",
"the",
"Exif",
"data",
"for",
"the",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L477-L505 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getFavorites | public Collection<User> getFavorites(String photoId, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_FAVORITES);
parameters.put("photo_id", photoId);
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
List<User> users = new ArrayList<User>();
Element userRoot = response.getPayload();
NodeList userNodes = userRoot.getElementsByTagName("person");
for (int i = 0; i < userNodes.getLength(); i++) {
Element userElement = (Element) userNodes.item(i);
User user = new User();
user.setId(userElement.getAttribute("nsid"));
user.setUsername(userElement.getAttribute("username"));
user.setFaveDate(userElement.getAttribute("favedate"));
users.add(user);
}
return users;
} | java | public Collection<User> getFavorites(String photoId, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_FAVORITES);
parameters.put("photo_id", photoId);
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
List<User> users = new ArrayList<User>();
Element userRoot = response.getPayload();
NodeList userNodes = userRoot.getElementsByTagName("person");
for (int i = 0; i < userNodes.getLength(); i++) {
Element userElement = (Element) userNodes.item(i);
User user = new User();
user.setId(userElement.getAttribute("nsid"));
user.setUsername(userElement.getAttribute("username"));
user.setFaveDate(userElement.getAttribute("favedate"));
users.add(user);
}
return users;
} | [
"public",
"Collection",
"<",
"User",
">",
"getFavorites",
"(",
"String",
"photoId",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"Strin... | Returns the list of people who have favorited a given photo.
This method does not require authentication.
@param photoId
@param perPage
@param page
@return List of {@link com.flickr4java.flickr.people.User} | [
"Returns",
"the",
"list",
"of",
"people",
"who",
"have",
"favorited",
"a",
"given",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L517-L549 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getInfo | public Photo getInfo(String photoId, String secret) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_INFO);
parameters.put("photo_id", photoId);
if (secret != null) {
parameters.put("secret", secret);
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photoElement = response.getPayload();
return PhotoUtils.createPhoto(photoElement);
} | java | public Photo getInfo(String photoId, String secret) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_INFO);
parameters.put("photo_id", photoId);
if (secret != null) {
parameters.put("secret", secret);
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photoElement = response.getPayload();
return PhotoUtils.createPhoto(photoElement);
} | [
"public",
"Photo",
"getInfo",
"(",
"String",
"photoId",
",",
"String",
"secret",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"para... | Get all info for the specified photo.
The calling user must have permission to view the photo.
This method does not require authentication.
@param photoId
The photo Id
@param secret
The optional secret String
@return The Photo
@throws FlickrException | [
"Get",
"all",
"info",
"for",
"the",
"specified",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L565-L581 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getNotInSet | public PhotoList<Photo> getNotInSet(int perPage, int page) throws FlickrException {
PhotoList<Photo> photos = new PhotoList<Photo>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", PhotosInterface.METHOD_GET_NOT_IN_SET);
RequestContext requestContext = RequestContext.getRequestContext();
List<String> extras = requestContext.getExtras();
if (extras.size() > 0) {
parameters.put("extras", StringUtilities.join(extras, ","));
}
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoElements = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoElements.getLength(); i++) {
Element photoElement = (Element) photoElements.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | java | public PhotoList<Photo> getNotInSet(int perPage, int page) throws FlickrException {
PhotoList<Photo> photos = new PhotoList<Photo>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", PhotosInterface.METHOD_GET_NOT_IN_SET);
RequestContext requestContext = RequestContext.getRequestContext();
List<String> extras = requestContext.getExtras();
if (extras.size() > 0) {
parameters.put("extras", StringUtilities.join(extras, ","));
}
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoElements = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoElements.getLength(); i++) {
Element photoElement = (Element) photoElements.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"getNotInSet",
"(",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"PhotoList",
"<",
"Photo",
">",
"photos",
"=",
"new",
"PhotoList",
"<",
"Photo",
">",
"(",
")",
";",
"Map",
"<",
... | Return a collection of Photo objects not in part of any sets.
This method requires authentication with 'read' permission.
@param perPage
The per page
@param page
The page
@return The collection of Photo objects
@throws FlickrException | [
"Return",
"a",
"collection",
"of",
"Photo",
"objects",
"not",
"in",
"part",
"of",
"any",
"sets",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L595-L631 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getPerms | public Permissions getPerms(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_PERMS);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element permissionsElement = response.getPayload();
Permissions permissions = new Permissions();
permissions.setId(permissionsElement.getAttribute("id"));
permissions.setPublicFlag("1".equals(permissionsElement.getAttribute("ispublic")));
permissions.setFamilyFlag("1".equals(permissionsElement.getAttribute("isfamily")));
permissions.setFriendFlag("1".equals(permissionsElement.getAttribute("isfriend")));
permissions.setComment(permissionsElement.getAttribute("permcomment"));
permissions.setAddmeta(permissionsElement.getAttribute("permaddmeta"));
return permissions;
} | java | public Permissions getPerms(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_PERMS);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element permissionsElement = response.getPayload();
Permissions permissions = new Permissions();
permissions.setId(permissionsElement.getAttribute("id"));
permissions.setPublicFlag("1".equals(permissionsElement.getAttribute("ispublic")));
permissions.setFamilyFlag("1".equals(permissionsElement.getAttribute("isfamily")));
permissions.setFriendFlag("1".equals(permissionsElement.getAttribute("isfriend")));
permissions.setComment(permissionsElement.getAttribute("permcomment"));
permissions.setAddmeta(permissionsElement.getAttribute("permaddmeta"));
return permissions;
} | [
"public",
"Permissions",
"getPerms",
"(",
"String",
"photoId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",... | Get the permission information for the specified photo.
This method requires authentication with 'read' permission.
@param photoId
The photo id
@return The Permissions object
@throws FlickrException | [
"Get",
"the",
"permission",
"information",
"for",
"the",
"specified",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L643-L662 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getRecent | public PhotoList<Photo> getRecent(Set<String> extras, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_RECENT);
if (extras != null && !extras.isEmpty()) {
parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, ","));
}
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement);
return photos;
} | java | public PhotoList<Photo> getRecent(Set<String> extras, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_RECENT);
if (extras != null && !extras.isEmpty()) {
parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, ","));
}
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement);
return photos;
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"getRecent",
"(",
"Set",
"<",
"String",
">",
"extras",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMa... | Get a collection of recent photos.
This method does not require authentication.
@see com.flickr4java.flickr.photos.Extras
@param extras
Set of extra-fields
@param perPage
The number of photos per page
@param page
The page offset
@return A collection of Photo objects
@throws FlickrException | [
"Get",
"a",
"collection",
"of",
"recent",
"photos",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L679-L700 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getSizes | public Collection<Size> getSizes(String photoId, boolean sign) throws FlickrException {
SizeList<Size> sizes = new SizeList<Size>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_SIZES);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element sizesElement = response.getPayload();
sizes.setIsCanBlog("1".equals(sizesElement.getAttribute("canblog")));
sizes.setIsCanDownload("1".equals(sizesElement.getAttribute("candownload")));
sizes.setIsCanPrint("1".equals(sizesElement.getAttribute("canprint")));
NodeList sizeNodes = sizesElement.getElementsByTagName("size");
for (int i = 0; i < sizeNodes.getLength(); i++) {
Element sizeElement = (Element) sizeNodes.item(i);
Size size = new Size();
size.setLabel(sizeElement.getAttribute("label"));
size.setWidth(sizeElement.getAttribute("width"));
size.setHeight(sizeElement.getAttribute("height"));
size.setSource(sizeElement.getAttribute("source"));
size.setUrl(sizeElement.getAttribute("url"));
size.setMedia(sizeElement.getAttribute("media"));
sizes.add(size);
}
return sizes;
} | java | public Collection<Size> getSizes(String photoId, boolean sign) throws FlickrException {
SizeList<Size> sizes = new SizeList<Size>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_SIZES);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element sizesElement = response.getPayload();
sizes.setIsCanBlog("1".equals(sizesElement.getAttribute("canblog")));
sizes.setIsCanDownload("1".equals(sizesElement.getAttribute("candownload")));
sizes.setIsCanPrint("1".equals(sizesElement.getAttribute("canprint")));
NodeList sizeNodes = sizesElement.getElementsByTagName("size");
for (int i = 0; i < sizeNodes.getLength(); i++) {
Element sizeElement = (Element) sizeNodes.item(i);
Size size = new Size();
size.setLabel(sizeElement.getAttribute("label"));
size.setWidth(sizeElement.getAttribute("width"));
size.setHeight(sizeElement.getAttribute("height"));
size.setSource(sizeElement.getAttribute("source"));
size.setUrl(sizeElement.getAttribute("url"));
size.setMedia(sizeElement.getAttribute("media"));
sizes.add(size);
}
return sizes;
} | [
"public",
"Collection",
"<",
"Size",
">",
"getSizes",
"(",
"String",
"photoId",
",",
"boolean",
"sign",
")",
"throws",
"FlickrException",
"{",
"SizeList",
"<",
"Size",
">",
"sizes",
"=",
"new",
"SizeList",
"<",
"Size",
">",
"(",
")",
";",
"Map",
"<",
"... | Get the available sizes of a Photo.
The boolean toggle allows to (api-)sign the call.
This way the calling user can retrieve sizes for <b>his own</b> private photos.
@param photoId
The photo ID
@param sign
toggle to allow optionally signing the call (Authenticate)
@return A collection of {@link Size}
@throws FlickrException | [
"Get",
"the",
"available",
"sizes",
"of",
"a",
"Photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L732-L761 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getUntagged | public PhotoList<Photo> getUntagged(int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_UNTAGGED);
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement);
return photos;
} | java | public PhotoList<Photo> getUntagged(int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_UNTAGGED);
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement);
return photos;
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"getUntagged",
"(",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"... | Get the collection of untagged photos.
This method requires authentication with 'read' permission.
@param perPage
@param page
@return A Collection of Photos
@throws FlickrException | [
"Get",
"the",
"collection",
"of",
"untagged",
"photos",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L773-L791 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getWithGeoData | public PhotoList<Photo> getWithGeoData(Date minUploadDate, Date maxUploadDate, Date minTakenDate, Date maxTakenDate, int privacyFilter, String sort,
Set<String> extras, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_WITH_GEO_DATA);
if (minUploadDate != null) {
parameters.put("min_upload_date", Long.toString(minUploadDate.getTime() / 1000L));
}
if (maxUploadDate != null) {
parameters.put("max_upload_date", Long.toString(maxUploadDate.getTime() / 1000L));
}
if (minTakenDate != null) {
parameters.put("min_taken_date", Long.toString(minTakenDate.getTime() / 1000L));
}
if (maxTakenDate != null) {
parameters.put("max_taken_date", Long.toString(maxTakenDate.getTime() / 1000L));
}
if (privacyFilter > 0) {
parameters.put("privacy_filter", Integer.toString(privacyFilter));
}
if (sort != null) {
parameters.put("sort", sort);
}
if (extras != null && !extras.isEmpty()) {
parameters.put("extras", StringUtilities.join(extras, ","));
}
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement);
return photos;
} | java | public PhotoList<Photo> getWithGeoData(Date minUploadDate, Date maxUploadDate, Date minTakenDate, Date maxTakenDate, int privacyFilter, String sort,
Set<String> extras, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_WITH_GEO_DATA);
if (minUploadDate != null) {
parameters.put("min_upload_date", Long.toString(minUploadDate.getTime() / 1000L));
}
if (maxUploadDate != null) {
parameters.put("max_upload_date", Long.toString(maxUploadDate.getTime() / 1000L));
}
if (minTakenDate != null) {
parameters.put("min_taken_date", Long.toString(minTakenDate.getTime() / 1000L));
}
if (maxTakenDate != null) {
parameters.put("max_taken_date", Long.toString(maxTakenDate.getTime() / 1000L));
}
if (privacyFilter > 0) {
parameters.put("privacy_filter", Integer.toString(privacyFilter));
}
if (sort != null) {
parameters.put("sort", sort);
}
if (extras != null && !extras.isEmpty()) {
parameters.put("extras", StringUtilities.join(extras, ","));
}
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement);
return photos;
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"getWithGeoData",
"(",
"Date",
"minUploadDate",
",",
"Date",
"maxUploadDate",
",",
"Date",
"minTakenDate",
",",
"Date",
"maxTakenDate",
",",
"int",
"privacyFilter",
",",
"String",
"sort",
",",
"Set",
"<",
"String",
">"... | Returns a list of your geo-tagged photos.
This method requires authentication with 'read' permission.
@param minUploadDate
Minimum upload date. Photos with an upload date greater than or equal to this value will be returned. Set to null to not specify a date.
@param maxUploadDate
Maximum upload date. Photos with an upload date less than or equal to this value will be returned. Set to null to not specify a date.
@param minTakenDate
Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. Set to null to not specify a date.
@param maxTakenDate
Maximum taken date. Photos with an taken date less than or equal to this value will be returned. Set to null to not specify a date.
@param privacyFilter
Return photos only matching a certain privacy level. Valid values are:
<ul>
<li>1 public photos</li>
<li>2 private photos visible to friends</li>
<li>3 private photos visible to family</li>
<li>4 private photos visible to friends & family</li>
<li>5 completely private photos</li>
</ul>
Set to 0 to not specify a privacy Filter.
@see com.flickr4java.flickr.photos.Extras
@param sort
The order in which to sort returned photos. Deafults to date-posted-desc. The possible values are: date-posted-asc, date-posted-desc,
date-taken-asc, date-taken-desc, interestingness-desc, and interestingness-asc.
@param extras
A set of Strings controlling the extra information to fetch for each returned record. Currently supported fields are: license, date_upload,
date_taken, owner_name, icon_server, original_format, last_update, geo. Set to null or an empty set to not specify any extras.
@param perPage
Number of photos to return per page. If this argument is 0, it defaults to 100. The maximum allowed value is 500.
@param page
The page of results to return. If this argument is 0, it defaults to 1.
@return photos
@throws FlickrException | [
"Returns",
"a",
"list",
"of",
"your",
"geo",
"-",
"tagged",
"photos",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L831-L871 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.removeTag | public void removeTag(String tagId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_REMOVE_TAG);
parameters.put("tag_id", tagId);
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void removeTag(String tagId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_REMOVE_TAG);
parameters.put("tag_id", tagId);
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"removeTag",
"(",
"String",
"tagId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
"(",
... | Remove a tag from a photo.
This method requires authentication with 'write' permission.
@param tagId
The tag ID
@throws FlickrException | [
"Remove",
"a",
"tag",
"from",
"a",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1006-L1016 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.search | public PhotoList<Photo> search(SearchParameters params, int perPage, int page) throws FlickrException {
PhotoList<Photo> photos = new PhotoList<Photo>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SEARCH);
parameters.putAll(params.getAsParameters());
if (perPage > 0) {
parameters.put("per_page", "" + perPage);
}
if (page > 0) {
parameters.put("page", "" + page);
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoNodes = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | java | public PhotoList<Photo> search(SearchParameters params, int perPage, int page) throws FlickrException {
PhotoList<Photo> photos = new PhotoList<Photo>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SEARCH);
parameters.putAll(params.getAsParameters());
if (perPage > 0) {
parameters.put("per_page", "" + perPage);
}
if (page > 0) {
parameters.put("page", "" + page);
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoNodes = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"search",
"(",
"SearchParameters",
"params",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"PhotoList",
"<",
"Photo",
">",
"photos",
"=",
"new",
"PhotoList",
"<",
"Photo",
">",
"... | Search for photos which match the given search parameters.
@param params
The search parameters
@param perPage
The number of photos to show per page
@param page
The page offset
@return A PhotoList
@throws FlickrException | [
"Search",
"for",
"photos",
"which",
"match",
"the",
"given",
"search",
"parameters",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1030-L1061 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.searchInterestingness | public PhotoList<Photo> searchInterestingness(SearchParameters params, 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_INTERESTINGNESS);
parameters.putAll(params.getAsParameters());
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoNodes = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
Photo photo = new Photo();
photo.setId(photoElement.getAttribute("id"));
User owner = new User();
owner.setId(photoElement.getAttribute("owner"));
photo.setOwner(owner);
photo.setSecret(photoElement.getAttribute("secret"));
photo.setServer(photoElement.getAttribute("server"));
photo.setFarm(photoElement.getAttribute("farm"));
photo.setTitle(photoElement.getAttribute("title"));
photo.setPublicFlag("1".equals(photoElement.getAttribute("ispublic")));
photo.setFriendFlag("1".equals(photoElement.getAttribute("isfriend")));
photo.setFamilyFlag("1".equals(photoElement.getAttribute("isfamily")));
photos.add(photo);
}
return photos;
} | java | public PhotoList<Photo> searchInterestingness(SearchParameters params, 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_INTERESTINGNESS);
parameters.putAll(params.getAsParameters());
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoNodes = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
Photo photo = new Photo();
photo.setId(photoElement.getAttribute("id"));
User owner = new User();
owner.setId(photoElement.getAttribute("owner"));
photo.setOwner(owner);
photo.setSecret(photoElement.getAttribute("secret"));
photo.setServer(photoElement.getAttribute("server"));
photo.setFarm(photoElement.getAttribute("farm"));
photo.setTitle(photoElement.getAttribute("title"));
photo.setPublicFlag("1".equals(photoElement.getAttribute("ispublic")));
photo.setFriendFlag("1".equals(photoElement.getAttribute("isfriend")));
photo.setFamilyFlag("1".equals(photoElement.getAttribute("isfamily")));
photos.add(photo);
}
return photos;
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"searchInterestingness",
"(",
"SearchParameters",
"params",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"PhotoList",
"<",
"Photo",
">",
"photos",
"=",
"new",
"PhotoList",
"<",
"Pho... | Search for interesting photos using the Flickr Interestingness algorithm.
@param params
Any search parameters
@param perPage
Number of items per page
@param page
The page to start on
@return A PhotoList
@throws FlickrException | [
"Search",
"for",
"interesting",
"photos",
"using",
"the",
"Flickr",
"Interestingness",
"algorithm",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1075-L1120 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.setContentType | public void setContentType(String photoId, String contentType) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_CONTENTTYPE);
parameters.put("photo_id", photoId);
parameters.put("content_type", contentType);
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void setContentType(String photoId, String contentType) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_CONTENTTYPE);
parameters.put("photo_id", photoId);
parameters.put("content_type", contentType);
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"setContentType",
"(",
"String",
"photoId",
",",
"String",
"contentType",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
"... | Set the content type of a photo.
This method requires authentication with 'write' permission.
@see com.flickr4java.flickr.Flickr#CONTENTTYPE_PHOTO
@see com.flickr4java.flickr.Flickr#CONTENTTYPE_SCREENSHOT
@see com.flickr4java.flickr.Flickr#CONTENTTYPE_OTHER
@param photoId
The photo ID
@param contentType
The contentType to set
@throws FlickrException | [
"Set",
"the",
"content",
"type",
"of",
"a",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1136-L1147 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.setDates | public void setDates(String photoId, Date datePosted, Date dateTaken, String dateTakenGranularity) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_DATES);
parameters.put("photo_id", photoId);
if (datePosted != null) {
parameters.put("date_posted", Long.toString(datePosted.getTime() / 1000));
}
if (dateTaken != null) {
parameters.put("date_taken", ((DateFormat) DATE_FORMATS.get()).format(dateTaken));
}
if (dateTakenGranularity != null) {
parameters.put("date_taken_granularity", dateTakenGranularity);
}
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void setDates(String photoId, Date datePosted, Date dateTaken, String dateTakenGranularity) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_DATES);
parameters.put("photo_id", photoId);
if (datePosted != null) {
parameters.put("date_posted", Long.toString(datePosted.getTime() / 1000));
}
if (dateTaken != null) {
parameters.put("date_taken", ((DateFormat) DATE_FORMATS.get()).format(dateTaken));
}
if (dateTakenGranularity != null) {
parameters.put("date_taken_granularity", dateTakenGranularity);
}
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"setDates",
"(",
"String",
"photoId",
",",
"Date",
"datePosted",
",",
"Date",
"dateTaken",
",",
"String",
"dateTakenGranularity",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"Hash... | Set the dates for the specified photo.
This method requires authentication with 'write' permission.
@param photoId
The photo ID
@param datePosted
The date the photo was posted or null
@param dateTaken
The date the photo was taken or null
@param dateTakenGranularity
The granularity of the taken date or null
@throws FlickrException | [
"Set",
"the",
"dates",
"for",
"the",
"specified",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1164-L1186 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.setMeta | public void setMeta(String photoId, String title, String description) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_META);
parameters.put("photo_id", photoId);
parameters.put("title", title);
parameters.put("description", description);
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void setMeta(String photoId, String title, String description) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_META);
parameters.put("photo_id", photoId);
parameters.put("title", title);
parameters.put("description", description);
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"setMeta",
"(",
"String",
"photoId",
",",
"String",
"title",
",",
"String",
"description",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
... | Set the meta data for the photo.
This method requires authentication with 'write' permission.
@param photoId
The photo ID
@param title
The new title
@param description
The new description
@throws FlickrException | [
"Set",
"the",
"meta",
"data",
"for",
"the",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1201-L1213 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.setPerms | public void setPerms(String photoId, Permissions permissions) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_PERMS);
parameters.put("photo_id", photoId);
parameters.put("is_public", permissions.isPublicFlag() ? "1" : "0");
parameters.put("is_friend", permissions.isFriendFlag() ? "1" : "0");
parameters.put("is_family", permissions.isFamilyFlag() ? "1" : "0");
parameters.put("perm_comment", Integer.toString(permissions.getComment()));
parameters.put("perm_addmeta", Integer.toString(permissions.getAddmeta()));
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void setPerms(String photoId, Permissions permissions) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_PERMS);
parameters.put("photo_id", photoId);
parameters.put("is_public", permissions.isPublicFlag() ? "1" : "0");
parameters.put("is_friend", permissions.isFriendFlag() ? "1" : "0");
parameters.put("is_family", permissions.isFamilyFlag() ? "1" : "0");
parameters.put("perm_comment", Integer.toString(permissions.getComment()));
parameters.put("perm_addmeta", Integer.toString(permissions.getAddmeta()));
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"setPerms",
"(",
"String",
"photoId",
",",
"Permissions",
"permissions",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";... | Set the permissions for the photo.
This method requires authentication with 'write' permission.
@param photoId
The photo ID
@param permissions
The permissions object
@throws FlickrException | [
"Set",
"the",
"permissions",
"for",
"the",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1226-L1241 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/upload/UploadInterface.java | UploadInterface.checkTickets | public List<Ticket> checkTickets(Set<String> tickets) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_CHECK_TICKETS);
StringBuffer sb = new StringBuffer();
Iterator<String> it = tickets.iterator();
while (it.hasNext()) {
if (sb.length() > 0) {
sb.append(",");
}
Object obj = it.next();
if (obj instanceof Ticket) {
sb.append(((Ticket) obj).getTicketId());
} else {
sb.append(obj);
}
}
parameters.put("tickets", sb.toString());
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// <uploader>
// <ticket id="128" complete="1" photoid="2995" />
// <ticket id="129" complete="0" />
// <ticket id="130" complete="2" />
// <ticket id="131" invalid="1" />
// </uploader>
List<Ticket> list = new ArrayList<Ticket>();
Element uploaderElement = response.getPayload();
NodeList ticketNodes = uploaderElement.getElementsByTagName("ticket");
int n = ticketNodes.getLength();
for (int i = 0; i < n; i++) {
Element ticketElement = (Element) ticketNodes.item(i);
String id = ticketElement.getAttribute("id");
String complete = ticketElement.getAttribute("complete");
boolean invalid = "1".equals(ticketElement.getAttribute("invalid"));
String photoId = ticketElement.getAttribute("photoid");
Ticket info = new Ticket();
info.setTicketId(id);
info.setInvalid(invalid);
info.setStatus(Integer.parseInt(complete));
info.setPhotoId(photoId);
list.add(info);
}
return list;
} | java | public List<Ticket> checkTickets(Set<String> tickets) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_CHECK_TICKETS);
StringBuffer sb = new StringBuffer();
Iterator<String> it = tickets.iterator();
while (it.hasNext()) {
if (sb.length() > 0) {
sb.append(",");
}
Object obj = it.next();
if (obj instanceof Ticket) {
sb.append(((Ticket) obj).getTicketId());
} else {
sb.append(obj);
}
}
parameters.put("tickets", sb.toString());
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// <uploader>
// <ticket id="128" complete="1" photoid="2995" />
// <ticket id="129" complete="0" />
// <ticket id="130" complete="2" />
// <ticket id="131" invalid="1" />
// </uploader>
List<Ticket> list = new ArrayList<Ticket>();
Element uploaderElement = response.getPayload();
NodeList ticketNodes = uploaderElement.getElementsByTagName("ticket");
int n = ticketNodes.getLength();
for (int i = 0; i < n; i++) {
Element ticketElement = (Element) ticketNodes.item(i);
String id = ticketElement.getAttribute("id");
String complete = ticketElement.getAttribute("complete");
boolean invalid = "1".equals(ticketElement.getAttribute("invalid"));
String photoId = ticketElement.getAttribute("photoid");
Ticket info = new Ticket();
info.setTicketId(id);
info.setInvalid(invalid);
info.setStatus(Integer.parseInt(complete));
info.setPhotoId(photoId);
list.add(info);
}
return list;
} | [
"public",
"List",
"<",
"Ticket",
">",
"checkTickets",
"(",
"Set",
"<",
"String",
">",
"tickets",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",... | Checks the status of one or more asynchronous photo upload tickets. This method does not require authentication.
@param tickets
a set of ticket ids (Strings) or {@link Ticket} objects containing ids
@return a list of {@link Ticket} objects.
@throws FlickrException | [
"Checks",
"the",
"status",
"of",
"one",
"or",
"more",
"asynchronous",
"photo",
"upload",
"tickets",
".",
"This",
"method",
"does",
"not",
"require",
"authentication",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/upload/UploadInterface.java#L46-L95 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/REST.java | REST.setProxy | public void setProxy(String proxyHost, int proxyPort) {
System.setProperty("http.proxySet", "true");
System.setProperty("http.proxyHost", proxyHost);
System.setProperty("http.proxyPort", "" + proxyPort);
System.setProperty("https.proxyHost", proxyHost);
System.setProperty("https.proxyPort", "" + proxyPort);
} | java | public void setProxy(String proxyHost, int proxyPort) {
System.setProperty("http.proxySet", "true");
System.setProperty("http.proxyHost", proxyHost);
System.setProperty("http.proxyPort", "" + proxyPort);
System.setProperty("https.proxyHost", proxyHost);
System.setProperty("https.proxyPort", "" + proxyPort);
} | [
"public",
"void",
"setProxy",
"(",
"String",
"proxyHost",
",",
"int",
"proxyPort",
")",
"{",
"System",
".",
"setProperty",
"(",
"\"http.proxySet\"",
",",
"\"true\"",
")",
";",
"System",
".",
"setProperty",
"(",
"\"http.proxyHost\"",
",",
"proxyHost",
")",
";",... | Set a proxy for REST-requests.
@param proxyHost
@param proxyPort | [
"Set",
"a",
"proxy",
"for",
"REST",
"-",
"requests",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/REST.java#L103-L109 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/REST.java | REST.setProxy | public void setProxy(String proxyHost, int proxyPort, String username, String password) {
setProxy(proxyHost, proxyPort);
proxyAuth = true;
proxyUser = username;
proxyPassword = password;
} | java | public void setProxy(String proxyHost, int proxyPort, String username, String password) {
setProxy(proxyHost, proxyPort);
proxyAuth = true;
proxyUser = username;
proxyPassword = password;
} | [
"public",
"void",
"setProxy",
"(",
"String",
"proxyHost",
",",
"int",
"proxyPort",
",",
"String",
"username",
",",
"String",
"password",
")",
"{",
"setProxy",
"(",
"proxyHost",
",",
"proxyPort",
")",
";",
"proxyAuth",
"=",
"true",
";",
"proxyUser",
"=",
"u... | Set a proxy with authentication for REST-requests.
@param proxyHost
@param proxyPort
@param username
@param password | [
"Set",
"a",
"proxy",
"with",
"authentication",
"for",
"REST",
"-",
"requests",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/REST.java#L119-L124 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/REST.java | REST.get | @Override
public com.flickr4java.flickr.Response get(String path, Map<String, Object> parameters, String apiKey, String sharedSecret) throws FlickrException {
OAuthRequest request = new OAuthRequest(Verb.GET, buildUrl(path));
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
request.addQuerystringParameter(entry.getKey(), String.valueOf(entry.getValue()));
}
if (proxyAuth) {
request.addHeader("Proxy-Authorization", "Basic " + getProxyCredentials());
}
RequestContext requestContext = RequestContext.getRequestContext();
Auth auth = requestContext.getAuth();
OAuth10aService service = createOAuthService(apiKey, sharedSecret);
if (auth != null) {
OAuth1AccessToken requestToken = new OAuth1AccessToken(auth.getToken(), auth.getTokenSecret());
service.signRequest(requestToken, request);
} else {
// For calls that do not require authorization e.g. flickr.people.findByUsername which could be the
// first call if the user did not supply the user-id (i.e. nsid).
if (!parameters.containsKey(Flickr.API_KEY)) {
request.addQuerystringParameter(Flickr.API_KEY, apiKey);
}
}
if (Flickr.debugRequest) {
logger.debug("GET: " + request.getCompleteUrl());
}
try {
return handleResponse(request, service);
} catch (IllegalAccessException | InstantiationException | SAXException | IOException | InterruptedException | ExecutionException | ParserConfigurationException e) {
throw new FlickrRuntimeException(e);
}
} | java | @Override
public com.flickr4java.flickr.Response get(String path, Map<String, Object> parameters, String apiKey, String sharedSecret) throws FlickrException {
OAuthRequest request = new OAuthRequest(Verb.GET, buildUrl(path));
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
request.addQuerystringParameter(entry.getKey(), String.valueOf(entry.getValue()));
}
if (proxyAuth) {
request.addHeader("Proxy-Authorization", "Basic " + getProxyCredentials());
}
RequestContext requestContext = RequestContext.getRequestContext();
Auth auth = requestContext.getAuth();
OAuth10aService service = createOAuthService(apiKey, sharedSecret);
if (auth != null) {
OAuth1AccessToken requestToken = new OAuth1AccessToken(auth.getToken(), auth.getTokenSecret());
service.signRequest(requestToken, request);
} else {
// For calls that do not require authorization e.g. flickr.people.findByUsername which could be the
// first call if the user did not supply the user-id (i.e. nsid).
if (!parameters.containsKey(Flickr.API_KEY)) {
request.addQuerystringParameter(Flickr.API_KEY, apiKey);
}
}
if (Flickr.debugRequest) {
logger.debug("GET: " + request.getCompleteUrl());
}
try {
return handleResponse(request, service);
} catch (IllegalAccessException | InstantiationException | SAXException | IOException | InterruptedException | ExecutionException | ParserConfigurationException e) {
throw new FlickrRuntimeException(e);
}
} | [
"@",
"Override",
"public",
"com",
".",
"flickr4java",
".",
"flickr",
".",
"Response",
"get",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
",",
"String",
"apiKey",
",",
"String",
"sharedSecret",
")",
"throws",
"FlickrE... | Invoke an HTTP GET request on a remote host. You must close the InputStream after you are done with.
@param path The request path
@param parameters The parameters (collection of Parameter objects)
@return The Response | [
"Invoke",
"an",
"HTTP",
"GET",
"request",
"on",
"a",
"remote",
"host",
".",
"You",
"must",
"close",
"the",
"InputStream",
"after",
"you",
"are",
"done",
"with",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/REST.java#L133-L168 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photosets/comments/PhotosetsCommentsInterface.java | PhotosetsCommentsInterface.addComment | public String addComment(String photosetId, String commentText) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_ADD_COMMENT);
parameters.put("photoset_id", photosetId);
parameters.put("comment_text", commentText);
// Note: This method requires an HTTP POST request.
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// response:
// <comment id="97777-12492-72057594037942601" />
Element commentElement = response.getPayload();
return commentElement.getAttribute("id");
} | java | public String addComment(String photosetId, String commentText) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_ADD_COMMENT);
parameters.put("photoset_id", photosetId);
parameters.put("comment_text", commentText);
// Note: This method requires an HTTP POST request.
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// response:
// <comment id="97777-12492-72057594037942601" />
Element commentElement = response.getPayload();
return commentElement.getAttribute("id");
} | [
"public",
"String",
"addComment",
"(",
"String",
"photosetId",
",",
"String",
"commentText",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
... | Add a comment to a photoset. This method requires authentication with 'write' permission.
@param photosetId
The id of the photoset to add a comment to.
@param commentText
Text of the comment
@return the comment id
@throws FlickrException | [
"Add",
"a",
"comment",
"to",
"a",
"photoset",
".",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/comments/PhotosetsCommentsInterface.java#L55-L71 | train |
boncey/Flickr4Java | src/examples/java/FlickrCrawler.java | FlickrCrawler.convertToFileSystemChar | public static String convertToFileSystemChar(String name) {
String erg = "";
Matcher m = Pattern.compile("[a-z0-9 _#&@\\[\\(\\)\\]\\-\\.]", Pattern.CASE_INSENSITIVE).matcher(name);
while (m.find()) {
erg += name.substring(m.start(), m.end());
}
if (erg.length() > 200) {
erg = erg.substring(0, 200);
System.out.println("cut filename: " + erg);
}
return erg;
} | java | public static String convertToFileSystemChar(String name) {
String erg = "";
Matcher m = Pattern.compile("[a-z0-9 _#&@\\[\\(\\)\\]\\-\\.]", Pattern.CASE_INSENSITIVE).matcher(name);
while (m.find()) {
erg += name.substring(m.start(), m.end());
}
if (erg.length() > 200) {
erg = erg.substring(0, 200);
System.out.println("cut filename: " + erg);
}
return erg;
} | [
"public",
"static",
"String",
"convertToFileSystemChar",
"(",
"String",
"name",
")",
"{",
"String",
"erg",
"=",
"\"\"",
";",
"Matcher",
"m",
"=",
"Pattern",
".",
"compile",
"(",
"\"[a-z0-9 _#&@\\\\[\\\\(\\\\)\\\\]\\\\-\\\\.]\"",
",",
"Pattern",
".",
"CASE_INSENSITIV... | convert filename to clean filename | [
"convert",
"filename",
"to",
"clean",
"filename"
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/examples/java/FlickrCrawler.java#L28-L39 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java | GeoInterface.getPerms | public GeoPermissions getPerms(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_PERMS);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// response:
// <perms id="240935723" ispublic="1" iscontact="0" isfriend="0" isfamily="0"/>
GeoPermissions perms = new GeoPermissions();
Element permsElement = response.getPayload();
perms.setPublic("1".equals(permsElement.getAttribute("ispublic")));
perms.setContact("1".equals(permsElement.getAttribute("iscontact")));
perms.setFriend("1".equals(permsElement.getAttribute("isfriend")));
perms.setFamily("1".equals(permsElement.getAttribute("isfamily")));
perms.setId(permsElement.getAttribute("id"));
// I ignore the id attribute. should be the same as the given
// photo id.
return perms;
} | java | public GeoPermissions getPerms(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_PERMS);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// response:
// <perms id="240935723" ispublic="1" iscontact="0" isfriend="0" isfamily="0"/>
GeoPermissions perms = new GeoPermissions();
Element permsElement = response.getPayload();
perms.setPublic("1".equals(permsElement.getAttribute("ispublic")));
perms.setContact("1".equals(permsElement.getAttribute("iscontact")));
perms.setFriend("1".equals(permsElement.getAttribute("isfriend")));
perms.setFamily("1".equals(permsElement.getAttribute("isfamily")));
perms.setId(permsElement.getAttribute("id"));
// I ignore the id attribute. should be the same as the given
// photo id.
return perms;
} | [
"public",
"GeoPermissions",
"getPerms",
"(",
"String",
"photoId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"pu... | Get permissions for who may view geo data for a photo.
This method requires authentication with 'read' permission.
@param photoId
reqired photo id, not null
@return the permissions
@throws FlickrException
if photo id is invalid, if photo has no geodata or if any other error has been reported in the response. | [
"Get",
"permissions",
"for",
"who",
"may",
"view",
"geo",
"data",
"for",
"a",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java#L105-L126 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java | GeoInterface.setPerms | public void setPerms(String photoId, GeoPermissions perms) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_PERMS);
parameters.put("photo_id", photoId);
parameters.put("is_public", perms.isPublic() ? "1" : "0");
parameters.put("is_contact", perms.isContact() ? "1" : "0");
parameters.put("is_friend", perms.isFriend() ? "1" : "0");
parameters.put("is_family", perms.isFamily() ? "1" : "0");
// Note: This method requires an HTTP POST request.
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
// This method has no specific response - It returns an empty sucess response
// if it completes without error.
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void setPerms(String photoId, GeoPermissions perms) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_PERMS);
parameters.put("photo_id", photoId);
parameters.put("is_public", perms.isPublic() ? "1" : "0");
parameters.put("is_contact", perms.isContact() ? "1" : "0");
parameters.put("is_friend", perms.isFriend() ? "1" : "0");
parameters.put("is_family", perms.isFamily() ? "1" : "0");
// Note: This method requires an HTTP POST request.
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
// This method has no specific response - It returns an empty sucess response
// if it completes without error.
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"setPerms",
"(",
"String",
"photoId",
",",
"GeoPermissions",
"perms",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
... | Set the permission for who may view the geo data associated with a photo.
This method requires authentication with 'write' permission.
@param photoId
The id of the photo to set permissions for.
@param perms
Permissions, who can see the geo data of this photo
@throws FlickrException | [
"Set",
"the",
"permission",
"for",
"who",
"may",
"view",
"the",
"geo",
"data",
"associated",
"with",
"a",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java#L194-L210 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java | GeoInterface.photosForLocation | public PhotoList<Photo> photosForLocation(GeoData location, Set<String> extras, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
PhotoList<Photo> photos = new PhotoList<Photo>();
parameters.put("method", METHOD_PHOTOS_FOR_LOCATION);
if (extras.size() > 0) {
parameters.put("extras", StringUtilities.join(extras, ","));
}
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
parameters.put("lat", Float.toString(location.getLatitude()));
parameters.put("lon", Float.toString(location.getLongitude()));
parameters.put("accuracy", Integer.toString(location.getAccuracy()));
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoElements = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoElements.getLength(); i++) {
Element photoElement = (Element) photoElements.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | java | public PhotoList<Photo> photosForLocation(GeoData location, Set<String> extras, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
PhotoList<Photo> photos = new PhotoList<Photo>();
parameters.put("method", METHOD_PHOTOS_FOR_LOCATION);
if (extras.size() > 0) {
parameters.put("extras", StringUtilities.join(extras, ","));
}
if (perPage > 0) {
parameters.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
parameters.put("page", Integer.toString(page));
}
parameters.put("lat", Float.toString(location.getLatitude()));
parameters.put("lon", Float.toString(location.getLongitude()));
parameters.put("accuracy", Integer.toString(location.getAccuracy()));
Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoElements = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoElements.getLength(); i++) {
Element photoElement = (Element) photoElements.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"photosForLocation",
"(",
"GeoData",
"location",
",",
"Set",
"<",
"String",
">",
"extras",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",... | Return a list of photos for a user at a specific latitude, longitude and accuracy.
@param location
@param extras
@param perPage
@param page
@return The collection of Photo objects
@throws FlickrException
@see com.flickr4java.flickr.photos.Extras | [
"Return",
"a",
"list",
"of",
"photos",
"for",
"a",
"user",
"at",
"a",
"specific",
"latitude",
"longitude",
"and",
"accuracy",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java#L291-L324 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/collections/CollectionsInterface.java | CollectionsInterface.parseCollection | private Collection parseCollection(Element collectionElement) {
Collection collection = new Collection();
collection.setId(collectionElement.getAttribute("id"));
collection.setServer(collectionElement.getAttribute("server"));
collection.setSecret(collectionElement.getAttribute("secret"));
collection.setChildCount(collectionElement.getAttribute("child_count"));
collection.setIconLarge(collectionElement.getAttribute("iconlarge"));
collection.setIconSmall(collectionElement.getAttribute("iconsmall"));
collection.setDateCreated(collectionElement.getAttribute("datecreate"));
collection.setTitle(XMLUtilities.getChildValue(collectionElement, "title"));
collection.setDescription(XMLUtilities.getChildValue(collectionElement, "description"));
Element iconPhotos = XMLUtilities.getChild(collectionElement, "iconphotos");
if (iconPhotos != null) {
NodeList photoElements = iconPhotos.getElementsByTagName("photo");
for (int i = 0; i < photoElements.getLength(); i++) {
Element photoElement = (Element) photoElements.item(i);
collection.addPhoto(PhotoUtils.createPhoto(photoElement));
}
}
return collection;
} | java | private Collection parseCollection(Element collectionElement) {
Collection collection = new Collection();
collection.setId(collectionElement.getAttribute("id"));
collection.setServer(collectionElement.getAttribute("server"));
collection.setSecret(collectionElement.getAttribute("secret"));
collection.setChildCount(collectionElement.getAttribute("child_count"));
collection.setIconLarge(collectionElement.getAttribute("iconlarge"));
collection.setIconSmall(collectionElement.getAttribute("iconsmall"));
collection.setDateCreated(collectionElement.getAttribute("datecreate"));
collection.setTitle(XMLUtilities.getChildValue(collectionElement, "title"));
collection.setDescription(XMLUtilities.getChildValue(collectionElement, "description"));
Element iconPhotos = XMLUtilities.getChild(collectionElement, "iconphotos");
if (iconPhotos != null) {
NodeList photoElements = iconPhotos.getElementsByTagName("photo");
for (int i = 0; i < photoElements.getLength(); i++) {
Element photoElement = (Element) photoElements.item(i);
collection.addPhoto(PhotoUtils.createPhoto(photoElement));
}
}
return collection;
} | [
"private",
"Collection",
"parseCollection",
"(",
"Element",
"collectionElement",
")",
"{",
"Collection",
"collection",
"=",
"new",
"Collection",
"(",
")",
";",
"collection",
".",
"setId",
"(",
"collectionElement",
".",
"getAttribute",
"(",
"\"id\"",
")",
")",
";... | Parse the XML for a collection as returned by getInfo call.
@param collectionElement
@return | [
"Parse",
"the",
"XML",
"for",
"a",
"collection",
"as",
"returned",
"by",
"getInfo",
"call",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/collections/CollectionsInterface.java#L120-L143 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/collections/CollectionsInterface.java | CollectionsInterface.parseTreeCollection | private Collection parseTreeCollection(Element collectionElement) {
Collection collection = new Collection();
parseCommonFields(collectionElement, collection);
collection.setTitle(collectionElement.getAttribute("title"));
collection.setDescription(collectionElement.getAttribute("description"));
// Collections can contain either sets or collections (but not both)
NodeList childCollectionElements = collectionElement.getElementsByTagName("collection");
for (int i = 0; i < childCollectionElements.getLength(); i++) {
Element childCollectionElement = (Element) childCollectionElements.item(i);
collection.addCollection(parseTreeCollection(childCollectionElement));
}
NodeList childPhotosetElements = collectionElement.getElementsByTagName("set");
for (int i = 0; i < childPhotosetElements.getLength(); i++) {
Element childPhotosetElement = (Element) childPhotosetElements.item(i);
collection.addPhotoset(createPhotoset(childPhotosetElement));
}
return collection;
} | java | private Collection parseTreeCollection(Element collectionElement) {
Collection collection = new Collection();
parseCommonFields(collectionElement, collection);
collection.setTitle(collectionElement.getAttribute("title"));
collection.setDescription(collectionElement.getAttribute("description"));
// Collections can contain either sets or collections (but not both)
NodeList childCollectionElements = collectionElement.getElementsByTagName("collection");
for (int i = 0; i < childCollectionElements.getLength(); i++) {
Element childCollectionElement = (Element) childCollectionElements.item(i);
collection.addCollection(parseTreeCollection(childCollectionElement));
}
NodeList childPhotosetElements = collectionElement.getElementsByTagName("set");
for (int i = 0; i < childPhotosetElements.getLength(); i++) {
Element childPhotosetElement = (Element) childPhotosetElements.item(i);
collection.addPhotoset(createPhotoset(childPhotosetElement));
}
return collection;
} | [
"private",
"Collection",
"parseTreeCollection",
"(",
"Element",
"collectionElement",
")",
"{",
"Collection",
"collection",
"=",
"new",
"Collection",
"(",
")",
";",
"parseCommonFields",
"(",
"collectionElement",
",",
"collection",
")",
";",
"collection",
".",
"setTit... | Parse the XML for a collection as returned by getTree call.
@param collectionElement
@return | [
"Parse",
"the",
"XML",
"for",
"a",
"collection",
"as",
"returned",
"by",
"getTree",
"call",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/collections/CollectionsInterface.java#L151-L172 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/util/XMLUtilities.java | XMLUtilities.getValue | public static String getValue(Element element) {
if (element != null) {
Node dataNode = element.getFirstChild();
if (dataNode != null) {
return ((Text) dataNode).getData();
}
}
return null;
} | java | public static String getValue(Element element) {
if (element != null) {
Node dataNode = element.getFirstChild();
if (dataNode != null) {
return ((Text) dataNode).getData();
}
}
return null;
} | [
"public",
"static",
"String",
"getValue",
"(",
"Element",
"element",
")",
"{",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"Node",
"dataNode",
"=",
"element",
".",
"getFirstChild",
"(",
")",
";",
"if",
"(",
"dataNode",
"!=",
"null",
")",
"{",
"return... | Get the text value for the specified element. If the element is null, or the element's body is empty then this method will return null.
@param element
The Element
@return The value String or null | [
"Get",
"the",
"text",
"value",
"for",
"the",
"specified",
"element",
".",
"If",
"the",
"element",
"is",
"null",
"or",
"the",
"element",
"s",
"body",
"is",
"empty",
"then",
"this",
"method",
"will",
"return",
"null",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/util/XMLUtilities.java#L41-L49 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/util/XMLUtilities.java | XMLUtilities.getChild | public static Element getChild(Element element, String name) {
return (Element) element.getElementsByTagName(name).item(0);
} | java | public static Element getChild(Element element, String name) {
return (Element) element.getElementsByTagName(name).item(0);
} | [
"public",
"static",
"Element",
"getChild",
"(",
"Element",
"element",
",",
"String",
"name",
")",
"{",
"return",
"(",
"Element",
")",
"element",
".",
"getElementsByTagName",
"(",
"name",
")",
".",
"item",
"(",
"0",
")",
";",
"}"
] | Get the first child element with the given name.
@param element
The parent element
@param name
The child element name
@return The child element or null | [
"Get",
"the",
"first",
"child",
"element",
"with",
"the",
"given",
"name",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/util/XMLUtilities.java#L60-L62 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/util/XMLUtilities.java | XMLUtilities.getChildValue | public static String getChildValue(Element element, String name) {
return getValue(getChild(element, name));
} | java | public static String getChildValue(Element element, String name) {
return getValue(getChild(element, name));
} | [
"public",
"static",
"String",
"getChildValue",
"(",
"Element",
"element",
",",
"String",
"name",
")",
"{",
"return",
"getValue",
"(",
"getChild",
"(",
"element",
",",
"name",
")",
")",
";",
"}"
] | Get the value of the fist child element with the given name.
@param element
The parent element
@param name
The child element name
@return The child element value or null | [
"Get",
"the",
"value",
"of",
"the",
"fist",
"child",
"element",
"with",
"the",
"given",
"name",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/util/XMLUtilities.java#L73-L75 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/people/PeopleInterface.java | PeopleInterface.findByEmail | public User findByEmail(String email) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_FIND_BY_EMAIL);
parameters.put("find_email", email);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element userElement = response.getPayload();
User user = new User();
user.setId(userElement.getAttribute("nsid"));
user.setUsername(XMLUtilities.getChildValue(userElement, "username"));
return user;
} | java | public User findByEmail(String email) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_FIND_BY_EMAIL);
parameters.put("find_email", email);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element userElement = response.getPayload();
User user = new User();
user.setId(userElement.getAttribute("nsid"));
user.setUsername(XMLUtilities.getChildValue(userElement, "username"));
return user;
} | [
"public",
"User",
"findByEmail",
"(",
"String",
"email",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
"("... | Find the user by their email address.
This method does not require authentication.
@param email
The email address
@return The User
@throws FlickrException | [
"Find",
"the",
"user",
"by",
"their",
"email",
"address",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L80-L95 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/people/PeopleInterface.java | PeopleInterface.getPublicGroups | public Collection<Group> getPublicGroups(String userId) throws FlickrException {
List<Group> groups = new ArrayList<Group>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_PUBLIC_GROUPS);
parameters.put("user_id", userId);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element groupsElement = response.getPayload();
NodeList groupNodes = groupsElement.getElementsByTagName("group");
for (int i = 0; i < groupNodes.getLength(); i++) {
Element groupElement = (Element) groupNodes.item(i);
Group group = new Group();
group.setId(groupElement.getAttribute("nsid"));
group.setName(groupElement.getAttribute("name"));
group.setAdmin("1".equals(groupElement.getAttribute("admin")));
group.setEighteenPlus(groupElement.getAttribute("eighteenplus").equals("0") ? false : true);
groups.add(group);
}
return groups;
} | java | public Collection<Group> getPublicGroups(String userId) throws FlickrException {
List<Group> groups = new ArrayList<Group>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_PUBLIC_GROUPS);
parameters.put("user_id", userId);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element groupsElement = response.getPayload();
NodeList groupNodes = groupsElement.getElementsByTagName("group");
for (int i = 0; i < groupNodes.getLength(); i++) {
Element groupElement = (Element) groupNodes.item(i);
Group group = new Group();
group.setId(groupElement.getAttribute("nsid"));
group.setName(groupElement.getAttribute("name"));
group.setAdmin("1".equals(groupElement.getAttribute("admin")));
group.setEighteenPlus(groupElement.getAttribute("eighteenplus").equals("0") ? false : true);
groups.add(group);
}
return groups;
} | [
"public",
"Collection",
"<",
"Group",
">",
"getPublicGroups",
"(",
"String",
"userId",
")",
"throws",
"FlickrException",
"{",
"List",
"<",
"Group",
">",
"groups",
"=",
"new",
"ArrayList",
"<",
"Group",
">",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Obje... | Get a collection of public groups for the user.
The groups will contain only the members nsid, name, admin and eighteenplus. If you want the whole group-information, you have to call
{@link com.flickr4java.flickr.groups.GroupsInterface#getInfo(String)}.
This method does not require authentication.
@param userId
The user ID
@return The public groups
@throws FlickrException | [
"Get",
"a",
"collection",
"of",
"public",
"groups",
"for",
"the",
"user",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L201-L225 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/people/PeopleInterface.java | PeopleInterface.getPublicPhotos | public PhotoList<Photo> getPublicPhotos(String userId, 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", METHOD_GET_PUBLIC_PHOTOS);
parameters.put("user_id", userId);
if (perPage > 0) {
parameters.put("per_page", "" + perPage);
}
if (page > 0) {
parameters.put("page", "" + page);
}
if (extras != null) {
parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, ","));
}
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoNodes = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | java | public PhotoList<Photo> getPublicPhotos(String userId, 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", METHOD_GET_PUBLIC_PHOTOS);
parameters.put("user_id", userId);
if (perPage > 0) {
parameters.put("per_page", "" + perPage);
}
if (page > 0) {
parameters.put("page", "" + page);
}
if (extras != null) {
parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, ","));
}
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoNodes = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"getPublicPhotos",
"(",
"String",
"userId",
",",
"Set",
"<",
"String",
">",
"extras",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"PhotoList",
"<",
"Photo",
">",
"photos",
"=",... | Get a collection of public photos for the specified user ID.
This method does not require authentication.
@see com.flickr4java.flickr.photos.Extras
@param userId
The User ID
@param extras
Set of extra-attributes to include (may be null)
@param perPage
The number of photos per page
@param page
The page offset
@return The PhotoList collection
@throws FlickrException | [
"Get",
"a",
"collection",
"of",
"public",
"photos",
"for",
"the",
"specified",
"user",
"ID",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L248-L283 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/people/PeopleInterface.java | PeopleInterface.getUploadStatus | public User getUploadStatus() throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_UPLOAD_STATUS);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element userElement = response.getPayload();
User user = new User();
user.setId(userElement.getAttribute("id"));
user.setPro("1".equals(userElement.getAttribute("ispro")));
user.setUsername(XMLUtilities.getChildValue(userElement, "username"));
Element bandwidthElement = XMLUtilities.getChild(userElement, "bandwidth");
user.setBandwidthMax(bandwidthElement.getAttribute("max"));
user.setBandwidthUsed(bandwidthElement.getAttribute("used"));
user.setIsBandwidthUnlimited("1".equals(bandwidthElement.getAttribute("unlimited")));
Element filesizeElement = XMLUtilities.getChild(userElement, "filesize");
user.setFilesizeMax(filesizeElement.getAttribute("max"));
Element setsElement = XMLUtilities.getChild(userElement, "sets");
user.setSetsCreated(setsElement.getAttribute("created"));
user.setSetsRemaining(setsElement.getAttribute("remaining"));
Element videosElement = XMLUtilities.getChild(userElement, "videos");
user.setVideosUploaded(videosElement.getAttribute("uploaded"));
user.setVideosRemaining(videosElement.getAttribute("remaining"));
Element videoSizeElement = XMLUtilities.getChild(userElement, "videosize");
user.setVideoSizeMax(videoSizeElement.getAttribute("maxbytes"));
return user;
} | java | public User getUploadStatus() throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_UPLOAD_STATUS);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element userElement = response.getPayload();
User user = new User();
user.setId(userElement.getAttribute("id"));
user.setPro("1".equals(userElement.getAttribute("ispro")));
user.setUsername(XMLUtilities.getChildValue(userElement, "username"));
Element bandwidthElement = XMLUtilities.getChild(userElement, "bandwidth");
user.setBandwidthMax(bandwidthElement.getAttribute("max"));
user.setBandwidthUsed(bandwidthElement.getAttribute("used"));
user.setIsBandwidthUnlimited("1".equals(bandwidthElement.getAttribute("unlimited")));
Element filesizeElement = XMLUtilities.getChild(userElement, "filesize");
user.setFilesizeMax(filesizeElement.getAttribute("max"));
Element setsElement = XMLUtilities.getChild(userElement, "sets");
user.setSetsCreated(setsElement.getAttribute("created"));
user.setSetsRemaining(setsElement.getAttribute("remaining"));
Element videosElement = XMLUtilities.getChild(userElement, "videos");
user.setVideosUploaded(videosElement.getAttribute("uploaded"));
user.setVideosRemaining(videosElement.getAttribute("remaining"));
Element videoSizeElement = XMLUtilities.getChild(userElement, "videosize");
user.setVideoSizeMax(videoSizeElement.getAttribute("maxbytes"));
return user;
} | [
"public",
"User",
"getUploadStatus",
"(",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"\"method\"",
... | Get upload status for the currently authenticated user.
Requires authentication with 'read' permission using the new authentication API.
@return A User object with upload status data fields filled
@throws FlickrException | [
"Get",
"upload",
"status",
"for",
"the",
"currently",
"authenticated",
"user",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L293-L327 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/people/PeopleInterface.java | PeopleInterface.add | public void add(String photoId, String userId, Rectangle bounds) throws FlickrException {
// Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause issues
com.flickr4java.flickr.photos.people.PeopleInterface pi = new com.flickr4java.flickr.photos.people.PeopleInterface(apiKey, sharedSecret, transportAPI);
pi.add(photoId, userId, bounds);
} | java | public void add(String photoId, String userId, Rectangle bounds) throws FlickrException {
// Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause issues
com.flickr4java.flickr.photos.people.PeopleInterface pi = new com.flickr4java.flickr.photos.people.PeopleInterface(apiKey, sharedSecret, transportAPI);
pi.add(photoId, userId, bounds);
} | [
"public",
"void",
"add",
"(",
"String",
"photoId",
",",
"String",
"userId",
",",
"Rectangle",
"bounds",
")",
"throws",
"FlickrException",
"{",
"// Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause i... | Add the given person to the photo. Optionally, send in co-ordinates
@param photoId
@param userId
@param bounds
@throws FlickrException | [
"Add",
"the",
"given",
"person",
"to",
"the",
"photo",
".",
"Optionally",
"send",
"in",
"co",
"-",
"ordinates"
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L445-L450 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/people/PeopleInterface.java | PeopleInterface.getList | public PersonTagList<PersonTag> getList(String photoId) throws FlickrException {
// Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause issues
com.flickr4java.flickr.photos.people.PeopleInterface pi = new com.flickr4java.flickr.photos.people.PeopleInterface(apiKey, sharedSecret, transportAPI);
return pi.getList(photoId);
} | java | public PersonTagList<PersonTag> getList(String photoId) throws FlickrException {
// Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause issues
com.flickr4java.flickr.photos.people.PeopleInterface pi = new com.flickr4java.flickr.photos.people.PeopleInterface(apiKey, sharedSecret, transportAPI);
return pi.getList(photoId);
} | [
"public",
"PersonTagList",
"<",
"PersonTag",
">",
"getList",
"(",
"String",
"photoId",
")",
"throws",
"FlickrException",
"{",
"// Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause issues\r",
"com",
".... | Get a list of people in a given photo.
@param photoId
@throws FlickrException | [
"Get",
"a",
"list",
"of",
"people",
"in",
"a",
"given",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L501-L506 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/people/PeopleInterface.java | PeopleInterface.getLimits | public User getLimits() throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_LIMITS);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element userElement = response.getPayload();
User user = new User();
user.setId(userElement.getAttribute("nsid"));
NodeList photoNodes = userElement.getElementsByTagName("photos");
for (int i = 0; i < photoNodes.getLength(); i++) {
Element plElement = (Element) photoNodes.item(i);
PhotoLimits pl = new PhotoLimits();
user.setPhotoLimits(pl);
pl.setMaxDisplay(plElement.getAttribute("maxdisplaypx"));
pl.setMaxUpload(plElement.getAttribute("maxupload"));
}
NodeList videoNodes = userElement.getElementsByTagName("videos");
for (int i = 0; i < videoNodes.getLength(); i++) {
Element vlElement = (Element) videoNodes.item(i);
VideoLimits vl = new VideoLimits();
user.setPhotoLimits(vl);
vl.setMaxDuration(vlElement.getAttribute("maxduration"));
vl.setMaxUpload(vlElement.getAttribute("maxupload"));
}
return user;
} | java | public User getLimits() throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_LIMITS);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element userElement = response.getPayload();
User user = new User();
user.setId(userElement.getAttribute("nsid"));
NodeList photoNodes = userElement.getElementsByTagName("photos");
for (int i = 0; i < photoNodes.getLength(); i++) {
Element plElement = (Element) photoNodes.item(i);
PhotoLimits pl = new PhotoLimits();
user.setPhotoLimits(pl);
pl.setMaxDisplay(plElement.getAttribute("maxdisplaypx"));
pl.setMaxUpload(plElement.getAttribute("maxupload"));
}
NodeList videoNodes = userElement.getElementsByTagName("videos");
for (int i = 0; i < videoNodes.getLength(); i++) {
Element vlElement = (Element) videoNodes.item(i);
VideoLimits vl = new VideoLimits();
user.setPhotoLimits(vl);
vl.setMaxDuration(vlElement.getAttribute("maxduration"));
vl.setMaxUpload(vlElement.getAttribute("maxupload"));
}
return user;
} | [
"public",
"User",
"getLimits",
"(",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"\"method\"",
",",
... | Get's the user's current upload limits, User object only contains user_id
@return Media Limits | [
"Get",
"s",
"the",
"user",
"s",
"current",
"upload",
"limits",
"User",
"object",
"only",
"contains",
"user_id"
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L552-L580 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/galleries/GalleriesInterface.java | GalleriesInterface.getList | public List<Gallery> getList(String userId, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_LIST);
parameters.put("user_id", userId);
if (perPage > 0) {
parameters.put("per_page", String.valueOf(perPage));
}
if (page > 0) {
parameters.put("page", String.valueOf(page));
}
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element element = response.getPayload();
GalleryList<Gallery> galleries = new GalleryList<Gallery>();
galleries.setPage(element.getAttribute("page"));
galleries.setPages(element.getAttribute("pages"));
galleries.setPerPage(element.getAttribute("per_page"));
galleries.setTotal(element.getAttribute("total"));
NodeList galleryNodes = element.getElementsByTagName("gallery");
for (int i = 0; i < galleryNodes.getLength(); i++) {
Element galleryElement = (Element) galleryNodes.item(i);
Gallery gallery = new Gallery();
gallery.setId(galleryElement.getAttribute("id"));
gallery.setUrl(galleryElement.getAttribute("url"));
User owner = new User();
owner.setId(galleryElement.getAttribute("owner"));
gallery.setOwner(owner);
gallery.setCreateDate(galleryElement.getAttribute("date_create"));
gallery.setUpdateDate(galleryElement.getAttribute("date_update"));
gallery.setPrimaryPhotoId(galleryElement.getAttribute("primary_photo_id"));
gallery.setPrimaryPhotoServer(galleryElement.getAttribute("primary_photo_server"));
gallery.setPrimaryPhotoFarm(galleryElement.getAttribute("primary_photo_farm"));
gallery.setPrimaryPhotoSecret(galleryElement.getAttribute("primary_photo_secret"));
gallery.setPhotoCount(galleryElement.getAttribute("count_photos"));
gallery.setVideoCount(galleryElement.getAttribute("count_videos"));
galleries.add(gallery);
}
return galleries;
} | java | public List<Gallery> getList(String userId, int perPage, int page) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_LIST);
parameters.put("user_id", userId);
if (perPage > 0) {
parameters.put("per_page", String.valueOf(perPage));
}
if (page > 0) {
parameters.put("page", String.valueOf(page));
}
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element element = response.getPayload();
GalleryList<Gallery> galleries = new GalleryList<Gallery>();
galleries.setPage(element.getAttribute("page"));
galleries.setPages(element.getAttribute("pages"));
galleries.setPerPage(element.getAttribute("per_page"));
galleries.setTotal(element.getAttribute("total"));
NodeList galleryNodes = element.getElementsByTagName("gallery");
for (int i = 0; i < galleryNodes.getLength(); i++) {
Element galleryElement = (Element) galleryNodes.item(i);
Gallery gallery = new Gallery();
gallery.setId(galleryElement.getAttribute("id"));
gallery.setUrl(galleryElement.getAttribute("url"));
User owner = new User();
owner.setId(galleryElement.getAttribute("owner"));
gallery.setOwner(owner);
gallery.setCreateDate(galleryElement.getAttribute("date_create"));
gallery.setUpdateDate(galleryElement.getAttribute("date_update"));
gallery.setPrimaryPhotoId(galleryElement.getAttribute("primary_photo_id"));
gallery.setPrimaryPhotoServer(galleryElement.getAttribute("primary_photo_server"));
gallery.setPrimaryPhotoFarm(galleryElement.getAttribute("primary_photo_farm"));
gallery.setPrimaryPhotoSecret(galleryElement.getAttribute("primary_photo_secret"));
gallery.setPhotoCount(galleryElement.getAttribute("count_photos"));
gallery.setVideoCount(galleryElement.getAttribute("count_videos"));
galleries.add(gallery);
}
return galleries;
} | [
"public",
"List",
"<",
"Gallery",
">",
"getList",
"(",
"String",
"userId",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
","... | Return the list of galleries created by a user. Sorted from newest to oldest.
@param userId
The user you want to check for
@param perPage
Number of galleries per page
@param page
The page number
@return gallery
@throws FlickrException
@see <a hrerf="http://www.flickr.com/services/api/flickr.galleries.getList.html">flickr.galleries.getList</a> | [
"Return",
"the",
"list",
"of",
"galleries",
"created",
"by",
"a",
"user",
".",
"Sorted",
"from",
"newest",
"to",
"oldest",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/galleries/GalleriesInterface.java#L82-L127 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/notes/NotesInterface.java | NotesInterface.add | public Note add(String photoId, Note note) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_ADD);
parameters.put("photo_id", photoId);
Rectangle bounds = note.getBounds();
if (bounds != null) {
parameters.put("note_x", String.valueOf(bounds.x));
parameters.put("note_y", String.valueOf(bounds.y));
parameters.put("note_w", String.valueOf(bounds.width));
parameters.put("note_h", String.valueOf(bounds.height));
}
String text = note.getText();
if (text != null) {
parameters.put("note_text", text);
}
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element noteElement = response.getPayload();
note.setId(noteElement.getAttribute("id"));
return note;
} | java | public Note add(String photoId, Note note) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_ADD);
parameters.put("photo_id", photoId);
Rectangle bounds = note.getBounds();
if (bounds != null) {
parameters.put("note_x", String.valueOf(bounds.x));
parameters.put("note_y", String.valueOf(bounds.y));
parameters.put("note_w", String.valueOf(bounds.width));
parameters.put("note_h", String.valueOf(bounds.height));
}
String text = note.getText();
if (text != null) {
parameters.put("note_text", text);
}
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element noteElement = response.getPayload();
note.setId(noteElement.getAttribute("id"));
return note;
} | [
"public",
"Note",
"add",
"(",
"String",
"photoId",
",",
"Note",
"note",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
... | Add a note to a photo. The Note object bounds and text must be specified.
@param photoId
The photo ID
@param note
The Note object
@return The updated Note object | [
"Add",
"a",
"note",
"to",
"a",
"photo",
".",
"The",
"Note",
"object",
"bounds",
"and",
"text",
"must",
"be",
"specified",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/notes/NotesInterface.java#L48-L73 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/notes/NotesInterface.java | NotesInterface.edit | public void edit(Note note) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_EDIT);
parameters.put("note_id", note.getId());
Rectangle bounds = note.getBounds();
if (bounds != null) {
parameters.put("note_x", String.valueOf(bounds.x));
parameters.put("note_y", String.valueOf(bounds.y));
parameters.put("note_w", String.valueOf(bounds.width));
parameters.put("note_h", String.valueOf(bounds.height));
}
String text = note.getText();
if (text != null) {
parameters.put("note_text", text);
}
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void edit(Note note) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_EDIT);
parameters.put("note_id", note.getId());
Rectangle bounds = note.getBounds();
if (bounds != null) {
parameters.put("note_x", String.valueOf(bounds.x));
parameters.put("note_y", String.valueOf(bounds.y));
parameters.put("note_w", String.valueOf(bounds.width));
parameters.put("note_h", String.valueOf(bounds.height));
}
String text = note.getText();
if (text != null) {
parameters.put("note_text", text);
}
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"edit",
"(",
"Note",
"note",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"\"met... | Update a note.
@param note
The Note to update
@throws FlickrException | [
"Update",
"a",
"note",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/notes/NotesInterface.java#L101-L122 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java | LicensesInterface.getInfo | public Collection<License> getInfo() throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_INFO);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
List<License> licenses = new ArrayList<License>();
Element licensesElement = response.getPayload();
NodeList licenseElements = licensesElement.getElementsByTagName("license");
for (int i = 0; i < licenseElements.getLength(); i++) {
Element licenseElement = (Element) licenseElements.item(i);
License license = new License();
license.setId(licenseElement.getAttribute("id"));
license.setName(licenseElement.getAttribute("name"));
license.setUrl(licenseElement.getAttribute("url"));
licenses.add(license);
}
return licenses;
} | java | public Collection<License> getInfo() throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_INFO);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
List<License> licenses = new ArrayList<License>();
Element licensesElement = response.getPayload();
NodeList licenseElements = licensesElement.getElementsByTagName("license");
for (int i = 0; i < licenseElements.getLength(); i++) {
Element licenseElement = (Element) licenseElements.item(i);
License license = new License();
license.setId(licenseElement.getAttribute("id"));
license.setName(licenseElement.getAttribute("name"));
license.setUrl(licenseElement.getAttribute("url"));
licenses.add(license);
}
return licenses;
} | [
"public",
"Collection",
"<",
"License",
">",
"getInfo",
"(",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",... | Fetches a list of available photo licenses for Flickr.
This method does not require authentication.
@return A collection of License objects
@throws FlickrException | [
"Fetches",
"a",
"list",
"of",
"available",
"photo",
"licenses",
"for",
"Flickr",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java#L49-L69 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java | LicensesInterface.setLicense | public void setLicense(String photoId, int licenseId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_LICENSE);
parameters.put("photo_id", photoId);
parameters.put("license_id", Integer.toString(licenseId));
// Note: This method requires an HTTP POST request.
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// This method has no specific response - It returns an empty sucess response if it completes without error.
} | java | public void setLicense(String photoId, int licenseId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_LICENSE);
parameters.put("photo_id", photoId);
parameters.put("license_id", Integer.toString(licenseId));
// Note: This method requires an HTTP POST request.
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// This method has no specific response - It returns an empty sucess response if it completes without error.
} | [
"public",
"void",
"setLicense",
"(",
"String",
"photoId",
",",
"int",
"licenseId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"pa... | Sets the license for a photo.
This method requires authentication with 'write' permission.
@param photoId
The photo to update the license for.
@param licenseId
The license to apply, or 0 (zero) to remove the current license.
@throws FlickrException | [
"Sets",
"the",
"license",
"for",
"a",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java#L82-L95 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/tags/TagsInterface.java | TagsInterface.getClusterPhotos | public PhotoList<Photo> getClusterPhotos(String tag, String clusterId) throws FlickrException {
PhotoList<Photo> photos = new PhotoList<Photo>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CLUSTER_PHOTOS);
parameters.put("tag", tag);
parameters.put("cluster_id", clusterId);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
NodeList photoNodes = photosElement.getElementsByTagName("photo");
photos.setPage("1");
photos.setPages("1");
photos.setPerPage("" + photoNodes.getLength());
photos.setTotal("" + photoNodes.getLength());
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | java | public PhotoList<Photo> getClusterPhotos(String tag, String clusterId) throws FlickrException {
PhotoList<Photo> photos = new PhotoList<Photo>();
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CLUSTER_PHOTOS);
parameters.put("tag", tag);
parameters.put("cluster_id", clusterId);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photosElement = response.getPayload();
NodeList photoNodes = photosElement.getElementsByTagName("photo");
photos.setPage("1");
photos.setPages("1");
photos.setPerPage("" + photoNodes.getLength());
photos.setTotal("" + photoNodes.getLength());
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"getClusterPhotos",
"(",
"String",
"tag",
",",
"String",
"clusterId",
")",
"throws",
"FlickrException",
"{",
"PhotoList",
"<",
"Photo",
">",
"photos",
"=",
"new",
"PhotoList",
"<",
"Photo",
">",
"(",
")",
";",
"Map... | Returns the first 24 photos for a given tag cluster.
<p>
This method does not require authentication.
</p>
@param tag
@param clusterId
@return PhotoList
@throws FlickrException | [
"Returns",
"the",
"first",
"24",
"photos",
"for",
"a",
"given",
"tag",
"cluster",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/tags/TagsInterface.java#L122-L147 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/tags/TagsInterface.java | TagsInterface.getListPhoto | public Photo getListPhoto(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_LIST_PHOTO);
parameters.put("photo_id", photoId);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photoElement = response.getPayload();
Photo photo = new Photo();
photo.setId(photoElement.getAttribute("id"));
List<Tag> tags = new ArrayList<Tag>();
Element tagsElement = (Element) photoElement.getElementsByTagName("tags").item(0);
NodeList tagElements = tagsElement.getElementsByTagName("tag");
for (int i = 0; i < tagElements.getLength(); i++) {
Element tagElement = (Element) tagElements.item(i);
Tag tag = new Tag();
tag.setId(tagElement.getAttribute("id"));
tag.setAuthor(tagElement.getAttribute("author"));
tag.setAuthorName(tagElement.getAttribute("authorname"));
tag.setRaw(tagElement.getAttribute("raw"));
tag.setValue(((Text) tagElement.getFirstChild()).getData());
tags.add(tag);
}
photo.setTags(tags);
return photo;
} | java | public Photo getListPhoto(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_LIST_PHOTO);
parameters.put("photo_id", photoId);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element photoElement = response.getPayload();
Photo photo = new Photo();
photo.setId(photoElement.getAttribute("id"));
List<Tag> tags = new ArrayList<Tag>();
Element tagsElement = (Element) photoElement.getElementsByTagName("tags").item(0);
NodeList tagElements = tagsElement.getElementsByTagName("tag");
for (int i = 0; i < tagElements.getLength(); i++) {
Element tagElement = (Element) tagElements.item(i);
Tag tag = new Tag();
tag.setId(tagElement.getAttribute("id"));
tag.setAuthor(tagElement.getAttribute("author"));
tag.setAuthorName(tagElement.getAttribute("authorname"));
tag.setRaw(tagElement.getAttribute("raw"));
tag.setValue(((Text) tagElement.getFirstChild()).getData());
tags.add(tag);
}
photo.setTags(tags);
return photo;
} | [
"public",
"Photo",
"getListPhoto",
"(",
"String",
"photoId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
... | Get a list of tags for the specified photo.
<p>
This method does not require authentication.
</p>
@param photoId
The photo ID
@return The collection of Tag objects | [
"Get",
"a",
"list",
"of",
"tags",
"for",
"the",
"specified",
"photo",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/tags/TagsInterface.java#L200-L231 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/tags/TagsInterface.java | TagsInterface.getListUser | public Collection<Tag> getListUser(String userId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_LIST_USER);
parameters.put("user_id", userId);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element whoElement = response.getPayload();
List<Tag> tags = new ArrayList<Tag>();
Element tagsElement = (Element) whoElement.getElementsByTagName("tags").item(0);
NodeList tagElements = tagsElement.getElementsByTagName("tag");
for (int i = 0; i < tagElements.getLength(); i++) {
Element tagElement = (Element) tagElements.item(i);
Tag tag = new Tag();
tag.setValue(((Text) tagElement.getFirstChild()).getData());
tags.add(tag);
}
return tags;
} | java | public Collection<Tag> getListUser(String userId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_LIST_USER);
parameters.put("user_id", userId);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element whoElement = response.getPayload();
List<Tag> tags = new ArrayList<Tag>();
Element tagsElement = (Element) whoElement.getElementsByTagName("tags").item(0);
NodeList tagElements = tagsElement.getElementsByTagName("tag");
for (int i = 0; i < tagElements.getLength(); i++) {
Element tagElement = (Element) tagElements.item(i);
Tag tag = new Tag();
tag.setValue(((Text) tagElement.getFirstChild()).getData());
tags.add(tag);
}
return tags;
} | [
"public",
"Collection",
"<",
"Tag",
">",
"getListUser",
"(",
"String",
"userId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"para... | Get a collection of tags used by the specified user.
<p>
This method does not require authentication.
</p>
@param userId
The User ID
@return The User object
@throws FlickrException | [
"Get",
"a",
"collection",
"of",
"tags",
"used",
"by",
"the",
"specified",
"user",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/tags/TagsInterface.java#L245-L269 | train |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/tags/TagsInterface.java | TagsInterface.getRelated | public RelatedTagsList getRelated(String tag) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_RELATED);
parameters.put("tag", tag);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element tagsElement = response.getPayload();
RelatedTagsList tags = new RelatedTagsList();
tags.setSource(tagsElement.getAttribute("source"));
NodeList tagElements = tagsElement.getElementsByTagName("tag");
for (int i = 0; i < tagElements.getLength(); i++) {
Element tagElement = (Element) tagElements.item(i);
Tag t = new Tag();
t.setValue(XMLUtilities.getValue(tagElement));
tags.add(t);
}
return tags;
} | java | public RelatedTagsList getRelated(String tag) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_RELATED);
parameters.put("tag", tag);
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element tagsElement = response.getPayload();
RelatedTagsList tags = new RelatedTagsList();
tags.setSource(tagsElement.getAttribute("source"));
NodeList tagElements = tagsElement.getElementsByTagName("tag");
for (int i = 0; i < tagElements.getLength(); i++) {
Element tagElement = (Element) tagElements.item(i);
Tag t = new Tag();
t.setValue(XMLUtilities.getValue(tagElement));
tags.add(t);
}
return tags;
} | [
"public",
"RelatedTagsList",
"getRelated",
"(",
"String",
"tag",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put... | Get the related tags.
<p>
This method does not require authentication.
</p>
@param tag
The source tag
@return A RelatedTagsList object
@throws FlickrException | [
"Get",
"the",
"related",
"tags",
"."
] | f66987ba0e360e5fb7730efbbb8c51f3d978fc25 | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/tags/TagsInterface.java#L383-L407 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/misc/IOUtils.java | IOUtils.closeThrowSqlException | public static void closeThrowSqlException(Closeable closeable, String label) throws SQLException {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
throw SqlExceptionUtil.create("could not close " + label, e);
}
}
} | java | public static void closeThrowSqlException(Closeable closeable, String label) throws SQLException {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
throw SqlExceptionUtil.create("could not close " + label, e);
}
}
} | [
"public",
"static",
"void",
"closeThrowSqlException",
"(",
"Closeable",
"closeable",
",",
"String",
"label",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"closeable",
"!=",
"null",
")",
"{",
"try",
"{",
"closeable",
".",
"close",
"(",
")",
";",
"}",
"cat... | Close it and ignore any exceptions. | [
"Close",
"it",
"and",
"ignore",
"any",
"exceptions",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/misc/IOUtils.java#L30-L38 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/logger/LoggerFactory.java | LoggerFactory.getLogger | public static Logger getLogger(String className) {
if (logType == null) {
logType = findLogType();
}
return new Logger(logType.createLog(className));
} | java | public static Logger getLogger(String className) {
if (logType == null) {
logType = findLogType();
}
return new Logger(logType.createLog(className));
} | [
"public",
"static",
"Logger",
"getLogger",
"(",
"String",
"className",
")",
"{",
"if",
"(",
"logType",
"==",
"null",
")",
"{",
"logType",
"=",
"findLogType",
"(",
")",
";",
"}",
"return",
"new",
"Logger",
"(",
"logType",
".",
"createLog",
"(",
"className... | Return a logger associated with a particular class name. | [
"Return",
"a",
"logger",
"associated",
"with",
"a",
"particular",
"class",
"name",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/LoggerFactory.java#L38-L43 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/logger/LoggerFactory.java | LoggerFactory.getSimpleClassName | public static String getSimpleClassName(String className) {
// get the last part of the class name
String[] parts = className.split("\\.");
if (parts.length <= 1) {
return className;
} else {
return parts[parts.length - 1];
}
} | java | public static String getSimpleClassName(String className) {
// get the last part of the class name
String[] parts = className.split("\\.");
if (parts.length <= 1) {
return className;
} else {
return parts[parts.length - 1];
}
} | [
"public",
"static",
"String",
"getSimpleClassName",
"(",
"String",
"className",
")",
"{",
"// get the last part of the class name",
"String",
"[",
"]",
"parts",
"=",
"className",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"if",
"(",
"parts",
".",
"length",
"<=",
... | Return the single class name from a class-name string. | [
"Return",
"the",
"single",
"class",
"name",
"from",
"a",
"class",
"-",
"name",
"string",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/LoggerFactory.java#L48-L56 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/logger/LoggerFactory.java | LoggerFactory.findLogType | private static LogType findLogType() {
// see if the log-type was specified as a system property
String logTypeString = System.getProperty(LOG_TYPE_SYSTEM_PROPERTY);
if (logTypeString != null) {
try {
return LogType.valueOf(logTypeString);
} catch (IllegalArgumentException e) {
Log log = new LocalLog(LoggerFactory.class.getName());
log.log(Level.WARNING, "Could not find valid log-type from system property '" + LOG_TYPE_SYSTEM_PROPERTY
+ "', value '" + logTypeString + "'");
}
}
for (LogType logType : LogType.values()) {
if (logType.isAvailable()) {
return logType;
}
}
// fall back is always LOCAL, never reached
return LogType.LOCAL;
} | java | private static LogType findLogType() {
// see if the log-type was specified as a system property
String logTypeString = System.getProperty(LOG_TYPE_SYSTEM_PROPERTY);
if (logTypeString != null) {
try {
return LogType.valueOf(logTypeString);
} catch (IllegalArgumentException e) {
Log log = new LocalLog(LoggerFactory.class.getName());
log.log(Level.WARNING, "Could not find valid log-type from system property '" + LOG_TYPE_SYSTEM_PROPERTY
+ "', value '" + logTypeString + "'");
}
}
for (LogType logType : LogType.values()) {
if (logType.isAvailable()) {
return logType;
}
}
// fall back is always LOCAL, never reached
return LogType.LOCAL;
} | [
"private",
"static",
"LogType",
"findLogType",
"(",
")",
"{",
"// see if the log-type was specified as a system property",
"String",
"logTypeString",
"=",
"System",
".",
"getProperty",
"(",
"LOG_TYPE_SYSTEM_PROPERTY",
")",
";",
"if",
"(",
"logTypeString",
"!=",
"null",
... | Return the most appropriate log type. This should _never_ return null. | [
"Return",
"the",
"most",
"appropriate",
"log",
"type",
".",
"This",
"should",
"_never_",
"return",
"null",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/LoggerFactory.java#L61-L82 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/logger/Logger.java | Logger.trace | public void trace(String msg) {
logIfEnabled(Level.TRACE, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null);
} | java | public void trace(String msg) {
logIfEnabled(Level.TRACE, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null);
} | [
"public",
"void",
"trace",
"(",
"String",
"msg",
")",
"{",
"logIfEnabled",
"(",
"Level",
".",
"TRACE",
",",
"null",
",",
"msg",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG",
",",
"null",
")",
";",
"}"
] | Log a trace message. | [
"Log",
"a",
"trace",
"message",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L53-L55 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/logger/Logger.java | Logger.trace | public void trace(Throwable throwable, String msg, Object[] argArray) {
logIfEnabled(Level.TRACE, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);
} | java | public void trace(Throwable throwable, String msg, Object[] argArray) {
logIfEnabled(Level.TRACE, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);
} | [
"public",
"void",
"trace",
"(",
"Throwable",
"throwable",
",",
"String",
"msg",
",",
"Object",
"[",
"]",
"argArray",
")",
"{",
"logIfEnabled",
"(",
"Level",
".",
"TRACE",
",",
"throwable",
",",
"msg",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_A... | Log a trace message with a throwable. | [
"Log",
"a",
"trace",
"message",
"with",
"a",
"throwable",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L116-L118 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/logger/Logger.java | Logger.info | public void info(Throwable throwable, String msg, Object[] argArray) {
logIfEnabled(Level.INFO, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);
} | java | public void info(Throwable throwable, String msg, Object[] argArray) {
logIfEnabled(Level.INFO, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);
} | [
"public",
"void",
"info",
"(",
"Throwable",
"throwable",
",",
"String",
"msg",
",",
"Object",
"[",
"]",
"argArray",
")",
"{",
"logIfEnabled",
"(",
"Level",
".",
"INFO",
",",
"throwable",
",",
"msg",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG... | Log a info message with a throwable. | [
"Log",
"a",
"info",
"message",
"with",
"a",
"throwable",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L256-L258 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/logger/Logger.java | Logger.warn | public void warn(Throwable throwable, String msg, Object[] argArray) {
logIfEnabled(Level.WARNING, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);
} | java | public void warn(Throwable throwable, String msg, Object[] argArray) {
logIfEnabled(Level.WARNING, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);
} | [
"public",
"void",
"warn",
"(",
"Throwable",
"throwable",
",",
"String",
"msg",
",",
"Object",
"[",
"]",
"argArray",
")",
"{",
"logIfEnabled",
"(",
"Level",
".",
"WARNING",
",",
"throwable",
",",
"msg",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_... | Log a warning message with a throwable. | [
"Log",
"a",
"warning",
"message",
"with",
"a",
"throwable",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L326-L328 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/logger/Logger.java | Logger.fatal | public void fatal(String msg) {
logIfEnabled(Level.FATAL, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null);
} | java | public void fatal(String msg) {
logIfEnabled(Level.FATAL, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null);
} | [
"public",
"void",
"fatal",
"(",
"String",
"msg",
")",
"{",
"logIfEnabled",
"(",
"Level",
".",
"FATAL",
",",
"null",
",",
"msg",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG",
",",
"null",
")",
";",
"}"
] | Log a fatal message. | [
"Log",
"a",
"fatal",
"message",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L403-L405 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/logger/Logger.java | Logger.fatal | public void fatal(Throwable throwable, String msg, Object[] argArray) {
logIfEnabled(Level.FATAL, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);
} | java | public void fatal(Throwable throwable, String msg, Object[] argArray) {
logIfEnabled(Level.FATAL, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);
} | [
"public",
"void",
"fatal",
"(",
"Throwable",
"throwable",
",",
"String",
"msg",
",",
"Object",
"[",
"]",
"argArray",
")",
"{",
"logIfEnabled",
"(",
"Level",
".",
"FATAL",
",",
"throwable",
",",
"msg",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_A... | Log a fatal message with a throwable. | [
"Log",
"a",
"fatal",
"message",
"with",
"a",
"throwable",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L466-L468 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/logger/Logger.java | Logger.log | public void log(Level level, String msg) {
logIfEnabled(level, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null);
} | java | public void log(Level level, String msg) {
logIfEnabled(level, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null);
} | [
"public",
"void",
"log",
"(",
"Level",
"level",
",",
"String",
"msg",
")",
"{",
"logIfEnabled",
"(",
"level",
",",
"null",
",",
"msg",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG",
",",
"null",
")",
";",
"}"
] | Log a message at the provided level. | [
"Log",
"a",
"message",
"at",
"the",
"provided",
"level",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L473-L475 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/logger/Logger.java | Logger.log | public void log(Level level, Throwable throwable, String msg, Object[] argArray) {
logIfEnabled(level, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);
} | java | public void log(Level level, Throwable throwable, String msg, Object[] argArray) {
logIfEnabled(level, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);
} | [
"public",
"void",
"log",
"(",
"Level",
"level",
",",
"Throwable",
"throwable",
",",
"String",
"msg",
",",
"Object",
"[",
"]",
"argArray",
")",
"{",
"logIfEnabled",
"(",
"level",
",",
"throwable",
",",
"msg",
",",
"UNKNOWN_ARG",
",",
"UNKNOWN_ARG",
",",
"... | Log a message with a throwable at the provided level. | [
"Log",
"a",
"message",
"with",
"a",
"throwable",
"at",
"the",
"provided",
"level",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/logger/Logger.java#L536-L538 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/DaoManager.java | DaoManager.lookupDao | public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
ClassConnectionSource key = new ClassConnectionSource(connectionSource, clazz);
Dao<?, ?> dao = lookupDao(key);
@SuppressWarnings("unchecked")
D castDao = (D) dao;
return castDao;
} | java | public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
ClassConnectionSource key = new ClassConnectionSource(connectionSource, clazz);
Dao<?, ?> dao = lookupDao(key);
@SuppressWarnings("unchecked")
D castDao = (D) dao;
return castDao;
} | [
"public",
"synchronized",
"static",
"<",
"D",
"extends",
"Dao",
"<",
"T",
",",
"?",
">",
",",
"T",
">",
"D",
"lookupDao",
"(",
"ConnectionSource",
"connectionSource",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"if",
"(",
"connectionSource",
"==",
... | Helper method to lookup a DAO if it has already been associated with the class. Otherwise this returns null. | [
"Helper",
"method",
"to",
"lookup",
"a",
"DAO",
"if",
"it",
"has",
"already",
"been",
"associated",
"with",
"the",
"class",
".",
"Otherwise",
"this",
"returns",
"null",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L109-L118 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/DaoManager.java | DaoManager.lookupDao | public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
TableConfigConnectionSource key = new TableConfigConnectionSource(connectionSource, tableConfig);
Dao<?, ?> dao = lookupDao(key);
if (dao == null) {
return null;
} else {
@SuppressWarnings("unchecked")
D castDao = (D) dao;
return castDao;
}
} | java | public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
TableConfigConnectionSource key = new TableConfigConnectionSource(connectionSource, tableConfig);
Dao<?, ?> dao = lookupDao(key);
if (dao == null) {
return null;
} else {
@SuppressWarnings("unchecked")
D castDao = (D) dao;
return castDao;
}
} | [
"public",
"synchronized",
"static",
"<",
"D",
"extends",
"Dao",
"<",
"T",
",",
"?",
">",
",",
"T",
">",
"D",
"lookupDao",
"(",
"ConnectionSource",
"connectionSource",
",",
"DatabaseTableConfig",
"<",
"T",
">",
"tableConfig",
")",
"{",
"if",
"(",
"connectio... | Helper method to lookup a DAO if it has already been associated with the table-config. Otherwise this returns
null. | [
"Helper",
"method",
"to",
"lookup",
"a",
"DAO",
"if",
"it",
"has",
"already",
"been",
"associated",
"with",
"the",
"table",
"-",
"config",
".",
"Otherwise",
"this",
"returns",
"null",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L137-L151 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/DaoManager.java | DaoManager.registerDao | public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao);
} | java | public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao);
} | [
"public",
"static",
"synchronized",
"void",
"registerDao",
"(",
"ConnectionSource",
"connectionSource",
",",
"Dao",
"<",
"?",
",",
"?",
">",
"dao",
")",
"{",
"if",
"(",
"connectionSource",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"("... | Register the DAO with the cache. This will allow folks to build a DAO externally and then register so it can be
used internally as necessary.
<p>
<b>NOTE:</b> By default this registers the DAO to be associated with the class that it uses. If you need to
register multiple dao's that use different {@link DatabaseTableConfig}s then you should use
{@link #registerDaoWithTableConfig(ConnectionSource, Dao)}.
</p>
<p>
<b>NOTE:</b> You should maybe use the {@link DatabaseTable#daoClass()} and have the DaoManager construct the DAO
if possible.
</p> | [
"Register",
"the",
"DAO",
"with",
"the",
"cache",
".",
"This",
"will",
"allow",
"folks",
"to",
"build",
"a",
"DAO",
"externally",
"and",
"then",
"register",
"so",
"it",
"can",
"be",
"used",
"internally",
"as",
"necessary",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L168-L173 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/DaoManager.java | DaoManager.unregisterDao | public static synchronized void unregisterDao(ConnectionSource connectionSource, Dao<?, ?> dao) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
removeDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()));
} | java | public static synchronized void unregisterDao(ConnectionSource connectionSource, Dao<?, ?> dao) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
removeDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()));
} | [
"public",
"static",
"synchronized",
"void",
"unregisterDao",
"(",
"ConnectionSource",
"connectionSource",
",",
"Dao",
"<",
"?",
",",
"?",
">",
"dao",
")",
"{",
"if",
"(",
"connectionSource",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"... | Remove a DAO from the cache. This is necessary if we've registered it already but it throws an exception during
configuration. | [
"Remove",
"a",
"DAO",
"from",
"the",
"cache",
".",
"This",
"is",
"necessary",
"if",
"we",
"ve",
"registered",
"it",
"already",
"but",
"it",
"throws",
"an",
"exception",
"during",
"configuration",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L179-L184 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/DaoManager.java | DaoManager.clearDaoCache | public static synchronized void clearDaoCache() {
if (classMap != null) {
classMap.clear();
classMap = null;
}
if (tableConfigMap != null) {
tableConfigMap.clear();
tableConfigMap = null;
}
} | java | public static synchronized void clearDaoCache() {
if (classMap != null) {
classMap.clear();
classMap = null;
}
if (tableConfigMap != null) {
tableConfigMap.clear();
tableConfigMap = null;
}
} | [
"public",
"static",
"synchronized",
"void",
"clearDaoCache",
"(",
")",
"{",
"if",
"(",
"classMap",
"!=",
"null",
")",
"{",
"classMap",
".",
"clear",
"(",
")",
";",
"classMap",
"=",
"null",
";",
"}",
"if",
"(",
"tableConfigMap",
"!=",
"null",
")",
"{",
... | Clear out our DAO caches. | [
"Clear",
"out",
"our",
"DAO",
"caches",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L228-L237 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/DaoManager.java | DaoManager.addCachedDatabaseConfigs | public static synchronized void addCachedDatabaseConfigs(Collection<DatabaseTableConfig<?>> configs) {
Map<Class<?>, DatabaseTableConfig<?>> newMap;
if (configMap == null) {
newMap = new HashMap<Class<?>, DatabaseTableConfig<?>>();
} else {
newMap = new HashMap<Class<?>, DatabaseTableConfig<?>>(configMap);
}
for (DatabaseTableConfig<?> config : configs) {
newMap.put(config.getDataClass(), config);
logger.info("Loaded configuration for {}", config.getDataClass());
}
configMap = newMap;
} | java | public static synchronized void addCachedDatabaseConfigs(Collection<DatabaseTableConfig<?>> configs) {
Map<Class<?>, DatabaseTableConfig<?>> newMap;
if (configMap == null) {
newMap = new HashMap<Class<?>, DatabaseTableConfig<?>>();
} else {
newMap = new HashMap<Class<?>, DatabaseTableConfig<?>>(configMap);
}
for (DatabaseTableConfig<?> config : configs) {
newMap.put(config.getDataClass(), config);
logger.info("Loaded configuration for {}", config.getDataClass());
}
configMap = newMap;
} | [
"public",
"static",
"synchronized",
"void",
"addCachedDatabaseConfigs",
"(",
"Collection",
"<",
"DatabaseTableConfig",
"<",
"?",
">",
">",
"configs",
")",
"{",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"DatabaseTableConfig",
"<",
"?",
">",
">",
"newMap",
";",... | This adds database table configurations to the internal cache which can be used to speed up DAO construction.
This is especially true of Android and other mobile platforms. | [
"This",
"adds",
"database",
"table",
"configurations",
"to",
"the",
"internal",
"cache",
"which",
"can",
"be",
"used",
"to",
"speed",
"up",
"DAO",
"construction",
".",
"This",
"is",
"especially",
"true",
"of",
"Android",
"and",
"other",
"mobile",
"platforms",
... | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L243-L255 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/DaoManager.java | DaoManager.createDaoFromConfig | private static <D, T> D createDaoFromConfig(ConnectionSource connectionSource, Class<T> clazz) throws SQLException {
// no loaded configs
if (configMap == null) {
return null;
}
@SuppressWarnings("unchecked")
DatabaseTableConfig<T> config = (DatabaseTableConfig<T>) configMap.get(clazz);
// if we don't config information cached return null
if (config == null) {
return null;
}
// else create a DAO using configuration
Dao<T, ?> configedDao = doCreateDao(connectionSource, config);
@SuppressWarnings("unchecked")
D castDao = (D) configedDao;
return castDao;
} | java | private static <D, T> D createDaoFromConfig(ConnectionSource connectionSource, Class<T> clazz) throws SQLException {
// no loaded configs
if (configMap == null) {
return null;
}
@SuppressWarnings("unchecked")
DatabaseTableConfig<T> config = (DatabaseTableConfig<T>) configMap.get(clazz);
// if we don't config information cached return null
if (config == null) {
return null;
}
// else create a DAO using configuration
Dao<T, ?> configedDao = doCreateDao(connectionSource, config);
@SuppressWarnings("unchecked")
D castDao = (D) configedDao;
return castDao;
} | [
"private",
"static",
"<",
"D",
",",
"T",
">",
"D",
"createDaoFromConfig",
"(",
"ConnectionSource",
"connectionSource",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"SQLException",
"{",
"// no loaded configs",
"if",
"(",
"configMap",
"==",
"null",
")",
... | Creates the DAO if we have config information cached and caches the DAO. | [
"Creates",
"the",
"DAO",
"if",
"we",
"have",
"config",
"information",
"cached",
"and",
"caches",
"the",
"DAO",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L334-L352 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/ReferenceObjectCache.java | ReferenceObjectCache.cleanNullReferences | public <T> void cleanNullReferences(Class<T> clazz) {
Map<Object, Reference<Object>> objectMap = getMapForClass(clazz);
if (objectMap != null) {
cleanMap(objectMap);
}
} | java | public <T> void cleanNullReferences(Class<T> clazz) {
Map<Object, Reference<Object>> objectMap = getMapForClass(clazz);
if (objectMap != null) {
cleanMap(objectMap);
}
} | [
"public",
"<",
"T",
">",
"void",
"cleanNullReferences",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"Map",
"<",
"Object",
",",
"Reference",
"<",
"Object",
">",
">",
"objectMap",
"=",
"getMapForClass",
"(",
"clazz",
")",
";",
"if",
"(",
"objectMap",... | Run through the map and remove any references that have been null'd out by the GC. | [
"Run",
"through",
"the",
"map",
"and",
"remove",
"any",
"references",
"that",
"have",
"been",
"null",
"d",
"out",
"by",
"the",
"GC",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/ReferenceObjectCache.java#L150-L155 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/ReferenceObjectCache.java | ReferenceObjectCache.cleanNullReferencesAll | public <T> void cleanNullReferencesAll() {
for (Map<Object, Reference<Object>> objectMap : classMaps.values()) {
cleanMap(objectMap);
}
} | java | public <T> void cleanNullReferencesAll() {
for (Map<Object, Reference<Object>> objectMap : classMaps.values()) {
cleanMap(objectMap);
}
} | [
"public",
"<",
"T",
">",
"void",
"cleanNullReferencesAll",
"(",
")",
"{",
"for",
"(",
"Map",
"<",
"Object",
",",
"Reference",
"<",
"Object",
">",
">",
"objectMap",
":",
"classMaps",
".",
"values",
"(",
")",
")",
"{",
"cleanMap",
"(",
"objectMap",
")",
... | Run through all maps and remove any references that have been null'd out by the GC. | [
"Run",
"through",
"all",
"maps",
"and",
"remove",
"any",
"references",
"that",
"have",
"been",
"null",
"d",
"out",
"by",
"the",
"GC",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/ReferenceObjectCache.java#L160-L164 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java | BaseForeignCollection.addAll | @Override
public boolean addAll(Collection<? extends T> collection) {
boolean changed = false;
for (T data : collection) {
try {
if (addElement(data)) {
changed = true;
}
} catch (SQLException e) {
throw new IllegalStateException("Could not create data elements in dao", e);
}
}
return changed;
} | java | @Override
public boolean addAll(Collection<? extends T> collection) {
boolean changed = false;
for (T data : collection) {
try {
if (addElement(data)) {
changed = true;
}
} catch (SQLException e) {
throw new IllegalStateException("Could not create data elements in dao", e);
}
}
return changed;
} | [
"@",
"Override",
"public",
"boolean",
"addAll",
"(",
"Collection",
"<",
"?",
"extends",
"T",
">",
"collection",
")",
"{",
"boolean",
"changed",
"=",
"false",
";",
"for",
"(",
"T",
"data",
":",
"collection",
")",
"{",
"try",
"{",
"if",
"(",
"addElement"... | Add the collection of elements to this collection. This will also them to the associated database table.
@return Returns true if any of the items did not already exist in the collection otherwise false. | [
"Add",
"the",
"collection",
"of",
"elements",
"to",
"this",
"collection",
".",
"This",
"will",
"also",
"them",
"to",
"the",
"associated",
"database",
"table",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java#L62-L75 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java | BaseForeignCollection.retainAll | @Override
public boolean retainAll(Collection<?> collection) {
if (dao == null) {
return false;
}
boolean changed = false;
CloseableIterator<T> iterator = closeableIterator();
try {
while (iterator.hasNext()) {
T data = iterator.next();
if (!collection.contains(data)) {
iterator.remove();
changed = true;
}
}
return changed;
} finally {
IOUtils.closeQuietly(iterator);
}
} | java | @Override
public boolean retainAll(Collection<?> collection) {
if (dao == null) {
return false;
}
boolean changed = false;
CloseableIterator<T> iterator = closeableIterator();
try {
while (iterator.hasNext()) {
T data = iterator.next();
if (!collection.contains(data)) {
iterator.remove();
changed = true;
}
}
return changed;
} finally {
IOUtils.closeQuietly(iterator);
}
} | [
"@",
"Override",
"public",
"boolean",
"retainAll",
"(",
"Collection",
"<",
"?",
">",
"collection",
")",
"{",
"if",
"(",
"dao",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"boolean",
"changed",
"=",
"false",
";",
"CloseableIterator",
"<",
"T",
... | Uses the iterator to run through the dao and retain only the items that are in the passed in collection. This
will remove the items from the associated database table as well.
@return Returns true of the collection was changed at all otherwise false. | [
"Uses",
"the",
"iterator",
"to",
"run",
"through",
"the",
"dao",
"and",
"retain",
"only",
"the",
"items",
"that",
"are",
"in",
"the",
"passed",
"in",
"collection",
".",
"This",
"will",
"remove",
"the",
"items",
"from",
"the",
"associated",
"database",
"tab... | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java#L103-L122 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java | BaseForeignCollection.clear | @Override
public void clear() {
if (dao == null) {
return;
}
CloseableIterator<T> iterator = closeableIterator();
try {
while (iterator.hasNext()) {
iterator.next();
iterator.remove();
}
} finally {
IOUtils.closeQuietly(iterator);
}
} | java | @Override
public void clear() {
if (dao == null) {
return;
}
CloseableIterator<T> iterator = closeableIterator();
try {
while (iterator.hasNext()) {
iterator.next();
iterator.remove();
}
} finally {
IOUtils.closeQuietly(iterator);
}
} | [
"@",
"Override",
"public",
"void",
"clear",
"(",
")",
"{",
"if",
"(",
"dao",
"==",
"null",
")",
"{",
"return",
";",
"}",
"CloseableIterator",
"<",
"T",
">",
"iterator",
"=",
"closeableIterator",
"(",
")",
";",
"try",
"{",
"while",
"(",
"iterator",
".... | Clears the collection and uses the iterator to run through the dao and delete all of the items in the collection
from the associated database table. This is different from removing all of the elements in the table since this
iterator is across just one item's foreign objects. | [
"Clears",
"the",
"collection",
"and",
"uses",
"the",
"iterator",
"to",
"run",
"through",
"the",
"dao",
"and",
"delete",
"all",
"of",
"the",
"items",
"in",
"the",
"collection",
"from",
"the",
"associated",
"database",
"table",
".",
"This",
"is",
"different",
... | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/BaseForeignCollection.java#L129-L143 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.and | public Where<T, ID> and() {
ManyClause clause = new ManyClause(pop("AND"), ManyClause.AND_OPERATION);
push(clause);
addNeedsFuture(clause);
return this;
} | java | public Where<T, ID> and() {
ManyClause clause = new ManyClause(pop("AND"), ManyClause.AND_OPERATION);
push(clause);
addNeedsFuture(clause);
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"and",
"(",
")",
"{",
"ManyClause",
"clause",
"=",
"new",
"ManyClause",
"(",
"pop",
"(",
"\"AND\"",
")",
",",
"ManyClause",
".",
"AND_OPERATION",
")",
";",
"push",
"(",
"clause",
")",
";",
"addNeedsFuture",
... | AND operation which takes the previous clause and the next clause and AND's them together. | [
"AND",
"operation",
"which",
"takes",
"the",
"previous",
"clause",
"and",
"the",
"next",
"clause",
"and",
"AND",
"s",
"them",
"together",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L129-L134 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.between | public Where<T, ID> between(String columnName, Object low, Object high) throws SQLException {
addClause(new Between(columnName, findColumnFieldType(columnName), low, high));
return this;
} | java | public Where<T, ID> between(String columnName, Object low, Object high) throws SQLException {
addClause(new Between(columnName, findColumnFieldType(columnName), low, high));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"between",
"(",
"String",
"columnName",
",",
"Object",
"low",
",",
"Object",
"high",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"Between",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"c... | Add a BETWEEN clause so the column must be between the low and high parameters. | [
"Add",
"a",
"BETWEEN",
"clause",
"so",
"the",
"column",
"must",
"be",
"between",
"the",
"low",
"and",
"high",
"parameters",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L183-L186 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.eq | public Where<T, ID> eq(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.EQUAL_TO_OPERATION));
return this;
} | java | public Where<T, ID> eq(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.EQUAL_TO_OPERATION));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"eq",
"(",
"String",
"columnName",
",",
"Object",
"value",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"SimpleComparison",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
")",
",... | Add a '=' clause so the column must be equal to the value. | [
"Add",
"a",
"=",
"clause",
"so",
"the",
"column",
"must",
"be",
"equal",
"to",
"the",
"value",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L191-L195 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.ge | public Where<T, ID> ge(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.GREATER_THAN_EQUAL_TO_OPERATION));
return this;
} | java | public Where<T, ID> ge(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.GREATER_THAN_EQUAL_TO_OPERATION));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"ge",
"(",
"String",
"columnName",
",",
"Object",
"value",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"SimpleComparison",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
")",
",... | Add a '>=' clause so the column must be greater-than or equals-to the value. | [
"Add",
"a",
">",
";",
"=",
"clause",
"so",
"the",
"column",
"must",
"be",
"greater",
"-",
"than",
"or",
"equals",
"-",
"to",
"the",
"value",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L200-L204 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.gt | public Where<T, ID> gt(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.GREATER_THAN_OPERATION));
return this;
} | java | public Where<T, ID> gt(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.GREATER_THAN_OPERATION));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"gt",
"(",
"String",
"columnName",
",",
"Object",
"value",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"SimpleComparison",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
")",
",... | Add a '>' clause so the column must be greater-than the value. | [
"Add",
"a",
">",
";",
"clause",
"so",
"the",
"column",
"must",
"be",
"greater",
"-",
"than",
"the",
"value",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L209-L213 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.in | public Where<T, ID> in(String columnName, Iterable<?> objects) throws SQLException {
addClause(new In(columnName, findColumnFieldType(columnName), objects, true));
return this;
} | java | public Where<T, ID> in(String columnName, Iterable<?> objects) throws SQLException {
addClause(new In(columnName, findColumnFieldType(columnName), objects, true));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"in",
"(",
"String",
"columnName",
",",
"Iterable",
"<",
"?",
">",
"objects",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"In",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
... | Add a IN clause so the column must be equal-to one of the objects from the list passed in. | [
"Add",
"a",
"IN",
"clause",
"so",
"the",
"column",
"must",
"be",
"equal",
"-",
"to",
"one",
"of",
"the",
"objects",
"from",
"the",
"list",
"passed",
"in",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L218-L221 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.in | public Where<T, ID> in(String columnName, Object... objects) throws SQLException {
return in(true, columnName, objects);
} | java | public Where<T, ID> in(String columnName, Object... objects) throws SQLException {
return in(true, columnName, objects);
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"in",
"(",
"String",
"columnName",
",",
"Object",
"...",
"objects",
")",
"throws",
"SQLException",
"{",
"return",
"in",
"(",
"true",
",",
"columnName",
",",
"objects",
")",
";",
"}"
] | Add a IN clause so the column must be equal-to one of the objects passed in. | [
"Add",
"a",
"IN",
"clause",
"so",
"the",
"column",
"must",
"be",
"equal",
"-",
"to",
"one",
"of",
"the",
"objects",
"passed",
"in",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L234-L236 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.exists | public Where<T, ID> exists(QueryBuilder<?, ?> subQueryBuilder) {
// we do this to turn off the automatic addition of the ID column in the select column list
subQueryBuilder.enableInnerQuery();
addClause(new Exists(new InternalQueryBuilderWrapper(subQueryBuilder)));
return this;
} | java | public Where<T, ID> exists(QueryBuilder<?, ?> subQueryBuilder) {
// we do this to turn off the automatic addition of the ID column in the select column list
subQueryBuilder.enableInnerQuery();
addClause(new Exists(new InternalQueryBuilderWrapper(subQueryBuilder)));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"exists",
"(",
"QueryBuilder",
"<",
"?",
",",
"?",
">",
"subQueryBuilder",
")",
"{",
"// we do this to turn off the automatic addition of the ID column in the select column list",
"subQueryBuilder",
".",
"enableInnerQuery",
"("... | Add a EXISTS clause with a sub-query inside of parenthesis.
<p>
<b>NOTE:</b> The sub-query will be prepared at the same time that the outside query is.
</p> | [
"Add",
"a",
"EXISTS",
"clause",
"with",
"a",
"sub",
"-",
"query",
"inside",
"of",
"parenthesis",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L273-L278 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.isNull | public Where<T, ID> isNull(String columnName) throws SQLException {
addClause(new IsNull(columnName, findColumnFieldType(columnName)));
return this;
} | java | public Where<T, ID> isNull(String columnName) throws SQLException {
addClause(new IsNull(columnName, findColumnFieldType(columnName)));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"isNull",
"(",
"String",
"columnName",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"IsNull",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
")",
")",
")",
";",
"return",
"this... | Add a 'IS NULL' clause so the column must be null. '=' NULL does not work. | [
"Add",
"a",
"IS",
"NULL",
"clause",
"so",
"the",
"column",
"must",
"be",
"null",
".",
"=",
"NULL",
"does",
"not",
"work",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L283-L286 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.isNotNull | public Where<T, ID> isNotNull(String columnName) throws SQLException {
addClause(new IsNotNull(columnName, findColumnFieldType(columnName)));
return this;
} | java | public Where<T, ID> isNotNull(String columnName) throws SQLException {
addClause(new IsNotNull(columnName, findColumnFieldType(columnName)));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"isNotNull",
"(",
"String",
"columnName",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"IsNotNull",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
")",
")",
")",
";",
"return",
... | Add a 'IS NOT NULL' clause so the column must not be null. '<>' NULL does not work. | [
"Add",
"a",
"IS",
"NOT",
"NULL",
"clause",
"so",
"the",
"column",
"must",
"not",
"be",
"null",
".",
"<",
";",
">",
";",
"NULL",
"does",
"not",
"work",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L291-L294 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.le | public Where<T, ID> le(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.LESS_THAN_EQUAL_TO_OPERATION));
return this;
} | java | public Where<T, ID> le(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.LESS_THAN_EQUAL_TO_OPERATION));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"le",
"(",
"String",
"columnName",
",",
"Object",
"value",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"SimpleComparison",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
")",
",... | Add a '<=' clause so the column must be less-than or equals-to the value. | [
"Add",
"a",
"<",
";",
"=",
"clause",
"so",
"the",
"column",
"must",
"be",
"less",
"-",
"than",
"or",
"equals",
"-",
"to",
"the",
"value",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L299-L303 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.lt | public Where<T, ID> lt(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.LESS_THAN_OPERATION));
return this;
} | java | public Where<T, ID> lt(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.LESS_THAN_OPERATION));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"lt",
"(",
"String",
"columnName",
",",
"Object",
"value",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"SimpleComparison",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
")",
",... | Add a '<' clause so the column must be less-than the value. | [
"Add",
"a",
"<",
";",
"clause",
"so",
"the",
"column",
"must",
"be",
"less",
"-",
"than",
"the",
"value",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L308-L312 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.like | public Where<T, ID> like(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.LIKE_OPERATION));
return this;
} | java | public Where<T, ID> like(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.LIKE_OPERATION));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"like",
"(",
"String",
"columnName",
",",
"Object",
"value",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"SimpleComparison",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
")",
... | Add a LIKE clause so the column must mach the value using '%' patterns. | [
"Add",
"a",
"LIKE",
"clause",
"so",
"the",
"column",
"must",
"mach",
"the",
"value",
"using",
"%",
"patterns",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L317-L321 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.ne | public Where<T, ID> ne(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.NOT_EQUAL_TO_OPERATION));
return this;
} | java | public Where<T, ID> ne(String columnName, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
SimpleComparison.NOT_EQUAL_TO_OPERATION));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"ne",
"(",
"String",
"columnName",
",",
"Object",
"value",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"SimpleComparison",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
")",
",... | Add a '<>' clause so the column must be not-equal-to the value. | [
"Add",
"a",
"<",
";",
">",
";",
"clause",
"so",
"the",
"column",
"must",
"be",
"not",
"-",
"equal",
"-",
"to",
"the",
"value",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L326-L330 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.not | public Where<T, ID> not() {
/*
* Special circumstance here when we have a needs future with a not. Something like and().not().like(...). In
* this case we satisfy the and()'s future as the not() but the not() becomes the new needs-future.
*/
Not not = new Not();
addClause(not);
addNeedsFuture(not);
return this;
} | java | public Where<T, ID> not() {
/*
* Special circumstance here when we have a needs future with a not. Something like and().not().like(...). In
* this case we satisfy the and()'s future as the not() but the not() becomes the new needs-future.
*/
Not not = new Not();
addClause(not);
addNeedsFuture(not);
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"not",
"(",
")",
"{",
"/*\n\t\t * Special circumstance here when we have a needs future with a not. Something like and().not().like(...). In\n\t\t * this case we satisfy the and()'s future as the not() but the not() becomes the new needs-future.\n\t... | Used to NOT the next clause specified. | [
"Used",
"to",
"NOT",
"the",
"next",
"clause",
"specified",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L335-L344 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.not | public Where<T, ID> not(Where<T, ID> comparison) {
addClause(new Not(pop("NOT")));
return this;
} | java | public Where<T, ID> not(Where<T, ID> comparison) {
addClause(new Not(pop("NOT")));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"not",
"(",
"Where",
"<",
"T",
",",
"ID",
">",
"comparison",
")",
"{",
"addClause",
"(",
"new",
"Not",
"(",
"pop",
"(",
"\"NOT\"",
")",
")",
")",
";",
"return",
"this",
";",
"}"
] | Used to NOT the argument clause specified. | [
"Used",
"to",
"NOT",
"the",
"argument",
"clause",
"specified",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L349-L352 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.or | public Where<T, ID> or() {
ManyClause clause = new ManyClause(pop("OR"), ManyClause.OR_OPERATION);
push(clause);
addNeedsFuture(clause);
return this;
} | java | public Where<T, ID> or() {
ManyClause clause = new ManyClause(pop("OR"), ManyClause.OR_OPERATION);
push(clause);
addNeedsFuture(clause);
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"or",
"(",
")",
"{",
"ManyClause",
"clause",
"=",
"new",
"ManyClause",
"(",
"pop",
"(",
"\"OR\"",
")",
",",
"ManyClause",
".",
"OR_OPERATION",
")",
";",
"push",
"(",
"clause",
")",
";",
"addNeedsFuture",
"... | OR operation which takes the previous clause and the next clause and OR's them together. | [
"OR",
"operation",
"which",
"takes",
"the",
"previous",
"clause",
"and",
"the",
"next",
"clause",
"and",
"OR",
"s",
"them",
"together",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L357-L362 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.or | public Where<T, ID> or(Where<T, ID> left, Where<T, ID> right, Where<T, ID>... others) {
Clause[] clauses = buildClauseArray(others, "OR");
Clause secondClause = pop("OR");
Clause firstClause = pop("OR");
addClause(new ManyClause(firstClause, secondClause, clauses, ManyClause.OR_OPERATION));
return this;
} | java | public Where<T, ID> or(Where<T, ID> left, Where<T, ID> right, Where<T, ID>... others) {
Clause[] clauses = buildClauseArray(others, "OR");
Clause secondClause = pop("OR");
Clause firstClause = pop("OR");
addClause(new ManyClause(firstClause, secondClause, clauses, ManyClause.OR_OPERATION));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"or",
"(",
"Where",
"<",
"T",
",",
"ID",
">",
"left",
",",
"Where",
"<",
"T",
",",
"ID",
">",
"right",
",",
"Where",
"<",
"T",
",",
"ID",
">",
"...",
"others",
")",
"{",
"Clause",
"[",
"]",
"clau... | OR operation which takes 2 arguments and OR's them together.
<p>
<b>NOTE:</b> There is no guarantee of the order of the clauses that are generated in the final query.
</p>
<p>
<b>NOTE:</b> I can't remove the generics code warning that can be associated with this method. You can instead
use the {@link #or(int)} method.
</p> | [
"OR",
"operation",
"which",
"takes",
"2",
"arguments",
"and",
"OR",
"s",
"them",
"together",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L375-L381 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.idEq | public Where<T, ID> idEq(ID id) throws SQLException {
if (idColumnName == null) {
throw new SQLException("Object has no id column specified");
}
addClause(new SimpleComparison(idColumnName, idFieldType, id, SimpleComparison.EQUAL_TO_OPERATION));
return this;
} | java | public Where<T, ID> idEq(ID id) throws SQLException {
if (idColumnName == null) {
throw new SQLException("Object has no id column specified");
}
addClause(new SimpleComparison(idColumnName, idFieldType, id, SimpleComparison.EQUAL_TO_OPERATION));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"idEq",
"(",
"ID",
"id",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"idColumnName",
"==",
"null",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"\"Object has no id column specified\"",
")",
";",
"}",
"addCl... | Add a clause where the ID is equal to the argument. | [
"Add",
"a",
"clause",
"where",
"the",
"ID",
"is",
"equal",
"to",
"the",
"argument",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L411-L417 | train |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.idEq | public <OD> Where<T, ID> idEq(Dao<OD, ?> dataDao, OD data) throws SQLException {
if (idColumnName == null) {
throw new SQLException("Object has no id column specified");
}
addClause(new SimpleComparison(idColumnName, idFieldType, dataDao.extractId(data),
SimpleComparison.EQUAL_TO_OPERATION));
return this;
} | java | public <OD> Where<T, ID> idEq(Dao<OD, ?> dataDao, OD data) throws SQLException {
if (idColumnName == null) {
throw new SQLException("Object has no id column specified");
}
addClause(new SimpleComparison(idColumnName, idFieldType, dataDao.extractId(data),
SimpleComparison.EQUAL_TO_OPERATION));
return this;
} | [
"public",
"<",
"OD",
">",
"Where",
"<",
"T",
",",
"ID",
">",
"idEq",
"(",
"Dao",
"<",
"OD",
",",
"?",
">",
"dataDao",
",",
"OD",
"data",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"idColumnName",
"==",
"null",
")",
"{",
"throw",
"new",
"SQLEx... | Add a clause where the ID is from an existing object. | [
"Add",
"a",
"clause",
"where",
"the",
"ID",
"is",
"from",
"an",
"existing",
"object",
"."
] | 154d85bbb9614a0ea65a012251257831fb4fba21 | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L422-L429 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.