本文整理汇总了Java中com.parse.ParseObject.createWithoutData方法的典型用法代码示例。如果您正苦于以下问题:Java ParseObject.createWithoutData方法的具体用法?Java ParseObject.createWithoutData怎么用?Java ParseObject.createWithoutData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.parse.ParseObject
的用法示例。
在下文中一共展示了ParseObject.createWithoutData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: alreadyBookedSlots
import com.parse.ParseObject; //导入方法依赖的package包/类
public void alreadyBookedSlots(final String trainerId, final String sDay, final String sDate, final Context context) {
arBookedSlots.clear();
ParseObject trainer = ParseObject.createWithoutData("Trainer", trainerId);
ParseQuery<ParseObject> query = ParseQuery.getQuery("BlockedSlots");
query.selectKeys(Arrays.asList("slot_time"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.whereEqualTo("slot_date", sDate);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> bookedSlots, com.parse.ParseException e) {
if (e == null) {
for (ParseObject slots : bookedSlots) {
int slotTime = Integer.valueOf(slots.getString("slot_time"));
arBookedSlots.add(slotTime);
}
} else {
Log.d("DEBUG", "Error: " + e.getMessage());
}
populateAvailableSlots(trainerId, sDay, sDate, context);
}
});
}
示例2: ConvertToParseObjectIfNecessary
import com.parse.ParseObject; //导入方法依赖的package包/类
public static Object ConvertToParseObjectIfNecessary(Object object) {
if (IsParseObject(object)) {
HashMap map = (HashMap)object;
String objectID = (String)map.get("_objectId");
String className = (String)map.get("_className");
if (className != null && className.length() > 0 && objectID != null && objectID.length() > 0) {
ParseObject parseObject = ParseObject.createWithoutData(className, objectID);
Set<String> keySet = map.keySet();
for (String key : keySet) {
// Ignore the keys we don't need to set (ACL is currently unsupported)
if (key.equals("_createdAt") || key.equals("_updatedAt") || key.equals("_ACL") ||
key.equals("_objectId") || key.equals("_className")) {
continue;
}
// Check if its a nested hash map. This only converts the original
// object to a parse object if it requires conversion, otherwise it just
// returns the original value
Object mapValue = map.get(key);
parseObject.put(key, ConvertToParseObjectIfNecessary(mapValue));
}
return parseObject;
}
}
return object;
}
示例3: getDaysBetweenDates
import com.parse.ParseObject; //导入方法依赖的package包/类
public void getDaysBetweenDates(final Date startdate, final Date enddate, String trainerId) {
ParseObject trainer = ParseObject.createWithoutData("Trainer", trainerId);
ParseQuery<ParseObject> query = ParseQuery.getQuery("TrainerSlots");
query.selectKeys(Arrays.asList("day"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> trainerSlots, com.parse.ParseException e) {
if (e == null) {
listOfAvailableDays.clear();
for (ParseObject slots : trainerSlots) {
String availableDay = slots.getString("day");
listOfAvailableDays.add(availableDay);
}
ArrayList<Date> unAvailableDates = new ArrayList<Date>();
Calendar calendar = new GregorianCalendar();
calendar.setTime(startdate);
while (calendar.getTime().before(enddate)) {
Date result = calendar.getTime();
for (int i = 0; i < listOfAvailableDays.size(); i++) {
if (listOfAvailableDays.contains(simpleDayFormat.format(result))) {
caldroidFragment.setBackgroundResourceForDate(R.color.availableSlotColor, result);
caldroidFragment.setTextColorForDate(R.color.white, result);
} else {
unAvailableDates.add(result);
}
}
calendar.add(Calendar.DATE, 1);
}
caldroidFragment.setDisableDates(unAvailableDates);
caldroidFragment.refreshView();
} else {
Log.d("DEBUG", "Error: " + e.getMessage());
}
}
});
}
示例4: getObjectIdUser
import com.parse.ParseObject; //导入方法依赖的package包/类
public static Object getObjectIdUser(String objectId){
return ParseObject.createWithoutData(Constants.CLASS_USER, objectId);
}
示例5: DeleteDataObject
import com.parse.ParseObject; //导入方法依赖的package包/类
public void DeleteDataObject(String className, String objectId, DeleteCallback callback) {
ParseObject object = ParseObject.createWithoutData(className, objectId);
object.deleteInBackground(callback);
}
示例6: populateEvents
import com.parse.ParseObject; //导入方法依赖的package包/类
private void populateEvents() {
String currentUser;
final ProgressWheel progressWheel = (ProgressWheel) findViewById(R.id.progress_wheel);
currentDate = Calendar.getInstance().getTime();// get current date
final SimpleDateFormat simpleDateStrFormat = new SimpleDateFormat(Constants.DATE_FORMAT);
final String strCurrentDate = simpleDateStrFormat.format(currentDate);
if (SimpleUser.currentUserObjectId == null) {
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
currentUser = pref.getString("userId", "");
} else {
currentUser = SimpleUser.currentUserObjectId;
}
ParseObject trainer = ParseObject.createWithoutData("Trainer", Trainer.currentTrainerObjectId);
ParseObject user = ParseObject.createWithoutData("SimpleUser", currentUser);
ParseQuery<ParseObject> query = ParseQuery.getQuery("BlockedSlots");
query.selectKeys(Arrays.asList("slot_date", "slot_time"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.whereEqualTo("user_id", user);
query.whereEqualTo("status", "addtocart");
query.orderByAscending("slot_date");
adSlots.clear();
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> trainerSlots, ParseException e) {
if (e == null) {
for (ParseObject slots : trainerSlots) {
BlockedSlots b = new BlockedSlots();
b.setSlotDate(slots.getString("slot_date"));
b.setSlotTime(slots.getString("slot_time"));
try {
Date cDate = simpleDateStrFormat.parse(strCurrentDate);
Date slotDate = simpleDateStrFormat.parse(slots.getString("slot_date"));
if (slotDate.after(cDate) || slotDate.equals(cDate)) {
alSlots.add(b);
}
adSlots.notifyDataSetChanged();
} catch (java.text.ParseException e1) {
e1.printStackTrace();
}
progressWheel.setVisibility(View.INVISIBLE);
adSlots.notifyDataSetChanged();
}
} else {
Log.v("DEBUG!!!!!!!!!!!!!", "Error occured >>>>>>>>>>>>>>>>>> " + e);
progressWheel.setVisibility(View.INVISIBLE);
}
}
});
bHome.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(UpcomingEventsActivity.this, HomeActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.enter_from_bottom, R.anim.stay_in_place);
}
});
}
示例7: populateAvailableSlots
import com.parse.ParseObject; //导入方法依赖的package包/类
public void populateAvailableSlots(final String trainerId, final String day, final String sDate, final Context context) {
final TextView tvSlotsInfo = (TextView) findViewById(R.id.tvSlotsInfo);
final ParseObject trainer = ParseObject.createWithoutData("Trainer",trainerId);
ParseQuery<ParseObject> query = ParseQuery.getQuery("TrainerSlots");
query.selectKeys(Arrays.asList("start_time", "end_time"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.whereEqualTo("day", day);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> trainerSlots, com.parse.ParseException e) {
if (e == null) {
listOfSlots.clear();
for (ParseObject slots : trainerSlots) {
int startTimeInt = Integer.valueOf(slots.getString("start_time"));
int endTimeInt = Integer.valueOf(slots.getString("end_time"));
arraySlots.clear();
for (int i = startTimeInt; startTimeInt < endTimeInt; startTimeInt++) {
arraySlots.add(startTimeInt);
}
// find out time slots not in arBookedSlots
List<Integer> noBookedSlots = new ArrayList<Integer>(arraySlots);
noBookedSlots.removeAll(arBookedSlots);
for (int k = 0; k < noBookedSlots.size(); k++) {
int intSlotsWithoutBookedSlots = noBookedSlots.get(k);
String slotsWithoutBookedSlots;
if (intSlotsWithoutBookedSlots <= 11) {
slotsWithoutBookedSlots = intSlotsWithoutBookedSlots + " " + Constants.AM;
} else if (intSlotsWithoutBookedSlots == 12) {
slotsWithoutBookedSlots = intSlotsWithoutBookedSlots + " " + Constants.PM;
} else {
slotsWithoutBookedSlots = (intSlotsWithoutBookedSlots - 12) + " " + Constants.PM;
}
listOfSlots.add(slotsWithoutBookedSlots);
}
SimpleDateFormat dt = new SimpleDateFormat("MMMM dd");
tvSlotsInfo.setText(listOfSlots.size() + " slots available on " + dt.format(new Date(sDate)) + ", " + day);
bSelectSlot.setBackground(getResources().getDrawable(R.drawable.primary_blue_button));
try {
Date d = simpleDateStrFormat.parse(sDate);
caldroidFragment.setBackgroundResourceForDate(R.color.selectedSlotColor, d);
previousDate = d;
caldroidFragment.refreshView();
} catch (java.text.ParseException e1) {
e1.printStackTrace();
}
}
} else {
Log.d("DEBUG", "Error: " + e.getMessage());
}
}
});
}
示例8: populateCart
import com.parse.ParseObject; //导入方法依赖的package包/类
private void populateCart(){
String currentUser;
currentDate = Calendar.getInstance().getTime();// get current date
final SimpleDateFormat simpleDateStrFormat = new SimpleDateFormat(Constants.DATE_FORMAT);
final String strCurrentDate = simpleDateStrFormat.format(currentDate);
if (SimpleUser.currentUserObjectId == null){
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
currentUser = pref.getString("userId","n");
}else {
currentUser = SimpleUser.currentUserObjectId;
}
ParseObject trainer = ParseObject.createWithoutData("Trainer", Trainer.currentTrainerObjectId);
ParseObject user = ParseObject.createWithoutData("SimpleUser", currentUser);
ParseQuery<ParseObject> query = ParseQuery.getQuery("BlockedSlots");
query.selectKeys(Arrays.asList("slot_date","slot_time"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.whereEqualTo("user_id", user);
query.whereEqualTo("status", Constants.ADD_TO_CART);
query.orderByAscending("slot_date");
adSlots.clear();
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> trainerSlots, ParseException e) {
if (e == null) {
for (ParseObject slots : trainerSlots) {
BlockedSlots b = new BlockedSlots();
b.setSlotDate(slots.getString("slot_date"));
b.setSlotTime(slots.getString("slot_time"));
try {
Date cDate = simpleDateStrFormat.parse(strCurrentDate);
Date slotDate = simpleDateStrFormat.parse(slots.getString("slot_date"));
if (slotDate.after(cDate) || slotDate.equals(cDate)) {
alSlots.add(b);
}
if (alSlots.size() > 0) {
int slotAmount = Trainer.currentPrice*alSlots.size();
int aSize = alSlots.size();
tvNoOfSlots.setText(aSize+" * $" +Trainer.currentPrice+".00 = $"+slotAmount+".00");
tvFooterTotalAmt.setText(Html.fromHtml("Total Amount: <b>$" + slotAmount + ".00</b>"));
}
adSlots.notifyDataSetChanged();
} catch (java.text.ParseException e1) {
e1.printStackTrace();
}
adSlots.notifyDataSetChanged();
}
} else {
Log.v("DEBUG!!!!!!!!!!!!!", "Error occured >>>>>>>>>>>>>>>>>> " + e);
}
}
});
bProceedtoPayment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(CartActivity.this, PaymentActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.enter_from_bottom, R.anim.stay_in_place);
}
});
}