Java Code Examples for com.orientechnologies.orient.core.metadata.schema.OClass#getName()

The following examples show how to use com.orientechnologies.orient.core.metadata.schema.OClass#getName() . 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 File: OClassIntrospector.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@Override
public OQueryDataProvider<ODocument> getDataProviderForGenericSearch(OClass oClass, IModel<String> queryModel) {
	String searchSql = CustomAttribute.SEARCH_QUERY.getValue(oClass);
	String sql=null;
	if(!Strings.isEmpty(searchSql)) {
		String upper = searchSql.toUpperCase().trim();
		if(upper.startsWith("SELECT")) sql = searchSql;
		else if(upper.startsWith("WHERE")) sql = "select from "+oClass.getName()+" "+searchSql;
		else {
			LOG.error("Unrecognized search sql: "+searchSql);
		}
	}

	if(sql==null) sql = "select from "+oClass.getName()+" where any() containstext :query";

	return new OQueryDataProvider<ODocument>(sql).setParameter("query", queryModel);
}
 
Example 2
Source File: OClassModel.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
@Override
protected void handleObject(OClass object) {
	String name = object!=null?object.getName():null;
	if(classNameModel!=null)
	{
		classNameModel.setObject(name);
	}
	else
	{
		classNameModel = Model.of(name);
	}
}
 
Example 3
Source File: OIndexPrototyper.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
@Override
protected OIndex<?> createInstance(OIndex proxy) {
	OSchema schema = OrientDbWebSession.get().getDatabase().getMetadata().getSchema();
	OClass oClass = schema.getClass(proxy.getDefinition().getClassName());
	String name = proxy.getName();
	List<String> fields = proxy.getDefinition().getFields();
	String type = proxy.getType();
	if(name==null) name=oClass.getName()+"."+fields.get(0);
	ODocument metadata = proxy.getMetadata();
	String algorithm = proxy.getAlgorithm();
	values.keySet().retainAll(RW_ATTRS);
	return oClass.createIndex(name, type, null, metadata, algorithm, fields.toArray(new String[0]));
}
 
Example 4
Source File: OLoggerEventDispatcherModelFactory.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
public OLoggerEventDispatcherModel createEventDispatcherModel(ODocument document) {
    OClass schemaClass = document.getSchemaClass();
    if (schemaClass != null) {
        switch (schemaClass.getName()) {
            case OLoggerEventDispatcherModel.CLASS_NAME:
                return new OLoggerEventDispatcherModel(document);
            case OLoggerEventFilteredDispatcherModel.CLASS_NAME:
                return new OLoggerEventFilteredDispatcherModel(document);
            case OLoggerEventMailDispatcherModel.CLASS_NAME:
                return new OLoggerEventMailDispatcherModel(document);
        }
    }
    return null;
}
 
Example 5
Source File: OArchitectClassesUtils.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public static OArchitectOClass toArchitectOClass(OClass oClass) {
    OArchitectOClass architectOClass = new OArchitectOClass(oClass.getName());
    architectOClass.setExistsInDb(true);

    architectOClass.setProperties(toOArchitectProperties(oClass, oClass.getSuperClasses()));
    architectOClass.setSuperClasses(toOArchitectClassNames(oClass.getSuperClasses()));
    architectOClass.setSubClasses(toOArchitectClassNames(oClass.getSubclasses()));
    architectOClass.setPageUrl("/class/" + oClass.getName());
    return architectOClass;
}
 
Example 6
Source File: ListboxVisualizer.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <V> Component createComponent(String id, DisplayMode mode,
		IModel<ODocument> documentModel, IModel<OProperty> propertyModel, IModel<V> valueModel) {
	if(DisplayMode.EDIT.equals(mode))
	{
		
		OProperty property = propertyModel.getObject();
		OClass oClass = property.getLinkedClass();
		if(oClass!=null) {
			IModel<List<ODocument>> choicesModel = new OQueryModel<ODocument>("select from "+oClass.getName()+" LIMIT 100");
			if(property.getType().isMultiValue())
			{
				return new ListMultipleChoice<ODocument>(id, (IModel<Collection<ODocument>>) valueModel, choicesModel, new ODocumentChoiceRenderer());
			}
			else
			{
				return new DropDownChoice<ODocument>(id, (IModel<ODocument>)valueModel, 
						choicesModel, new ODocumentChoiceRenderer())
						.setNullValid(!property.isNotNull());
			}
		} else {
			OrienteerWebSession.get()
				.warn(OrienteerWebApplication.get().getResourceSettings()
						.getLocalizer().getString("errors.listbox.linkedclassnotdefined", null, new OPropertyNamingModel(propertyModel)));
			return new Label(id, "");
		}
	}
	else
	{
		return null;
	}
}
 
Example 7
Source File: OClassClassNameConverter.java    From wicket-orientdb with Apache License 2.0 4 votes vote down vote up
@Override
public String convertToString(OClass value, Locale locale) {
	return value.getName();
}
 
Example 8
Source File: OClassChoiceRenderer.java    From wicket-orientdb with Apache License 2.0 4 votes vote down vote up
@Override
public Object getDisplayValue(OClass object) {
	return localize?new OClassNamingModel(object).getObject():object.getName();
}
 
Example 9
Source File: OClassChoiceRenderer.java    From wicket-orientdb with Apache License 2.0 4 votes vote down vote up
@Override
public String getIdValue(OClass object, int index) {
	return object.getName();
}
 
Example 10
Source File: OClassNamingModel.java    From wicket-orientdb with Apache License 2.0 4 votes vote down vote up
@Override
public String getResourceKey(OClass object) {
	return object.getName();
}
 
Example 11
Source File: OClassTextChoiceProvider.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public String getDisplayValue(OClass choice) {
    return choice.getName();
}
 
Example 12
Source File: OClassTextChoiceProvider.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public String getIdValue(OClass choice) {
    return choice.getName();
}
 
Example 13
Source File: ListOClassesModel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public String apply(OClass input) {
	return input.getName();
}
 
Example 14
Source File: ODocumentChoiceProvider.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
public ODocumentChoiceProvider(OClass oClass) {
    this.className =  oClass.getName();
    this.propertyName = getOClassIntrospector().getNameProperty(oClass).getName();
}