My Oracle Support Banner

In UIM, Clone Option for Place Entity. (Doc ID 2047651.1)

Last updated on SEPTEMBER 19, 2019

Applies to:

Oracle Communications Unified Inventory Management - Version 7.2.5.0.0 and later
Information in this document applies to any platform.

Goal

Qn1:Customer is looking for guidance in choosing the best approach for cloning an entity in UIM.

In our database, we have some addresses stored. I am in a process of creating a ruleset which renames a street. Renaming a street implies that all the addresses with the street's old name should change their lifecyclestage (continuing to exist in the DB). Further more, the aforementioned addresses will be cloned/copyed having the same characteristics, only with the new street's name and a lifecyclestage indicating they're active.

My question is what is the best manner to do so? I've searched through the API, and I've seen a method named clone(), which takes any kind of Object. Should this work on Place Specifications, alongside their Place Characteristics? Or is it best, in my case, to recreate those entities from scratch (using a creation method from the API)?

Note that i haven't tested the cloning yet.
 
Qn2:Customer has developed code to clone the Place,.

public static Collection cloneGeographicPlaces(Collection geographicPlace){
GeographicAddress newGeographicPlace = null;
List pcList = new ArrayList();
pcList.addAll(geographicPlace);
Collection clones = new ArrayList();
PlaceManager placeMgr = PersistenceHelper.makePlaceManager();
try{
for (int i = 0; i < pcList.size();/* i++ */){
newGeographicPlace = placeMgr.makeGeographicPlace(GeographicAddress.class);
Map<String, PlaceCharacteristic> charMap = pcList.get(i).getCharacteristicMap();
Set charSet = new HashSet<>(charMap.values());
  newGeographicPlace.setCharacteristics(charSet);
clones.add(newGeographicPlace);
break;
}
placeMgr.createGeographicPlace(clones);
log.error("", "Places have been successfully cloned");
} catch (ValidationException e){
log.error("", "Places could not be cloned due to error: " + e.getCause());
  e.printStackTrace();
}
return clones;
}

Wanted the review comments.
 
Qn3:1) Should i also create new instances of Place specifications or does it suffice to use clone()? I've seen that clone() does not entirely initialize the new object, i.e. an entityid is not assigned to the new place (the creation method does this)

2) How do i set the GUI id for the cloned/newly created object? I know it's autogenerated, but is there a method which i should call explicitely or is something happening internally, once the place is created?

3) I have another ruleset upon a geographic place creation, having its placement set to BEFORE. In this situation, my GeographicPlace is an address and this ruleset
makes some validation on its fields. The problem is that when i create the new place instance (for cloning purposes), even before setting its characteristics, the validation is being triggered and
throwing errors because it is called on null values.

4) Is there a way to also copy all the object properties at once (not its characteristics), but the properties of the object itself (description, latitude, longitude, etc)?
Or do i have to set them explicitely, one at a time?
 

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.