@Override public boolean apply(String input) { return CustomAttribute.getIfExists(input)==null; } };
public static CustomAttribute get(String name) { CustomAttribute ret = getIfExists(name); if(ret==null) throw new IllegalArgumentException("Custom attribute with name '"+name+"' was not found"); return ret; }
public static CustomAttribute create(String name, OType type, Class<?> javaClass, Object defaultValue, boolean encode, boolean hiearchical) { CustomAttribute ret = getIfExists(name); if(ret!=null) throw new IllegalArgumentException("Custom attribute with name '"+name+"' is already exist"); ret = new CustomAttribute(name, type, javaClass, defaultValue, encode, hiearchical); return ret; }
public static CustomAttribute getOrCreate(String name, OType type, Class<?> javaClass, Object defaultValue, boolean encode, boolean hiearchical) { CustomAttribute ret = getIfExists(name); return ret != null ? ret : create(name, type, javaClass, defaultValue, encode, hiearchical); }
@Override protected Comparable<?> comparableValue(OProperty input, String sortParam) { CustomAttribute custom = CustomAttribute.getIfExists(sortParam); if(custom!=null) { Object value = custom.getValue(input); return value instanceof Comparable?(Comparable<?>)value:null; } else return super.comparableValue(input, sortParam); }
else if((CustomAttribute.ON_CREATE_FIELDS.getName().equals(critery)) && (custom = CustomAttribute.getIfExists(critery)) != null) : new ArrayList<String>()); else if((custom = CustomAttribute.getIfExists(critery))!=null)
@SuppressWarnings("unchecked") @Override protected V getValue(OProperty entity, String critery) { CustomAttribute custom; if(OPropertyPrototyper.COLLATE.equals(critery)) { OCollate collate = entity.getCollate(); return (V)(collate!=null?collate.getName():null); } else if((custom = CustomAttribute.getIfExists(critery))!=null) { return custom.getValue(entity); } else { return (V) PropertyResolver.getValue(critery, entity); } }
else if((CustomAttribute.ON_CREATE_FIELDS.getName().equals(critery)) && (custom = CustomAttribute.getIfExists(critery)) != null) else if((custom = CustomAttribute.getIfExists(critery))!=null)
@Override protected void setValue(OProperty entity, String critery, V value) { ODatabaseDocument db = OrientDbWebSession.get().getDatabase(); db.commit(); try { CustomAttribute custom; if(OPropertyPrototyper.COLLATE.equals(critery)) { entity.setCollate((String)value); } else if((custom = CustomAttribute.getIfExists(critery))!=null) { custom.setValue(entity, value); } else { PropertyResolver.setValue(critery, entity, value, null); } } finally { db.begin(); } }
final CustomAttribute customAttr = CustomAttribute.getIfExists(critery);