private void fakePrimitiveRead(EClassifier classifier, ByteBuffer buffer) throws BimserverDatabaseException { if (classifier == EcorePackage.eINSTANCE.getEString()) { int length = buffer.getInt(); if (length != -1) { buffer.position(buffer.position() + length); } } else if (classifier == EcorePackage.eINSTANCE.getEInt() || classifier == EcorePackage.eINSTANCE.getEIntegerObject()) { buffer.position(buffer.position() + 4); } else if (classifier == EcorePackage.eINSTANCE.getELong() || classifier == EcorePackage.eINSTANCE.getELongObject()) { buffer.position(buffer.position() + 8); } else if (classifier == EcorePackage.eINSTANCE.getEFloat() || classifier == EcorePackage.eINSTANCE.getEFloatObject()) { buffer.position(buffer.position() + 4); } else if (classifier == EcorePackage.eINSTANCE.getEDouble() || classifier == EcorePackage.eINSTANCE.getEDoubleObject()) { buffer.position(buffer.position() + 8); } else if (classifier == EcorePackage.eINSTANCE.getEBoolean() || classifier == EcorePackage.eINSTANCE.getEBooleanObject()) { buffer.position(buffer.position() + 1); } else if (classifier == EcorePackage.eINSTANCE.getEDate()) { buffer.position(buffer.position() + 8); } else if (classifier == EcorePackage.eINSTANCE.getEByteArray()) { int length = buffer.getInt(); if (length != -1) { buffer.position(buffer.position() + length); } } else { throw new BimserverDatabaseException("Unimplemented " + classifier); } }
@Override public void migrate(Schema schema, DatabaseSession databaseSession) { EClass metricsClass = schema.createEClass("store", "Metrics"); EClass interfaceMetricClass = schema.createEClass("store", "InterfaceMetric"); EClass methodMetricClass = schema.createEClass("store", "MethodMetric"); schema.createEReference(metricsClass, "interfaces", interfaceMetricClass, Multiplicity.MANY).getEAnnotations().add(createEmbedsReferenceAnnotation()); schema.createEReference(interfaceMetricClass, "methods", methodMetricClass, Multiplicity.MANY).getEAnnotations().add(createEmbedsReferenceAnnotation()); schema.createEAttribute(interfaceMetricClass, "name", EcorePackage.eINSTANCE.getEString()); schema.createEAttribute(methodMetricClass, "name", EcorePackage.eINSTANCE.getEString()); schema.createEAttribute(methodMetricClass, "nrCalls", EcorePackage.eINSTANCE.getELongObject()); schema.createEAttribute(methodMetricClass, "lastCall", EcorePackage.eINSTANCE.getEDate()); schema.createEAttribute(methodMetricClass, "averageMs", EcorePackage.eINSTANCE.getELongObject()); schema.createEAttribute(methodMetricClass, "shortestMs", EcorePackage.eINSTANCE.getELongObject()); schema.createEAttribute(methodMetricClass, "longestMs", EcorePackage.eINSTANCE.getELongObject()); }
buffer.putFloat((Float) value); } else if (type == EcorePackage.eINSTANCE.getELong() || type == EcorePackage.eINSTANCE.getELongObject()) { if (value == null) { buffer.putLong(0L);
buffer.putFloat((Float) value); } else if (type == EcorePackage.eINSTANCE.getELong() || type == EcorePackage.eINSTANCE.getELongObject()) { if (value == null) { buffer.putLong(0L);
buffer.get(result, 0, 4); return result; } else if (classifier == EcorePackage.eINSTANCE.getELong() || classifier == EcorePackage.eINSTANCE.getELongObject()) { byte[] result = new byte[8]; buffer.get(result, 0, 8);
} else if (classifier == EcorePackage.eINSTANCE.getEShort() || classifier == EcorePackage.eINSTANCE.getEShortObject()) { return buffer.getShort(); } else if (classifier == EcorePackage.eINSTANCE.getELong() || classifier == EcorePackage.eINSTANCE.getELongObject()) { return buffer.getLong(); } else if (classifier == EcorePackage.eINSTANCE.getEFloat() || classifier == EcorePackage.eINSTANCE.getEFloatObject()) {
buffer.putFloat((Float) value); } else if (type == EcorePackage.eINSTANCE.getELong() || type == EcorePackage.eINSTANCE.getELongObject()) { ensureCapacity(buffer.position(), 8); if (value == null) {
} else if (classifier == EcorePackage.eINSTANCE.getELong() || classifier == EcorePackage.eINSTANCE.getELongObject()) { return buffer.getLong(); } else if (classifier == EcorePackage.eINSTANCE.getEFloat() || classifier == EcorePackage.eINSTANCE.getEFloatObject()) {
public int getPrimitiveSize(EDataType eDataType) { if (eDataType == EcorePackage.eINSTANCE.getEInt() || eDataType == EcorePackage.eINSTANCE.getEIntegerObject()) { return 4; } else if (eDataType == EcorePackage.eINSTANCE.getEFloat() || eDataType == EcorePackage.eINSTANCE.getEFloatObject()) { return 4; } else if (eDataType == EcorePackage.eINSTANCE.getEBoolean() || eDataType == EcorePackage.eINSTANCE.getEBooleanObject()) { return 1; } else if (eDataType == EcorePackage.eINSTANCE.getEDate()) { return 8; } else if (eDataType == EcorePackage.eINSTANCE.getELong() || eDataType == EcorePackage.eINSTANCE.getELongObject()) { return 8; } else if (eDataType == EcorePackage.eINSTANCE.getEString()) { return AVERAGE_STRING_SIZE; } else if (eDataType == EcorePackage.eINSTANCE.getEDouble() || eDataType == EcorePackage.eINSTANCE.getEDoubleObject()) { return 8; } else if (eDataType == EcorePackage.eINSTANCE.getEByteArray() || eDataType.getName().equals("DataHandler")) { return AVERAGE_BYTE_ARRAY_SIZE; } else if (eDataType instanceof EEnum) { return 4; } throw new RuntimeException("Unimplemented: " + eDataType); }
private int getPrimitiveSize(EDataType eDataType, Object val) { if (eDataType == EcorePackage.eINSTANCE.getEInt() || eDataType == EcorePackage.eINSTANCE.getEIntegerObject()) { return 4; } else if (eDataType == EcorePackage.eINSTANCE.getEFloat() || eDataType == EcorePackage.eINSTANCE.getEFloatObject()) { return 4; } else if (eDataType == EcorePackage.eINSTANCE.getEBoolean() || eDataType == EcorePackage.eINSTANCE.getEBooleanObject()) { return 1; } else if (eDataType == EcorePackage.eINSTANCE.getEDate()) { return 8; } else if (eDataType == EcorePackage.eINSTANCE.getEShort()) { return 2; } else if (eDataType == EcorePackage.eINSTANCE.getELong() || eDataType == EcorePackage.eINSTANCE.getELongObject()) { return 8; } else if (eDataType == EcorePackage.eINSTANCE.getEDouble() || eDataType == EcorePackage.eINSTANCE.getEDoubleObject()) { return 8; } else if (eDataType == EcorePackage.eINSTANCE.getEString()) { if (val != null) { return 4 + ((String) val).getBytes(Charsets.UTF_8).length; } return 4; } else if (eDataType == EcorePackage.eINSTANCE.getEByteArray()) { if (val != null) { return 4 + ((byte[]) val).length; } return 4; } else if (eDataType instanceof EEnum) { return 4; } throw new RuntimeException("Unimplemented: " + eDataType); }
public int getPrimitiveSize(EDataType eDataType, Object val) { if (eDataType == EcorePackage.eINSTANCE.getEInt() || eDataType == EcorePackage.eINSTANCE.getEIntegerObject()) { return 4; } else if (eDataType == EcorePackage.eINSTANCE.getEShort() || eDataType == EcorePackage.eINSTANCE.getEShortObject()) { return 2; } else if (eDataType == EcorePackage.eINSTANCE.getEFloat() || eDataType == EcorePackage.eINSTANCE.getEFloatObject()) { return 4; } else if (eDataType == EcorePackage.eINSTANCE.getEBoolean() || eDataType == EcorePackage.eINSTANCE.getEBooleanObject()) { return 1; } else if (eDataType == EcorePackage.eINSTANCE.getEDate()) { return 8; } else if (eDataType == EcorePackage.eINSTANCE.getELong() || eDataType == EcorePackage.eINSTANCE.getELongObject()) { return 8; } else if (eDataType == EcorePackage.eINSTANCE.getEDouble() || eDataType == EcorePackage.eINSTANCE.getEDoubleObject()) { return 8; } else if (eDataType == EcorePackage.eINSTANCE.getEString()) { if (val != null) { return 4 + ((String) val).getBytes(Charsets.UTF_8).length; } return 4; } else if (eDataType == EcorePackage.eINSTANCE.getEByteArray()) { if (val != null) { return 4 + ((byte[]) val).length; } return 4; } else if (eDataType instanceof EEnum) { return 4; } throw new RuntimeException("Unimplemented: " + eDataType); }
private void createConcreteRevisionClass() { schema.createEAttribute(concreteRevisionClass, "id", ecorePackage.getEIntegerObject(), Multiplicity.SINGLE); concreteRevisionProject = schema.createEReference(concreteRevisionClass, "project", project, Multiplicity.SINGLE); schema.createEAttribute(concreteRevisionClass, "checksum", ecorePackage.getEByteArray(), Multiplicity.SINGLE); concreteRevisionRevisions = schema.createEReference(concreteRevisionClass, "revisions", revisionClass, Multiplicity.MANY); schema.createEAttribute(concreteRevisionClass, "size", ecorePackage.getELongObject(), Multiplicity.SINGLE); schema.createEAttribute(concreteRevisionClass, "date", ecorePackage.getEDate(), Multiplicity.SINGLE); schema.createEAttribute(concreteRevisionClass, "lastError", ecorePackage.getEString(), Multiplicity.SINGLE); schema.createEAttribute(concreteRevisionClass, "clear", ecorePackage.getEBoolean(), Multiplicity.SINGLE); }
private String convertType(EClassifier type) { if (type == EcorePackage.eINSTANCE.getEDouble() || type == EcorePackage.eINSTANCE.getEDoubleObject()) { return "double"; } else if (type == EcorePackage.eINSTANCE.getEInt() || type == EcorePackage.eINSTANCE.getEIntegerObject()) { return "int"; } else if (type == EcorePackage.eINSTANCE.getEShort() || type == EcorePackage.eINSTANCE.getEShortObject()) { return "short"; } else if (type == EcorePackage.eINSTANCE.getEBoolean() || type == EcorePackage.eINSTANCE.getEBooleanObject()) { return "boolean"; } else if (type == EcorePackage.eINSTANCE.getEByteArray()) { return "bytearray"; } else if (type == EcorePackage.eINSTANCE.getELong() || type == EcorePackage.eINSTANCE.getELongObject()) { return "long"; } else if (type == EcorePackage.eINSTANCE.getEString()) { return "string"; } else if (type instanceof EEnum) { return "enum"; } return type.getName(); } }
private void createRevisionClass() { schema.createEAttribute(revisionClass, "id", ecorePackage.getEIntegerObject(), Multiplicity.SINGLE); schema.createEReference(revisionClass, "user", user, Multiplicity.SINGLE); schema.createEAttribute(revisionClass, "date", ecorePackage.getEDate(), Multiplicity.SINGLE); schema.createEAttribute(revisionClass, "comment", ecorePackage.getEString(), Multiplicity.SINGLE); schema.createEAttribute(revisionClass, "size", ecorePackage.getELongObject(), Multiplicity.SINGLE); revisionConcreteRevisions = schema.createEReference(revisionClass, "concreteRevisions", concreteRevisionClass, Multiplicity.MANY); schema.createEReference(revisionClass, "lastConcreteRevision", concreteRevisionClass, Multiplicity.SINGLE); revisionCheckouts = schema.createEReference(revisionClass, "checkouts", checkoutClass, Multiplicity.MANY); revisionProject = schema.createEReference(revisionClass, "project", project, Multiplicity.SINGLE); schema.createEAttribute(revisionClass, "tag", ecorePackage.getEString(), Multiplicity.SINGLE); schema.createEAttribute(revisionClass, "lastError", ecorePackage.getEString(), Multiplicity.SINGLE); schema.createEAttribute(revisionClass, "bmi", ecorePackage.getEIntegerObject(), Multiplicity.SINGLE); }
if (eFeature.getEType() == EcorePackage.eINSTANCE.getEString()) { bimServerClient.getLowLevelInterface().addStringAttribute(getTransactionId(), idEObject.getOid(), eFeature.getName(), notification.getNewStringValue()); } else if (eFeature.getEType() == EcorePackage.eINSTANCE.getELong() || eFeature.getEType() == EcorePackage.eINSTANCE.getELongObject()) { throw new UnsupportedOperationException(); } else if (eFeature.getEType() == EcorePackage.eINSTANCE.getEDouble() || eFeature.getEType() == EcorePackage.eINSTANCE.getEDoubleObject()) {
} else if (eType == EcorePackage.eINSTANCE.getEInt() || eType == EcorePackage.eINSTANCE.getEIntegerObject()) { return "List<Integer>"; } else if (eType == EcorePackage.eINSTANCE.getELong() || eType == EcorePackage.eINSTANCE.getELongObject()) { return "List<Long>"; } else if (eType == EcorePackage.eINSTANCE.getEDouble() || eType == EcorePackage.eINSTANCE.getEDoubleObject()) { } else if (eType == EcorePackage.eINSTANCE.getEInt() || eType == EcorePackage.eINSTANCE.getEIntegerObject()) { return "Integer"; } else if (eType == EcorePackage.eINSTANCE.getELong() || eType == EcorePackage.eINSTANCE.getELongObject()) { return "Long"; } else if (eType == EcorePackage.eINSTANCE.getEShort() || eType == EcorePackage.eINSTANCE.getEShortObject()) {
} else if (eFeature.getEType() == EcorePackage.eINSTANCE.getELong() || eFeature.getEType() == EcorePackage.eINSTANCE.getELongObject()) { lowLevelInterface.setWrappedLongAttribute(getTransactionId(), idEObject.getOid(), foundReference.getName(), idEObject.eClass().getName(), (Long) newValue); } else if (eFeature.getEType() == EcorePackage.eINSTANCE.getEDouble() || eFeature.getEType() == EcorePackage.eINSTANCE.getEDoubleObject()) { if (eFeature.getEType() == EcorePackage.eINSTANCE.getEString()) { lowLevelInterface.setStringAttribute(getTransactionId(), idEObject.getOid(), eFeature.getName(), (String) newValue); } else if (eFeature.getEType() == EcorePackage.eINSTANCE.getELong() || eFeature.getEType() == EcorePackage.eINSTANCE.getELongObject()) { lowLevelInterface.setLongAttribute(getTransactionId(), idEObject.getOid(), eFeature.getName(), (Long) newValue); } else if (eFeature.getEType() == EcorePackage.eINSTANCE.getEDouble() || eFeature.getEType() == EcorePackage.eINSTANCE.getEDoubleObject()) { if (eFeature.getEType() == EcorePackage.eINSTANCE.getEString()) { lowLevelInterface.setStringAttribute(getTransactionId(), idEObject.getOid(), eFeature.getName(), (String) newValue); } else if (eFeature.getEType() == EcorePackage.eINSTANCE.getELong() || eFeature.getEType() == EcorePackage.eINSTANCE.getELongObject()) { lowLevelInterface.setLongAttribute(getTransactionId(), idEObject.getOid(), eFeature.getName(), (Long) newValue); } else if (eFeature.getEType() == EcorePackage.eINSTANCE.getEDouble() || eFeature.getEType() == EcorePackage.eINSTANCE.getEDoubleObject()) {
classifierDefaultMapping.put(EcorePackage.eINSTANCE.getEIntegerObject(), DBType.INTEGER); classifierDefaultMapping.put(EcorePackage.eINSTANCE.getELong(), DBType.BIGINT); classifierDefaultMapping.put(EcorePackage.eINSTANCE.getELongObject(), DBType.BIGINT); classifierDefaultMapping.put(EcorePackage.eINSTANCE.getEShort(), DBType.SMALLINT); classifierDefaultMapping.put(EcorePackage.eINSTANCE.getEShortObject(), DBType.SMALLINT);
schema.createEAttribute(databaseInformationClass, "numberOfRevisions", ecorePackage.getEIntegerObject(), Multiplicity.SINGLE); schema.createEAttribute(databaseInformationClass, "numberOfCheckouts", ecorePackage.getEIntegerObject(), Multiplicity.SINGLE); schema.createEAttribute(databaseInformationClass, "databaseSizeInBytes", ecorePackage.getELongObject(), Multiplicity.SINGLE); schema.createEAttribute(databaseInformationClass, "type", ecorePackage.getEString(), Multiplicity.SINGLE); schema.createEAttribute(databaseInformationClass, "created", ecorePackage.getEDate(), Multiplicity.SINGLE);
initEReference ( getDevice_DataModuleOptions (), this.getDataModuleOptions (), null, "dataModuleOptions", null, 0, 1, Device.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED ); //$NON-NLS-1$ initEReference ( getDevice_HiveProperties (), theWorldPackage.getPropertyEntry (), null, "hiveProperties", null, 0, -1, Device.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED ); //$NON-NLS-1$ initEAttribute ( getDevice_SpontaneousBufferWindow (), theEcorePackage.getELongObject (), "spontaneousBufferWindow", null, 0, 1, Device.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED ); //$NON-NLS-1$ initEAttribute ( getDevice_CyclicPeriod (), theEcorePackage.getELongObject (), "cyclicPeriod", null, 0, 1, Device.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED ); //$NON-NLS-1$ initEAttribute ( getExporterItemInterceptor_Port (), ecorePackage.getEShort (), "port", "2404", 1, 1, ExporterItemInterceptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED ); //$NON-NLS-1$ //$NON-NLS-2$ initEReference ( getExporterItemInterceptor_HiveProperties (), theWorldPackage.getPropertyEntry (), null, "hiveProperties", null, 0, -1, ExporterItemInterceptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED ); //$NON-NLS-1$ initEAttribute ( getExporterItemInterceptor_SpontaneousBufferWindow (), theEcorePackage.getELongObject (), "spontaneousBufferWindow", null, 0, 1, ExporterItemInterceptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED ); //$NON-NLS-1$ initEAttribute ( getExporterItemInterceptor_CyclicPeriod (), theEcorePackage.getELongObject (), "cyclicPeriod", null, 0, 1, ExporterItemInterceptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED ); //$NON-NLS-1$