Extracting Requirements folder Tree structure from QC using API - hp-quality-center

I am trying to extract requirements from QC Requirement module. i could extract all requirements of a QC project but i would like to extract selected requirements only. So i need to give folder path and extract requirements accordingly.
Currently i use ReqFactory to extract Reqs from QC. Could you please help me or give me idea to extract requirmeents from selected folder path.
I tried Req Path and father id, but still it does not fulfill my need as some may have multiple sub folders under parent folders.

I assume you like to get all the child requirements of a requirement using the OTA API? The only solution I can offer is a bit clumsy. First you have to get the requirement where you want to start, e.g. "Requirements\Projects\ProjectX". How to achieve that is described in the OTA API Reference as an example of the ReqFactory object ("Find a specified requirement in a specified folder"). Or it is posted in this forum. If you know the ID of the start-requirement you can simply get the requirement with req_factory.Item(id).
When you have your requirement where you want to start, you can use the Find-method of the ReqFactory to get all its children, resp. all Requirement objects starting with the same path as the start-requirement. Here is an example-method in Ruby:
def list_all_child_requirements(start_req)
req_factory = #tdc.ReqFactory
req_path_strange_format = start_req.Field("RQ_REQ_PATH")
child_req_list = req_factory.Find(start_req.ID, "RQ_REQ_PATH", req_path_strange_format, 8)
child_req_list.each do |list_req|
puts list_req
end
end
The req_path_strange_format contains a String in the strange Quality Center notation like "AAAAAB". The Find-method starts from the start-requirement and searches all requirements which path starts with the same path as the path of the start-requirement. The parameter 8 means "starts with pattern" (described in the API Reference, Enum tagTDAPI_REQMODE). I just don't know how to access the Enum using Ruby, thats why the magic 8 is used... The Find-method returns a list with format "ID,NAME". From there it should be no problem to extract the requirements.
Doing the same directly in QC with a VAPI-XP-TEST and VB looks like that:
TDOutput.Clear
Dim reqPathStrangeFormat
Set reqF = tdConnection.ReqFactory
Set startReq = reqF.Item(14) ' ID of parent requirement
reqPathStrangeFormat = startReq.Field("RQ_REQ_PATH")
TDOutput.Print reqPathStrangeFormat
Set childReqList = reqF.Find(startReq.ID, "RQ_REQ_PATH", reqPathStrangeFormat, TDREQMODE_FIND_START_WITH)
For Each childReq in childReqList
TDOutput.Print childReq
Next
This code first prints some strange string "AAAAAB" or something similiar, then a list with "ID,NAME" of the requirements.

Related

Searching a DICOM server for metadata

I want to search the DICOM server. if for example user enters a patient id to serach, then my app populate a table with all the metadata relating to that id , such as id, name, accession number e.tc. if tha study id exists in the dicom server, How can this be done using dcm4chee kit. –
You can use dcm4che3 tool dcm4che-tool-findscu. This code shows you how to do a C-FIND against a PACS (or whatever implementing C-FIND as SCP).
FindSCU.java is quite clear, take a while and don't get missed through Apache Commons CLI code to understand input from console. Most of CLI management code is not in this project, but you can find it in the dcm4che3 tool dcm4che-tool-common project, org.dcm4che3.tool.common.CLIUtils.java class.
Take into account following considerations:
Specify the search level of Query/Retrieve. You can use several search levels in order to match attributes into a PACS. If you look at lines 260:265 of FindSCU.java, you will see that you can manage four different levels: PATIENT|STUDY|SERIES|IMAGE.This will instruct C-FIND SCP how to search matching attributes.
Tell C-FIND SCP what attributes do you want to retrieve. If you want to search studies to be retrieved later, you must ask for 0020, 000D Study​InstanceUID tag.
Of course, add all attributes that you want to populate your table.
Use retrieved 0020, 000D Study​InstanceUID tag value to do the C-GET/C-MOVE operation.
You can see how to configure attribute keys to do C-FIND SCU into CLIUtils.java class that is part of dcm4che3 tool dcm4che-tool-common project. See CLIUtils.addAttributes(Attributes, String[]).
Hope it helps!
Edit
Due to you comment you are using dcm4che2 and that you already have a DicomObject with the search result, if you want to obtain metadata from this DicomObject you must parse it before, using DicomInputStream, and then you can use getXXXX(Tag) from BasiDicomObject, something like this:
DicomObject dcmObj;
DicomInputStream dis = null;
dis = new DicomInputStream(file);
dcmObj = dis.readDicomObject();
String someVar = dcmObj.getString(Tag.SeriesInstanceUID);
Keep in mind, some attributes are inside sequences, and thus you have to search it before.
You can also take a look into dcm4che-tool-dcm2txt, you will see Dcm2Txt.java and in lines 170 and so on, there is how to parse whole dicom object.
If you need some general description about the DICOM network protocol, you could read the "Understanding DICOM with Orthanc" guide, and more specifically the section about C-Find.

premake5 adding new complex fields

I am trying to add a new premake5 field in my premake5 script but am having trouble understanding how to specify the field.kind .
I want to add a field that contains a list of (path, string ) pairs but can't work out how to specify the kind spec .
The documentation and examples are not particularly clear.
This is how I have registered my new field
premake.api.register( {
name = "mypathmappings",
scope = "config",
kind = "list:path:string", or "list:keyed:path:string"
}
)
and inside of a config scope I declare the field item like so
project myproject
mypathmappings { ["path/to/file1"] = "stringvalue1", ["path/to/file2"] = "stringvalue2"}
However when it comes to processing time I don't get what I'm expecting in the field:
function processpathmappings(cfg)
local pathmappings = cfg.mypathmappings
for path, value in pairs(pathmappings) do
--do something with the path and value but
--value is not a string as expected
end
end
Can someone explain how the complex kinds can be built up correctly from the field kinds registered in api.lua?
I get that "list:integer" specifies a list of integers but don't know how the "keyed" element works for example.
Right now, it is not possible to control the "kind" of the keys in a keyed value. The best you will be able to get with the current system is kind="keyed:string", which should give you the values (the strings) that you want, but the paths will not be processed by Premake (made absolute, etc.)
If it is feasible, you might want to flip it around to kind="keyed:path" and set the values like this:
mypathmappings { ["stringvalue1"] = "path/to/file1" }
But that relies on your string values being unique within a map.
In theory, Premake's field API could be extended to support kinds of keys; feel free to open a ticket or submit a pull request.

Attempting to deploy a binary to a location where a different binary is already stored

When I am publishing my page from tridio 2009, I am getting the error below:
Destination with name 'FTP=[Host=servername, Location=\RET, Password=******, Port=21, UserName=retftp]' reported the following failure:
A processing error occurred processing a transport package Attempting to deploy a binary [Binary id=tcm:553-974947-16 variantId= sg= path=/Images/image_thumbnail01.jpg] to a location where a different binary is already stored Existing binary: tcd:pub[553]/binarymeta[974950]
Below is my code snippet
Component bigImageComp = th.GetComponentValue("bigimage", imageMetaFields);
string bigImagefileName = string.Empty;
string bigImagePath = string.Empty;
bigImagefileName = bigImageComp.BinaryContent.Filename;
bigImagePath = m_Engine.AddBinary(bigImageComp.Id, TcmUri.UriNull, null, bigImageComp.BinaryContent.GetByteArray(), Path.GetFileName(bigImagefileName));
imageBigNode.InnerText = bigImagePath;
Please suggest
Chris Summers addressed this on his blog. Have a read of the article - http://www.urbancherry.net/blogengine/post/2010/02/09/Unique-binary-filenames-for-SDL-Tridion-Multimedia-Components.aspx
Generally in Tridion Content Delivery we can only keep one version of a Component. To get multiple "versions" of a MMC we have to publish MMC as variants. By this way we can produce as many variants as we need via templating.
You can refer below article for more detail:
http://yatb.mitza.net/2012/03/publishing-images-as-variants.html#!/2012/03/publishing-images-as-variants.html
When adding binaries you must ensure that the file and it's metadata is unique. If one of the values e.g. the filename appears to be the same but the rest of the metadata does not match, then deployment will fail.
In the given example (as Nuno points out) the binary 910 is trying to deploy over binary 703. The filename is the same but the binary is identified to be not the same (in the case a different ID from the same publication). For this example you will need to rename one of the binaries (either the file itself or change the path) and everything will be fine.
Other scenarios can be that the same image is used from two different templates and the template id is used as the varient ID. If this is the case it is the same image BUT the varient ID check fails so to avoid overwriting the same image the deployer fails it.
Often unpublishing can help, however, the image is only removed when ALL references to it are removed. So if it is used from more than one place there are more open references.
This is logical protection from the deployer. You would not want the wrong image replacing another and either upsetting the layout or potentially changing the content to another meeting (think advertising banner).
This is actual cause and reason for above problem (Something got from forum)

best practice for DB & File search with lucene.net in a asp.net web application

i have site where i need to develop site search functionality. the data may reside in database table or may in aspx page as static word. i search google and found that lucene.net may be appropriate for the site search functionality. but i never use lucene.net so i dont know how to create lucene.net index file. i want to develop 2 utility in my site like
1) one for create & update index file reading data from database table & physical aspx file.
2) utility which search multiple single or multiple keyword against index file.
i found a bit of code snippet which i just do not understand
string indexFileLocation = #"C:\Index";
string stopWordsLocation = #"C:\Stopwords.txt";
var directory = FSDirectory.Open(new DirectoryInfo(indexFileLocation));
Analyzer analyzer = new StandardAnalyzer(
Lucene.Net.Util.Version.LUCENE_29, new FileInfo(stopWordsLocation));
what is Lucene.Net.Util.Version.LUCENE_29 what is stopWordsLocation
how data need to store in Stopwords.txt
but have no concept to develop the above 2 utility. so please guide me how search my DB and as well as aspx files with lucene.net....i will be glad if some one discuss here with bit of sample code. thanks
Lucene.Net.Util.Version.LUCENE_29 just indicates the Lucene version your are using, you should always use the most up to date in new code. It is there for backward compatibility in case you upgrade your Lucene with a version that changes the StandardAnalyzer, but you dont want to re-index all your data.
The stopWordsLocation is the location of a file with your stop words, words you dont want to index.
IE: it, he, she, the, or, and etc...
Its a regular text file, each line should contain 1 stop word, and separate each line with a linebreak.
http://lucene.apache.org/core/old_versioned_docs/versions/3_0_1/api/all/org/apache/lucene/analysis/WordlistLoader.html#getWordSet(java.io.Reader)

Are there any test data generator tools which can be used with selenium/Nunit?

I was wondering if there was anything that provides test data for injecting into Nunit tests?
I'm sure I came across something recently that does this but I couldn't find it again.
Basically the idea is that I could use selenium and Nunit to create new customers within the system automatically.
So I could have selenium type in customer names generated from test generator (the < DataGenerator > is just an imaginary class):
e.g.
dim sFirstName as string = < DataGenerator >.GetRandomFirstName()
dim sLastName as string = < DataGenerator >.GetRandomLastName()
selenium.type("firstname_field",sFirstName)
selenium.type("lastname_field",sLastName )
I've already seen SQLDataGenerator from Redgate which has a cmd line wrapper class, but I was wondering if there was anything else.
Have you looked at PEX?
It looks for input and output parameters and can work with many unit testing frameworks including NUnit.
Depending on how your methods are organized, this could work to generate test data for your methods.
Take a look at the video here to see a demo.
You may also want to take a look at http://www.fakenamegenerator.com. This site has an API you can call or you can download a CSV file of up to 50,000 records that you can then access from your script. They provide quite a bit of basic demographic information including interrelations between the data (so no 6 foot tall, 180 lb 5 year olds, for example).

Resources