// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.olio.data.object.assistant; import android.content.ContentResolver; import android.content.ContentValues; import android.database.Cursor; import android.net.Uri; import com.olio.communication.notifications.NotificationFilters; import com.olio.communication.notifications.Utilities; import com.olio.data.object.assistant.rule.ContextContainer; import com.olio.data.object.assistant.rule.Rule; import com.olio.data.object.assistant.rule.SilenceNotificationsRule; import com.olio.data.object.context.PersonalAssistantContext; import com.olio.olios.model.record.DatabaseRecord; import com.olio.olios.model.record.DatabaseRecordMixins; import com.olio.util.ALog; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Objects; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; public class ActiveRemindMeLater implements DatabaseRecord { public static final String CONTEXT_CONTAINER_LIST = "context_container_list"; public static final String NOTIFICATION_CATEGORY = "notification_category"; public static final String NOTIFICATION_ID = "notification_id"; public static final String RULE_ID = "rule_id"; public static final String TABLE_NAME = "active_remind_me_later"; private static String columnProjection[]; private static com.olio.olios.model.record.DatabaseRecord.DatabaseRecordFactory databaseRecordFactory = new com.olio.olios.model.record.DatabaseRecord.DatabaseRecordFactory() { public DatabaseRecord getRecordInstance() { return new ActiveRemindMeLater(); } }; private static final List recordFields; private List mContextContainers; private com.olio.communication.notifications.NotificationFilters.Category mNotificationCategory; private String mNotificationId; private String mRuleId; public ActiveRemindMeLater() { } public ActiveRemindMeLater(String s, List list, com.olio.communication.notifications.NotificationFilters.Category category, String s1) { mNotificationId = s; mContextContainers = list; mNotificationCategory = category; mRuleId = s1; } public static List activeRemindMeLaters(ContentResolver contentresolver) { contentresolver = contentresolver.query(DatabaseRecordMixins.baseUriForTable(databaseRecordFactory), columnProjection, null, null, null); List list = DatabaseRecordMixins.recordsFromCursor(contentresolver, databaseRecordFactory); contentresolver.close(); contentresolver = list; if (list == null) { contentresolver = new ArrayList(); } return contentresolver; } public static void delete(ContentResolver contentresolver, String s) { ALog.v("Removing ActivatedRemindMeLater for notification id: %s", new Object[] { s }); try { contentresolver.delete(DatabaseRecordMixins.baseUriForTable(databaseRecordFactory), "notification_id = ?", new String[] { s }); return; } // Misplaced declaration of an exception variable catch (ContentResolver contentresolver) { ALog.e("Activated RemindMeLater: %s could not be deleted.", new Object[] { s }); } } public static String[] staticColumnProjection() { return columnProjection; } public static com.olio.olios.model.record.DatabaseRecord.DatabaseRecordFactory staticFactory() { return databaseRecordFactory; } public String[] columnProjection() { return columnProjection; } public String defaultOrderBy() { return null; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } else { obj = (ActiveRemindMeLater)obj; return (new EqualsBuilder()).append(mNotificationId, ((ActiveRemindMeLater) (obj)).mNotificationId).append(mContextContainers, ((ActiveRemindMeLater) (obj)).mContextContainers).append(mNotificationCategory, ((ActiveRemindMeLater) (obj)).mNotificationCategory).isEquals(); } } public com.olio.olios.model.record.DatabaseRecord.DatabaseRecordFactory factory() { return databaseRecordFactory; } public List getContextContainers() { return mContextContainers; } public com.olio.communication.notifications.NotificationFilters.Category getNotificationCategory() { return mNotificationCategory; } public String getNotificationId() { return mNotificationId; } public String getRuleId() { return mRuleId; } public Cursor handleCustomUriQuery(Uri uri, String as[], String s, String as1[], String s1) { return null; } public int hashCode() { return (new HashCodeBuilder(17, 37)).append(mNotificationId).append(mContextContainers).append(mNotificationCategory).toHashCode(); } public String indexColumn() { return "notification_id"; } public boolean isActivatedForContexts(List list) { Object obj = getContextContainers(); if (obj != null) goto _L2; else goto _L1 _L1: return false; _L2: obj = ((List) (obj)).iterator(); _L5: if (!((Iterator) (obj)).hasNext()) goto _L1; else goto _L3 _L3: ContextContainer contextcontainer = (ContextContainer)((Iterator) (obj)).next(); Iterator iterator = list.iterator(); PersonalAssistantContext personalassistantcontext; do { if (!iterator.hasNext()) { continue; /* Loop/switch isn't completed */ } personalassistantcontext = (PersonalAssistantContext)iterator.next(); } while (contextcontainer.name == null || personalassistantcontext.getContextName() == null || contextcontainer.value == null || personalassistantcontext.getContextValue() == null || !contextcontainer.name.equalsIgnoreCase(personalassistantcontext.getContextName()) || !contextcontainer.value.equalsIgnoreCase(personalassistantcontext.getContextValue())); break; /* Loop/switch isn't completed */ if (true) goto _L5; else goto _L4 _L4: return true; } public boolean isActivatedForRule(Rule rule) { return !rule.isEnabled() && Objects.equals(mRuleId, rule.getObjectId()); } public boolean isEnabled(SilenceNotificationsRule silencenotificationsrule) { return silencenotificationsrule.isEnabled(); } public List recordFields() { return recordFields; } public void save(ContentResolver contentresolver) { ContentValues contentvalues = DatabaseRecordMixins.valuesForRecord(this); Uri uri = DatabaseRecordMixins.baseUriForTable(databaseRecordFactory); int i = contentresolver.update(uri, contentvalues, String.format("%s = '%s'", new Object[] { "notification_id", getNotificationId() }), null); if (i == 0) { contentresolver.insert(uri, contentvalues); } else if (i > 1) { ALog.e("Attempting to save ActiveRemindeMeLater and there is more than one row in the table.", new Object[0]); throw new RuntimeException("Attempting to save ActiveRemindeMeLater and there is more than one row in the table."); } } public void setContextContainers(List list) { mContextContainers = list; } public void setNotificationCategory(com.olio.communication.notifications.NotificationFilters.Category category) { mNotificationCategory = category; } public void setNotificationId(String s) { mNotificationId = s; } public void setRuleId(String s) { mRuleId = s; } public String tableName() { return "active_remind_me_later"; } public Uri tableUri() { return DatabaseRecordMixins.baseUriForTable(databaseRecordFactory); } static { recordFields = new LinkedList(); recordFields.add(new com.olio.olios.model.record.DatabaseRecord.RecordField() { public void assignFromCursor(ActiveRemindMeLater activeremindmelater, Cursor cursor) { activeremindmelater.setNotificationId(cursor.getString(cursor.getColumnIndex(columnName()))); } public volatile void assignFromCursor(Object obj, Cursor cursor) { assignFromCursor((ActiveRemindMeLater)obj, cursor); } public String columnName() { return "notification_id"; } public String createType() { return "TEXT"; } public void writeToContentValues(ActiveRemindMeLater activeremindmelater, ContentValues contentvalues) { contentvalues.put(columnName(), activeremindmelater.getNotificationId()); } public volatile void writeToContentValues(Object obj, ContentValues contentvalues) { writeToContentValues((ActiveRemindMeLater)obj, contentvalues); } }); recordFields.add(new com.olio.olios.model.record.DatabaseRecord.RecordField() { public void assignFromCursor(ActiveRemindMeLater activeremindmelater, Cursor cursor) { cursor = cursor.getBlob(cursor.getColumnIndex(columnName())); if (cursor != null) { activeremindmelater.setContextContainers((List)Utilities.decode(cursor)); } } public volatile void assignFromCursor(Object obj, Cursor cursor) { assignFromCursor((ActiveRemindMeLater)obj, cursor); } public String columnName() { return "context_container_list"; } public String createType() { return "BLOB"; } public void writeToContentValues(ActiveRemindMeLater activeremindmelater, ContentValues contentvalues) { if (activeremindmelater.getContextContainers() != null) { contentvalues.put(columnName(), Utilities.encodeWithSerialization(activeremindmelater.getContextContainers())); return; } else { contentvalues.put(columnName(), (byte[])null); return; } } public volatile void writeToContentValues(Object obj, ContentValues contentvalues) { writeToContentValues((ActiveRemindMeLater)obj, contentvalues); } }); recordFields.add(new com.olio.olios.model.record.DatabaseRecord.RecordField() { public void assignFromCursor(ActiveRemindMeLater activeremindmelater, Cursor cursor) { cursor = Integer.valueOf(cursor.getInt(cursor.getColumnIndex(columnName()))); if (cursor != null) { activeremindmelater.setNotificationCategory(NotificationFilters.fromANCSValue(cursor.intValue())); return; } else { activeremindmelater.setNotificationCategory(com.olio.communication.notifications.NotificationFilters.Category.NONE); return; } } public volatile void assignFromCursor(Object obj, Cursor cursor) { assignFromCursor((ActiveRemindMeLater)obj, cursor); } public String columnName() { return "notification_category"; } public String createType() { return "INTEGER"; } public void writeToContentValues(ActiveRemindMeLater activeremindmelater, ContentValues contentvalues) { contentvalues.put(columnName(), Integer.valueOf(activeremindmelater.getNotificationCategory().ANCSValue)); } public volatile void writeToContentValues(Object obj, ContentValues contentvalues) { writeToContentValues((ActiveRemindMeLater)obj, contentvalues); } }); recordFields.add(new com.olio.olios.model.record.DatabaseRecord.RecordFieldSet() { public void assignFromCursorColumn(ActiveRemindMeLater activeremindmelater, Cursor cursor, int i) { activeremindmelater.setRuleId(cursor.getString(i)); } public volatile void assignFromCursorColumn(Object obj, Cursor cursor, int i) { assignFromCursorColumn((ActiveRemindMeLater)obj, cursor, i); } public String columnName() { return "rule_id"; } public String createType() { return "TEXT"; } public void writeToContentValues(ActiveRemindMeLater activeremindmelater, ContentValues contentvalues) { contentvalues.put(columnName(), activeremindmelater.getRuleId()); } public volatile void writeToContentValues(Object obj, ContentValues contentvalues) { writeToContentValues((ActiveRemindMeLater)obj, contentvalues); } }); columnProjection = DatabaseRecordMixins.columnProjectionFromRecordFields(recordFields); } }