Save objects in ATG
Save objects in ATG:
Hi,
I was recently being interviewed for an ATG job which involved custom development. I was asked to describe the development that I did. When I mentioned that I used RQL to persist data in repository items, the interviewer broke in with "RQL?" I said "yes RQL" and then there was a long silence. She then replied "why would you use RQL? in ATG you just save objects" I don't know what she is referring to, can anybody explain what she meant?
Yes, there are different methods that can be called to persist your changes.
- MutableRepository.updateItem() is called to update an existing items and is used in conjunction to MutableRepositoryItem.setPropertyValue()
- MutableRepository.createItem() followed by MutableRepository.addItem() is called to create a new item
- MutableRepository.removeItem() is called to delete and existing item
Similar Messages
-
Hi,
I have some confusions about Order object in ATG. Please see -
When actually ATG creates an Order object and how?
Is there any scenario where we should use synchronize on Order object?
An ItemPricingEngine invoked through a price droplet. How/when an OrderPricingEngine gets invoked?
Thanks.Hi,
Don't get confused that we need to synchronize only those things which are shared between multiple users.
We should synchronize order because there should not be more than one thread/process updating it , else you will get inconsistencies and invalid version exceptions as already pointed by gurvinder.
About your 3rd point :
pricing can be invoked in many ways from many places , like droplet , formhandlers , pipelines etc.
Enable loggingdebug on important components like OrderPricingEngine , ItemPricingEngine , Pricing tools and various Pricing calculators and study the logs then you will be clear on what is invoked and when is invoked. -
How to save object to SQLite?
Hi,
I am confusing with this.
How to save object (instance of class) to SQLite and read the
object back to Flex?
Thanks
MarkSQLite is a relational database, not an object-oriented
database, so you can't just spit an object into it without
translation. You
could serialize it with JSON or XML and store that in a
column, but then you're giving up most of the benefit of a proper
database engine. It's best to flatten the object yourself into the
database structure. How you do that, exactly, depends on your
object structure(s).
So, if you have an object like this:
var foo:Object = { bar: 'qux', bletch: new Date(), farbly: [
42, 69 ] };
you probably need two tables to represent it: a main "foos"
table (a collection of foo objects) and a separate "farblys" table
to hold the array elements. This separation of arrays out into a
table of their own linked to the original table is called
normalization.
Normalization will be covered in any decent tutorial book on
SQL databases. You'll need to get one to best understand how to
utilize SQLite, or anything like it. I got a lot out of
The
Practical SQL Handbook. I doubt that it covers SQLite
specifically. I have an older edition, so I can't check, but the
current edition was released about the same time that SQLite was,
and SQLite took some time to get noticed. The
SQLite Documentation
will fill in the gaps. The main thing to beware of is that SQLite
doesn't support all the advanced things you will read about in a
general SQL book.
If you don't want to mess with all this object-relational
mapping and normalization stuff, and you don't have much data to
store, you might look into Flash Local Stored Objects (LSO), also
called "Flash cookies". The runtime has a default limit of 100 KB
of data per application. The advantage of LSOs is that you can use
them like any other ActionScript object, and Flash handles the
storage details for you. It's great for configuration data and
small bits of user data. -
Exception Thrown when trying to save object to disk
Alright,
So I've got an object that looks like this
private class InputData implements Serializable {
public String name = "";
public String condition = "";
public String value = "";
public String[] productTypes = new String[]{};
public String[] ticketStates = new String[]{};
public String fieldName = "";
public String startDate = "";
public String endDate = "";
public String dateRange = "";
............................It has two constructors and overrides the toString() method. I'm trying to save it to a file with the following
private void saveSearchesToDisk() {
File f = new File(SAVED_SEARCHES_DIR, SAVED_SEARCHES_FILE);
InputData[] data = ...
try {
FileOutputStream fos = new FileOutputStream(f);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeInt(data.length);
for (int i = 0; i < data.length; i++) {
oos.writeObject(data);
oos.flush();
oos.close();
fos.close();
}catch(FileNotFoundException e) {
e.printStackTrace();
catch(IOException e) {
System.out.println(e.getMessage() + " hi hi hi hi");
e.printStackTrace();
I'm getting this exception, and I have no idea why???
java.io.NotSerializableException: com.sun.java.swing.plaf.windows.XPStyleAny ideas?I think you are misunderstanding something.
The reason why the outer members are being serialized, or attempted to be serialized, is because of the inner object's hidden link to the outer object. So the outer object is reachable from the inner object, and the outer data members are reachable from the outer object. There is no hidden link from the inner object directly to the outer object's members if that's what you're talking about. So there is no need for the notation you are talking about and so it doesn't exist.
So the question remains, do you want the outer object serialized or not? -
Save object state but not the data
Hi Everyone,
I'm trying to serialize a form so that I can recover the state information such as size of the form at close, size of splitpane separator, and size of each column of a JTable within the form.
However, I don't want to save the JTable's data. Also, I'm not sure about the procedure for deserialization.
For example if I have a line like:
frame.getContentPane().add(new JTable(tableModel));
next time I read the form, it already has the table within it so I shouldn't really create it or add the JTable to it, am I right?
Any comment to clarify this is really appreciated.
Thanks,
AlOk here is what you got to do just like createing your own subclass of JFrame
you should also create subclesses all the GUI componants you going to use in the application that need their state saved and restored.
All those class should implement a comman interface which has getState and setState (Ex:- CJTextArea, CJTextField, CJTable, CJFrame, CJInternalFrame, CJPanel .....). and thos subclasses should be used to create the widows
You will also need a several state classes for various types of components
such as
ComponentState -- Super class
ContainerState -- to hold stateobjects given by the components in a perticuler Container (ex:- JPanel)
FrameState
TextCompState -- text components (JTextField,JTextArea)
ListState
TableState
and the getStste and setSatate of the form should be written to return an object which contains the state of the form and all the other state objects returned by its nested components.
This kind of thing is done in most of the software organization in (Not just to restor the state but for many different tasks) that develop large applications with complex user interfaces.
Its worth spending some time to devalop such an API becouse it can be used in any programdeveloped after that.
The company I work has done excatly that some time ago but I cant post any code here (You know why) -
Hi all,
i have to save an instance in memory because i need the information later.
The Programm goes like this:
1) Get instance1
2) call sap-classes and methods
3) create instance2
4) Call function to show instance2
5) Start BDT functions. And at this point i loose my information about instance1
how can i write the instance1 into "global memory" for accessing all data all the time?
Thanks
stefanHi Stefan,
If you want to save an instance of a class in memory, you can use persistent classes.
Generally ABAP programs work with data and objects that are valid at
runtime. They are transient i.e. temporary and disappear when program ends.
To store this data permanently and independently of the program context,
i.e. persistently, it must be stored in the database. This means instances of
global classes can be written to database tables.
Persistent Services in ABAP Objects can be used to write the current attribute
values of objects defined as persistent to associated transparent tables.
On request, these values can be imported from the tables and assigned to an
object previously defined as persistent.
To use persistent services for objects, their types must be created as
persistent classes in Class Builder.
Send me your mail ID so that I can pass you a document on creation of persistent classes.
Award points if found useful.
Regards
Indrajit. -
I want to save some objects from my program. I have the url (getClass().getResource("resources/state.ser")) but can't find how to create a writer from a url that can write an object.
Ruskin wrote:
I want to save some objects from my program. I have the url (getClass().getResource("resources/state.ser")) but can't find how to create a writer from a url that can write an object.If the resource is in a Jar you're out of luck. It cannot be written.
The general approach is to..
1) If the resource exists at a known path(a) use that resource path. If not, get the URL from the Jar, read the bytes, and store it at the known path.
2) Gain a File object to the resource on the known path.
3) Get an InputStream to read from the File object.
4) Get an OutputStream to write to the File object.
a) Something like ${user.home}/com/your/resources/state.ser
There are other options that can be used for sand-boxed code. Depending on the contents of the ser (is that a serialised object?) you might write the data to other places than a file.
BTW - these questions are much more easily and better answered if you can put aside what you are trying to do, and instead tell us what you are trying to achieve. An example of the latter is "I want to offer the end user the program ability to save/restore the application state between runs". -
How can i save object in file ?
For example I have some object in the memory, and i want to save it on the disk, and after i'm going load this object in memory and work with him...How can i do it ?
May be I must use JavaSpaces technology (but i don't enought knows this) ?
Please help me.
[email protected]Serializing an Object:
try
ObjectOutputStream myOutput ObjectOutputStream(new FileOutputStream("objects.out"));
myOutput.writeObject("Hello! How are you on this very fine day?");
out.close()
catch(IOException e)
System.err.println("Doh! You're probably writing to a file that you don't have permissions to access!");
catch(ClassNotFoundException e)
System.err.println("You should only get this if you're using some strange reflection stuff, or just try to output something that doesn't exist.. I don't really know why the compiler wouldn't catch this error instead otherwise");
Getting that object back:
try
ObjectInputStream inObjects = new ObjectInputStream(new FileInputStream("objects.out"));
String myObj = (String)in.readObject();
System.out.println(myObj);
Pretty simple. If you want to be more practical, and store more than one type of object in that file, you can use relfection:
-Jason Thomas. -
How to save object to a local file.
Hello all.
I need to save an object, i.e. an ABAP program, to a local file and then be able to "import" it into another system.
I am not talking about the lines of codes that can be saved as a local file, but the whole program including screens and so on. Something similar to releasing a transport with object R3TR PROG ZMYPROGRAM to another system, but instead to the local desktop.
Anyone would know if this can be done?
Regards
LandeHi,
Vist the Link for complete Download there are some utility programs.
http://www.dalestech.com
Regards
vijay -
TextLayout not Serializable AND final class - can't extend and save objects
As the title reads, I am using a TextLayout object in a class called Foo.
I want to be able to serialize Foo and save it to the HD. This can't be done because TextLayout does not implement Serializable.
So I tried to create a new class that extended the TextLayout class. This wasn't possible because TextLayout is defined as:
public final class TextLayout
extends Object
implements Cloneable
Basically, I have no clue how to be able to save my Foo class to the HD since I can't serialize the TextLayout object inside the Foo class. I would really appreciate help, because it is quite important that this works.
Thanks.Siniz wrote:
I have never dabbled with with transient variables, but I just read up on it and understand what you are getting at. Is this really the only way?
The reason why I need to use TextLayout is because I need the bounding box of the text. I see no other way to get a bounding box around text than using TextLayout.That's a question for the swing/awt forums.
I am also not entirely sure what you mean when you say I should write my own writeObject and readObject methods? You are saying I should entirely ditch the ObjectOutputStream methods?No, you implement those methods on your class in order to customize serialization. Please see the javadocs on the Serializable interface. -
Block users not to be able to save objects as $tmp (local object)
Hi,
We don't want any user to save their changes to a local object ($tmp) in the process of creating a change request.
Is there any way to block users from using this? Please help.
Thanks
VijayHi Vijay,
As per my understanding, $tmp usage cannot be blocked completely.
Its usage can be restricted by using the authorization object S_DEVELOP as per the Note 395937.
I think this should be relevant for your requirement.
Regards,
Srikishan -
FM to Save Objects to Favorites Role
Hi,
Does anyone know if a function module which saves some object to the users' favorites role?
Where can I find a description of all FMs?
Thanks.PRGN_GENER_CREATE_URL will allow you to save a URL to favorites in SAP.
-
HI
how an order object is created in atg after adding an item to cart
please give me clear picturebelow threads will be helpful :
Order Object Creation
Order Creation for Anonymous and Registered/Loggedin User -
Not able to save Objects in Oraganisational management
Dear Gurus,
When i am creating Objects in OM system was given error message it is not saving objects, objects are creating in golden master server but unable to create objects in testing and quality.
Please guide me how ti solve this issue.Hi,
Now problem is solved by maintaining the switch.
Thank you very much.
Cheers -
Hello, I am concerned with how to save a Vector into a file. Can anyone help me ?
[url http://java.sun.com/j2se/1.5.0/docs/api/java/io/BufferedWriter.html]java.io.BufferedWriter
Maybe you are looking for
-
Why does my left earbud not work with my ipod touch (no erbud set will work)
the left earbud will skip and sometiimes not even work when i plug it into my ipod touch 3g. it not even a year old and this happens with any set of earbuds i use even new from the store.
-
How to setup a canon ip2600 printer without the cd?
how to setup a canon ip2600 printer without the cd? Solved! Go to Solution.
-
How to import a playlist in Home Sharing From Computer to ...
How to import a playlist in Home Sharing From Computer to computer and other devices?
-
How to execute dir dos command in Runtime Execution
Hi All, Does anybody know how to execute the dir command in DOS in the runtime execution for example, when we open the command prompt, c:\Documents and Settings\java> e: e:\cd java e:\dir *.* how we can list the directory in runtime execution?
-
I develop a web application in mvc 3 and it's seems to Ok on my end system as well as on my IIs (when I hosted on my System's IIS 7) But there is a problem when I hosted this web application on a web hosting server I got Error when i deal with some d