Java Code Examples for com.orientechnologies.orient.core.sql.OSQLEngine

The following examples show how to use com.orientechnologies.orient.core.sql.OSQLEngine. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: nexus-public   Source File: OrientBootstrap.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private void registerCustomFunctions(final Iterable<OSQLFunctionAbstract> functions) {
  log.debug("Registering custom OrientDB functions");
  for (OSQLFunctionAbstract function : functions) {
    log.debug("Registering OrientDB function " + function.getName());
    OSQLEngine.getInstance().registerFunction(function.getName(), function);
  }
}
 
Example 2
Source Project: orientdb-lucene   Source File: OLuceneIndexPlugin.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void startup() {
  super.startup();
  Orient.instance().addDbLifecycleListener(this);

  OIndexes.registerFactory(new OLuceneIndexFactory(true));
  OSQLEngine.registerOperator(new OLuceneTextOperator());
  OSQLEngine.registerOperator(new OLuceneWithinOperator());
  OSQLEngine.registerOperator(new OLuceneNearOperator());
  OLogManager.instance().info(this, "Lucene index plugin installed and active. Lucene version: %s",
      OLuceneIndexManagerAbstract.LUCENE_VERSION);
}
 
Example 3
Source Project: Orienteer   Source File: OIndexMetaPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void setValue(OIndex<?> entity, String critery, V value) {
	ODatabaseDocument db = OrientDbWebSession.get().getDatabase();
	db.commit();
	try
	{
		if(OIndexPrototyper.DEF_COLLATE.equals(critery))
		{
			if(value!=null)
			{
				String collate = value.toString();
				entity.getDefinition().setCollate(OSQLEngine.getCollate(collate));
			}
			else
			{
				entity.getDefinition().setCollate(null);
			}
		}
		else
		{
			PropertyResolver.setValue(critery, entity, value, null);
		}
	} finally
	{
		db.begin();
	}
}
 
Example 4
Source Project: Orienteer   Source File: OIndexMetaPanel.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected Component resolveComponent(String id, DisplayMode mode,
		String critery) {
	if(DisplayMode.VIEW.equals(mode))
	{
		if(OIndexPrototyper.DEF_CLASS_NAME.equals(critery))
		{
			return new OClassViewPanel(id, new OClassModel((IModel<String>)getModel()));
		}
		else if(OIndexPrototyper.DEF_NULLS_IGNORED.equals(critery))
		{
			return new BooleanViewPanel(id, (IModel<Boolean>)getModel());
		}
		//Default component for view
		return new Label(id, getModel());
	}
	else if(DisplayMode.EDIT.equals(mode))
	{
		boolean isProto = getEntityObject() instanceof IPrototype<?>;
		if(OIndexPrototyper.NAME.equals(critery) && isProto)
		{
			return new TextField<V>(id, getModel()).setType(String.class).setRequired(true);
		}
		else if(OIndexPrototyper.TYPE.equals(critery) && isProto)
		{
			return new DropDownChoice<String>(id, (IModel<String>)getModel(), INDEX_TYPES).setRequired(true);
		}
		else if(OIndexPrototyper.ALGORITHM.equals(critery) && isProto)
		{
			return new DropDownChoice<String>(id, (IModel<String>)getModel(), ALGORITHMS).setNullValid(true);
		}
		else if(OIndexPrototyper.DEF_COLLATE.equals(critery))
		{
			OIndex<?> index = getEntityObject();
			if(!(index.getDefinition() instanceof OCompositeIndexDefinition)
					&& (!isProto || index.getDefinition().getFields().size()==1))
			{
				return new DropDownChoice<String>(id, (IModel<String>)getModel(), Lists.newArrayList(OSQLEngine.getCollateNames())).setNullValid(true);
			}
		}
		else if(OIndexPrototyper.DEF_NULLS_IGNORED.equals(critery))
		{
			return new CheckBox(id, (IModel<Boolean>)getModel());
		}
		else if(OIndexPrototyper.METADATA.equals(critery) && isProto)
		{
			return new TextArea<>(id, getModel()).setType(ODocument.class);
		}
		//Default component for edit is view
		return resolveComponent(id, DisplayMode.VIEW, critery);
	}
	else return null;
}