I am using the IBM JZOS API to access PDS members and now I need some information about the members. There is the class PdsDirectory.MemberInfo.Statistics, so that I can create a PdsDirectory, iterate over it and get the Statistics of each member (e.g. modification date, last editing user,...) like so:
PdsDirectory dir = new PdsDirectory(args[0]);
for (Iterator iter = dir.iterator(); iter.hasNext(); ) {
PdsDirectory.MemberInfo info = (PdsDirectory.MemberInfo)iter.next();
System.out.println(info);
}
But I need those statistics only for one single file. Is there a way with
ZFile zFile = new ZFile("//DD:INPUT", "rb,type=record,noseek");
or creating a reader, to access those information? Or is the only way to create the directory and find the file I need?
The only information you can get for a data set is from the catalog. You can use the JZOS CatalogSearch class to do that from Java. There is a sample on github.
PDS member statistics are usually only present if you edit members using ISPF. ISPF stores statistics in the PDS directory user data field. Any application can use this field for whatever they like but it's usually only used by ISPF. There are no such statistics in the catalog. There is no last edited userid or record count etc. There is creation data, last referenced date and lots of other useful metadata. You may not find what you are looking for but most of the interesting stuff is in the Format 1 DSCB.
Related
I have to create a BroadcastStream to be able to change the properties on the database and see the application of these properties in real time on the application.
The problems I have are 2:
1) When I read the database I need to have all the lines at the same time, via resultSet, HashMap or anything that can contain a structure of the type key-value, as some properties depend on other properties, so I cannot process them individually.
The structure of my MapStateDescriptor will be:
//String = topic name
//TopicProperties = object containing all the topic properties
MapStateDescriptor<String, TopicProperties> propertiesStateDescriptor = new MapStateDescriptor<String, TopicProperties>("properties",
BasicTypeInfo.STRING_TYPE_INFO,
BasicTypeInfo.of(new TypeHint<TopicProperties>() {}));
BroadcastStream<Row> propertiesBroadcastStream = env.createInput(JDBCInputFormat)
.map(new TopicPropertiesDbMapper()
.broadcast(propertiesStateDescriptor);
TopicPropertiesDbMapper converts what JDBCInputFormat returns to the String structure, TopicProperties.
The problem is that it is processed one row at a time, but I need to process them all together, as mentioned above.
2) Repeat the reading of the properties and update the BroadcastStream once an hour.
I specify that I have already made a version of the one above, but with the reading of the properties from file, through:
readFile (FileInputFormat, path file, FileProcessingMode, milliseconds of interval for re-reading)
it is working and I solved the two problems listed above for the database case with:
1) Set "unsplittable" flag of the FileInputFormat class to "true";
2) FileProcessingMode.PROCESS_CONTINUOUSLY.
First of all, I want to clarify that my experience working with wikidata is very limited, so feel free to correct if any of my terminology is wrong.
I've been playing with wikidata toolkit, more specifically their wdtk-wikibaseapi. This allows you to get entity information and their different properties as such:
WikibaseDataFetcher wbdf = WikibaseDataFetcher.getWikidataDataFetcher();
EntityDocument q42 = wbdf.getEntityDocument("Q42");
List<StatementGroup> groups = ((ItemDocument) q42).getStatementGroups();
for(StatementGroup g : groups) {
List<Statement> statements = g.getStatements();
for(Statement s : statements) {
System.out.println(s.getMainSnak().getPropertyId().getId());
System.out.println(s.getValue());
}
}
The above would get me the entity Douglas Adams and all the properties under his site: https://www.wikidata.org/wiki/Q42
Now wikidata toolkit has the ability to load and process dump files, meaning you can download a dump to your local and process it using their DumpProcessingController class under the wdtk-dumpfiles library. I'm just not sure what is meant by processing.
Can anyone explain me what does processing mean in this context?
Can you do something similar to what was done using wdtk-wikibaseapi in the example above but using a local dump file and wdtk-dumpfiles i.e. get an entity and it's respective properties? I don't want to get the info from online source, only from the dump (offline).
If this is not possible using wikidata-toolkit, could you point me to somewhere that can get me started on getting entities and their properties from a dump file for wikidata please? I am using Java.
How can I access the history of a Workflow instance using the Adobe AEM api for java?
Say I've created one workflow which contains 3 workitems. I want to access the details associated with all the workitems for that workflow (E.g.Status,Title,User,StartTime,EndTime,Action,Comment).
Take a look at the following classes.
com.day.cq.workflow.WorkflowSession
https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/workflow/WorkflowService.html
and
com.day.cq.workflow.WorkflowSession
https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/workflow/WorkflowSession.html
If you want to see a code example on how to filter on a particular workflow instance, you can find a lot of documents in the following file of your AEM instance:
/crx/de/index.jsp#/libs/cq/workflow/components/console/archive/json.jsp
In summary, you will need to create a workflow service and fetch the model to iterate over it's instances to apply relevant filters.
Alternatively, you can write a query to get data from /var/eventing/jobs node which is essentially a workflow instance data store.
This might work for you
List<HistoryItem> history = workflowSession.getHistory(workItem.getWorkflow());
HistoryItem current;
if (history.size() > 0) {
HistoryItem current = history.get(history.size() - 1);
do {
current = current.getPreviousHistoryItem();
} while (current != null);
}
In my application i have a set of file which contains some information.Now what i have to do i have to process the files and among those files which are duplicate i have to skip them so to do that i have used file CRC to check which files are processed and which are not,so now in the case of duplicate checking i have to store the file CRC to some where because when today's processing is over then i will have to process the file again tomorrow.Then if some file are duplicate of today those should be skipped. so now what i have done in my code is..
filesSize += fileInf.srcFileSize;
// if file if already polled and under processing or in execution queue
if (filesInQueue.get(fileInf.srcFileCRC) != null) {
System.out.println("Skipping queued file: " + fileInf.srcFileName);
ifCRCExist.add(fileInf.srcFileCRC);
fileInf.srcFileCRC, is the required fileCRC which i have added to the list now i have store the list non persistently some where which i can use to check the record later..I think i am clear now..Please any one help me..
Each instance in Java is transient by nature. Are you in search of a Singleton? You may provide the ArrayList as a static field of some Class. For example:
public class InMemoryStore {
public static final List<String> MY_SINGLETON_LIST;
static {
MY_SINGLETON_LIST = ...
}
}
Or you may do it by creating a bean with Spring, for example.
If you want a non persistent storage means not in DB or XML then make a class
and create a static list member. Now you can use it as many times by initializing only once. Just like Singleton pattern.
I'm trying o use method CopyIntoItems and add to uploaded file owner property. Field Owner should be type USER. am setting up it like this:
FieldInformation fieldInformationUser = new FieldInformation();
fieldInformationUser.setDisplayName("Owner");
fieldInformationUser.setInternalName("Owner");
fieldInformationUser.setType(FieldType.USER);
fieldInformationUser.setValue("domain//username");
I'm using this library: Sharepoint library link
If TEXT type field is updated in presented above way - it passes, but does't update field at SharePoint server. Problem occurs when i'm using type USER - server returns
Invalid data has been used to update the list item. The field you are trying to update may be read only.
WSDL specifies fieldType.USER as a string field. he question is, how this string should look like... Anyone knows?
You must make sure that the user exists in the users table in SharePoint. It may be that it exists in AD but it hasn't been added to SharePoint yet.
If it were C#, then you would first issue the EnsureUser command:
//C# CSOM code
SPUser user=web.EnsureUser(userName);
listItem[fieldName] = user;
You should search for a similar method in the library you're using