I am working on an android app with java and i use firestore database i have a collections called user location who is structured like in photo :
db->RootCollection->document->subCollection->document->subColections->object
my problem is that when a user change his location or a new user come in a location who is alredy exist (other user have same location) it create a new document (like in "oran, algerie"). I wanted to use option.merge when I add a new user and update the documents but the problem is that I cant retrieve all documents of the root collection I used the normal way:
db.("Users Locations").get()...
It return null. I tried to use the collectionGroup method:
mDb.collectionGroup("User Locations").get()...
It returns already null
If I correctly understand your problem, you need to use a CollectionGroup query on the User List collections:
mDb.collectionGroup("User List").get()...
As a matter of fact, there is no documents in the Users Locations collection: As we can see in your screenshot, these "documents" are displayed with an italic font in the Firebase console: this is because these documents are only present (in the console) as "container" of one or more sub-collection but they are not "genuine" documents.
Related
I am trying to get the modified content after the given time from google sheets. Nowhere I can found the api to get the data. What i can see is getting modified date alone from the drive Api. How can I get the data using Drive or Sheets Api? Give me the suggestions if Possible
Google Drive keeps a track of revision history of files that are contained on it. There is however, no way to obtain the revisions from a request alone.
Google allows for you to receive email notifications whenever a user makes an edit to your sheet, which you can set up by completing the following steps:
In the Spreadsheet's web view, click Tools -> Notification rules...
Under Notify me at myemail#address.ext when... select Any changes are made
Under Notify me with... select Email - right away
Click Save.
You should also be aware that you will not get a notification for edits made to the sheet by you - notifications are only received when another user edits the sheet. Whenever you get an email notification, you will receive a link to view the changes to the spreadsheet in the form of a read-only web view link.
You can work around this programatically, though there isn't one right way and it can be quite complicated. You can use the Revisions: list method of the Drive REST API to get the information about the user that made an edit, as well as a list of links which you can use to export that revision of the sheet to another MIME Type, as shown below in the request response.
Requesting:
GET https://www.googleapis.com/drive/v3/files/SPREADSHEET_ID/revisions
with revisions/exportLinks,revisions/lastModifyingUser/emailAddress as the fields field and replacing SPREADSHEET_ID with the ID of the spreadsheet will give you a 200 response:
{
"revisions": [
{
"lastModifyingUser": {
"emailAddress": "username#domain.ext"
},
"exportLinks": {
"application/x-vnd.oasis.opendocument.spreadsheet": "https://docs.google.com/spreadsheets/export?id=SPREADSHEET_ID&revision=revisionNumber&exportFormat=ods",
"text/tab-separated-values": "https://docs.google.com/spreadsheets/export?id=SPREADSHEET_ID&revision=revisionNumber&exportFormat=tsv",
"application/pdf": "https://docs.google.com/spreadsheets/export?id=SPREADSHEET_ID&revision=revisionNumber&exportFormat=pdf",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "https://docs.google.com/spreadsheets/export?id=SPREADSHEET_ID&revision=revisionNumber&exportFormat=xlsx",
"text/csv": "https://docs.google.com/spreadsheets/export?id=SPREADSHEET_ID&revision=revisionNumber&exportFormat=csv",
"application/zip": "https://docs.google.com/spreadsheets/export?id=SPREADSHEET_ID&revision=revisionNumber&exportFormat=zip",
"application/vnd.oasis.opendocument.spreadsheet": "https://docs.google.com/spreadsheets/export?id=SPREADSHEET_ID&revision=1&exportFormat=ods"
}
}
]
}
With the links to individual changes, you can fetch and compare the different versions of the Sheet using Apps Script, and output A1 notation of the cells that have different values between versions. This, with the email address from the original Revisions: list request, is enough to compile a file or a log containing.
You can put this into a simple onEdit() trigger bound to the sheet will allow you to automatically get the changes each time a user edits the sheet.
I've been making a tool to create dummy documents on Lotus Notes using the Java API.
So far I've been successful creating the documents using the NotesFactory create session method
NotesFactory.createSession(serverUrl, username, password);
And later creating the document using the Database class createDocument() method.
However, regardless of the user I put when I'm creating the session, the created document always has "Administrator" as the document originator.
Is there any way to override this behavior?
EDIT 8/24/2016:
Here is the code I'm using to create documents
Session session = NotesFactory.createSession(serverUrl, username, password);
Database db = session.getDatabase(session.getServerName(), "docLibra.nsf");
Document doc = db.createDocument();
// Set document properties
doc.replaceItemValue("Subject", "Sample Subject");
RichTextItem bodyItem = doc.createRichTextItem("Body");
bodyItem.appendText("Sample content");
doc.save();
doc.recycle();
db.recycle();
session.recycle();
I created several users (i.e. user1, user2) and I'm able to get a Session with the credentials of those, but when the document is saved. The originator is set as Administrator, even tough the Administrator credentials are nowhere on the code and the code is executed on an external computer.
Well, that means that your code is running under the identity of someone name "Administrator". That could be you, or the person who re-signed the code before allowing to run on the server. Get in touch with that person.
Now, what are you trying to do ? Impersonnating someone else ? On Domino ? No way.
Writing code that any user can run ? There are many ways.
Generating documents that can be read, or maybe modified, by all users or by a definite subset of them ? There are plenty of ways. Look for Access Control List, for the concept of Role, and for the special types of fields Author and Reader.
I have created a workflow template having some manual activities. Performers of these activities are groups and any user from these groups can attach some documents to the workflow when they get respective work item in their inbox. Is there any way to differentiate who has attached what document in which activity?
IDfCollection listAttachment = wf.getAttachments() provides me all the attachments in the workflow. Is there any way to differentiate which user has attached which document in which activity?
Since you wrote DFC code I suppose you want this via code:
IDfCollection listAttachment = wf.getAttachments();
while(listAttachment.next()){
((IDfWorkflowAttachment)listAttachment).getCreatorName(); // return who has add it
((IDfWorkflowAttachment)listAttachment).getCreationDate(); // return when was added
}
Unfortunately you can find out in which activity it was added.
Check this link for IDfWorkflowAttachment javadocs.
I have my webpage opened using RFT. In that page, I have a link I want to click.
For that I am using
objMap.ClickTabLink(objMap.document_eBenefitsHome(), "Upload Documentation", "Upload Documentation");
The current page link name is "Upload Documentation"
I know that objMap.document_eBenefitsHome() takes it back to the initial page, what can I use in that place which uses the "current page opened" ?
Many thanks in advance.
There are some alternatives that could solve your problem:
Open the Test Object Map; select from the map the object that represents the document document_eBenefitsHome; modify the .url property using regular expression, so that the URLs of the two pages you cited in your question match the regex.
Find dinamically the document object using the find method. Once the page containing the link you want to click was fully loaded, try to use this code to find the document: find(atDescendant(".class", "Html.HtmlDocument"), false). The false boolean value allow the find method to search also among object that are not previously recorded.
I'm writing a simple standalone Java class that uses Lotus Domino's NCSO JAR for remote-connecting to a Domino server.
I'm establishing a session, getting access to a database and then to a view:
Session session = NotesFactory.createSession("host", "user", "password");
Database db = session.getDatabase(null, "MyDB.nsf");
View view = db.getView("MyView");
Now, I'm printing the number of entries in the view:
int count = view.getEntryCount();
I get a nonzero number (let's say 1500).
However, I can't seem to load any document by key. For example, for any letter in the alphabet, I'm getting an empty document collection with this call:
System.err.println(view.getAllDocumentsByKey(letter, false));
When I try to load a document by key, when I know that the key exists in the view, I get null.
Document document = view.getDocumentByKey("DocKey"); // Equals null even though
// I know that 'DocKey' is
// the key of an existing
// document within the view.
The very same code is said to be working (although I didn't check it) when using local Notes calls (using Notes.jar).
What am I missing?
EDIT
I just noticed that session.getNotesVersion() returns version 8.5.2. The NCSO.jar file that I'm currently using doesn't appear to have a few methods that were added with Notes 8. Therefore, there is a possibility that the NCSO.jar file I use belongs to an earlier version of Notes than the one I'm trying to communicate with. Could that be the reason?
If the same code is working locally, then that should rule out the possibility that the first column of the view isn't sorted. Assuming that, then the most likely issue is that the documents are protected by ReaderNames fields and the identity that you are using for authenticating your session does not have access to the documents.
Assuming I understand you right, you want to get all documents where the first (lookup) column of the view contains anything that starts with a specific letter?
E.g. you send "A" to veiw.getAllDocumentsByKey() and expect a collection that contains "Apple", "Alpha", "Amoeba" and "Apricot" to be returned?
I would modify the column in the view to only hold the first letter:
#Left(MyField;1)
Then it would be easy to perform the lookup and see if you get the correct result.