thiagolocatelli / parse4j Goto Github PK
View Code? Open in Web Editor NEWJava Library to deal with Parse (parse.com) REST API
Home Page: http://thiagolocatelli.github.io/parse4j
Java Library to deal with Parse (parse.com) REST API
Home Page: http://thiagolocatelli.github.io/parse4j
Since parse announced it's plan to EOL Parse and has also released an open source API server, it would be good to add support for custom Parse URL to this library.
I get the below exception every time i try connecting api.parse.com with the parse4j library. Is there any pre-requisites that i'm missing?
Hi,
I need the jar of a release for a legacy project with the Parse.initialize(String, String, String) because migrating parse server.
Needed for a production system, please help me.
I will pay you 5$
I see that some of the methods in ParseUser are stubbed out for now. Any eta on when they will be implemented? Also, will the currentUser be set when ParseUser is fully implemented? Thanks!
Hi,
I'm wondering if the current implementation of getParseData() in ParseObject is correct. See inline questions below.
public JSONObject getParseData() {
JSONObject parseData = new JSONObject();
for(String key : operations.keySet()) {
ParseFieldOperation operation = (ParseFieldOperation) operations.get(key);
if(operation instanceof SetFieldOperation) {
parseData.put(key, operation.encode(PointerEncodingStrategy.get()));
}
else if(operation instanceof IncrementFieldOperation) {
parseData.put(key, operation.encode(PointerEncodingStrategy.get()));
}
else if(operation instanceof DeleteFieldOperation) {
parseData.put(key, operation.encode(PointerEncodingStrategy.get()));
}
else if(operation instanceof RelationOperation) {
parseData.put(key, operation.encode(PointerEncodingStrategy.get()));
}
else {
/*
QUESTIONS:
1. Every modification of a ParseObject as far as I can see (read: put()) is done via operations.
So if we get here, I expect that we've encountered an unsupported operation
NOT a sub-ParseObject. Can you explain why you're expecting a ParseObject here?
2. Why doesn't this code take other operations like AddOperation into account?
*/
//here we deal will sub objects like ParseObject;
Object obj = data.get(key);
if(obj instanceof ParseObject) {
ParseObject pob = (ParseObject) obj;
parseData.put(key, pob.getParseData());
}
}
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("parseData-> " + parseData);
}
return parseData;
}
In your pom.xml
I see The Apache Software License, Version 2.0
is referenced, but in your README you have a TODO - so what is the official statement?
Hi,
I can't fetch relational data which is relation to object and list of object.
Thanks.
The current implementation of ParseObject.setData()
performs the following operations after the data has been set which effectively clears the set data. This operation should be performed at the beginning of the method instead of at the end.
this.isDirty = false;
this.operations.clear();
this.dirtyKeys.clear();
A known issue caused by this defect is that after logging in on a ParseUser object, the user information is unavailable.
Dear All,
Is there any saveAll method in parse4j where we give list of parse object and all of them are saved in one query?
Regards.
Shouldn't it be parseUser.setData(jsonResponse, false);
instead of parseUser.setData(jsonResponse, true);
?
I'm getting the exception ParseFile must be saved before being set on a ParseObject.
Greetings,
Increment operation sends wrong values to the server because of setting needIncrement to false here
Is there no way to query for users using parse4j?
Hello,
I tried the example for columns with type "Array" with the given example:
gameScore.addAllUnique("skills", Arrays.asList("flying", "kungfu"));
gameScore.saveInBackground();
And it throw me the exception:
Exception in thread "main" java.lang.IllegalArgumentException: not implemented!
at org.parse4j.operation.AddUniqueOperation.apply(AddUniqueOperation.java:27)
at org.parse4j.ParseObject.performOperation(ParseObject.java:396)
at org.parse4j.ParseObject.addAllUnique(ParseObject.java:331)
It seems that this feature is not implemented yet.
Hi,
I just download the parse4J via using Eclipse Maven plugin. However, when I try to execute basic query, it generates a warning message; SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". In addition, can you provide more detail related with
parse4j installation? Is there any jar files that contains all the dependencies?
Regards.
Hi,
I am not sure if this is an issue but I tried updating an existinng parse object using Parse4J
and instead of updating the columns "active" and "results" it creates a new column "data" as shown in the Image below.
I don't have code to show you at the moment but I did follow your tutorial. Everything else works perfectly, just updating is causing an issue.
Is it possible to delete files using Parse4j? Deleting objects is of course possible, but does that cascade delete any files associated with the object? The default REST APIs does not cascade delete.
This library is really awesome but I recently had to install a system who's network connection runs through a proxy and I was not able to connect to Parse.com. Looks like parse4j is ignoring proxy environment variables. Any idea if this is going to be fixed anytime soon?
Best,
M.
hii guys, Can I upload a xls? or I need authoreize something in my app? I checked my ACL is public/read/write.....follow my code..
Path path = Paths.get(USER_DIRECTORY + "/workbook.xls");
byte[] data = Files.readAllBytes(path);
final ParseFile parseFile = new ParseFile("test1.xls", data);
parseFile.save(new SaveCallback() {
@Override
public void done(ParseException pe) {
System.out.println("pe =" + pe);
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
I need to add a ParseObject array to an object. With the Android API I use the ParseObject.addAll method:
public ParseObject getParseObject() {
ParseObject po = new ParseObject("CustomExercise");
po.put("type", type.id);
po.put("question", question);
po.put("user", ParseUser.getCurrentUser());
int index = 0;
List<ParseObject> opts = new ArrayList<ParseObject>();
for (String option : options) {
ParseObject opo = new ParseObject("ExerciseOption");
opo.put("text", option);
opo.put("correct", index == correctIndex);
opts.add(opo);
index++;
}
po.addAll("options", opts);
return po;
}
which works well, but I get an "java.lang.IllegalArgumentException: not implemented!" exception when trying to use add or addAll in Parse4j. The documentations mentions addAllUnique, but it's also not implemented. Is there an alternative way of doing it?
Hello, I am trying to query a list of objects which contains a ParseFile, this is the failing code:
ParseQuery query=ParseQuery.getQuery("file_test");
System.out.println(query.find().size());
I am getting this exception:
Exception in thread "main" java.lang.IllegalArgumentException: ParseFile must be saved before being set on a ParseObject.
at org.parse4j.ParseObject.put(ParseObject.java:359)
Maybe find setData method should not be doing same validations as when we are creating the objects, I may be wrong on this :P
I can't create an anonymous class of LoginCallback because I can't implement the method 'done'. Is this intended?
Edit: Nevermind, loginInBackground is not implemented yet :)
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Table"); query.whereContainedIn("pointer", listOfParseObjects); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> list, ParseException parseException) { if (parseException == null) { //do something }}else{ parseException.printStackTrace(); } } });
Exception in thread "pool-1-thread-3" org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
at org.json.JSONTokener.syntaxError(JSONTokener.java:451)
at org.json.JSONObject.(JSONObject.java:195)
at org.json.JSONObject.(JSONObject.java:319)
at org.parse4j.command.ParseResponse.getJsonObject(ParseResponse.java:83)
at org.parse4j.command.ParseResponse.getException(ParseResponse.java:71)
at org.parse4j.ParseQuery.find(ParseQuery.java:598)
at org.parse4j.ParseQuery.find(ParseQuery.java:469)
at org.parse4j.ParseQuery$FindInBackgroundThread.run(ParseQuery.java:618)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
What is the license of this code?
Hello
I've added support for the Schema API in my repository. To run tests against this requires use of the master-key for the sample parse application you have in your tests. Thoughts?
Jon
So trying to sort Ascending w.r.t createdAt but Descending wtr ANOTHER_KEY.
now if i call parseQuery.orderByDescending("createdAt,ANOTHER_KEY"), everything is fine, but if i do
parseQuery.orderByDescending("ANOTHER_KEY"),
parseQuery.addOrderByAscending("createdAt")
it throws a parse exception from the parseserver saying createdAt is not a valid order key.
I looked at the source, for the REST api, you simply add the key with a '-' sign for descending so why is this happening ?
As a preface, I'll apologize : I'm french, so there are French words in my queries and my tables.
Anyways, I've been having problem with the queries frome Parse4J.
In my data on Parse.com, I have Themes and SubThemes in the same table, but Themes have as RootTheme "Root", while SubThemes have as RootTheme another Theme.
I've been trying to add the results of a query into a ComboBox, but the Query has been returning me 5 times the same result, instead of the 5 RootThemes.
Here's my code :
private ParseQuery<ParseObject> themeQuery;
private ObservableList<String> themeComboData;
@Override
public void initialize(URL location, ResourceBundle resources) {
themeComboData = FXCollections.observableArrayList();
themeQuery = ParseQuery.getQuery("Theme").whereEqualTo("RootThemeID", "DBWw03ygSv");
themeQuery.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> themeList, ParseException e) {
if (e == null) {
for(int i = 0; i < themeList.size(); i++){
ParseObject themeTemp;
themeTemp = new ParseObject("Theme");
themeTemp = themeList.get(i);
themeComboData.add(themeTemp.getString("Name"));
}
} else {
Logger.getLogger(AmIApp.class.getName()).log(Level.SEVERE, null, e);
}
}
});
themeCombo.setItems(themeComboData);
}
But all it does is filling my Combo Box themeCombo with 5 times "Affinités", instead of the 5 different RootThemes.
Any advice ? Thanks in advance :)
Hi Guys, I am using this useful library to initial my database in Parse. I need to upload thousands of files to Parse. But sometimes it gets stuck there without any exception nor response. I suspect that it is likely to be timeout. Anyway, is there any timeout option for us to set up when we are uploading a file? In this case, I could always cancel it activaely when it is necessary.
query.include("pointerfield")
Parse query include gives "java.lang.IllegalArgumentException: value may not be null." error
Hi,
I have a question related with the delete operation. Do I need to specify the objectId for delete operation?
Regards.
I found this lib a few hours ago and i decided to test, but suddenly, when i try to save a object to my parse app i get the following error.
Exception in thread "main" java.lang.IllegalArgumentException: not implemented!
at org.parse4j.operation.AddOperation.apply(AddOperation.java:26)
at org.parse4j.ParseObject.performOperation(ParseObject.java:396)
at org.parse4j.ParseObject.addAll(ParseObject.java:322)
at org.parse4j.ParseObject.add(ParseObject.java:317)
I saw the source of the version 1.4 (the last on mvrepository) and i found that you are throwing the exception on purpose, there is anything that i can do to skip this error??
Thanks in advance.
Hello,
I am trying to remove a dozens of objects from a relation, but only the last object in the loop is being removed. The previous object are discarded from "remove list". In "operation" field I can see only the last one. Someone else had the same problem?
If I remove only one object and then save to Parse, every works fine.
Thanks
I have need of push notification for parse
Let me know how much time it will take to be implemented ?
https://github.com/thiagolocatelli/parse4j#PushNotifications
I added 1.4 and it does not have the ability to initialize with a self hosted parse URL. I looked at your current pom file and tried to copy the version you have set there and maven cannot find it. Am I missing something or has this not been updated on maven yet? If so. Please update your readme.
P.S. Great library by the way. Been working on mobile/web with Parse for years. You guys did a great job following their naming conventions and everything!
First thanks for building this library! Works well so far, however it seems the whereMatchesKeyInQuery doesn't work, throwing the following exception. I tried with class types other than User & Installation having the same outcome. Here is my code:
public void queryUserWithInstallation() {
ParseQuery query = ParseQuery.getQuery("_Installation");
ParseQuery userQuery = ParseQuery.getQuery("_User");
query.whereMatchesKeyInQuery("user", "objectId", userQuery);
query.findInBackground(new FindCallback() {
@OverRide
public void done(List list,
ParseException parseException) {
// TODO Auto-generated method stub
}
});
}
03:24:30.243 [pool-1-thread-1] ERROR org.parse4j.util.ParseEncoder - Object type not decoded: org.parse4j.ParseQuery
Exception in thread "pool-1-thread-1" java.lang.IllegalArgumentException: Invalid type for ParseObject: class org.parse4j.ParseQuery
at org.parse4j.util.ParseEncoder.encode(ParseEncoder.java:128)
at org.parse4j.util.ParseEncoder.encode(ParseEncoder.java:64)
at org.parse4j.util.ParseEncoder.encode(ParseEncoder.java:82)
at org.parse4j.util.ParseEncoder.encode(ParseEncoder.java:82)
at org.parse4j.ParseQuery.toREST(ParseQuery.java:334)
at org.parse4j.ParseQuery.find(ParseQuery.java:470)
at org.parse4j.ParseQuery$FindInBackgroundThread.run(ParseQuery.java:591)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Can i modify this project to make it usable with hosted parse?
Or can you help me with using REST API ?
Dear All,
Is it possible to set a limit to ParseQuery? If it is then can you direct me related with this issue?
Regards,
I have no problem in create a new ParseObject with the following code, but if I want to update the existing record, it seems like not working. Any idea?
The ParseObject.validateSave()
method is never called. This effectively means that the validation in subclasses, e.g., ParseUser is never done.
Dear All,
Can you direct me related with delete operation in User table? Also is there any progress on updating an existing object attribute?
Regards,
I can't seem to be able to even log in. If I use the login() method, I get an error
"Exception in thread "pool-1-thread-7" java.lang.IllegalArgumentException: ParseFile must be saved before being set on a ParseObject."
If I use the logIn() method, I can only return the username. All others return null.
If I use the loginInBackground() Method, I receive the error:
"Inherited abstract methods are not accessible and could not be implemented"
Is anyone getting these errors or know how to fix?
Thanks
I cannot use ParseBatch in my application, when I try it I am getting : "ParseBatch cannot be resolved to a type"
I also checked the classes in the jar library and I cannot find the ParseBatch class under org.Parse4j
I use the following code with parse4j 1.3 in a wicket web application:
ParseQuery pq = ParseQuery.getQuery(Event.class); pq.skip((int)first); pq.limit((int)count); return pq.find().iterator();
The find() call raises an IllegalArgumentException: ParseFile must be saved before being set on a ParseObject. However I'm not saving any object, I'm only fetching. Here is my Event class:
@ParseClassName("Event") public class Event extends ParseObject { public String getEventLinkRegistration() { return getString("eventLinkRegistration"); } public void setEventLinkRegistration(String eventLinkRegistration) { put("eventLinkRegistration", eventLinkRegistration); } public String getEventContactName() { return getString("eventContactName"); } public void setEventContactName(String eventContactName) { put("eventContactName", eventContactName); } public String getEventContactMail() { return getString("eventContactMail"); } public void setEventContactMail(String eventContactMail) { put("eventContactMail", eventContactMail); } public String getEventContactPhone() { return getString("eventContactPhone"); } public void setEventContactPhone(String eventContactPhone) { put("eventContactPhone", eventContactPhone); } public String getEventAddress() { return getString("eventAddress"); } public void setEventAddress(String eventAddress) { put ("eventAddress", eventAddress); } public String getEventCity() { return getString("eventCity"); } public void setEventCity(String eventCity) { put("eventCity", eventCity); } public ParseRelation getEventCountry() { return getRelation("eventCountry"); } public void setEventCountry(ParseRelation eventCountry) { put("eventCountry", eventCountry); } public String getEventTitle() { return getString("eventTitle"); } public void setEventTitle(String eventTitle) { put("eventTitle", eventTitle); } public String getEventText() { return getString("eventText"); } public void setEventText(String eventText) { put("eventText", eventText); } public Date getEventDate() { return getDate("eventDate"); } public void setEventDate(Date eventDate) { put("eventDate", eventDate); } public ParseFile getEventImg() { return getParseFile("eventImg"); } public void setEventImg(ParseFile eventImg) { put("eventImg", eventImg); } public ParseGeoPoint getEventPosition() { return getParseGeoPoint("eventPosition"); } public void setEventPosition(ParseGeoPoint eventPosition) { put("eventPosition", eventPosition); } }
Here is the relevant part of the stack trace:
Caused by: java.lang.IllegalArgumentException: ParseFile must be saved before being set on a ParseObject.
at org.parse4j.ParseObject.put(ParseObject.java:359)
at org.parse4j.ParseObject.setData(ParseObject.java:725)
at org.parse4j.ParseQuery.find(ParseQuery.java:499)
Do you have any timeline for 'Security for Other Objects' Section? Without ACL for the Objects saved in Parse, anybody can access/modify the data as the APP_ID & REST_APP_ID can not be secured?
Any alternative would be greatly appreciated.
Cheers,
mike
Hi there,
Just wondering, is the parseUser class not finished or am I doing something wrong. I can't find a method in the class.
Any help or reply would be greatly appreciated.
Thanks
Error on "ParseQuery.getQuery" = "java.lang.NoSuchMethodError: org.json.JSONObject.keySet()"
run:
10:40:05.271 [main] DEBUG org.parse4j.util.ParseRegistry - Registering sub class _User
10:40:05.298 [main] DEBUG org.parse4j.util.ParseRegistry - Registering sub class roles
10:40:05.301 [main] DEBUG o.p.operation.ParseFieldOperations - Registering Delete decoder
10:40:05.302 [main] DEBUG o.p.operation.ParseFieldOperations - Registering Increment decoder
10:40:05.303 [main] DEBUG o.p.operation.ParseFieldOperations - Registering Add decoder
10:40:05.304 [main] DEBUG o.p.operation.ParseFieldOperations - Registering AddUnique decoder
10:40:05.307 [main] DEBUG o.p.operation.ParseFieldOperations - Registering Remove decoder
10:40:05.310 [main] DEBUG o.p.operation.ParseFieldOperations - Registering AddRelation decoder
10:40:05.311 [main] DEBUG o.p.operation.ParseFieldOperations - Registering RemoveRelation decoder
FIM
10:40:05.352 [pool-1-thread-1] DEBUG org.parse4j.command.ParseCommand - Data to be sent: {"data":{"where":{"objectId":"9nmZulMSw9"}}}
10:40:05.931 [pool-1-thread-1] DEBUG org.parse4j.command.ParseGetCommand - Request URL: https://api.parse.com/1/classes/cielo
Exception in thread "pool-1-thread-1" java.lang.NoSuchMethodError: org.json.JSONObject.keySet()Ljava/util/Set;
at org.parse4j.command.ParseGetCommand.getRequest(ParseGetCommand.java:54)
at org.parse4j.command.ParseCommand.perform(ParseCommand.java:44)
at org.parse4j.ParseQuery.find(ParseQuery.java:500)
at org.parse4j.ParseQuery.find(ParseQuery.java:470)
at org.parse4j.ParseQuery.get(ParseQuery.java:378)
at org.parse4j.ParseQuery$GetInBackgroundThread.run(ParseQuery.java:453)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
MyCode (JAR on Project: http://prntscr.com/6o4y67):
import org.parse4j.*;
import org.parse4j.callback.GetCallback;
public class Consulta {
public static void main(String[] args) {
Parse.initialize("XYZ", "XYZ");
ParseQuery<ParseObject> query = ParseQuery.getQuery("cielo");
query.getInBackground("9nmZulMSw9", new GetCallback<ParseObject>() {
@Override
public void done(ParseObject object, ParseException e) {
if (e == null) {
System.out.println(object.getString("nome"));
} else {
System.out.println("ERRO!!!!!!!!!!!!!" + e.getMessage());
}
}
});
System.out.println("FIM");
}
}
I have a scenario where I have a table of objects that need created or updated based on key value pairs. Sounds like an opportunity for batch operations. What do you think?
If you are not planning on doing this yourself. Would you have a preferred approach you'd like me to take so you can pull it back in?
ParseFile getData() is not implemented completely. Currently it is just returning null.
Hi,
First of all, thank you for this amazing Library. I am making a game using libgdx and I would love to use the library. However, after adding compile 'com.github.thiagolocatelli:parse4j:1.4' to my build.gradle, I tried to initialize Parse in my main class using Parse.initialize(APPID, RESTfulKey);. However, i am getting java.lang.ExceptionInInitializerError in that line. How would I go about fixing this? Thank you.
EDIT:
Here are some warnings i get
WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.2 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.json:json:20131018 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages
WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.2 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.json:json:20131018 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage with jarjar to change the class packages
Hi!
I don't know really if this a issue or not, but, if i didn't changed this line I can't use your API (Thanks for this, by the way).
In this line (54):
Iterator it = query.keySet().iterator();
I got a error, and I changed for this line and I can compile:
Iterator it = query.keys();
I don't know if its a issue or not, but with this, I can't compile.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.