Object Structure creation where main obejct is a view - maximo

If main object of an application is a view, then how can we create an object structure for that application?
Which application to be included?

We can create object structures for an object which is view as well.
Say for example, WOACTIVITY is the main object in Activities and Tasks application which is a view of WORKORDER object. You can create an object structure for WOACTIVITY object and you can give activity as the application. However giving the application while creating OS is not mandatory.
I hope I answered your question!

Related

Is the default behaviour for NSManagedObjectContext save() method a blocking method?

To be very specific: If I get the managed object context from the app delegate and do not set any parameters on it, what happens when running inserts, updates followed by save()?
Does the app block on save() until done?
Yes, the save method blocks. It's not even a default-- that's how it is, always. Does't matter if the context came from the app delegate or somewhere else, save is a synchronous method.
This what it came down to:
Normally, when I create an object, I only set the main key (properties that don't change through the lifecycle of the object) on creation. I then use an update method to complete the creation. In this particular case, I changed one property on the server from 'creational' property to 'updateable' property, but I missed it in the app. So the app was deleting the objects only to have the server create them again a bit later...

Invoke onExit() manually in SAPUI5

Is there is a way to invoke onExit() Life cycle hook manually?
If you´re talking about the onExit function of your controller you can! However, you should consider the View Lifecycle. According to this Lifecycle the framework will automatically call the onExit hook for you:
onExit(): Called when the view is destroyed; used to free resources and finalize activities
Source: SAPUI5 Documentation
Since it is a function which belongs to your controller you are able to call it manually by this.onExit() (in your controller).
However, this shouldn´t be necessary. To act according to the lifecycle you can call .destroy() of your view which destroys the view, the controller and all associated children.
destroy(): Cleans up the resources associated with this element and all its children.
Source: SAPUI5 Documentation

NSFetchedResultController not getting updated

I am using a UICollectionView to manage a to-do list with a NSFetchedResultController and RestKit. When I am creating/updating an element with the postObject:/putObject: methods, NSFetchedResultController does not get updated. If I call the reload method on the collection view new objects are not present. The only solution I found is reloading all the objects with getObjectsAtPath.
New objects are well added to the backend storage as well as in the local SQLite database. I set up the NSFetchedResultController's delegate correctly and initialized it with the mainQueueManagedObjectContext.

Sending custom objects across portlets in liferay

I'm having serious issues trying to send share custom objects between portlets in liferay. I have a Hook Plugin, with a servlet filter, which loads an object of Type MyCustomClass and inserts it into the request object as a parameter.
When i try to read this object in a portlet's render() i get a ClassCastException, though i am casting the object to the same class.
I understand that liferay plugins have different contexts, and i already tried to change the classloader before loading the object in the bean and portlet like this:
ClassLoader portalcl = PortalClassLoaderUtil.getClassLoader();
ClassLoader currentcl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(portalcl);
//do my stuff
Thread.currentThread().setContextClassLoader(currentcl);
however, it did not solved the problem, and the only way i found to solve the problem is to serialize the object into a json string, and deserialize it whenever i need it.
Isn't this kinda lame ? Does anyone know a better solution ?
Regards, DS
It sounds like the main problem you're seeing is that two different class loaders are loading the class which techncally makes them different classes (which it seems like you've already determined).
I haven't used LifeRay much but this has been a problem I've seen on other platforms as well. We were using WebSphere and solved this problem by putting the common MyCustomClass into a shared library that was on the server classpath. This way the server will load the class and make it available to all applications on the server through the server's single classloader. If you let each application load the class then you'll keep seeing this exception.

How would you inject and handle a database object from an object pool into a resource?

i've been thinking about implementing a object pool for jcouchdb objects for jersey. Now i am asking myself what would be the best way to deliver a jcouchdb instance to the resource endpoints.
I expect the pool to have a method for requesting an jcouchdb object and for releasing it so that it can be reused.
My first idea was to implement a InjectableProvider as a singleton an use a annotation in the resource endpoint to "grab" it. The InjectableProvider then returns an jcouchdb object from the object pool and marks it as busy. How can i release the jcouchdb object after I've used it? And i would request a jcouchdb object for every resource endpoint instance even if i never need it?! (don't know when the annotated objects get instantiated)
Another idea i was thinking about was to attach the object pool to the servlet context (with set attribute).
Any other ideas?
I am basically a bit confused when i comes to shared resources and jersey. Hopefully someone can clear things up for me.
Thanks
If you do exactly as you just said, your code would look like this:
public class MyResource{
#GET
#RequestMapping("/bleh")
public Response getValue(#Context JCouchDBObject object){
//manipulate object
}
}
#Provider
public class MyProvider extends InjectableProvider<Context, Parameter>{
public Injectable<JCouchDBObject> getInjectable(ComponentContext context, Context hp, Parameter param) {
//GetObject and return
}
}
I've never worked with JCouchDB, but unless each object is linked to the DB connection pool - there is nothing to manually release - all of this will be handled for you.
But: This is not what the InjectableProvider was designed for. Typically, the InjectableProvider will be used to create and resolve some sort of request object (such as the JCouchDBObject's ID, etc). Then you should use a service to collect the JCouchDBObject and handling any manually release there.

Resources