Getting document instance from NSPersistentDocument?
I'm still fairly new to Objective C and programming in general, so if my question is inane please forgive me.
Here is what I'm stuck on. I'm currently working on an Cocoa desktop app that uses NSPersistentDocument. I currently have a view controller that manages a modal window. I would like to save to the ManagedObjectContext in one of that view controller's methods. According to Apple's documentation on Core Data"
"The context is in effect also your gateway to the rest of the Core Data infrastructure. As such, it is expected that you either keep a reference to the context, or you have a means of easily retrieving it—for example, if you are developing a document-based application that uses NSPersistentDocument, you can use the document class’s managedObjectContext method."
and elsewhere
"Where a managed object context comes from is entirely application-dependent. In a Cocoa document-based application using NSPersistentDocument, the persistent document typically creates the context, and gives you access to it through the managedObjectContext method."
and finally
"Getting a Managed Object Context
In OS X:
In an single-coordinator applications, you can get the application’s context directly from the application delegate.
In document-based applications, you can get the context directly from the document instance."
I think I'm missing the bigger picture here. My questions is... what is the document instance and how do I access it from other classes? This method in my modal view controller:
" - (IBAction)saveContext:id)sender {
if ([tagsArray count] != 0) {
int objectcount;
for (objectcount = 0; objectcount < [tagsArray count]; objectcount ++){
Tag *singleTag = (Tag *) [NSEntityDescription insertNewObjectForEntityForName:@"Tag" inManagedObjectContext:self.managedObjectContext];
singleTag.tagname = [tagsArray objectAtIndex:objectcount];
singleTag.video = selectedFile;
NSLog(@"Tagnames %@",singleTag.tagname);
[NSApp stopModalWithCode:NSOKButton];
[self.window close];
Gives me a "No known class method for selector 'managedObjectContext' compiler warning. Actually any method I try to call on the Document class gives the same warning. Something tells me the document instance is NOT called by "Document" because it's talking about a class method, but I have no clue what I should put in it's place. FWIW making an additional managedObjectContext in the view controller does not work as NSPersistentDocument does not allow more than one. I tried declaring "document" as a property in the view controller like this:
@property (strong) Document *docController;
But that's creating a new instance of the Document class rather than referencing the pre-existing one. The context is not getting saved because it's deallocated as soon as the window is closed. Obviously I'm thinking about this the wrong way. There isn't much info out there on core-data & document based apps. Can someone help me with this? I've been stuck on this for quite a while now and am desparate for help.
Thanks.
hi,
i think, that's not possible in that way you expect it.
the only idea, i have, is to use the jvmpi interface.
if you write your own profiler using jvmpi, your java program
will reach a c or c++ dll-function JVM_OnLoad().
There you have an instance of the java vm.
but still you are a thread of the vm.
How to pass it to a diffrent process ?
maybe via a variable which is shared by the dll with
another process.
Similar Messages
-
How to get File object from Document Object . ?
In conventional Dom Parsing we pass file to DocumentBuilder to get Document Object .
File file = new File("c:\\MyXMLFile.xml");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file); // gOT Document here . My problem is how do i get File object back from Document . If i have Document object with mi.
Please consider above code as example i dont have File object in my code . i am using Xhive DB API where i get Document directly from API method .
I need to convert this Document to File to get size of file
Please suggest solution on this
Edited by: AmitChalwade123456 on Dec 5, 2008 6:10 AMHello Guys any views on this topic
-
Runtime error encounter when getting instance from ResourceFactory
Hi,
I'm developing a IView report on the documents' status in the repository, but i have encounter the following runtime error when I get an resource instance from the ResourceFactory,
<i>Portal Runtime Error
An Exception occurred while processing a request for:
IView: N/A
Component: N/A
com/sapportals/wcm/repository/IResourceFactory</i>
My codes are as follows:
<i>IResourceFactory factory = Resourcefactory.getInstance()</i>
I try to catch the ResourceException(), but an similar runtime error occured. I'm using PDK EP 6.0_60.2.2
Thanks for any suggestions/solutions provided.Hi,
did you set the SharingReference attribute in portalapp.xml to "knowledgemanagement, usermanagement" ?
Best regards,
Thilo -
Cannot a get JSP page instance from a page being destroyed
We have a J2EE app, using Struts + Tiles (build 1.1-b3), running on Win2KPro, Ora9ias v9.0.3. The application is roles-based, and different users see different versions of the same page based on their role authorizations. Occasionally, when multiple users in different roles are requesting the same page, the app returns the following exception:
OracleJSP:
JSP Error:
Request URI:/fast/WEB-INF/jsp/tiles/layouts/baseLayout.jsp
Exception:
javax.servlet.ServletException: Cannot a get JSP page instance from a page being destroyed
at oracle.jsp.runtimev2.JspPageInstFacade.getInstance(JspPageInstFacade.java:147)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:303)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:119)
at org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtilStrutsModulesImpl.java:124)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:161)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:703)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:818)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:467)
at web2d_inf._jsp._tiles._layouts._baseLayout._jspService(_baseLayout.java:445)
[SRC:/WEB-INF/jsp/tiles/layouts/baseLayout.jsp:149]
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:209)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1033)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:269)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:249)
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:303)
at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at com.gal.fast.portal.web.FastActionServlet.service(FastActionServlet.java:110)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:148)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:536)
All the code in the two custom classes above ( com.gal.fast.portal.web.SessionInitializedFilter and com.gal.fast.portal.web.FastActionServlet ) has been commented out to the point that they are NOOP stubs.
We only see this with multiple near-simultaneous requests for the same page with differet roles. It smells like a threading issue to me, but I'm no expert (hence this post). Any thoughts?
--mattWe have a J2EE app, using Struts + Tiles (build 1.1-b3), running on Win2KPro, Ora9ias v9.0.3. The application is roles-based, and different users see different versions of the same page based on their role authorizations. Occasionally, when multiple users in different roles are requesting the same page, the app returns the following exception:
OracleJSP:
JSP Error:
Request URI:/fast/WEB-INF/jsp/tiles/layouts/baseLayout.jsp
Exception:
javax.servlet.ServletException: Cannot a get JSP page instance from a page being destroyed
at oracle.jsp.runtimev2.JspPageInstFacade.getInstance(JspPageInstFacade.java:147)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:303)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:119)
at org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtilStrutsModulesImpl.java:124)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:161)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:703)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:818)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:467)
at web2d_inf._jsp._tiles._layouts._baseLayout._jspService(_baseLayout.java:445)
[SRC:/WEB-INF/jsp/tiles/layouts/baseLayout.jsp:149]
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:209)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1033)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:269)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:249)
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:303)
at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at com.gal.fast.portal.web.FastActionServlet.service(FastActionServlet.java:110)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:148)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:536)
All the code in the two custom classes above ( com.gal.fast.portal.web.SessionInitializedFilter and com.gal.fast.portal.web.FastActionServlet ) has been commented out to the point that they are NOOP stubs.
We only see this with multiple near-simultaneous requests for the same page with differet roles. It smells like a threading issue to me, but I'm no expert (hence this post). Any thoughts?
--matt -
How to get an accounting document number from an Invoice number
Dear All,
I have a requirement where I need to know which accounting document is created against a particular invoice. As we know that in the document flow of invoice we can see the Accounting document also. But to develop the report I need to pick the accounting document by the invoice document. Please suggest me a table where this value is getting stored. I already tried VBFA and VBKD but nowhere I am getting such information from which I can pick a accounting document number for a particular invoice.
Please give me your suggestions.
Regards,
SanjuDear,
For Billing document create no. range by Tcode-VN01 and assign it to in Tcode-VOFA
For Accounting document create no. range by Tcode-FBN1 and activate the External Field and assing it to in Tcode- OBA7
but Assign the same no. range to both Document types for exp 1000000 to 1999999.
Regards
AJIT K SINGH
HAPPY TO HELP U -
How to get payment document number from paid column in monthly invoice
Dear experts
I use SBO japan version and i need to know how to get payment document number from paid column in monthly invoice ?
in table MIN1, only contain invoice and credit note document number, there is no payment document number
thank you for your help
Best Regards
JeiMingDear Gordon
Yeah, you are right, i can use field MIentry in RCT2
thank you
Best regards
jeiming -
How to get a HttpServletRequest instance from ApplicationModule ?
All methods that I use as data actions are located in ApplModuleImpl.java. I need to get an IP address of an user using one of those methods. The problem is that I have to get an instance of HttpServletRequest (which have a getRemoteAddr() method) but I don't know how to do it from Application Module.
Any ideas ?I approached a similar problem by extending the PageController and the ApplicationModule classes for the application (in the ViewController and Model projects respectively). Rather than tie the AppModule directly to the HTTP request object, I extended the PageController subclass to process the request object for specific information needed from it and communicate to the ApplicationModule as needed.
In the extended PageController subclass, you'll have to import javax.servlet.http.HttpServletRequest and use
HttpServletRequest request = (HttpServletRequest) context.getEnvironment().getRequest(); to get reference to the request object.
I extended the ApplicationModule with setter methods to pass information into it from the specific PageController subclasses; the approach keeps the model layer more independent of the web-browser layer (it's not dependent on an HttpServletRequest object), and still allows the AppModule to be used with different UI technologies.
We also needed to get the custom PageController methods invoked at the right points.
Edited by: rpalazola on Sep 16, 2008 11:37 AM
Edited by: rpalazola on Sep 16, 2008 11:44 AM -
Getting document no. using document id from dms
Dear Experts,
I want to get Document No. using Document ID of particuler document from DMS. Is there any Function Module which returns Document No. from Document ID. So how to get this.
<< Moderator message - Everyone's problem is important. But the answers in the forum are provided by volunteers. Please do not ask for help quickly. >>
With Regards !
Shekh Ibrahim
Edited by: Rob Burbank on Jan 17, 2011 4:23 PMHi again,
maybe the report DMS_KPRO_READ2 can be useful for this requirement. Other useful tables could be DMS_PH_CD1, DMS_DOC2LOIO or DMS_PHIO2FILE.
Best regards,
Christoph -
How can get document from mac to iphone
How can I get document from imac that is saved, to my iphone?
What kind of document?
iWork documents (Pages, Numbers, Keynote) can be saved to iCloud and opened by the corresponding apps on the iPhone.
PDFs can be transferred via iTunes or Dropbox and read using an application such as Goodreader.
If you can add some detail to your request, we can try to offer a better solution.
Matt -
How do I get documents from mac to iPad
How do I get documents from Mac to iPad?
If you just have a few that you want to view, you can e-mail them to yourself and use the viewer in the mail app to view them.
If you have several or want to save them on the iPad or edit them then you'll need an app. Apple has iPad versions of Pages, numbers and keynote that should sync between your mac and iPad. -
Get Sales order from Billing document number
Given Billing document number from VBRK-VBELN, how to get the Sales order number VBAK-VBELN?
Please check table VBFA.
Below code might give you some idea:
PARAMETERS: P_VBELN TYPE VBELN OBLIGATORY.
DATA: COMWA TYPE VBCO6.
DATA: IT_VBFA TYPE TABLE OF VBFA,
WA_VBFA TYPE VBFA.
COMWA-VBELN = P_VBELN.
CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'
EXPORTING
BELEGTYP = 'M'
COMWA = COMWA
TABLES
VBFA_TAB = IT_VBFA
EXCEPTIONS
NO_VBFA = 1
NO_VBUK_FOUND = 2
OTHERS = 3.
LOOP AT IT_VBFA INTO WA_VBFA WHERE VBTYP_N = 'C'.
WRITE:/ WA_VBFA-VBELN.
ENDLOOP.
Kind Regards
Eswar -
How to get documents from RMS linked to particular case id using webdynpro
HI friends,
Can anybody knows " How to get documents from RMS linked to particular case id."
From end: webdynpro
backend: RMS.
please do the needful.
Thanks and Regards
-SujathaHI friends,
Can anybody knows " How to get documents from RMS linked to particular case id."
From end: webdynpro
backend: RMS.
please do the needful.
Thanks and Regards
-Sujatha -
How do I get documents from pc to ipad?
I have installed Pages on my iPad but don't know how to get documents from my PC to the Cloud.
Go into iTunes, while iPad is connected, select it under devices. On the apps tab, scroll down and you will see the documents box. You can then select Pages and browse/select your document and then sync to the iPad.
http://support.apple.com/kb/ht4094 -
Getting a document file from the transcribed audio file
I would like to know how to get a "document" file from the transcribed files created by Soundbooth. The files created by SB have 'xml' or 'xmp' extensions and I do not know what to do with these files or how to "read" them.
I am on a macbook pro MAC OS 10.5.5. I have latest versions of Word, and Final Cut Pro.
Any help would be appreciated. This is my first foray into the world of Adobe products.
Thanks,
EricThe Transcript XML files conform to the XML Standards, and are a "marked up" text document containing several pieces of information. You can open the file in TextEdit (on Mac) or Notepad (on Windows) and you should be able to see what sorts of metadata is saved for each word in the transcription. Each transcribed word is stored in a data block, along with its timestamp, the duration of the spoken word, and some other metadata. This information is invaluable when importing the file into other applications or databases.
Neither Soundbooth nor Premiere Pro support exporting the transcript without the additional metadata or XML tags right now, but since it's a basic text file, it should be a very simple chore for a script to parse that file and write out each transcribed word to a new file.
Durin -
SRDEMO ??? error occurred while getting property "userId" from an instance
Error
JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-29000: Unexpected exception caught: java.lang.RuntimeException, msg=javax.servlet.jsp.el.ELException: An error occurred while getting property "userId" from an instance of class oracle.mysrdemo.view.UserInfo
JBO-29000: Unexpected exception caught: java.lang.RuntimeException, msg=javax.servlet.jsp.el.ELException: An error occurred while getting property "userId" from an instance of class oracle.mysrdemo.view.UserInfo
javax.servlet.jsp.el.ELException: An error occurred while getting property "userId" from an instance of class oracle.mysrdemo.view.UserInfo
Hello,
Can you please guide to correct the above error. Thanks a lot.
DShahHi,
I got the answer to my question. The tables were not populated. So I ran the script - populateSchemaTables.sql, and got the data into the tables. The error is gone!
Lin
Maybe you are looking for
-
No longer able to use Capture (only capture now)
I used to be able to capture with the full capture functionality (in Final Cut Express) and now I can only 'capture now'. I have not changed any of the system settings. I confirm my camera (Sony HDR-HC7) is recognised in system profiler and I can als
-
PR to PO - ME59 Doc type issue
Hi Experts, I am executing the functionality of auto PO and did all the master data settings. When I convert PR of doc type ZNB to PO via ME59, then it takes PO doc type as ZNB. Similarly, when I convert PR of doc type ZNB1 to PO via ME59, then it ta
-
SCRATCHED MY IPOD VIDEO SCREEN..HOW TO FIX?!
I've just purchased a 30gb ipod video, along with a skin. While i was putting on the skin, it roughly damaged the screen and scratched it. I am very dissapointed for the screen is suppose to prevent scratches, but while putting it on. It actually cre
-
HP dv6263cl DVD Rom unable to burn any dvd
dear hp/support team mates: i have purchased HP 6000 series notebook in Oct -07 and i m satisfied with its performance. intially i didn't have any data to burn on the dvd rom. but with passage of time i have data which requires backup on dvd rom. now
-
is it possible to center a img, where is dynamicly load to htmlText-field? just found this: Livedocs align in the img-tag is just possible for "right" or "left", but not "center"? is there a workaround or trick for this?