Re: Assembler: Not able to call the method createItem but able to call the method getItem and fill from Flex application.
Hi, I'm new to Flex and currently having some problem on calling/reaching my Assembler class method createItem. I find it weird because I manage to call/reach both fill and getItem method but just couldn't call the createItem method reside in my Assembler class. Below is the details of my code: main.mxml (just part of the code...) <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:component="*" layout="absolute" creationComplete="getSource()"> <mx:DataService id="ds" destination="videoService" result="setData(event)"/> <mx:DataService id="vcds" destination="commentsService"/> private function getSource():void{ ds.getItem({videoId:2}); } private function setData(event:ResultEvent):void{ video = VideoItem(event.result); movie = "/videoshow/"+video.uploadPath+"/"+video.videoFileName; videoDisplay.play(); btnPlay.label = "Pause"; IS_PAUSED = false; } private function submitNewComment():void{ var comment:VideoComment; comment = new VideoComment(); comment.comments = StringUtil.trim(commentTextArea.text); comment.videoId = video.videoId; comment.userId = 1; //vcds.getItem({commentsId:1}); --> This part is working fine var ref:ItemReference = vcds.createItem(comment); //This part is not working vcds.commit(); } .................................................................... data-management-config.xml <?xml version="1.0" encoding="UTF-8"?> <service id="data-service" class="flex.data.DataService" messageTypes="flex.data.messages.DataMessage"> <adapters> <adapter-definition id="actionscript" class="flex.data.adapters.ASObjectAdapter" default="true"/> <adapter-definition id="java-dao" class="flex.data.adapters.JavaAdapter"/> </adapters> <default-channels> <channel ref="my-rtmp"/> </default-channels> <destination id="videoService"> <adapter ref="java-dao" /> <properties> <source>com.bt.bat.videoshow.services.manager.VideoAssembler</source> <scope>application</scope> <metadata> <identity property="videoId"/> </metadata> <network> <session-timeout>20</session-timeout> <paging enabled="false" pageSize="10" /> <throttle-inbound policy="ERROR" max-frequency="500"/> <throttle-outbound policy="REPLACE" max-frequency="500"/> </network> </properties> </destination> <destination id="commentsService"> <adapter ref="java-dao" /> <properties> <source>com.bt.bat.videoshow.services.manager.VideoCommentAssembler</source> <scope>application</scope> <cache-items>true</cache-items> <metadata> <identity property="commentsId"/> </metadata> <network> <session-timeout>20</session-timeout> <paging enabled="true" pageSize="10" /> <throttle-inbound policy="ERROR" max-frequency="500"/> <throttle-outbound policy="REPLACE" max-frequency="500"/> </network> </properties> </destination> </service> .......................................................................... My Assembler class public class VideoCommentAssembler extends AbstractAssembler { public void createItem(Object item) { System.out.println("Inside createItem of VideoCommentAssembler......."); VideoUploadService.getInstance().createVideoComment( (VideoComments) item); } public void deleteItem(Object previousVersion) { System.out.println("Here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); super.deleteItem(previousVersion); } public Collection fill(List fillParameters) { // TODO Auto-generated method stub return super.fill(fillParameters); } public Object getItem(Map identity) { System.out.println("inside getItem of VideoCommentAssembler."); return VideoUploadService.getInstance().loadVideo(((Integer) identity.get("commentsId")).intValue()); } public void loadComments(String _string){ System.out.println("Inside Assembler loadComments method."); } } .......................................................................... Hopefully someone can really help me on this as I spend almost 3 days to find out what is wrong with my code/setting. Just couldn't understand why cant the createItem method in my Assembler class been called (The system.out.println inside the createItem is not been printed on my console), where else the other 2 method : fill and getItem able been called successfully (The system.out.println inside both this method can print out ...in my console). Fyi, there's no error...nothing occur in my console, log, or the flex client side (on my browser). I going to be crazy soon!! Someone....please help!

