本文整理汇总了Java中com.microsoft.azure.documentdb.DocumentClientException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentClientException.printStackTrace方法的具体用法?Java DocumentClientException.printStackTrace怎么用?Java DocumentClientException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.microsoft.azure.documentdb.DocumentClientException
的用法示例。
在下文中一共展示了DocumentClientException.printStackTrace方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTodoItem
import com.microsoft.azure.documentdb.DocumentClientException; //导入方法依赖的package包/类
@Override
public TodoItem createTodoItem(TodoItem todoItem) {
// Serialize the TodoItem as a JSON Document.
Document todoItemDocument = new Document(gson.toJson(todoItem));
// Annotate the document as a TodoItem for retrieval (so that we can
// store multiple entity types in the collection).
todoItemDocument.set("entityType", "todoItem");
try {
// Persist the document using the DocumentClient.
todoItemDocument = documentClient.createDocument(
getTodoCollection().getSelfLink(), todoItemDocument, null,
false).getResource();
} catch (DocumentClientException e) {
e.printStackTrace();
return null;
}
return gson.fromJson(todoItemDocument.toString(), TodoItem.class);
}
开发者ID:pivotal-partner-solution-architecture,项目名称:azure-service-broker-client,代码行数:22,代码来源:DocDbDao.java
示例2: updateTodoItem
import com.microsoft.azure.documentdb.DocumentClientException; //导入方法依赖的package包/类
@Override
public TodoItem updateTodoItem(String id, boolean isComplete) {
// Retrieve the document from the database
Document todoItemDocument = getDocumentById(id);
// You can update the document as a JSON document directly.
// For more complex operations - you could de-serialize the document in
// to a POJO, update the POJO, and then re-serialize the POJO back in to
// a document.
todoItemDocument.set("complete", isComplete);
try {
// Persist/replace the updated document.
todoItemDocument = documentClient.replaceDocument(todoItemDocument,
null).getResource();
} catch (DocumentClientException e) {
e.printStackTrace();
return null;
}
return gson.fromJson(todoItemDocument.toString(), TodoItem.class);
}
开发者ID:pivotal-partner-solution-architecture,项目名称:azure-service-broker-client,代码行数:23,代码来源:DocDbDao.java
示例3: deleteTodoItem
import com.microsoft.azure.documentdb.DocumentClientException; //导入方法依赖的package包/类
@Override
public boolean deleteTodoItem(String id) {
// DocumentDB refers to documents by self link rather than id.
// Query for the document to retrieve the self link.
Document todoItemDocument = getDocumentById(id);
try {
// Delete the document by self link.
documentClient.deleteDocument(todoItemDocument.getSelfLink(), null);
} catch (DocumentClientException e) {
e.printStackTrace();
return false;
}
return true;
}
开发者ID:pivotal-partner-solution-architecture,项目名称:azure-service-broker-client,代码行数:18,代码来源:DocDbDao.java
示例4: createTodoItem
import com.microsoft.azure.documentdb.DocumentClientException; //导入方法依赖的package包/类
@Override
public TodoItem createTodoItem(TodoItem todoItem) {
// Serialize the TodoItem as a JSON Document.
Document todoItemDocument = new Document(gson.toJson(todoItem));
// Annotate the document as a TodoItem for retrieval (so that we can
// store multiple entity types in the collection).
todoItemDocument.set("entityType", "todoItem");
try {
// Persist the document using the DocumentClient.
todoItemDocument = documentClient.createDocument(
getTodoCollection().getSelfLink(), todoItemDocument, null,
false).getResource();
} catch (DocumentClientException e) {
e.printStackTrace();
return null;
}
return gson.fromJson(todoItemDocument.toString(), TodoItem.class);
}
示例5: updateTodoItem
import com.microsoft.azure.documentdb.DocumentClientException; //导入方法依赖的package包/类
@Override
public TodoItem updateTodoItem(String id, boolean isComplete) {
// Retrieve the document from the database
Document todoItemDocument = getDocumentById(id);
// You can update the document as a JSON document directly.
// For more complex operations - you could de-serialize the document in
// to a POJO, update the POJO, and then re-serialize the POJO back in to
// a document.
todoItemDocument.set("complete", isComplete);
try {
// Persist/replace the updated document.
todoItemDocument = documentClient.replaceDocument(todoItemDocument,
null).getResource();
} catch (DocumentClientException e) {
e.printStackTrace();
return null;
}
return gson.fromJson(todoItemDocument.toString(), TodoItem.class);
}
示例6: deleteTodoItem
import com.microsoft.azure.documentdb.DocumentClientException; //导入方法依赖的package包/类
@Override
public boolean deleteTodoItem(String id) {
// DocumentDB refers to documents by self link rather than id.
// Query for the document to retrieve the self link.
Document todoItemDocument = getDocumentById(id);
try {
// Delete the document by self link.
documentClient.deleteDocument(todoItemDocument.getSelfLink(), null);
} catch (DocumentClientException e) {
e.printStackTrace();
return false;
}
return true;
}
示例7: getTodoDatabase
import com.microsoft.azure.documentdb.DocumentClientException; //导入方法依赖的package包/类
private Database getTodoDatabase() {
if (databaseCache == null) {
// Get the database if it exists
List<Database> databaseList = documentClient
.queryDatabases(
"SELECT * FROM root r WHERE r.id='"
+ properties.getDatabaseId()
+ "'", null).getQueryIterable().toList();
if (databaseList.size() > 0) {
// Cache the database object so we won't have to query for it
// later to retrieve the selfLink.
databaseCache = databaseList.get(0);
} else {
// Create the database if it doesn't exist.
try {
Database databaseDefinition = new Database();
databaseDefinition.setId(properties
.getDatabaseId());
databaseCache = documentClient.createDatabase(
databaseDefinition, null).getResource();
} catch (DocumentClientException e) {
// TODO: Something has gone terribly wrong - the app wasn't
// able to query or create the collection.
// Verify your connection, endpoint, and key.
e.printStackTrace();
}
}
}
return databaseCache;
}
开发者ID:pivotal-partner-solution-architecture,项目名称:azure-service-broker-client,代码行数:35,代码来源:DocDbDao.java
示例8: getTodoCollection
import com.microsoft.azure.documentdb.DocumentClientException; //导入方法依赖的package包/类
private DocumentCollection getTodoCollection() {
if (collectionCache == null) {
// Get the collection if it exists.
List<DocumentCollection> collectionList = documentClient
.queryCollections(
getTodoDatabase().getSelfLink(),
"SELECT * FROM root r WHERE r.id='"
+ properties.getResourceId()
+ "'", null).getQueryIterable().toList();
if (collectionList.size() > 0) {
// Cache the collection object so we won't have to query for it
// later to retrieve the selfLink.
collectionCache = collectionList.get(0);
} else {
// Create the collection if it doesn't exist.
try {
DocumentCollection collectionDefinition = new DocumentCollection();
collectionDefinition.setId(properties
.getResourceId());
collectionCache = documentClient.createCollection(
getTodoDatabase().getSelfLink(),
collectionDefinition, null).getResource();
} catch (DocumentClientException e) {
// TODO: Something has gone terribly wrong - the app wasn't
// able to query or create the collection.
// Verify your connection, endpoint, and key.
e.printStackTrace();
}
}
}
return collectionCache;
}
开发者ID:pivotal-partner-solution-architecture,项目名称:azure-service-broker-client,代码行数:38,代码来源:DocDbDao.java
示例9: getTodoDatabase
import com.microsoft.azure.documentdb.DocumentClientException; //导入方法依赖的package包/类
private Database getTodoDatabase() {
if (databaseCache == null) {
// Get the database if it exists
List<Database> databaseList = documentClient
.queryDatabases(
"SELECT * FROM root r WHERE r.id='" + DATABASE_ID
+ "'", null).getQueryIterable().toList();
if (databaseList.size() > 0) {
// Cache the database object so we won't have to query for it
// later to retrieve the selfLink.
databaseCache = databaseList.get(0);
} else {
// Create the database if it doesn't exist.
try {
Database databaseDefinition = new Database();
databaseDefinition.setId(DATABASE_ID);
databaseCache = documentClient.createDatabase(
databaseDefinition, null).getResource();
} catch (DocumentClientException e) {
// TODO: Something has gone terribly wrong - the app wasn't
// able to query or create the collection.
// Verify your connection, endpoint, and key.
e.printStackTrace();
}
}
}
return databaseCache;
}
示例10: getTodoCollection
import com.microsoft.azure.documentdb.DocumentClientException; //导入方法依赖的package包/类
private DocumentCollection getTodoCollection() {
if (collectionCache == null) {
// Get the collection if it exists.
List<DocumentCollection> collectionList = documentClient
.queryCollections(
getTodoDatabase().getSelfLink(),
"SELECT * FROM root r WHERE r.id='" + COLLECTION_ID
+ "'", null).getQueryIterable().toList();
if (collectionList.size() > 0) {
// Cache the collection object so we won't have to query for it
// later to retrieve the selfLink.
collectionCache = collectionList.get(0);
} else {
// Create the collection if it doesn't exist.
try {
DocumentCollection collectionDefinition = new DocumentCollection();
collectionDefinition.setId(COLLECTION_ID);
collectionCache = documentClient.createCollection(
getTodoDatabase().getSelfLink(),
collectionDefinition, null).getResource();
} catch (DocumentClientException e) {
// TODO: Something has gone terribly wrong - the app wasn't
// able to query or create the collection.
// Verify your connection, endpoint, and key.
e.printStackTrace();
}
}
}
return collectionCache;
}