private void joinEvent() { showLoadingDialog(getString(R.string.submitting)); ParseRelation<ParseObject> attendees = mEvent.getRelation("attendees"); attendees.add(ParseUser.getCurrentUser()); mEvent.saveInBackground(new SaveCallback() { @Override public void done(ParseException e) { dismissDialog(); if(e!=null){ new AlertDialog.Builder(getActivity()).setMessage(e.getMessage()).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { getActivity().finish(); } }).setCancelable(false).show(); } else{ Toast.makeText(getActivity(), "You're going!", Toast.LENGTH_SHORT).show(); aq.id(R.id.btn_submit).enabled(false); mHasJoined=true; } } }); }
public void getDepartmentInfo() { ParseObject project = new ParseObject("project"); project.put("title", "Some title here"); ParseObject dept = new ParseObject("department"); dept.put("name", "Some name here"); dept.put("description", "Some description here"); ParseRelation<ParseObject> relation = dept.getRelation("projects"); relation.add(project); dept.put("projects", relation); dept.saveInBackground(new SaveCallback() { @Override public void done(ParseException e) { if (e == null) { Log.d("dept", "saved"); } else { Log.d("dept", "Error: " + e.getMessage()); } } }); // ParseQuery<ParseObject> query = ParseQuery.getQuery("department"); // query.findInBackground(new FindCallback<ParseObject>() { // @Override // public void done(List<ParseObject> objects, ParseException e) { // if (e == null) { // for (ParseObject dept : objects) { // // } // } else { // Log.d(getClass().getSimpleName(), "Error: " + e.getMessage()); // } // } // }); }
public ParseRelation<Node> getNodeRelation() { return getRelation(KEY_NODE_RELATION); }
public static <T extends ParseObject> ParseRelation<T> get(ParseObject parseObject, String key, ParseRelation<T> defValue) { return (ParseRelation<T>) parseObject.getRelation(key); }
public static HashMap ObjectToHashMap(ParseObject parseObject) { HashMap map = new HashMap(); if (parseObject != null) { Set<String> keySet = parseObject.keySet(); for (String key : keySet) { Object value = parseObject.get(key); if (value instanceof Boolean || value instanceof String || value instanceof Integer || value instanceof Float || value instanceof Double || value instanceof HashMap || value instanceof Date) { map.put(key, value); } else if (value instanceof ArrayList) { map.put(key, ParseDataConversions.ArrayListToHashMapArray((ArrayList)value)); } else if (value instanceof ParseObject) { HashMap convertedObject = ParseDataConversions.ObjectToHashMap((ParseObject)value); map.put(key, convertedObject); } else if (value instanceof ParseGeoPoint) { map.put(key, ParseDataConversions.GeoPointToHashMap((ParseGeoPoint)value)); } else if (value instanceof ParseRelation) { map.put(key, ParseDataConversions.RelationToHashMap((ParseRelation)value)); } else if (value instanceof ParseFile) { map.put(key, ParseDataConversions.FileToHashMap((ParseFile)value)); Log.e(TAG, "Returned data contains an unsupported column type: ParseFile"); } else { Log.e(TAG, "Unrecognized object in ArrayList, skipping:" + key + " " + value.getClass().getName()); } } // Remember class name, object IDs, created and updated dates map.put("_className", parseObject.getClassName()); map.put("_objectId", parseObject.getObjectId()); map.put("_createdAt", parseObject.getCreatedAt()); map.put("_updatedAt", parseObject.getUpdatedAt()); } return map; }
public static HashMap RelationToHashMap(ParseRelation parseRelation) { Log.e(TAG, "Unsupported conversion: ParseRelation"); return new HashMap(); }
static boolean isValidType(Object value) { return value instanceof JSONObject || value instanceof JSONArray || value instanceof String || value instanceof Number || value instanceof Boolean || value == JSONObject.NULL || value instanceof ParseObject || value instanceof ParseACL || value instanceof ParseFile || value instanceof ParseGeoPoint || value instanceof Date || value instanceof byte[] || value instanceof List || value instanceof Map || value instanceof ParseRelation; }