public static Uuid getDefaultInstance(String defaultValue) { return new Uuid(defaultValue); }
@Deprecated @Override protected String createFlowName() { StringBuilder sb = new StringBuilder(); sb.append(OFRendererConstants.INTENT_L2_FLOW_NAME); sb.append(endPointGroups.get(OFRendererConstants.SRC_END_POINT_GROUP_INDEX)); sb.append(endPointGroups.get(OFRendererConstants.DST_END_POINT_GROUP_INDEX)); sb.append(intent.getId().getValue()); return sb.toString(); }
@ConstructorProperties("value") public Uuid(java.lang.String _value) { if (_value != null) { check_valueLength(_value); } Preconditions.checkNotNull(_value, "Supplied value may not be null"); for (Pattern p : patterns) { Preconditions.checkArgument(p.matcher(_value).matches(), "Supplied value \"%s\" does not match required pattern \"%s\"", _value, p); } this._value = _value; }
@Override protected Object doExecute() throws Exception { Uuid uuid = Uuid.getDefaultInstance(id); if (provider.removeIntent(uuid)) { return String.format("Intent successfully removed (id: %s)", uuid.toString()); } else { return String.format("Error removing intent (id: %s)", uuid.toString()); } } }
Uuid uuid = Uuid.getDefaultInstance(id); Intent intent = provider.getIntent(uuid); sb.append(String.format("Intent Id: <%s>\n", intent.getId().getValue())); sb.append(String.format("Subjects: \n")); for (Subjects subjects : intent.getSubjects()) {
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_id == null) ? 0 : _id.hashCode()); return result; }
@Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } EndPointGroupKey other = (EndPointGroupKey) obj; if (_id == null) { if (other._id != null) { return false; } } else if(!_id.equals(other._id)) { return false; } return true; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_id == null) ? 0 : _id.hashCode()); return result; }
@Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } IntentKey other = (IntentKey) obj; if (_id == null) { if (other._id != null) { return false; } } else if(!_id.equals(other._id)) { return false; } return true; }
@Override protected Object doExecute() throws Exception { List<Intent> listIntents = provider.listIntents(isConfigurationData); if (listIntents.size() > 0) { StringBuilder sb = new StringBuilder(); Integer counter = 1; for (Intent intent : listIntents) { sb.append(String.format("#%d - id: %s\n", counter, intent.getId().getValue())); counter++; } return sb.toString(); } else { return String.format("No intents found. Check the logs for more details."); } } }
public static Uuid getDefaultInstance(String defaultValue) { return new Uuid(defaultValue); }
@Override public int hashCode() { if (hashValid) { return hash; } final int prime = 31; int result = 1; result = prime * result + ((_id == null) ? 0 : _id.hashCode()); result = prime * result + ((_key == null) ? 0 : _key.hashCode()); result = prime * result + ((_selector == null) ? 0 : _selector.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); hash = result; hashValid = true; return result; }
return false; } else if(!_id.equals(other.getId())) { return false;
/** * * @param intentKey * @return the user that created this intent */ private static UserId getUserId(IntentKey intentKey) { // for this release, assume userId to be the same as the NIC intent ID return new UserId(intentKey.getId().getValue()); }
@Override protected Object doExecute() throws Exception { UUID uuid = UUID.randomUUID(); List<Subjects> subjects = createSubjects(); List<Actions> intentActions = createActions(); Intent intent = new IntentBuilder(). setId(new Uuid(uuid.toString())) .setSubjects(subjects) .setActions(intentActions) .build(); if (provider.addIntent(intent)) { return String.format("Intent created (id: %s)", uuid.toString()); } else { return "Error creating new intent"; } }
@Override public int hashCode() { if (hashValid) { return hash; } final int prime = 31; int result = 1; result = prime * result + ((_actions == null) ? 0 : _actions.hashCode()); result = prime * result + ((_conditions == null) ? 0 : _conditions.hashCode()); result = prime * result + ((_constraints == null) ? 0 : _constraints.hashCode()); result = prime * result + ((_detailedStatusMessage == null) ? 0 : _detailedStatusMessage.hashCode()); result = prime * result + ((_id == null) ? 0 : _id.hashCode()); result = prime * result + ((_key == null) ? 0 : _key.hashCode()); result = prime * result + ((_status == null) ? 0 : _status.hashCode()); result = prime * result + ((_subjects == null) ? 0 : _subjects.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); hash = result; hashValid = true; return result; }
return false; } else if(!_id.equals(other.getId())) { return false;
/** * To set the redirect intent data * @param intent :intent */ private void addIntentToCache(Intent intent) { RedirectNodeData redirectNodeData; String intentId = intent.getId().getValue(); if (redirectNodeCache.get(intentId) == null) { redirectNodeData = new RedirectNodeData(); redirectNodeData.setIntent(intent); redirectNodeCache.put(intentId, redirectNodeData); } else { redirectNodeData = redirectNodeCache.get(intentId); redirectNodeData.setIntent(intent); } }
/** * @param buffer * the beginning string typed by the user * @param cursor * the position of the cursor * @param candidates * the list of completions proposed to the user */ @Override public int complete(String buffer, int cursor, List<String> candidates) { String query = (buffer == null) ? ".*" : buffer; if (!query.contains("*")) { query = query.concat(".*"); } StringsCompleter delegate = new StringsCompleter(); for (Intent intent : provider.listIntents(true)) { String id = intent.getId().getValue(); if (id.matches(query)) { candidates.add(id); delegate.getStrings().add(id); } } return delegate.complete(buffer, cursor, candidates); } }