public AssignmentContentEdit edit(String id) { return (AssignmentContentEdit) super.editResource(id); }
public AssignmentContent get(String id) { return (AssignmentContent) super.getResource(id); }
public void cancel(AssignmentSubmissionEdit edit) { super.cancelResource(edit); }
public Edit putResource(String id, Object[] others) { // create one with just the id, and perhaps some other fields as well Entity entry = m_user.newResource(null, id, others); // form the XML and SQL for the insert Document doc = StorageUtils.createDocument(); entry.toXml(doc, new Stack()); String xml = StorageUtils.writeDocumentToString(doc); String statement = // singleStorageSql. "insert into " + m_resourceTableName + insertFields(m_resourceTableIdField, m_resourceTableOtherFields, "XML") + " values ( ?, " + valuesParams(m_resourceTableOtherFields) + " ? )"; Object[] flds = m_user.storageFields(entry); if (flds == null) flds = new Object[0]; Object[] fields = new Object[flds.length + 2]; System.arraycopy(flds, 0, fields, 1, flds.length); fields[0] = caseId(entry.getId()); fields[fields.length - 1] = xml; // process the insert boolean ok = m_sql.dbWrite(statement, fields); // if this failed, assume a key conflict (i.e. id in use) if (!ok) return null; // now get a lock on the record for edit Edit edit = editResource(id); if (edit == null) { log.warn("putResource(): didn't get a lock!"); return null; } return edit; }
String xml = StorageUtils.writeDocumentToString(doc); String statement = "insert into " + m_resourceTableName + insertDeleteFields(m_resourceTableIdField, m_resourceTableOtherFields, "RESOURCE_UUID", "DELETE_DATE", "DELETE_USERID", "XML") + " values ( ?, " + valuesParams(m_resourceTableOtherFields) + " ? ,? ,? ,?)"; Object[] fields = new Object[flds.length + 5]; System.arraycopy(flds, 0, fields, 1, flds.length); fields[0] = caseId(entry.getId()); Edit edit = editResource(id); if (edit == null)
+ StorageUtils.escapeSql(caseId(id)) + "' )" + " for update nowait"; StringBuilder result = new StringBuilder(); Connection lock = m_sql.dbReadLock(statement, result); Entity entry = readResource(result.toString()); edit = m_user.newResourceEdit(null, entry); Entity entry = getResource(id); if (entry == null) return null; fields[1] = internalRecordId(caseId(id)); fields[2] = TimeService.newTime(); fields[3] = sessionId; Entity entry = getResource(id); if (entry == null) return null;
public AssignmentEdit put(String id, String context) { // pack the context in an array Object[] others = new Object[1]; others[0] = context; return (AssignmentEdit) super.putResource(id, others); }
public void remove(NotificationEdit edit) { super.removeResource(edit); } }
public boolean check(String id) { return super.checkResource(id); }
public void commit(AssignmentContentEdit edit) { super.commitResource(edit); }
public boolean isEmpty() { // count int count = countAllResources(); return (count == 0); }
m_collectionStore = new BaseDbSingleStorage(m_collectionTableName, "COLLECTION_ID", COLLECTION_FIELDS, m_locksInDb, "collection", collectionUser, m_sqlService); m_collectionStorageFields = BaseDbSingleStorage.STORAGE_FIELDS; m_resourceStore = new BaseDbSingleStorage(m_resourceTableName, "RESOURCE_ID", (bodyInFile ? RESOURCE_FIELDS_FILE_CONTEXT : RESOURCE_FIELDS_CONTEXT ), m_locksInDb, "resource", resourceUser, m_sqlService); m_resourceDeleteStore = new BaseDbSingleStorage(m_resourceDeleteTableName, "RESOURCE_ID", (bodyInFile ? RESOURCE_FIELDS_FILE_CONTEXT : RESOURCE_FIELDS_CONTEXT ), m_locksInDb, "resource", resourceUser, m_sqlService, m_resourceStore); // support for SAK-12874
public Edit putResource(String id, Object[] others) { // create one with just the id, and perhaps some other fields as well Entity entry = m_user.newResource(null, id, others); // form the XML and SQL for the insert Document doc = StorageUtils.createDocument(); entry.toXml(doc, new Stack()); String xml = StorageUtils.writeDocumentToString(doc); String statement = // singleStorageSql. "insert into " + m_resourceTableName + insertFields(m_resourceTableIdField, m_resourceTableOtherFields, "XML") + " values ( ?, " + valuesParams(m_resourceTableOtherFields) + " ? )"; Object[] flds = m_user.storageFields(entry); if (flds == null) flds = new Object[0]; Object[] fields = new Object[flds.length + 2]; System.arraycopy(flds, 0, fields, 1, flds.length); fields[0] = caseId(entry.getId()); fields[fields.length - 1] = xml; // process the insert boolean ok = m_sql.dbWrite(statement, fields); // if this failed, assume a key conflict (i.e. id in use) if (!ok) return null; // now get a lock on the record for edit Edit edit = editResource(id); if (edit == null) { log.warn("putResource(): didn't get a lock!"); return null; } return edit; }
String xml = StorageUtils.writeDocumentToString(doc); String statement = "insert into " + m_resourceTableName + insertDeleteFields(m_resourceTableIdField, m_resourceTableOtherFields, "RESOURCE_UUID", "DELETE_DATE", "DELETE_USERID", "XML") + " values ( ?, " + valuesParams(m_resourceTableOtherFields) + " ? ,? ,? ,?)"; Object[] fields = new Object[flds.length + 5]; System.arraycopy(flds, 0, fields, 1, flds.length); fields[0] = caseId(entry.getId()); Edit edit = editResource(id); if (edit == null)
+ StorageUtils.escapeSql(caseId(id)) + "' )" + " for update nowait"; StringBuilder result = new StringBuilder(); Connection lock = m_sql.dbReadLock(statement, result); Entity entry = readResource(result.toString()); edit = m_user.newResourceEdit(null, entry); Entity entry = getResource(id); if (entry == null) return null; fields[1] = internalRecordId(caseId(id)); fields[2] = TimeService.newTime(); fields[3] = sessionId; Entity entry = getResource(id); if (entry == null) return null;
public AssignmentSubmissionEdit put(String id, String assignmentId, String submitterId, String submitTime, String submitted, String graded) { // pack the context in an array Object[] others = new Object[5]; others[0] = assignmentId; others[1] = submitterId; others[2] = submitTime; others[3] = submitted; others[4] = graded; return (AssignmentSubmissionEdit) super.putResource(id, others); }
public void remove(PreferencesEdit edit) { super.removeResource(edit); } }
public boolean check(String id) { return super.checkResource(id); }
public void commit(AliasEdit edit) { super.commitResource(edit); }
public boolean isEmpty() { // count int count = countAllResources(); return (count == 0); }