use of org.bimserver.models.store.ByteArrayType in project BIMserver by opensourceBIM.
the class BimServer method cloneAndAdd.
public Type cloneAndAdd(DatabaseSession session, Type input) throws BimserverDatabaseException {
if (input instanceof BooleanType) {
BooleanType booleanType = session.create(BooleanType.class);
booleanType.setValue(((BooleanType) input).isValue());
session.store(booleanType);
return booleanType;
} else if (input instanceof StringType) {
StringType stringType = session.create(StringType.class);
stringType.setValue(((StringType) input).getValue());
session.store(stringType);
return stringType;
} else if (input instanceof DoubleType) {
DoubleType doubleType = session.create(DoubleType.class);
doubleType.setValue(((DoubleType) input).getValue());
session.store(doubleType);
return doubleType;
} else if (input instanceof LongType) {
LongType longType = session.create(LongType.class);
longType.setValue(((LongType) input).getValue());
session.store(longType);
return longType;
} else if (input instanceof ByteArrayType) {
ByteArrayType byteArrayType = session.create(ByteArrayType.class);
byteArrayType.setValue(((ByteArrayType) input).getValue());
session.store(byteArrayType);
return byteArrayType;
}
return null;
}
use of org.bimserver.models.store.ByteArrayType in project BIMserver by opensourceBIM.
the class PluginConfiguration method fromDefaults.
public static PluginConfiguration fromDefaults(ObjectDefinition settingsDefinition) {
if (settingsDefinition == null) {
return null;
}
PluginConfiguration pluginConfiguration = new PluginConfiguration();
for (ParameterDefinition parameterDefinition : settingsDefinition.getParameters()) {
if (parameterDefinition.getDefaultValue() != null) {
Type value = parameterDefinition.getDefaultValue();
Object newValue = null;
if (value instanceof PrimitiveType) {
if (value instanceof BooleanType) {
newValue = ((BooleanType) value).isValue();
} else if (value instanceof StringType) {
newValue = ((StringType) value).getValue();
} else if (value instanceof DoubleType) {
newValue = ((DoubleType) value).getValue();
} else if (value instanceof LongType) {
newValue = ((LongType) value).getValue();
} else if (value instanceof ByteArrayType) {
newValue = ((ByteArrayType) value).getValue();
}
} else if (value instanceof ArrayType) {
throw new NotImplementedException("ArrayType not implemented");
} else if (value instanceof ObjectType) {
throw new NotImplementedException("ObjectType not implemented");
}
pluginConfiguration.values.put(parameterDefinition.getIdentifier(), newValue);
}
}
return pluginConfiguration;
}
Aggregations