RAM Java API - set asset attribute setValidValues exception
Hi,
We are using RAM 7.5.1.2 on WAS 7.0, Fix Pack 29, 64 bit, running on RedHat Linux 6.5, 64 bit. We are using the following code in a custom policy running on the server (from ramclient.zip in extensions) to copy the value in the asset "Owners" internal variable to variable "Tmp_Owner". Both are of type "user".
RAMSession ramSession = this.getPolicyContext().getRAMSession();
RAMAsset ramAsset = this.getPolicyContext().getRAMAsset();
RAMAssetAttribute raaTmpOwner = (RAMAssetAttribute) ramAsset.getAssetAttribute("Tmp_Owner");
raaTmpOwner.setValidValues(new String[]{ramAsset.getOwners()[0].getName()});
raaTmpOwner.setSingleSetting(true);
ramSession.put(raaTmpOwner, new NullProgressMonitor());
We get the following exception. Any ideas how to overcome this? TIA
Peter
com.ibm.ram.common.data.exception.RAMRuntimeException: You cannot modify the list of valid values for an attribute that is obtained from an asset. at com.ibm.ram.client.RAMAssetAttribute.setValidValues(RAMAssetAttribute.java:394) at org.kp.java.ram.extension.policy.AttributePolicy.test(AttributePolicy.java:73) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.runAssetPolicies(AssetLifecycleManager.java:2690) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.handleEventCycle(AssetLifecycleManager.java:1684) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.handleEventCycle(AssetLifecycleManager.java:1654) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.triggerStateChangeEvent(AssetLifecycleManager.java:1972) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.handleEventCycle(AssetLifecycleManager.java:1734) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.handleEventCycle(AssetLifecycleManager.java:1654) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.handleEvent(AssetLifecycleManager.java:488) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.triggerActionEvent(AssetLifecycleManager.java:2104) at com.ibm.ram.repository.assets.AssetManager.assetAction(AssetManager.java:4884) at pagecode.assetDetail.AssetDetailBase.save(AssetDetailBase.java:866) at sun.reflect.GeneratedMethodAccessor1830.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at org.apache.el.parser.AstValue.invoke(AstValue.java:159) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) at javax.faces.component.UICommand.broadcast(UICommand.java:387) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:458) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:763) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1667) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1602) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:149) at com.ibm.ram.repository.web.security.RAMServletFilter.doFilter(RAMServletFilter.java:569) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:125) at com.ibm.ram.repository.web.filters.CSRFSecurityFilter.doFilter(CSRFSecurityFilter.java:66) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:125) at com.ibm.ram.repository.web.filters.JavascriptSecurityFilter.doFilter(JavascriptSecurityFilter.java:29) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:125) at com.ibm.ram.repository.web.filters.GZipFilter.doFilter(GZipFilter.java:42) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:125) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:80) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:507) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:181) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3954) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:945) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:191) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277) at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1049) at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:643) at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1784) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1656)