Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,457,022
Community Members
 
Community Events
176
Community Groups

Move Insight Object from one Object Type to another in post function

Edited

Hello,

I'm trying to move an Insight object from one object type to another. Of course, if you are using the interface, this is no problem. But we want to move an object in a post function. The background of this is that we have a JIRA process that handles Hardware exchanges. At a certain status the user is asked, if the "old" Hardware should be scraped or put back in the pool for further usage.

If the user chooses "Scrape" the Hardware will be moved to the object type "Deprecated Hardware". With this, we can still access the old hardware in the Insight Backend, but remove the object from being chosen by a user during a "New User" Workflow.

I'm using the code below, and it does actually move the object (I'm using JMWE Groovy Script), but unfortunately without any values, but I can't figure out, where the problem in my code is. Help is much appreciated.

Thanks a lot, Michael

import com.atlassian.jira.component.ComponentAccessor;
import com.riadalabs.jira.plugins.insight.services.model.move.MoveObjectMapping;
import com.riadalabs.jira.plugins.insight.services.model.move.MoveObjectBean;
import com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping;

/* Get Insight Object Facade from plugin accessor */
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade");
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);

Class objectTypeAttFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade");
def objectTypeAttFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeAttFacadeClass);

def moveMap = new MoveObjectMapping();
def fromAtts = objectTypeAttFacade.findObjectTypeAttributeBeans(826);
def toAtts = objectTypeAttFacade.findObjectTypeAttributeBeans(832);
def index = 0;

toAtts?.each { item ->
MoveAttributeMapping temp = MoveAttributeMapping.create(item,fromAtts[index]);
moveMap.map(fromAtts[index].id,temp);
index++;
}

def mObject = new MoveObjectBean();

mObject.setFromObjectTypeId(826);
mObject.setObjectSchemaId(47);
mObject.setToObjectTypeId(832);
mObject.setMapping(moveMap);
mObject.setReferences(mObject.getReferences().valueOf("KEEP_REFERENCES_TO_OBJECT"));

def insightObjects = issue.get("Old asset");

if (insightObjects != null) {
insightObjects.each{insightObject ->
/* Move object/s */
try {
mObject.setIql("Key = " + insightObject.objectKey);
objectFacade.moveObjects(mObject);
} catch (Exception vie) {
log.warn("Could not update object attribute due to validation exception:" + vie.getMessage());
}
}
}

return true

3 answers

Hi Guys,

 

I tried this script with automation, but it do not work. Do you have any idea what may wrong with it?

 

BR,

Attila

 

import com.atlassian.jira.component.ComponentAccessor;
import com.riadalabs.jira.plugins.insight.services.model.move.MoveObjectMapping;
import com.riadalabs.jira.plugins.insight.services.model.move.MoveObjectBean;
import com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Logger log = LoggerFactory.getLogger("1. log");

/* Get Insight Object Facade from plugin accessor */
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade");
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);

Class objectTypeAttFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade");
def objectTypeAttFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeAttFacadeClass);

def moveMap = new MoveObjectMapping();
def fromAtts = objectTypeAttFacade.findObjectTypeAttributeBeans(object.getObjectTypeId());
def toAtts = objectTypeAttFacade.findObjectTypeAttributeBeans(144);
def index = 0;

toAtts?.each { item ->
MoveAttributeMapping temp = MoveAttributeMapping.create(item,fromAtts[index]);
moveMap.map(fromAtts[index].id,temp);
index++;
}
def mObject = new MoveObjectBean();

mObject.setFromObjectTypeId(object.getObjectTypeId());
mObject.setObjectSchemaId(1);
mObject.setToObjectTypeId(144);
mObject.setMapping(moveMap);
mObject.setReferences(mObject.getReferences().valueOf("KEEP_REFERENCES_TO_OBJECT"));
def insightObjects = object;

if (insightObjects != null)
{
/* Move object */
try
{
mObject.setIql("Key = " + insightObjects.objectKey);
objectFacade.moveObjects(mObject);
objectFacade.storeObjectBean(insightObjects);
} catch (Exception vie)
{
log.warn("Could not update object attribute due to validation exception:" + vie.getMessage());
}
}

@attilasalanki1983old topic, but did you resolve your problem? Was your problem with missing attributes?

I am using quite same logic and object gets moved, but all the attributes are empty.

I thought I'd not do a new topic, but rather update this old one as the problem is still the same and there are some few topics here as well, but they all end up with the same result - no attributes are being updated.

 

As this does not let me to submit my code highlihted I've used Pastebin. See my reply with working example.

 

The idea is the same - when objectType "Domains" attribute "STATUS" value gets changed to "NOT USED" I would like to move this Insight object to a child objectType ("Domains not used"). Child objectType holds the same attributes and in the same order as parent. Schema is the same.

I am going to use automation which is simplifed like this: when object is updated and IQL (insert your necessary condition here) execute (this) groovy script.

I have done some extra checks to script, but this is not definitely necessary, because the idea is the  same as previously posted here.

@Peter-Dave Sheehanmention here, as you have done the same in another topic: https://community.atlassian.com/t5/Jira-Software-questions/Moving-Insight-objects-via-Groovy-fails/qaq-p/1897498

When I'm doing mapping manually like in this quoted thread (see link before) I will get all attributes in the KEY value.

When I'm doing mapping automatically (with each), all attributes are "lost", but the object gets moved.

I have tried "sleep", to wait for object to move, it does not change the result.

I have tried to change the order (attribute map before and actually move later), also the result is the same.

 

I'm going to post some log.info output here:

2022-10-20 08:43:10,414 [http-nio-8080-exec-4] | fromAtts: [
ObjectTypeAttributeBean [id=789, name=Key, type=DEFAULT, defaultType=TEXT],
ObjectTypeAttributeBean [id=791, name=Created, type=DEFAULT, defaultType=DATE_TIME],
ObjectTypeAttributeBean [id=792, name=Updated, type=DEFAULT, defaultType=DATE_TIME],
ObjectTypeAttributeBean [id=841, name=Domeeninimi, type=DEFAULT, defaultType=TEXT],
ObjectTypeAttributeBean [id=842, name=Kontakt, type=REFERENCED_OBJECT, defaultType=NONE],
ObjectTypeAttributeBean [id=843, name=Kontakt_, type=DEFAULT, defaultType=TEXT],
ObjectTypeAttributeBean [id=844, name=Kus registris, type=DEFAULT, defaultType=SELECT],
ObjectTypeAttributeBean [id=845, name=Aegub, type=DEFAULT, defaultType=DATE],
ObjectTypeAttributeBean [id=846, name=Staatus, type=STATUS, defaultType=NONE],
ObjectTypeAttributeBean [id=847, name=Kommentaar, type=DEFAULT, defaultType=TEXT]
]


2022-10-20 08:43:10,414 [http-nio-8080-exec-4] | toAtts: [
ObjectTypeAttributeBean [id=1223, name=Key, type=DEFAULT, defaultType=TEXT],
ObjectTypeAttributeBean [id=1225, name=Created, type=DEFAULT, defaultType=DATE_TIME],
ObjectTypeAttributeBean [id=1226, name=Updated, type=DEFAULT, defaultType=DATE_TIME],
ObjectTypeAttributeBean [id=1227, name=Domeeninimi, type=DEFAULT, defaultType=TEXT],
ObjectTypeAttributeBean [id=1228, name=Kontakt, type=REFERENCED_OBJECT, defaultType=NONE],
ObjectTypeAttributeBean [id=1229, name=Kontakt_, type=DEFAULT, defaultType=TEXT],
ObjectTypeAttributeBean [id=1230, name=Kus registris, type=DEFAULT, defaultType=SELECT],
ObjectTypeAttributeBean [id=1231, name=Aegub, type=DEFAULT, defaultType=DATE],
ObjectTypeAttributeBean [id=1232, name=Staatus, type=STATUS, defaultType=NONE],
ObjectTypeAttributeBean [id=1233, name=Kommentaar, type=DEFAULT, defaultType=TEXT]
]

2022-10-20 08:43:10,425 [http-nio-8080-exec-4] | moveObject:
MoveObjectBean{
fromObjectTypeId=69,
toObjectTypeId=100,
mapping=MoveObjectMapping{attributeMappingMap={789=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@5ab84c21,
791=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@c695d39,
792=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@22c08628,
841=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@156ab381,
842=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@dab3c49,
843=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@4b6d3850,
844=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@6d3a16d3,
845=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@2d0c564e,
846=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@79917ed2,
847=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@5b9c6608}},
iql=Key = KAS-132347,
objectSchemaId=3,
references=KEEP_REFERENCES_TO_OBJECT}

 

One question before I dig into it. .. when you say "child objecttype" are you leveraging the attribute inheritance (this means that the attribute id is the same for the parent and the child) or do the child and parent have the same attribute names but with different ids?

Like Antoine Berry likes this

The first error I see is here:

MoveAttributeMapping.create(item, fromAtts[index]);

You have your 2 arguments reversed. Is't from then to.

But also, how can you be certain your 2 lists of attributes will be in the same sequence? 

And are you 100% sure they are of the same type?

Maybe try something like this:

toAtts?.each { toAttribute ->
def fromAttribute = fromAtts.find{it.name == toAttribute.name && it.type == toAttribute.type}
if(!fromAttribute) {
log.warn "Nothing to map to $toAttribute.name"
return
}
MoveAttributeMapping attMap = MoveAttributeMapping.create(fromAttribute, toAttribute);

log.info "Adding mapping of $fromAttribute.name from $fromAttribute.id to $toAttribute.id"
moveMap.map(fromAttribute.id, attMap);
}

Also, don't create a mutable of your object. That's only for editing attributes.

Like vahem2lu likes this

Thank you @Peter-Dave Sheehan, such a rookie mistake for mapping attributes.

For my case right now this object is "tree" child

- CMDB
-- Infra
--- Domain names
---- domains not used

And they always use the same attribute names and types in the same order. IDs of course are different.

Regarding to not/being mutable, if it's not mutable, I will get this error:

Could not update object attribute due to error: No signature of method: com.riadalabs.jira.plugins.insight.channel.external.api.facade.impl.ObjectFacadeImpl.storeObjectBean() is applicable for argument types: (com.riadalabs.jira.plugins.insight.services.model.ObjectBean) values: [domain.tld (KAS-132375)]

Working as expected, I am going to post a working example in some time.

So my working example of moving an Insight object from one type to another.

I have used some extra checks (especially IDs), but they are not necessary when you "trust" your automation workflow. 😃

import com.atlassian.jira.component.ComponentAccessor;
import com.riadalabs.jira.plugins.insight.services.model.move.MoveObjectMapping;
import com.riadalabs.jira.plugins.insight.services.model.move.MoveObjectBean;
import com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping;

Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade");
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);
Class objectTypeFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeFacade");
def objectTypeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeFacadeClass);
Class objectTypeAttFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade");
def objectTypeAttFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeAttFacadeClass);

// Define some variables

// set schemaId and typeId for active and inactive domains (from Jira Insight)
int schemaId = 3;
int activeDomainTypeId = 69;
int inactiveDomainTypeId = 100;

// set statusActiveAttributeId which is the ID of "Staatus" in active Object Type (secure/ObjectSchema.jspa?id=3&typeId=YOUR_ID&view=list&mode=attribute)
// set statusActive and statusNotActive IDs based on Jira Insight ID (secure/InsightConfigure.jspa?id=3&tab=statuses)
int statusActiveAttributeId = 846;
int statusActive = 70;
int statusNotActive = 72;

// object needs to be mutable and initiator gives us the object (which triggers this script)
// current object ID and KEY from actual request
object = object.createMutable();
int objectId = object.getId();
String objectKey = object.getObjectKey();

def objectTypeCurrentId = object.getObjectTypeId();
if ( objectTypeCurrentId != activeDomainTypeId ){
log.info ("objectTypeCurrentId is: " + objectTypeCurrentId + " and we are looking for: " + activeDomainTypeId + ". So, it's a mismatch! Exiting.");
// This object is not in correct typeId, exiting
return false;
}

def objectAttributeValue = objectFacade.loadObjectAttributeBean(objectId, statusActiveAttributeId).getObjectAttributeValueBeans()[0].getValue();

if (objectAttributeValue == statusNotActive){
/**
* Define move map - for mapping attributes between two typeId (old type -> new type)
* and make map with current attributes
* and to map them with new attributes
*/
MoveObjectMapping moveMap = new MoveObjectMapping();
def fromAtts = objectTypeAttFacade.findObjectTypeAttributeBeans(activeDomainTypeId);
def toAtts = objectTypeAttFacade.findObjectTypeAttributeBeans(inactiveDomainTypeId);
def index = 0;

// do the actual mapping with both arrays
// NB! This assumes that both attributes are same type and same name and in exact same order.
toAtts?.each { item ->
MoveAttributeMapping attMap = MoveAttributeMapping.create(fromAtts[index], item);
moveMap.map(fromAtts[index].id, attMap);
index++;
}

/**
* Define moveObject and store necessary elements
* for new object
*/
MoveObjectBean moveObject = new MoveObjectBean();
moveObject.setObjectSchemaId(schemaId);
moveObject.setFromObjectTypeId(activeDomainTypeId);
moveObject.setToObjectTypeId(inactiveDomainTypeId);
moveObject.setMapping(moveMap);
moveObject.setReferences(moveObject.getReferences().valueOf("KEEP_REFERENCES_TO_OBJECT"));

// Actually moving the object
// and storing attributes to the new object
try{
if (object != null){
moveObject.setIql("Key = " + objectKey);
objectFacade.storeObjectBean(object);
objectFacade.moveObjects(moveObject);
log.info("domain-status-move-to_unused for object: " + objectKey );
}
} catch (Exception e){
log.warn("Could not update object attribute due to error: " + e.getMessage());
}

return true;
} // if (objectAttributeValue == statusNotActive)
else {
log.info ("objectAttributeValue is: " + objectAttributeValue + " and we are looking for: " + statusNotActive + ". So, it's a mismatch! Exiting.");
return false;
}

return false;

You don't need to store the object (objectFacade.storeObjectBean(object)).

Remove that line and you won't need to make it mutable.

@Peter-Dave SheehanI've replaced my attribute mapping with your suggestion. The problem is that now when I'm moving within two objectTypeId's, which are the same attributes (order, name and type), the object gets moved.

But when I'm moving within two quite different objectTypeId's, then return is "true", so no errors, but the object is not being moved actually.

The idea should be that when a mapping is found, then this attribute is moved, others should be discarded.

Also moveObject seems OK to me as well.

2022-10-31 16:50:36,875 [http-nio-8080-exec-6] |
moveObject: MoveObjectBean{fromObjectTypeId=14,
toObjectTypeId=5,
mapping=MoveObjectMapping{attributeMappingMap={880=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@3064a8e,
144=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@4e7951d1,
83=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@590b1081,
85=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@2b84a08a,
86=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@1a67dd4e,
1306=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@1e14f00a,
667=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@1f9a7451,
141=com.riadalabs.jira.plugins.insight.services.model.move.MoveAttributeMapping@119417d8}},
iql=Key = KAS-18177,
objectSchemaId=3,
references=KEEP_REFERENCES_TO_OBJECT}

Anything I'm missing with "discarding" attributes?

Like Antoine Berry likes this

Sorry, I don't have a lot more to add. I've only ever really moved within 2 objects that largely share the same attributes. 

I'm not sure how else to discard an attribute other than not including it in the mapping.

Based on the MoveAttributeMapping documentation I can see that there is a possibility of creating a mapping using From only, which sets the "ShouldMap" to false.

You could try to reverse the logic (process all the "fromAtts" and find a matching "toAtt" instead of processing all the "toAtts" and finding a matching "fromAtt") and add a no-map mapping.

fromAtts?.each { fromAttribute ->
def toAttribute = toAtts.find{it.name == fromAttribute.name && it.type == fromAttribute.type}
MoveAttributeMapping attMap
if(!toAttribute) {
log.warn "Nothing to map to $fromAttribute.name"
attMap = MoveAttributeMapping.create(fromAttribute)
} else {
attMap = MoveAttributeMapping.create(fromAttribute, toAttribute);
}

log.info "Adding mapping of $fromAttribute.name from $fromAttribute.id to ${toAttribute?.id}"
moveMap.map(fromAttribute.id, attMap);
}
Like # people like this

Actually I guess it's the GUI behaviour too, that you find "fromAttributes" and map them to "toAttributes".

And this worked like a charm! Thank you for your support and I believe whoever finds this topic, they will get it done as well. :)

0 votes

Hi Michael.

You have to map every attribute from the source to the destination - and the type must match between source and target attributes...

The best way to understand the Move Object is to follow the Bulk-Move UI - the same should be done in your script.

Missing attributes won't be moved if not specified.

Kind regards,

Yinon

Team Riada

Hi @Yinon Negev ,

I faced pretty the same challenge @Michael Aydemir  was dealing with. Unfortunately, I'm not sure I did follow your hint exactly the way you were describing. Let me describe the issue, what is it current status and ask you for piece of code if possible :)

We are storing important kind of data in CRC object schema.
Because of the importance, we don't want anyone to operate manually.
Operations like new object creation or update are fully automated. Unfortunately, objects "removal" has to be done manually. We'd like to automate it.

There are 3 main object types:

  • Register Objects
  • Attribute Objects
  • Removed Objects
    Attribute Objects are only reference objects.
    Register Objects are our main objects. Once object is removed from Register Objects, it is moved to Removed Objects.
    Register Objects and Removed Objects hierarchy is the same. The difference is only in child type names that are prefixed with "Removed" in Removed Objects. Attribute list, their types and type values are the same, so manual action is just few clicks.

Here is one of my try, mainly based on this post.
Object is moved but without any attribute. It's searchable by it's label, but none attribute displayed and none attribute is saved when object edited manually.
Wondering if anything should be done with Progress object returned by moveObjects method (https://insight-javadoc.riada.io/insight-javadoc-5.4.2/com/riadalabs/jira/plugins/insight/channel/external/api/facade/ObjectFacade.html#moveObjects-com.riadalabs.jira.plugins.insight.services.model.move.MoveObjectBean-) but was not able any clue for that :/

 

/*
skipping imports and issue load
*/
def object = (issue.getCustomFieldValue(cfObject)[0]).createMutable()

Class objectSchemaFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectSchemaFacade");
ObjectSchemaFacade objectSchemaFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectSchemaFacadeClass);

Class objectTypeFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeFacade");
ObjectTypeFacade objectTypeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeFacadeClass);

ObjectSchemaBean crc = objectSchemaFacade.findObjectSchemaBeans().find

{ o -> o.objectSchemaKey == 'CRC'}

List<ObjectTypeBean> crcAllObjectTypes = objectTypeFacade.findObjectTypeBeansFlat(crc.id)
ObjectTypeBean srcObjectType = crcAllObjectTypes.find

{ o -> o.id == object.objectTypeId}

ObjectTypeBean tgtObjectType = crcAllObjectTypes.find

{ o -> o.name == ('Removed ' + srcObjectType.name)}

Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade");
ObjectFacade objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);

Class objectTypeAttFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade");
ObjectTypeAttributeFacade objectTypeAttFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeAttFacadeClass);

MoveObjectMapping moveMap = new MoveObjectMapping();
List<ObjectTypeAttributeBean> fromAtts = objectTypeAttFacade.findObjectTypeAttributeBeans(srcObjectType.id);
List<ObjectTypeAttributeBean> toAtts = objectTypeAttFacade.findObjectTypeAttributeBeans(tgtObjectType.id);

def index = 0;
toAtts?.each

{ item -> MoveAttributeMapping temp = MoveAttributeMapping.create(item,fromAtts[index]); moveMap.map(fromAtts[index].id,temp); index++; }

MoveObjectBean mObject = new MoveObjectBean();
mObject.setObjectSchemaId(crc.id);
mObject.setFromObjectTypeId(srcObjectType.id);
mObject.setToObjectTypeId(tgtObjectType.id);
mObject.setMapping(moveMap);
// mObject.setReferences(mObject.getReferences().valueOf("REMOVE_REFERENCES_TO_OBJECT"));

try

{ mObject.setIql("Key = " + object.objectKey); objectFacade.moveObjects(mObject); // objectFacade.storeObjectBean(object) }

catch (Exception vie)

{ log.warn("Could not update object attribute due to validation exception:" + vie.getMessage()); }

Like Fredrik Elmqvist likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events