congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
GroupNotFoundException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.ff4j.exception.GroupNotFoundException
constructor

Best Java code snippets using org.ff4j.exception.GroupNotFoundException.<init> (Showing top 20 results out of 315)

origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public Map<String, Feature> readGroup(String groupName) {
  Util.assertParamHasLength(groupName, "groupName");
  Map < String, Feature > features = readAll();
  Map < String, Feature > group = new HashMap<String, Feature>();
  for (Map.Entry<String,Feature> uid : features.entrySet()) {
    if (groupName.equals(uid.getValue().getGroup())) {
      group.put(uid.getKey(), uid.getValue());
    }
  }
  if (group.isEmpty()) {
    throw new GroupNotFoundException(groupName);
  }
  return group;
}
 
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public Map<String, Feature> readGroup(String groupName) {
  Util.assertParamHasLength(groupName, "groupName");
  Map < String, Feature > features = readAll();
  Map < String, Feature > group = new HashMap< String, Feature >();
  for (Map.Entry<String,Feature> uid : features.entrySet()) {
    if (groupName.equals(uid.getValue().getGroup())) {
      group.put(uid.getKey(), uid.getValue());
    }
  }
  if (group.isEmpty()) {
    throw new GroupNotFoundException(groupName);
  }
  return group;
}

origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void enableGroup(String groupName) {
  Util.assertHasLength(groupName);
  Response cRes = ClientHttpUtils.invokePostMethod(getGroups()
      .path(groupName)
      .path(OPERATION_ENABLE), authorizationHeaderValue);
  if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
    throw new GroupNotFoundException(groupName);
  }
  if (Status.NO_CONTENT.getStatusCode() != cRes.getStatus()) {
    throw new FeatureAccessException(CANNOT_GRANT_ROLE_ON_FEATURE_AN_HTTP_ERROR + cRes.getStatus() + OCCURED);
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void disableGroup(String groupName) {
  Util.assertHasLength(groupName);
  Response cRes = ClientHttpUtils.invokePostMethod(getGroups()
      .path(groupName)
      .path(OPERATION_DISABLE), authorizationHeaderValue);
  
  if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
    throw new GroupNotFoundException(groupName);
  }
  if (Status.NO_CONTENT.getStatusCode() != cRes.getStatus()) {
    throw new FeatureAccessException(CANNOT_GRANT_ROLE_ON_FEATURE_AN_HTTP_ERROR + cRes.getStatus() + OCCURED);
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Transactional
public void enableGroup(String groupName) {
  if (groupName == null || groupName.isEmpty()) {
    throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
  }
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  getJdbcTemplate().update(getQueryBuilder().enableGroup(), groupName);
}
origin: ff4j/ff4j

/**
 * Validate feature uid.
 *
 * @param uid
 *      target uid
 */
protected void assertGroupExist(String groupName) {
  Util.assertHasLength(groupName);
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
}

origin: ff4j/ff4j

/** {@inheritDoc} */
@Transactional
public void disableGroup(String groupName) {
  if (groupName == null || groupName.isEmpty()) {
    throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
  }
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  getJdbcTemplate().update(getQueryBuilder().disableGroup(), groupName);
}
origin: ff4j/ff4j

/** {@inheritDoc} */
public Map<String, Feature> readGroup(String groupName) {
  if (groupName == null || groupName.isEmpty()) {
    throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
  }
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  LinkedHashMap<String, Feature> mapFP = new LinkedHashMap<String, Feature>();
  List<Feature> lFp = getJdbcTemplate().query(getQueryBuilder().getFeatureOfGroup(), FMAPPER, groupName);
  for (Feature flipPoint : lFp) {
    mapFP.put(flipPoint.getUid(), flipPoint);
  }
  return mapFP;
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Transactional
public void removeFromGroup(String uid, String groupName) {
  if (uid == null || uid.isEmpty()) {
    throw new IllegalArgumentException(FEATURE_IDENTIFIER_CANNOT_BE_NULL_NOR_EMPTY);
  }
  if (groupName == null || groupName.isEmpty()) {
    throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
  }
  if (!exist(uid)) {
    throw new FeatureNotFoundException(uid);
  }
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  getJdbcTemplate().update(getQueryBuilder().addFeatureToGroup(), "", uid);
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public Map<String, Feature> readGroup(String groupName) {
  if (groupName == null || groupName.isEmpty()) {
    throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
  }
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  LinkedHashMap<String, Feature> mapFP = new LinkedHashMap<String, Feature>();
  for (DBObject dbObject : getFeaturesCollection().find(BUILDER.getGroupName(groupName))) {
    Feature feature = MAPPER.mapFeature(dbObject);
    mapFP.put(feature.getUid(), feature);
  }
  return mapFP;
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void disableGroup(String groupName) {
  if (groupName == null || groupName.isEmpty()) {
    throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
  }
  ClientResponse cRes = getGroups().path(groupName).path(OPERATION_DISABLE).post(ClientResponse.class);
  if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
    throw new GroupNotFoundException(groupName);
  }
  if (Status.NO_CONTENT.getStatusCode() != cRes.getStatus()) {
    throw new FeatureAccessException(CANNOT_GRANT_ROLE_ON_FEATURE_AN_HTTP_ERROR + cRes.getStatus() + OCCURED);
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void disableGroup(String groupName) {
  if (groupName == null || groupName.isEmpty()) {
    throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
  }
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  for (Document document: getFeaturesCollection().find(BUILDER.getGroupName(groupName))) {
    Object enabled = BUILDER.getEnable(false);
    getFeaturesCollection().updateOne(document, new Document(MONGO_SET, enabled));
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void enableGroup(String groupName) {
  if (groupName == null || groupName.isEmpty()) {
    throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
  }
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  for (Document document : getFeaturesCollection().find(BUILDER.getGroupName(groupName))) {
    Object enabled = BUILDER.getEnable(true);
    getFeaturesCollection().updateOne(document, new Document(MONGO_SET, enabled));
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void enableGroup(String groupName) {
  if (groupName == null || groupName.isEmpty()) {
    throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
  }
  ClientResponse cRes = getGroups().path(groupName).path(OPERATION_ENABLE).post(ClientResponse.class);
  if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
    throw new GroupNotFoundException(groupName);
  }
  if (Status.NO_CONTENT.getStatusCode() != cRes.getStatus()) {
    throw new FeatureAccessException(CANNOT_GRANT_ROLE_ON_FEATURE_AN_HTTP_ERROR + cRes.getStatus() + OCCURED);
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void removeFromGroup(String featureId, String groupName) {
  Util.assertParamHasLength(groupName, "groupName (#2)");
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  // retrieve
  Feature f = read(featureId);
  f.setGroup(null);
  // persist modification
  update(f);
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void removeFromGroup(String featureId, String groupName) {
  Util.assertParamHasLength(groupName, "groupName (#2)");
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  // retrieve
  Feature f = read(featureId);
  f.setGroup(null);
  // persist modification
  update(f);
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void removeFromGroup(String featureId, String groupName) {
  Util.assertParamHasLength(groupName, "groupName (#2)");
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  // retrieve
  Feature f = read(featureId);
  f.setGroup(null);
  // persist modification
  update(f);
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void enableGroup(String groupName) {
  if (groupName == null || groupName.isEmpty()) {
    throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
  }
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  for (DBObject dbObject : getFeaturesCollection().find(BUILDER.getGroupName(groupName))) {
    Object enabledd = BUILDER.getEnable(true);
    getFeaturesCollection().update(dbObject, BasicDBObjectBuilder.start(MONGO_SET, enabledd).get());
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void removeFromGroup(String featureId, String groupName) {
  Util.assertParamHasLength(groupName, "groupName (#2)");
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  // retrieve
  Feature f = read(featureId);
  f.setGroup(null);
  // persist modification
  update(f);
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void disableGroup(String groupName) {
  if (groupName == null || groupName.isEmpty()) {
    throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
  }
  if (!existGroup(groupName)) {
    throw new GroupNotFoundException(groupName);
  }
  for (DBObject dbObject : getFeaturesCollection().find(BUILDER.getGroupName(groupName))) {
    Object enabledd = BUILDER.getEnable(false);
    getFeaturesCollection().update(dbObject, BasicDBObjectBuilder.start(MONGO_SET, enabledd).get());
  }
}
org.ff4j.exceptionGroupNotFoundException<init>

Javadoc

Constructor by name.

Popular methods of GroupNotFoundException

    Popular in Java

    • Making http post requests using okhttp
    • getExternalFilesDir (Context)
    • scheduleAtFixedRate (ScheduledExecutorService)
    • putExtra (Intent)
    • Connection (java.sql)
      A connection represents a link from a Java application to a database. All SQL statements and results
    • ArrayList (java.util)
      ArrayList is an implementation of List, backed by an array. All optional operations including adding
    • Date (java.util)
      A specific moment in time, with millisecond precision. Values typically come from System#currentTime
    • Scanner (java.util)
      A parser that parses a text string of primitive types and strings with the help of regular expressio
    • BlockingQueue (java.util.concurrent)
      A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
    • Join (org.hibernate.mapping)
    • From CI to AI: The AI layer in your organization
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now