]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.server/src/org/simantics/db/server/protocol/GetChangeSetDataFunction.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.server / src / org / simantics / db / server / protocol / GetChangeSetDataFunction.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db.server.protocol;\r
13 \r
14 import java.nio.ByteOrder;\r
15 \r
16 public class GetChangeSetDataFunction extends AbstractFunction {\r
17     public long minChangeSetId = 0;\r
18     public long maxChangeSetId = 0;\r
19     public boolean failed = false;\r
20     public GetChangeSetDataFunction() {\r
21         super(MessageNumber.GetChangeSetDataRequest, MessageNumber.GetChangeSetDataResponse);\r
22     }\r
23     public GetChangeSetDataFunction(long minChangeSetId, long maxChangeSetId) {\r
24         super(MessageNumber.GetChangeSetDataRequest, MessageNumber.GetChangeSetDataResponse);\r
25         this.minChangeSetId = minChangeSetId;\r
26         this.maxChangeSetId = maxChangeSetId;\r
27     }\r
28     @Override\r
29     public DataBuffer serialize(ByteOrder byteOrder) {\r
30         buffer.clear();\r
31         buffer.order(byteOrder);\r
32         buffer.put(minChangeSetId);\r
33         buffer.put(maxChangeSetId);\r
34         buffer.mark();\r
35         return buffer;\r
36     }\r
37     @Override\r
38     public void deserialize(int receivedNumber_, DataBuffer dataBuffer) {\r
39         receivedNumber = receivedNumber_;\r
40         if (notRightDataForUs())\r
41             return;\r
42         failed = dataBuffer.get(failed);\r
43         gotResponse();\r
44     }\r
45 }\r