/** * Check that current feature does not exist. * * @param uid * current feature identifier.s */ protected void assertFeatureNotExist(String uid) { Util.assertHasLength(uid); if (exist(uid)) { throw new FeatureAlreadyExistException(uid); } }
/** {@inheritDoc} */ @Override public void create(Feature fp) { if (fp == null) { throw new IllegalArgumentException("Feature cannot be null nor empty"); } if (exist(fp.getUid())) { throw new FeatureAlreadyExistException(fp.getUid()); } getCache().put(new Element(fp.getUid(), fp)); }
/** {@inheritDoc} */ @Override public void create(Feature fp) { if (fp == null) { throw new IllegalArgumentException("Feature cannot be null nor empty"); } if (exist(fp.getUid())) { throw new FeatureAlreadyExistException(fp.getUid()); } getCacheManager().putFeature(fp); }
/** {@inheritDoc} */ @Override public void create(Feature fp) { if (fp == null) { throw new IllegalArgumentException("Feature cannot be null nor empty"); } if (exist(fp.getUid())) { throw new FeatureAlreadyExistException(fp.getUid()); } /* Now can process upsert through PUT HTTP method Response cRes = getStore().path(fp.getUid())// .request(MediaType.APPLICATION_JSON) // .put(Entity.entity(new FeatureApiBean(fp), MediaType.APPLICATION_JSON));*/ Response cRes = ClientHttpUtils .createRequest(getStore().path(fp.getUid()), authorizationHeaderValue, null) .put(Entity.entity(new FeatureApiBean(fp), MediaType.APPLICATION_JSON)); // Check response code CREATED or raised error if (Status.CREATED.getStatusCode() != cRes.getStatus()) { throw new FeatureAccessException("Cannot create feature, an HTTP error " + cRes.getStatus() + OCCURED); } }
/** {@inheritDoc} */ @Override public void create(Feature fp) { if (fp == null) { throw new IllegalArgumentException("Feature cannot be null nor empty"); } if (exist(fp.getUid())) { throw new FeatureAlreadyExistException(fp.getUid()); } getFeaturesCollection().save(MAPPER.toDBObject(fp)); }
/** {@inheritDoc} */ @Override public void create(Feature fp) { if (fp == null) { throw new IllegalArgumentException("Feature cannot be null nor empty"); } if (exist(fp.getUid())) { throw new FeatureAlreadyExistException(fp.getUid()); } getFeaturesCollection().insertOne(FMAPPER.toStore(fp)); }
/** {@inheritDoc} */ @Override @Transactional public void create(Feature fp) { Util.assertNotNull(fp); if (exist(fp.getUid())) { throw new FeatureAlreadyExistException(fp.getUid()); } createCoreFeature(fp); createPermissions(fp); createProperties(fp); }
throw new FeatureAlreadyExistException(fp.getUid());
/** {@inheritDoc} */ @Override public void create(Feature fp) { if (fp == null) { throw new IllegalArgumentException("Feature cannot be null nor empty"); } if (exist(fp.getUid())) { throw new FeatureAlreadyExistException(fp.getUid()); } // Now can process upsert through PUT HTTP method ClientResponse cRes = getStore().path(fp.getUid())// .type(MediaType.APPLICATION_JSON) // .put(ClientResponse.class, new FeatureApiBean(fp)); // Check response code CREATED or raised error if (Status.CREATED.getStatusCode() != cRes.getStatus()) { throw new FeatureAccessException("Cannot create feature, an HTTP error " + cRes.getStatus() + OCCURED); } }
/** {@inheritDoc} */ @Override public void create(Feature fp) { Util.assertNotNull("Feature", fp); if (exist(fp.getUid())) { throw new FeatureAlreadyExistException(fp.getUid()); } Jedis jedis = null; try { String id = fp.getUid(); jedis = getJedis(); // Store the feature in the mapping bucket. jedis.sadd(KEY_FEATURE_MAP, id); jedis.set(KEY_FEATURE + id, fp.toJson()); jedis.persist(KEY_FEATURE + id); } finally { if (jedis != null) { jedis.close(); } } }
/** {@inheritDoc} */ @Override public void create(Feature feature) { if (feature == null) { throw new IllegalArgumentException("Feature cannot be null nor empty"); } if (exist(feature.getUid())) { throw new FeatureAlreadyExistException(feature.getUid()); } // Create feature key getDriver().putValue( getDriver().getFeatureKey(feature.getUid()), getFeatureMapper().toStore(feature)); // Register in the dictionnary getDriver().registerFeature(feature.getUid()); }
/** {@inheritDoc} */ @Override public void create(Feature fp) { if (fp == null) { throw new IllegalArgumentException("Feature cannot be null nor empty"); } if (exist(fp.getUid())) { throw new FeatureAlreadyExistException(fp.getUid()); } Transaction tx = graphDb.beginTx(); // Create core graphDb.execute(createQueryNewCoreFeature(fp)); // Create Flipping Strategy if (fp.getFlippingStrategy() != null) { graphDb.execute(createQueryFlippingStrategy(fp)); } // Create Group if (fp.getGroup() != null && !"".equals(fp.getGroup())) { addToGroup(fp.getUid(), fp.getGroup()); } tx.success(); // Create Properties if (fp.getCustomProperties() != null && fp.getCustomProperties().size() > 0) { for (String pName : fp.getCustomProperties().keySet()) { createProperty(fp.getProperty(pName), fp.getUid()); } } }