Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8611f175b37633a701fd184b82ec770d94f2f4cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**
 * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Simon McDuff - initial API and implementation
 *    Ibrahim Sallam - code refactoring for CDO 3.0
 */
package org.eclipse.emf.cdo.server.internal.objectivity.schema;

import org.eclipse.emf.cdo.server.internal.objectivity.db.ObjySchema;

import com.objy.as.app.Class_Object;
import com.objy.as.app.Proposed_Class;
import com.objy.as.app.d_Access_Kind;
import com.objy.as.app.d_Module;
import com.objy.as.app.ooBaseType;
import com.objy.db.app.ooId;

public class ObjyFeatureMapEntry
{
  protected int tagId;

  protected ooId object;

  protected Class_Object classObject;

  public static final String MapEntryClassName = "ObjyFeatureMapEntry";

  public static final String EntryName = "tagId";

  public static final String EntryObject = "object";

  public static void buildSchema()
  {
    d_Module top_mod = ObjySchema.getTopModule();
    if (top_mod.resolve_class(MapEntryClassName) == null && top_mod.resolve_proposed_class(MapEntryClassName) == null)
    {
      // Proposed_Class B = new Proposed_Class(MapEntryClassName);
      Proposed_Class B = top_mod.propose_new_class(MapEntryClassName);
      B.add_base_class(com.objy.as.app.d_Module.LAST, com.objy.as.app.d_Access_Kind.d_PUBLIC, "ooObj");

      B.add_basic_attribute(com.objy.as.app.d_Module.LAST, // Access kind
          d_Access_Kind.d_PUBLIC, // Access kind
          ObjyFeatureMapEntry.EntryName, // Attribute name
          1, // # elements in fixed-size array
          ooBaseType.ooINT32); // type
      B.add_ref_attribute(com.objy.as.app.d_Module.LAST, d_Access_Kind.d_PUBLIC, // Access kind
          ObjyFeatureMapEntry.EntryObject, // Attribute name
          1, // # elements in fixed-size array
          "ooObj", // Type of numeric data
          false); // Short reference

      // top_mod.propose_new_class(B);
    }
  }

  /****
   * Factory.
   * 
   * @param tagId
   * @param oid
   */
  public ObjyFeatureMapEntry(int tagId, ooId oid, ooId near)
  {
    this.tagId = tagId;
    object = oid;

    classObject = Class_Object.new_persistent_object(ObjySchema.getObjyClass(MapEntryClassName).getASClass(), near,
        false);

    classObject.nset_ooId(EntryObject, object);
  }

  public ObjyFeatureMapEntry(Class_Object classObject)
  {
    this.classObject = classObject;
    tagId = classObject.nget_numeric(EntryName).intValue();
    object = classObject.nget_ooId(EntryObject);
  }

  public int getTagId()
  {
    return tagId;
  }

  public void setTagId(int tagId)
  {
    this.tagId = tagId;
  }

  public ooId getObject()
  {
    return object;
  }

  public void setObject(ooId object)
  {
    this.object = object;
  }

  public ooId getOid()
  {
    return classObject.objectID();
  }
}

Back to the top