Codota Logo
GroupNotFoundException.<init>
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
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

/** {@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

/**
 * 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} */
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

    • Running tasks concurrently on multiple threads
    • setContentView (Activity)
    • getExternalFilesDir (Context)
    • orElseThrow (Optional)
    • FileNotFoundException (java.io)
      Thrown when a file specified by a program cannot be found.
    • SecureRandom (java.security)
      This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
    • NumberFormat (java.text)
      The abstract base class for all number formats. This class provides the interface for formatting and
    • Comparator (java.util)
      A Comparator is used to compare two objects to determine their ordering with respect to each other.
    • Modifier (javassist)
      The Modifier class provides static methods and constants to decode class and member access modifiers
    • BoxLayout (javax.swing)
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now