public void updateAppInstanceDetails(String appIntName){
final String logp = CN + ":: updateAppInstanceDetails - ";
LOGGER.debug(logp + "START");
//get Application Instance Service
ApplicationInstanceService appInstService = Platform.getService(ApplicationInstanceService.class);
//get Application Instance from OIM for the given Application Instance Name
ApplicationInstance appInst = getApplicationInstance(appIntName, appInstService);
try{
//Set Display Name
appInst.setDisplayName("Application Instance Display Name");
//Set Description
appInst.setDescription("Application Instance Description");
//Update Application Instance Details
appInstService.updateApplicationInstance(appInst);
LOGGER.info(logp + "Successfully updated basic Application Instance details for - " + appInst);
}catch(Exception e){
LOGGER.error(logp + "Exception while updating ApplicationInstance in OIM - " + e, e);
}
LOGGER.debug(logp + "END");
}
public ApplicationInstance getApplicationInstance(String appIntName, ApplicationInstanceService appInstService){
final String logp = CN + "::getApplicationInstance - ";
LOGGER.debug(logp + "START");
if(null == appIntName || appIntName.trim().length() == 0){
LOGGER.error(logp + "Application Instance name is null or empty");
return null;
}
appIntName = appIntName.trim();
ApplicationInstance appInst = null;
try{
SearchCriteria criteria = new SearchCriteria(ApplicationInstance.APPINST_NAME, appIntName, SearchCriteria.Operator.EQUAL);
List<ApplicationInstance> appInstList = appInstService.findApplicationInstance(criteria, null);
if(appInstList.size() == 0 || appInstList.size() > 1) {
LOGGER.error(logp + "Improper number of ApplicationInstance found in OIM for Application Instance name " + appIntName + " - " + appInstList.size());
}else{
appInst = appInstList.get(0);
LOGGER.info(logp + "Successfully obtained ApplicationInstance - " + appInst);
}
}catch(Exception e) {
LOGGER.error(logp + "Exception while fetching ApplicationInstance for Application Instance name " + appIntName + " - " + e, e);
}
LOGGER.debug(logp + "END");
return appInst;
}
Happy Learning!!!
final String logp = CN + ":: updateAppInstanceDetails - ";
LOGGER.debug(logp + "START");
//get Application Instance Service
ApplicationInstanceService appInstService = Platform.getService(ApplicationInstanceService.class);
//get Application Instance from OIM for the given Application Instance Name
ApplicationInstance appInst = getApplicationInstance(appIntName, appInstService);
try{
//Set Display Name
appInst.setDisplayName("Application Instance Display Name");
//Set Description
appInst.setDescription("Application Instance Description");
//Update Application Instance Details
appInstService.updateApplicationInstance(appInst);
LOGGER.info(logp + "Successfully updated basic Application Instance details for - " + appInst);
}catch(Exception e){
LOGGER.error(logp + "Exception while updating ApplicationInstance in OIM - " + e, e);
}
LOGGER.debug(logp + "END");
}
public ApplicationInstance getApplicationInstance(String appIntName, ApplicationInstanceService appInstService){
final String logp = CN + "::getApplicationInstance - ";
LOGGER.debug(logp + "START");
if(null == appIntName || appIntName.trim().length() == 0){
LOGGER.error(logp + "Application Instance name is null or empty");
return null;
}
appIntName = appIntName.trim();
ApplicationInstance appInst = null;
try{
SearchCriteria criteria = new SearchCriteria(ApplicationInstance.APPINST_NAME, appIntName, SearchCriteria.Operator.EQUAL);
List<ApplicationInstance> appInstList = appInstService.findApplicationInstance(criteria, null);
if(appInstList.size() == 0 || appInstList.size() > 1) {
LOGGER.error(logp + "Improper number of ApplicationInstance found in OIM for Application Instance name " + appIntName + " - " + appInstList.size());
}else{
appInst = appInstList.get(0);
LOGGER.info(logp + "Successfully obtained ApplicationInstance - " + appInst);
}
}catch(Exception e) {
LOGGER.error(logp + "Exception while fetching ApplicationInstance for Application Instance name " + appIntName + " - " + e, e);
}
LOGGER.debug(logp + "END");
return appInst;
}
Happy Learning!!!
No comments:
Post a Comment