Java Code Examples for com.orientechnologies.orient.core.metadata.schema.OType#LINK

The following examples show how to use com.orientechnologies.orient.core.metadata.schema.OType#LINK . 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: InitTestModule.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
/**
 * Employee
 * name - String
 * id - Integer
 * roles - LinkedList
 * workPlace - Link (inverse with WorkPlace.employees)
 *
 * WorkPlace
 * name - String
 * id - Integer
 * employees - LinkList (inverse with Employee.workPlace)
 *
 * EmployeeRole
 * name - String
 * id - Integer
 * privilege - EmbeddedMap
 */
@Provides
@Singleton
public List<OArchitectOClass> provideTestClasses() {
    OArchitectOClass employee = new OArchitectOClass("Employee");
    OArchitectOClass workPlace = new OArchitectOClass("WorkPlace");

    OArchitectOProperty workPlaceProp = new OArchitectOProperty("workPlace", OType.LINK);
    OArchitectOProperty employees = new OArchitectOProperty("employees", OType.LINKLIST);

    workPlaceProp.setLinkedClass("WorkPlace")
            .setInversePropertyEnable(true)
            .setInverseProperty(employees);

    employees.setLinkedClass("Employee")
            .setInversePropertyEnable(true)
            .setInverseProperty(workPlaceProp);

    employee.setProperties(asList(
            new OArchitectOProperty("name", OType.STRING).setOrder(0),
            new OArchitectOProperty("id", OType.INTEGER).setOrder(10),
            workPlaceProp.setOrder(20),
            new OArchitectOProperty("testLink", OType.LINK).setOrder(30).setLinkedClass("WorkPlace")
    ));

    workPlace.setProperties(asList(
            new OArchitectOProperty("name", OType.STRING).setOrder(0),
            new OArchitectOProperty("id", OType.INTEGER).setOrder(10),
            employees.setOrder(20)
    ));

    return Arrays.asList(employee, workPlace);
}
 
Example 2
Source File: EmbeddedMapViewPanel.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public EmbeddedMapViewPanel(String id, final IModel<ODocument> documentModel, final IModel<OProperty> propertyModel) {
	super(id, new DynamicPropertyValueModel<Map<String, V>>(documentModel, propertyModel));
	OProperty property = propertyModel.getObject();
	final DefaultVisualizer visualizer = DefaultVisualizer.INSTANCE;
	final OType linkedType = property.getLinkedType();
	final OType oType = linkedType != null ? linkedType : (OType.LINKMAP.equals(property.getType()) ? OType.LINK :OType.ANY);
	IModel<Set<Map.Entry<String, V>>> entriesModel = new PropertyModel<>(getModel(), "entrySet()");
	ListView<Map.Entry<String, V>> listView = 
			new ListView<Map.Entry<String, V>>("items", new CollectionAdapterModel<>(entriesModel)) {

		@Override
		protected void populateItem(ListItem<Map.Entry<String, V>> item) {
			item.add(new Label("key", new PropertyModel<String>(item.getModel(), "key")));
			item.add(visualizer.createComponent("item", DisplayMode.VIEW, documentModel, propertyModel, oType, new PropertyModel<V>(item.getModel(), "value")));
		}
		
		@Override
		protected ListItem<Map.Entry<String, V>> newItem(int index, IModel<Map.Entry<String, V>> itemModel) {
			return new ListItem<Map.Entry<String, V>>(index, itemModel)
					{
						@Override
						public IMarkupFragment getMarkup(Component child) {
							if(child==null || !child.getId().equals("item")) return super.getMarkup(child);
							IMarkupFragment ret = markupProvider.provideMarkup(child);
							return ret!=null?ret:super.getMarkup(child);
						}
					};
		}
	};
	add(listView);
}
 
Example 3
Source File: IOSmsNotificationTransport.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@DAOField(linkedClass = OSmsSettings.CLASS_NAME, type = OType.LINK)
ODocument getSmsSettings();
 
Example 4
Source File: IOMailNotification.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@DAOField(linkedClass = OPreparedMail.CLASS_NAME, type = OType.LINK)
ODocument getPreparedMail();
 
Example 5
Source File: IOMailNotificationTransport.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@DAOField(linkedClass = OMailSettings.CLASS_NAME, type = OType.LINK)
ODocument getMailSettings();
 
Example 6
Source File: IONotification.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@DAOField(linkedClass = IONotificationStatus.CLASS_NAME, type = OType.LINK, notNull = true)
ODocument getStatus();
 
Example 7
Source File: IONotification.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@DAOField(linkedClass = IONotificationTransport.CLASS_NAME, type = OType.LINK, notNull = true)
ODocument getTransport();
 
Example 8
Source File: IOSmsNotification.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@DAOField(linkedClass = OPreparedSMS.CLASS_NAME, type = OType.LINK)
ODocument getPreparedSms();
 
Example 9
Source File: IONotificationStatusHistory.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@DAOField(linkedClass = IONotification.CLASS_NAME, inverse = "statusHistories", type = OType.LINK)
ODocument getNotification();
 
Example 10
Source File: IONotificationStatusHistory.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@DAOField(linkedClass = IONotificationStatus.CLASS_NAME, type = OType.LINK)
ODocument getStatus();
 
Example 11
Source File: EmbeddedMapEditPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
public EmbeddedMapEditPanel(String id, final IModel<ODocument> documentModel, final IModel<OProperty> propertyModel)
{
	super(id, new DynamicPropertyValueModel<Map<String, V>>(documentModel, propertyModel));
	setOutputMarkupId(true);
	OProperty property = propertyModel.getObject();
	final DefaultVisualizer visualizer = DefaultVisualizer.INSTANCE;
	final OType linkedType = property.getLinkedType();
	final OType oType = linkedType != null ? linkedType : (OType.LINKMAP.equals(property.getType()) ? OType.LINK :OType.ANY);
	listView = new ListView<Pair<V>>("items", new PropertyModel<List<Pair<V>>>(this, "data")) {

		@Override
		protected void populateItem(final ListItem<Pair<V>> item) {
			item.add(getKeyEditComponent(item));
			item.add(visualizer.createComponent("item", DisplayMode.EDIT, documentModel, propertyModel, oType, new PropertyModel<V>(item.getModel(), "value")));
			item.add(new AjaxFormCommand<Object>("remove", "command.remove")
					{
						@Override
						public void onClick(Optional<AjaxRequestTarget> targetOptional) {
							convertToData();
							getData().remove(item.getIndex());
							targetOptional.ifPresent(target -> target.add(EmbeddedMapEditPanel.this));
							listView.removeAll();
						}
					}.setDefaultFormProcessing(false)
					 .setAutoNotify(false)
					 .setBootstrapSize(BootstrapSize.EXTRA_SMALL)
					 .setBootstrapType(BootstrapType.DANGER)
					 .setIcon((String)null));
		}
		
		@Override
		protected ListItem<Pair<V>> newItem(int index, IModel<Pair<V>> itemModel) {
			return new ListItem<Pair<V>>(index, itemModel)
					{
						@Override
						public IMarkupFragment getMarkup(Component child) {
							if(child==null || !child.getId().equals("item")) return super.getMarkup(child);
							IMarkupFragment ret = markupProvider.provideMarkup(child);
							return ret!=null?ret:super.getMarkup(child);
						}
					};
		}

	};
	listView.setReuseItems(true);
	add(listView);
	add(new AjaxFormCommand<Pair<V>>("add", "command.add")
	{
		@Override
		public void onClick(Optional<AjaxRequestTarget> targetOptional) {
			convertToData();
			getData().add(new Pair<V>());
			targetOptional.ifPresent(target -> target.add(EmbeddedMapEditPanel.this));
			listView.removeAll();
		}
		
	}.setDefaultFormProcessing(false)
	 .setAutoNotify(false)
	 .setBootstrapSize(BootstrapSize.EXTRA_SMALL)
	 .setBootstrapType(BootstrapType.PRIMARY)
	 .setIcon((String)null));
}
 
Example 12
Source File: SuggestVisualizer.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
public SuggestVisualizer() {
    super(NAME, false, OType.LINK, OType.LINKLIST, OType.LINKSET);
}
 
Example 13
Source File: LinksAsEmbeddedVisualizer.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
public LinksAsEmbeddedVisualizer() {
	super(NAME, false, OType.LINK, OType.LINKLIST, OType.LINKBAG, OType.LINKSET, OType.LINKMAP);
}
 
Example 14
Source File: ListboxVisualizer.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
public ListboxVisualizer()
{
	super(NAME, false, OType.LINK, OType.LINKLIST, OType.LINKSET, OType.LINKBAG);
}