123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- import com.cognos.developer.schemas.bibus._3.BaseClass;
- import com.cognos.developer.schemas.bibus._3.OrderEnum;
- import com.cognos.developer.schemas.bibus._3.PropEnum;
- import com.cognos.developer.schemas.bibus._3.QueryOptions;
- import com.cognos.developer.schemas.bibus._3.SearchPathMultipleObject;
- import com.cognos.developer.schemas.bibus._3.Sort;
- public class ViewPackages
- {
-
- public String viewPackages(CRNConnect connection)
- {
- String output = new String();
- if (connection.getCMService() != null)
- {
- BaseClass bc[] = this.getPackages(connection);
-
-
- if (bc != null)
- {
- for (int i = 0; i < bc.length; i++)
- {
- System.out.println(
- " " + bc[i].getDefaultName().getValue());
- System.out.println(
- " " + bc[i].getSearchPath().getValue() + "\n");
- output =
- output.concat(
- " " + bc[i].getDefaultName().getValue() + "\n");
- output =
- output.concat(
- " "
- + bc[i].getSearchPath().getValue()
- + "\n\n");
- }
- }
- else
- {
- output =
- output.concat(
- "There are currently no published packages to display.");
- System.out.println(
- "\n\nThere are currently no published packages to display..");
- }
- }
- return output;
- }
- public BaseClass[] getPackages(CRNConnect connection)
- {
- PropEnum props[] =
- new PropEnum[] { PropEnum.searchPath, PropEnum.defaultName };
- if (connection.getCMService() != null)
- {
- Sort s[] = { new Sort()};
- s[0].setOrder(OrderEnum.ascending);
- s[0].setPropName(PropEnum.defaultName);
- try
- {
-
- BaseClass bc[] =
- connection.getCMService().query(
- new SearchPathMultipleObject("/content//package"),
- props,
- s,
- new QueryOptions());
- if (bc != null)
- {
- if (bc.length > 0)
- {
- return bc;
- }
- }
- else
- {
- System.out.println(
- "\n\nError occurred in function viewPackages.");
- }
- }
- catch (Exception e)
- {
- System.out.println(e.getMessage());
- }
- }
- else
- {
- System.out.println(
- "\n\nInvalid parameter passed to function viewPackages.");
- }
- return null;
- }
- }
|