Today I will cover how to delete system property in OIM 11g + some important details related of system properties.
1)Here it is the first code:
...
SystemConfigurationService confServiceDel = oimClient.getService(SystemConfigurationService.class);
try{
SystemProperty sysProp;
sysProp = confServiceDel.getSystemProperty(sysproperty);
lgb=confServiceDel.deleteSystemProperty(sysProp.getPtyKeyword(), new Date());
}catchInvalidDataLevelException e){
System.out.println("DataLevel issues:"+e);
....
[add here the conditions that you want to work if this happens...]
....
2)***Very important note***
You can delete a system property only if the data level of that system property is set to either 0 or 3. While deleting a system property, a message is displayed if the data level associated with the system property is not appropriate. For a description of the data levels, see Table below, "Data Levels Associated with a System Property".
2.1)DataLevel X description
===================================================
Data Level Description
0 Indicates that the system property can be modified or deleted
1 Indicates that the system property cannot be modified or deleted
2 Indicates that the system property can only be modified
3 Indicates that a system property can only be deleted
===================================================
3)This above is the main reason why you need to take care closely on exception InvalidDataLevelException . Also make sure during the system property creation or update you set the datalevel related.
3.1)during creation:
...
SystemProperty syspropcreation = new SystemProperty();
syspropcreation.setPtyKeyword(sysproperty);
syspropcreation.setPtyNote("Code implemented by ThiagoLeoncio");
syspropcreation.setPtyName(sysproperty);
syspropcreation.setPtyValue(syspropvalue);
syspropcreation.setPtyCreate(new Date());
syspropcreation.setPtyUpdate(new Date());
syspropcreation.setPtyDataLevel("0"); // <== IMPORTANT PIECE
syspropcreation.setPtyUpdateby("13");
syspropcreation.setPtyCreateby("13");
confService.addSystemProperty(syspropcreation);
...
3.2)during update:
...
sysPropUpd.setPtyDataLevel("0");
confServiceUpd.updateSystemProperty(sysPropUpd,new Date());
...
4)Reference:
4.1)http://docs.oracle.com/cd/E21764_01/doc.1111/e14308/system_props.htm#BABFCDAD
4.2)http://docs.oracle.com/cd/E37115_01/apirefs.1112/e28159/oracle/iam/conf/api/SystemConfigurationService.html
I hope this helps.
Thiago Leoncio.