/** * Check that current feature does not exist. * * @param uid * current feature identifier.s */ protected void assertPropertyNotExist(String uid) { Util.assertHasLength(uid); if (existProperty(uid)) { throw new PropertyAlreadyExistException(uid); } }
/** {@inheritDoc} */ @Override public <T> void createProperty(Property<T> property) { if (property == null) { throw new IllegalArgumentException("Property cannot be null nor empty"); } if (existProperty(property.getName())) { throw new PropertyAlreadyExistException(property.getName()); } getCacheManager().putProperty(property); }
/** {@inheritDoc} */ @Override public <T> void createProperty(Property<T> property) { if (property == null) { throw new IllegalArgumentException("Property cannot be null nor empty"); } if (existProperty(property.getName())) { throw new PropertyAlreadyExistException(property.getName()); } wrapper.getCacheProperties().put(new Element(property.getName(), property)); }
Util.assertHasLength(ap.getName()); if (existProperty(ap.getName())) { throw new PropertyAlreadyExistException(ap.getName());
/** {@inheritDoc} */ public <T> void createProperty(Property<T> prop) { if (prop == null) { throw new IllegalArgumentException("Property cannot be null nor empty"); } if (existProperty(prop.getName())) { throw new PropertyAlreadyExistException(prop.getName()); } getPropertiesCollection().insertOne(PMAPPER.toStore(prop)); }
/** {@inheritDoc} */ public <T> void createProperty(Property<T> prop) { if (prop == null) { throw new IllegalArgumentException("Property cannot be null nor empty"); } if (existProperty(prop.getName())) { throw new PropertyAlreadyExistException(prop.getName()); } getPropertiesCollection().save(MAPPER.fromProperty2DBObject(prop)); }
/** {@inheritDoc} */ public <T> void createProperty(Property<T> value) { Util.assertNotNull(value); Util.assertHasLength(value.getName()); if (existProperty(value.getName())) { throw new PropertyAlreadyExistException("Property already exist"); } /* Now can process upsert through PUT HTTP method Response cRes = getStore().path(value.getName())// .request(MediaType.APPLICATION_JSON) .put(Entity.entity(new PropertyApiBean(value), MediaType.APPLICATION_JSON));*/ Response cRes = ClientHttpUtils .createRequest(getStore().path(value.getName()), authorization, null) .put(Entity.entity(new PropertyApiBean(value), MediaType.APPLICATION_JSON)); // Check response code CREATED or raised error if (Status.CREATED.getStatusCode() != cRes.getStatus()) { throw new FeatureAccessException("Cannot create properties, an HTTP error " + cRes.getStatus() + OCCURED); } }
/** {@inheritDoc} */ public <T> void createProperty(Property<T> ap) { Util.assertNotNull(ap); Connection sqlConn = null; PreparedStatement ps = null; try { sqlConn = getDataSource().getConnection(); if (existProperty(ap.getName())) { throw new PropertyAlreadyExistException(ap.getName()); } ps = sqlConn.prepareStatement(getQueryBuilder().createProperty()); ps.setString(1, ap.getName()); ps.setString(2, ap.getType()); ps.setString(3, ap.asString()); ps.setString(4, ap.getDescription()); if (ap.getFixedValues() != null && !ap.getFixedValues().isEmpty()) { String fixedValues = ap.getFixedValues().toString(); ps.setString(5, fixedValues.substring(1, fixedValues.length() - 1)); } else { ps.setString(5, null); } ps.executeUpdate(); } catch (SQLException sqlEX) { throw new PropertyAccessException("Cannot update properties database, SQL ERROR", sqlEX); } finally { // Connection is closed alse here within clos statement closeStatement(ps); closeConnection(sqlConn); } }
/** {@inheritDoc} */ public <T> void createProperty(Property<T> ap) { Util.assertNotNull(ap); Util.assertHasLength(ap.getName()); if (existProperty(ap.getName())) { throw new PropertyAlreadyExistException(ap.getName()); } String fixedValues = null; if (ap.getFixedValues() != null && ap.getFixedValues().size() > 0) { fixedValues = ap.getFixedValues().toString(); fixedValues = fixedValues.substring(1, fixedValues.length() - 1); } getJdbcTemplate().update(getQueryBuilder().createProperty(), ap.getName(), ap.getType(), ap.asString(), ap.getDescription(), fixedValues); }
/** * {@inheritDoc} */ public <T> void createProperty(Property<T> prop) { Util.assertNotNull(prop); if (existProperty(prop.getName())) { throw new PropertyAlreadyExistException(prop.getName()); } Jedis jedis = null; try { jedis = getJedis(); String name = prop.getName(); // Store the feature in the mapping bucket. jedis.sadd(KEY_PROPERTY_MAP, name); jedis.set(KEY_PROPERTY + name, prop.toJson()); jedis.persist(KEY_PROPERTY + name); } finally { if (jedis != null) { jedis.close(); } } }
/** {@inheritDoc} */ @Override public <T> void createProperty(Property<T> property) { if (property == null) { throw new IllegalArgumentException("Property cannot be null nor empty"); } if (existProperty(property.getName())) { throw new PropertyAlreadyExistException(property.getName()); } // Create property getDriver().putValue( getDriver().getPropertyKey(property.getName()), propertyMapper.toStore(property)); // Register in the dictionnary getDriver().registerProperty(property.getName()); }
/** {@inheritDoc} */ @Override public <T> void createProperty(Property<T> value) { Util.assertNotNull(value); Util.hasLength(value.getName()); if (existProperty(value.getName())) { throw new PropertyAlreadyExistException(value.getName()); } conf().addProperty(value.getName(), value.asString()); }
/** {@inheritDoc} */ public <T> void createProperty(Property<T> value) { Util.assertNotNull(value); Util.assertHasLength(value.getName()); if (existProperty(value.getName())) { throw new PropertyAlreadyExistException("Property already exist"); } ClientResponse cRes = getStore().path(value.getName())// .type(MediaType.APPLICATION_JSON) // .put(ClientResponse.class, new PropertyApiBean(value)); // Check response code CREATED or raised error if (Status.CREATED.getStatusCode() != cRes.getStatus()) { throw new FeatureAccessException("Cannot create properties, an HTTP error " + cRes.getStatus() + OCCURED); } }