
net.alantea.glideui.utils.LinkAccess Maven / Gradle / Ivy
The newest version!
package net.alantea.glideui.utils;
import java.util.HashMap;
import java.util.Map;
import net.alantea.glide.Direction;
import net.alantea.glide.Entity;
import net.alantea.glide.Relation;
public class LinkAccess
{
/** The name. */
private String name;
/** Defines the class objects to search in. */
private Class> target;
/** Defines the method name for validate objects in listing. */
private String validator;
/** Defines the direction to search. */
private Direction direction = Direction.OUTGOING;
private Class extends Relation> relationType;
private Class extends Entity> relationTarget;
/** The key. */
private String key;
/** The page. */
private String page;
/** The type. */
private String type;
/** The order. */
private int order;
/** The multiple. */
private boolean multiple;
/** The create. */
private boolean create;
/** The editable. */
private boolean editable;
/** The attrs. */
Map attrs = new HashMap<>();
/**
* Instantiates a new link access.
*
* @param name the name
* @param key the key
* @param editable the editable
* @param page the page
* @param type the type
* @param target the target
* @param relationType the relation type
* @param relationTarget the relation target
* @param direction the direction
* @param order the order
* @param validator the validator
* @param multiple the multiple
* @param create the create
* @param map the map
*/
public LinkAccess(String name, String key, boolean editable, String page, String type, Class> target,
Class extends Relation> relationType, Class extends Entity> relationTarget,
Direction direction, int order, String validator, boolean multiple, boolean create, Map map)
{
super();
this.name = name;
this.key = key;
this.editable = editable;
this.page = (page == null) ? "" : page;
this.type = (type == null) ? "LINK" : type;
this.target = target;
this.relationType = (relationType == null) ? Relation.class : relationType;
this.relationTarget = (relationTarget == null) ? Entity.class : relationTarget;
this.direction = (direction == null) ? Direction.OUTGOING : direction;
this.order = order;
this.validator = (validator == null) ? "" : validator;
this.multiple = multiple;
this.create = create;
this.attrs.putAll(map);
}
public Class> getTarget()
{
return target;
}
public boolean isMultiple()
{
return multiple;
}
/**
* Gets the editable.
*
* @return the editable
*/
public boolean isEditable()
{
return editable;
}
public boolean isCreate()
{
return create;
}
public String getValidator()
{
return validator;
}
public Direction getDirection()
{
return direction;
}
public Class extends Relation> getRelationType()
{
return relationType;
}
public Class extends Entity> getRelationTarget()
{
return relationTarget;
}
/**
* Gets the name.
*
* @return the name
*/
public String getName()
{
return name;
}
/**
* Gets the key.
*
* @return the key
*/
public String getKey()
{
return key;
}
/**
* Gets the page.
*
* @return the page
*/
public String getPage()
{
return page;
}
/**
* Gets the type.
*
* @return the type
*/
public String getType()
{
return type;
}
/**
* Gets the order.
*
* @return the order
*/
public int getOrder()
{
return order;
}
/**
* Gets the attribute.
*
* @param key the key
* @return the attribute
*/
public String getAttribute(String key)
{
return attrs.get(key);
}
/**
* Gets the attributes.
*
* @return the attributes
*/
public Map getAttributes()
{
return attrs;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy