Tabnine Logo
GroupNotFoundException
Code IndexAdd Tabnine to your IDE (free)

How to use
GroupNotFoundException
in
org.ff4j.exception

Best Java code snippets using org.ff4j.exception.GroupNotFoundException (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 Map<String, Feature> readGroup(String groupName) {
  Util.assertParamHasLength(groupName, "groupName");
  Map < String, Feature > features = readAll();
  Map < String, Feature > group = new HashMap<>();
  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 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 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} */
@Override
public void removeFromGroup(String uid, String groupName) {
  Util.assertHasLength(uid, groupName);
  Response cRes = ClientHttpUtils.invokePostMethod(getStore()
      .path(uid)
      .path(OPERATION_REMOVEGROUP)
      .path(groupName), authorizationHeaderValue);
  if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
    throw new FeatureNotFoundException(uid);
  }
  if (Status.BAD_REQUEST.getStatusCode() == cRes.getStatus()) {
    throw new GroupNotFoundException(groupName);
  }
  if (Status.NO_CONTENT.getStatusCode() != cRes.getStatus()) {
    throw new FeatureAccessException("Cannot remove feature from group, an HTTP error " + cRes.getStatus() + OCCURED);
  }
}
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} */
public Map<String, Feature> readGroup(String groupName) {
  Util.assertHasLength(groupName);
  Response cRes = ClientHttpUtils.invokeGetMethod(getGroups().path(groupName), authorizationHeaderValue);
  if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
    throw new GroupNotFoundException(groupName);
  }
  if (Status.OK.getStatusCode() != cRes.getStatus()) {
    throw new FeatureAccessException(CANNOT_GRANT_ROLE_ON_FEATURE_AN_HTTP_ERROR + cRes.getStatus() + OCCURED);
  }
  String resEntity = cRes.readEntity(String.class);
  Feature[] fArray = parseFeatureArray(resEntity);
  Map<String, Feature> features = new HashMap<String, Feature>();
  for (Feature feature : fArray) {
    features.put(feature.getUid(), feature);
  }
  return features;
}
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 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 (Document document : getFeaturesCollection().find(BUILDER.getGroupName(groupName))) {
    Feature feature = FMAPPER.fromStore(document);
    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 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);
  }
  Document target = BUILDER.getFeatUid(uid);
  Document nGroupName = BUILDER.getGroupName("");
  getFeaturesCollection().updateOne(target, new Document(MONGO_SET, nGroupName));
}

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);
  }
}
org.ff4j.exceptionGroupNotFoundException

Javadoc

Group operations are available only if group exist, toherwise this exception is raised.

Most used methods

  • <init>
    Constructor by name.

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSharedPreferences (Context)
  • putExtra (Intent)
  • getExternalFilesDir (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Top Vim plugins
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