All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.continual.services.model.impl.json.CommonRelationSelector Maven / Gradle / Ivy

There is a newer version: 0.3.16
Show newest version
package io.continual.services.model.impl.json;

import java.util.LinkedList;

import io.continual.services.model.core.Model;
import io.continual.services.model.core.ModelRelationInstance;
import io.continual.services.model.core.ModelRelationList;
import io.continual.services.model.core.ModelRequestContext;
import io.continual.services.model.core.exceptions.ModelRequestException;
import io.continual.services.model.core.exceptions.ModelServiceException;
import io.continual.services.model.impl.common.BaseRelationSelector;
import io.continual.util.naming.Path;

public class CommonRelationSelector extends BaseRelationSelector implements Model.RelationSelector
{
	public CommonRelationSelector ( CommonJsonDbModel model, Path obj )
	{
		super ( model, obj );
	}

	@SuppressWarnings("deprecation")
	@Override
	public ModelRelationList getRelations ( ModelRequestContext context ) throws ModelServiceException, ModelRequestException
	{
		final String named = getNameFilter ();
		
		final LinkedList result = new LinkedList<> ();
		if ( wantInbound() ) result.addAll ( getModel().getInboundRelationsNamed ( context, getObject(), named ) );
		if ( wantOutbound() ) result.addAll ( getModel().getOutboundRelationsNamed ( context, getObject(), named ) );

		return ModelRelationList.simpleListOfCollection ( result );
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy