06-16-2017 4:10 PM - edited 02-03-2024 9:10 PM
Hi experts,
I'm in SAP BI 4.2 SP3 and I'm trying to do several things (using SDK), such as :
- Move a LCM Job from a folder to another one
- Schedule a LCM Job
- Maybe even modify a LCM Job or create a new one
Anyway, I found a very specific java class (com.businessobjects.lcm.job.IJob) in which I found a lot of very promising things but I have no clue about how to use it??? There is no documentation on it and I wonder if it's even possible to make that kind of things...
If you have any idea, please tell me 😃
I'd be very pleased to share my work to you if everything works fine.
Best regards
Unfortunalty, it doesn't work...
Here is a sample of code I just used :
As you can see, I can see the current value of CMS_NAME (but not the other properties). And if I try to change it, it doesn't change anything into the CMC.
I think the best way to change the destination of a LCM Job is to create a CMS object (but I really don't know how to do so...) and use the setDestCMS(CMS object) but there is actually no documentation on it...
Damn : I'm sure I'm not so far to find a way to make it but I'm stuck with this CMS object.
Best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please try this.
job.properties().setProperty(IDHelper.nameToID(JobConstants.LCM_JOB_DESTINATION_CMS_NAME), "destination_cms_name");
not tested code.
-Bharath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's almost done : I was able to schedule a job but now I would like to change the destination CMS using SDK.
I found, into the IJob type, the function setDestCMS which only accept CMS type.
So I tried to create a CMS using import com.businessobjects.lcm.core.CMS but I don't know how to instantiate. Have you any idea of how to make it?
Best regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. Create Enterprise Session using Java SDK:
IEnterpriseSession basicLogon() throws SDKException
{
ISessionMgr sessionManager = CrystalEnterprise.getSessionMgr();
IEnterpriseSession enterpriseSession = sessionManager.logon("username", "password", "<cms>:<port>", "secEnterprise");
return enterpriseSession;
}
2. Create LCM Job using Java SDK:
IJob create_LCM_Job (IEnterpriseSession enterpriseSession) throws SDKException
{
IInfoStore infostore = (IInfoStore) enterpriseSession.getService("InfoStore");
IInfoObjects newJobs = infostore.newInfoObjectCollection();
IJob newJob = (IJob) newJobs.add(IJob.KIND);
newJob.setTitle("myJob");
newJob.setDescription("This is a new lcm job InfoObject.");
newJob.setParentID(837);//set folder id
infostore.commit(newJobs);
return newJob;
}
3. Modify LCM job using Java SDK
void modify_LCM_Job(IEnterpriseSession enterpriseSession, int job_id) throws SDKException
{
IInfoStore infostore = (IInfoStore) enterpriseSession.getService("InfoStore");
String query = "SELECT * FROM CI_INFOOBJECTS, CI_SYSTEMOBJECTS, CI_APPOBJECTS "
+ "WHERE SI_KIND='" + IJob.KIND + "' "
+ "And SI_ID='" + job_id + "'";
IInfoObjects jobs = infostore.query(query);
IJob job = (IJob) jobs.get(0);
job.setTitle("MyJob_new_name");//set new name
job.setParentID(1234);//changing folder id(moving from one folde to another)
job.save();
infostore.commit(jobs);
}
4. Schedule LCM Job using Java SDK
-
-Bharath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks you very much for your quick response!! I tried to do what you wrote but I've got a error message when I try to launch it.
Here is the code I used :
public static void test(String User, String Password, String Host, String Authentication) throws SDKException{
BI4_Event log= new BI4_Event();
IEnterpriseSession enterpriseSession=log.BI4_Logon(User, Password, Host, Authentication);
modify_LCM_Job(enterpriseSession,160000);
}
static void modify_LCM_Job(IEnterpriseSession enterpriseSession, int job_id) throws SDKException
{
IInfoStore infostore = (IInfoStore) enterpriseSession.getService("InfoStore");
String query = "SELECT * FROM CI_INFOOBJECTS, CI_SYSTEMOBJECTS, CI_APPOBJECTS "
+ "WHERE SI_KIND='" + IJob.KIND + "' "
+ "And SI_ID='" + job_id + "'";
System.out.println(query);
IInfoObjects jobs = infostore.query(query);
IJob job = (IJob) jobs.get(0);
//job.setTitle("MyJob_new_name");//set new name
job.setParentID(175102);//changing folder id(moving from one folder to another)
infostore.commit(jobs);
}
As you can see, I took your code and I just tried to launch that, knowing the query returns me 1 result in the Query Builder.
However, I have an error message :
Exception in thread "main" java.lang.NoClassDefFoundError: com/businessobjects/sdk/biar/exception/XSDException
at com.businessobjects.lcm.job.LCMJobFactory.makePlugin(LCMJobFactory.java:30)
at com.crystaldecisions.sdk.occa.pluginmgr.internal.PluginMgr.getPluginInterface(PluginMgr.java:349)
at com.crystaldecisions.sdk.occa.infostore.internal.InfoObjects.continueUnpackHelper(InfoObjects.java:592)
at com.crystaldecisions.sdk.occa.infostore.internal.InfoObjects.continueUnpack(InfoObjects.java:537)
at com.crystaldecisions.sdk.occa.infostore.internal.InfoObjects.startUnpack(InfoObjects.java:512)
at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore$XRL3WireStrategy.startUnpackTo(InternalInfoStore.java:1686)
at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore$XRL3WireStrategy.startUnpackTo(InternalInfoStore.java:1666)
at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore.unpackAll(InternalInfoStore.java:1064)
at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore.queryHelper(InternalInfoStore.java:1098)
I think I missed something, like a JAR of something, like that?
Best regards,
It's ok, I finally found the solution : I missed one JAR : commentary.common.jar and everything works fine!!
Thank you very much anyway!!
Hi Vincent,
Assuming you have Java SDK setup .
Else please refer the documents:
1.Setting up the development environment
-
- Bharath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.