id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
141,600
dickschoeller/gedbrowser
gedbrowserng/src/main/java/org/schoellerfamily/gedbrowser/api/datamodel/ApiExtraLists.java
ApiExtraLists.change
public final void change() { final ApiAttribute chanAttr = new ApiAttribute("attribute", "Changed"); chanAttr.getAttributes().add(new DateUtil().todayDateAttribute()); final ArrayList<ApiAttribute> chanList = new ArrayList<>(); chanList.add(chanAttr); this.changed.clear(); this.changed.addAll(chanList); }
java
public final void change() { final ApiAttribute chanAttr = new ApiAttribute("attribute", "Changed"); chanAttr.getAttributes().add(new DateUtil().todayDateAttribute()); final ArrayList<ApiAttribute> chanList = new ArrayList<>(); chanList.add(chanAttr); this.changed.clear(); this.changed.addAll(chanList); }
[ "public", "final", "void", "change", "(", ")", "{", "final", "ApiAttribute", "chanAttr", "=", "new", "ApiAttribute", "(", "\"attribute\"", ",", "\"Changed\"", ")", ";", "chanAttr", ".", "getAttributes", "(", ")", ".", "add", "(", "new", "DateUtil", "(", ")", ".", "todayDateAttribute", "(", ")", ")", ";", "final", "ArrayList", "<", "ApiAttribute", ">", "chanList", "=", "new", "ArrayList", "<>", "(", ")", ";", "chanList", ".", "add", "(", "chanAttr", ")", ";", "this", ".", "changed", ".", "clear", "(", ")", ";", "this", ".", "changed", ".", "addAll", "(", "chanList", ")", ";", "}" ]
Mark the person as changed today.
[ "Mark", "the", "person", "as", "changed", "today", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowserng/src/main/java/org/schoellerfamily/gedbrowser/api/datamodel/ApiExtraLists.java#L92-L99
141,601
dickschoeller/gedbrowser
gedbrowser-security/src/main/java/org/schoellerfamily/gedbrowser/security/service/impl/CustomUserDetailsService.java
CustomUserDetailsService.changePassword
public void changePassword(final String oldPassword, final String newPassword) { final Authentication currentUser = SecurityContextHolder.getContext().getAuthentication(); final String username = currentUser.getName(); if (authenticationManager == null) { logger.debug( "No authentication manager set. can't change Password!"); return; } else { logger.debug("Re-authenticating user '" + username + "' for password change request."); authenticationManager.authenticate( new UsernamePasswordAuthenticationToken(username, oldPassword)); } logger.debug("Changing password for user '" + username + "'"); final SecurityUser user = (SecurityUser) loadUserByUsername(username); user.setPassword(passwordEncoder.encode(newPassword)); users.add(user); }
java
public void changePassword(final String oldPassword, final String newPassword) { final Authentication currentUser = SecurityContextHolder.getContext().getAuthentication(); final String username = currentUser.getName(); if (authenticationManager == null) { logger.debug( "No authentication manager set. can't change Password!"); return; } else { logger.debug("Re-authenticating user '" + username + "' for password change request."); authenticationManager.authenticate( new UsernamePasswordAuthenticationToken(username, oldPassword)); } logger.debug("Changing password for user '" + username + "'"); final SecurityUser user = (SecurityUser) loadUserByUsername(username); user.setPassword(passwordEncoder.encode(newPassword)); users.add(user); }
[ "public", "void", "changePassword", "(", "final", "String", "oldPassword", ",", "final", "String", "newPassword", ")", "{", "final", "Authentication", "currentUser", "=", "SecurityContextHolder", ".", "getContext", "(", ")", ".", "getAuthentication", "(", ")", ";", "final", "String", "username", "=", "currentUser", ".", "getName", "(", ")", ";", "if", "(", "authenticationManager", "==", "null", ")", "{", "logger", ".", "debug", "(", "\"No authentication manager set. can't change Password!\"", ")", ";", "return", ";", "}", "else", "{", "logger", ".", "debug", "(", "\"Re-authenticating user '\"", "+", "username", "+", "\"' for password change request.\"", ")", ";", "authenticationManager", ".", "authenticate", "(", "new", "UsernamePasswordAuthenticationToken", "(", "username", ",", "oldPassword", ")", ")", ";", "}", "logger", ".", "debug", "(", "\"Changing password for user '\"", "+", "username", "+", "\"'\"", ")", ";", "final", "SecurityUser", "user", "=", "(", "SecurityUser", ")", "loadUserByUsername", "(", "username", ")", ";", "user", ".", "setPassword", "(", "passwordEncoder", ".", "encode", "(", "newPassword", ")", ")", ";", "users", ".", "add", "(", "user", ")", ";", "}" ]
Change password of current user. @param oldPassword old password @param newPassword new password
[ "Change", "password", "of", "current", "user", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-security/src/main/java/org/schoellerfamily/gedbrowser/security/service/impl/CustomUserDetailsService.java#L58-L85
141,602
dickschoeller/gedbrowser
geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/persistence/GeoCodeLoader.java
GeoCodeLoader.load
public final void load(final String filename) { logger.debug("Loading the cache from places file: " + filename); try ( InputStream fis = new FileInputStream(filename); ) { load(fis); } catch (IOException e) { logger.error("Problem reading places file", e); } }
java
public final void load(final String filename) { logger.debug("Loading the cache from places file: " + filename); try ( InputStream fis = new FileInputStream(filename); ) { load(fis); } catch (IOException e) { logger.error("Problem reading places file", e); } }
[ "public", "final", "void", "load", "(", "final", "String", "filename", ")", "{", "logger", ".", "debug", "(", "\"Loading the cache from places file: \"", "+", "filename", ")", ";", "try", "(", "InputStream", "fis", "=", "new", "FileInputStream", "(", "filename", ")", ";", ")", "{", "load", "(", "fis", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "error", "(", "\"Problem reading places file\"", ",", "e", ")", ";", "}", "}" ]
Read places from a data file. The file is | separated. It may contain just a historical place name or both historical and modern places names. @param filename the name of the file to load
[ "Read", "places", "from", "a", "data", "file", ".", "The", "file", "is", "|", "separated", ".", "It", "may", "contain", "just", "a", "historical", "place", "name", "or", "both", "historical", "and", "modern", "places", "names", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/persistence/GeoCodeLoader.java#L35-L44
141,603
dickschoeller/gedbrowser
geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/GeoServiceGeometry.java
GeoServiceGeometry.createLocation
private static Feature createLocation(final Point point, final LocationType locationType) { final Feature location = new Feature(); location.setGeometry(point); location.setProperty("locationType", locationType); location.setId("location"); return location; }
java
private static Feature createLocation(final Point point, final LocationType locationType) { final Feature location = new Feature(); location.setGeometry(point); location.setProperty("locationType", locationType); location.setId("location"); return location; }
[ "private", "static", "Feature", "createLocation", "(", "final", "Point", "point", ",", "final", "LocationType", "locationType", ")", "{", "final", "Feature", "location", "=", "new", "Feature", "(", ")", ";", "location", ".", "setGeometry", "(", "point", ")", ";", "location", ".", "setProperty", "(", "\"locationType\"", ",", "locationType", ")", ";", "location", ".", "setId", "(", "\"location\"", ")", ";", "return", "location", ";", "}" ]
Convert a Point and LocationType into a Feature. @param point the Point @param locationType the LocationType @return the Feature
[ "Convert", "a", "Point", "and", "LocationType", "into", "a", "Feature", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/GeoServiceGeometry.java#L49-L56
141,604
dickschoeller/gedbrowser
gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/order/FamilyOrderAnalyzer.java
FamilyOrderAnalyzer.checkFamily
public void checkFamily(final Family family) { final LocalDate familyDate = analyzeDates(family); final LocalDate seenDate = earliestDate(seenFamily); if (seenDate == null) { if (familyDate != null) { seenFamily = family; } } else { if (familyDate != null) { if (familyDate.isBefore(seenDate)) { final Person spouse = (new FamilyNavigator(family)) .getSpouse(person); final Person seenSpouse = (new FamilyNavigator(seenFamily)) .getSpouse(person); final String message = String.format( "Family order: family with spouse %s (%s) is after " + "family with spouse %s (%s)", spouse.getName().getString(), familyDate.toString(), seenSpouse.getName().getString(), seenDate.toString()); getResult().addMismatch(message); } seenFamily = family; } } }
java
public void checkFamily(final Family family) { final LocalDate familyDate = analyzeDates(family); final LocalDate seenDate = earliestDate(seenFamily); if (seenDate == null) { if (familyDate != null) { seenFamily = family; } } else { if (familyDate != null) { if (familyDate.isBefore(seenDate)) { final Person spouse = (new FamilyNavigator(family)) .getSpouse(person); final Person seenSpouse = (new FamilyNavigator(seenFamily)) .getSpouse(person); final String message = String.format( "Family order: family with spouse %s (%s) is after " + "family with spouse %s (%s)", spouse.getName().getString(), familyDate.toString(), seenSpouse.getName().getString(), seenDate.toString()); getResult().addMismatch(message); } seenFamily = family; } } }
[ "public", "void", "checkFamily", "(", "final", "Family", "family", ")", "{", "final", "LocalDate", "familyDate", "=", "analyzeDates", "(", "family", ")", ";", "final", "LocalDate", "seenDate", "=", "earliestDate", "(", "seenFamily", ")", ";", "if", "(", "seenDate", "==", "null", ")", "{", "if", "(", "familyDate", "!=", "null", ")", "{", "seenFamily", "=", "family", ";", "}", "}", "else", "{", "if", "(", "familyDate", "!=", "null", ")", "{", "if", "(", "familyDate", ".", "isBefore", "(", "seenDate", ")", ")", "{", "final", "Person", "spouse", "=", "(", "new", "FamilyNavigator", "(", "family", ")", ")", ".", "getSpouse", "(", "person", ")", ";", "final", "Person", "seenSpouse", "=", "(", "new", "FamilyNavigator", "(", "seenFamily", ")", ")", ".", "getSpouse", "(", "person", ")", ";", "final", "String", "message", "=", "String", ".", "format", "(", "\"Family order: family with spouse %s (%s) is after \"", "+", "\"family with spouse %s (%s)\"", ",", "spouse", ".", "getName", "(", ")", ".", "getString", "(", ")", ",", "familyDate", ".", "toString", "(", ")", ",", "seenSpouse", ".", "getName", "(", ")", ".", "getString", "(", ")", ",", "seenDate", ".", "toString", "(", ")", ")", ";", "getResult", "(", ")", ".", "addMismatch", "(", "message", ")", ";", "}", "seenFamily", "=", "family", ";", "}", "}", "}" ]
Check this family for internal order and relative order to the other families for this person. @param family the family to check
[ "Check", "this", "family", "for", "internal", "order", "and", "relative", "order", "to", "the", "other", "families", "for", "this", "person", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/order/FamilyOrderAnalyzer.java#L55-L81
141,605
dickschoeller/gedbrowser
gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/order/FamilyOrderAnalyzer.java
FamilyOrderAnalyzer.analyzeDates
private LocalDate analyzeDates(final Family family) { if (family == null) { return null; } LocalDate earliestDate = null; final FamilyAnalysisVisitor visitor = new FamilyAnalysisVisitor(); family.accept(visitor); for (final Attribute attribute : visitor.getTrimmedAttributes()) { basicOrderCheck(attribute); setSeenEvent(attribute); final LocalDate date = createLocalDate(attribute); earliestDate = minDate(earliestDate, date); } return earliestDate(visitor); }
java
private LocalDate analyzeDates(final Family family) { if (family == null) { return null; } LocalDate earliestDate = null; final FamilyAnalysisVisitor visitor = new FamilyAnalysisVisitor(); family.accept(visitor); for (final Attribute attribute : visitor.getTrimmedAttributes()) { basicOrderCheck(attribute); setSeenEvent(attribute); final LocalDate date = createLocalDate(attribute); earliestDate = minDate(earliestDate, date); } return earliestDate(visitor); }
[ "private", "LocalDate", "analyzeDates", "(", "final", "Family", "family", ")", "{", "if", "(", "family", "==", "null", ")", "{", "return", "null", ";", "}", "LocalDate", "earliestDate", "=", "null", ";", "final", "FamilyAnalysisVisitor", "visitor", "=", "new", "FamilyAnalysisVisitor", "(", ")", ";", "family", ".", "accept", "(", "visitor", ")", ";", "for", "(", "final", "Attribute", "attribute", ":", "visitor", ".", "getTrimmedAttributes", "(", ")", ")", "{", "basicOrderCheck", "(", "attribute", ")", ";", "setSeenEvent", "(", "attribute", ")", ";", "final", "LocalDate", "date", "=", "createLocalDate", "(", "attribute", ")", ";", "earliestDate", "=", "minDate", "(", "earliestDate", ",", "date", ")", ";", "}", "return", "earliestDate", "(", "visitor", ")", ";", "}" ]
Analyze the family. Add any date order problems to the analysis. @param family the family to check @return the earliest date of an event in the family
[ "Analyze", "the", "family", ".", "Add", "any", "date", "order", "problems", "to", "the", "analysis", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/order/FamilyOrderAnalyzer.java#L89-L103
141,606
dickschoeller/gedbrowser
gedbrowserng/src/main/java/org/schoellerfamily/gedbrowser/api/controller/UploadController.java
UploadController.upload
@RequestMapping(value = "/v1/upload", method = RequestMethod.POST, consumes = "multipart/form-data") @ResponseBody public final ApiHead upload( @RequestParam("file") final MultipartFile file) { if (file == null) { logger.info("in file upload: file is null"); return null; } logger.info("in file upload: " + file.getOriginalFilename()); storageService.store(file); final String name = file.getOriginalFilename().replaceAll("\\.ged", ""); return crud().readOne(name, ""); }
java
@RequestMapping(value = "/v1/upload", method = RequestMethod.POST, consumes = "multipart/form-data") @ResponseBody public final ApiHead upload( @RequestParam("file") final MultipartFile file) { if (file == null) { logger.info("in file upload: file is null"); return null; } logger.info("in file upload: " + file.getOriginalFilename()); storageService.store(file); final String name = file.getOriginalFilename().replaceAll("\\.ged", ""); return crud().readOne(name, ""); }
[ "@", "RequestMapping", "(", "value", "=", "\"/v1/upload\"", ",", "method", "=", "RequestMethod", ".", "POST", ",", "consumes", "=", "\"multipart/form-data\"", ")", "@", "ResponseBody", "public", "final", "ApiHead", "upload", "(", "@", "RequestParam", "(", "\"file\"", ")", "final", "MultipartFile", "file", ")", "{", "if", "(", "file", "==", "null", ")", "{", "logger", ".", "info", "(", "\"in file upload: file is null\"", ")", ";", "return", "null", ";", "}", "logger", ".", "info", "(", "\"in file upload: \"", "+", "file", ".", "getOriginalFilename", "(", ")", ")", ";", "storageService", ".", "store", "(", "file", ")", ";", "final", "String", "name", "=", "file", ".", "getOriginalFilename", "(", ")", ".", "replaceAll", "(", "\"\\\\.ged\"", ",", "\"\"", ")", ";", "return", "crud", "(", ")", ".", "readOne", "(", "name", ",", "\"\"", ")", ";", "}" ]
Controller for uploading new GEDCOM files. @param file the file being sent @return the head object for that file
[ "Controller", "for", "uploading", "new", "GEDCOM", "files", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowserng/src/main/java/org/schoellerfamily/gedbrowser/api/controller/UploadController.java#L45-L60
141,607
dickschoeller/gedbrowser
gedbrowser-renderer/src/main/java/org/schoellerfamily/gedbrowser/renderer/GedRenderer.java
GedRenderer.renderPad
protected static final StringBuilder renderPad(final StringBuilder builder, final int pad, final boolean newLine) { renderNewLine(builder, newLine); for (int i = 0; i < pad; i++) { builder.append(' '); } return builder; }
java
protected static final StringBuilder renderPad(final StringBuilder builder, final int pad, final boolean newLine) { renderNewLine(builder, newLine); for (int i = 0; i < pad; i++) { builder.append(' '); } return builder; }
[ "protected", "static", "final", "StringBuilder", "renderPad", "(", "final", "StringBuilder", "builder", ",", "final", "int", "pad", ",", "final", "boolean", "newLine", ")", "{", "renderNewLine", "(", "builder", ",", "newLine", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pad", ";", "i", "++", ")", "{", "builder", ".", "append", "(", "'", "'", ")", ";", "}", "return", "builder", ";", "}" ]
Render some leading spaces onto a line of html. @param builder Buffer for holding the rendition @param pad Minimum number spaces for padding each line of the output @param newLine put in a new line for each line. @return the builder
[ "Render", "some", "leading", "spaces", "onto", "a", "line", "of", "html", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-renderer/src/main/java/org/schoellerfamily/gedbrowser/renderer/GedRenderer.java#L89-L96
141,608
dickschoeller/gedbrowser
gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/visitor/AbstractAnalysisVisitor.java
AbstractAnalysisVisitor.visit
@Override public final void visit(final Attribute attribute) { attributes.add(attribute); if (ignoreable(attribute)) { return; } trimmedAttributes.add(attribute); }
java
@Override public final void visit(final Attribute attribute) { attributes.add(attribute); if (ignoreable(attribute)) { return; } trimmedAttributes.add(attribute); }
[ "@", "Override", "public", "final", "void", "visit", "(", "final", "Attribute", "attribute", ")", "{", "attributes", ".", "add", "(", "attribute", ")", ";", "if", "(", "ignoreable", "(", "attribute", ")", ")", "{", "return", ";", "}", "trimmedAttributes", ".", "add", "(", "attribute", ")", ";", "}" ]
Visit an Attribute. Track the complete list of Attributes and a list trimmed by removing "ignoreable" attributes. @see GedObjectVisitor#visit(Attribute)
[ "Visit", "an", "Attribute", ".", "Track", "the", "complete", "list", "of", "Attributes", "and", "a", "list", "trimmed", "by", "removing", "ignoreable", "attributes", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/visitor/AbstractAnalysisVisitor.java#L58-L65
141,609
dickschoeller/gedbrowser
gedbrowser/src/main/java/org/schoellerfamily/gedbrowser/controller/SubmissionController.java
SubmissionController.submission
@RequestMapping("/submission") public final String submission( @RequestParam(value = "id", required = false, defaultValue = "SUBN1") final String idString, @RequestParam(value = "db", required = false, defaultValue = "schoeller") final String dbName, final Model model) { logger.debug("Entering source"); final Root root = fetchRoot(dbName); final RenderingContext context = createRenderingContext(); final Submission submission = (Submission) root.find(idString); if (submission == null) { throw new SubmissionNotFoundException( "Submission " + idString + " not found", idString, dbName, context); } final GedRenderer<?> submissionRenderer = new GedRendererFactory() .create(submission, context); model.addAttribute("filename", gedbrowserHome + "/" + dbName + ".ged"); model.addAttribute("submissionString", submission.getString()); model.addAttribute("model", submissionRenderer); model.addAttribute("appInfo", appInfo); logger.debug("Exiting submission"); return "submission"; }
java
@RequestMapping("/submission") public final String submission( @RequestParam(value = "id", required = false, defaultValue = "SUBN1") final String idString, @RequestParam(value = "db", required = false, defaultValue = "schoeller") final String dbName, final Model model) { logger.debug("Entering source"); final Root root = fetchRoot(dbName); final RenderingContext context = createRenderingContext(); final Submission submission = (Submission) root.find(idString); if (submission == null) { throw new SubmissionNotFoundException( "Submission " + idString + " not found", idString, dbName, context); } final GedRenderer<?> submissionRenderer = new GedRendererFactory() .create(submission, context); model.addAttribute("filename", gedbrowserHome + "/" + dbName + ".ged"); model.addAttribute("submissionString", submission.getString()); model.addAttribute("model", submissionRenderer); model.addAttribute("appInfo", appInfo); logger.debug("Exiting submission"); return "submission"; }
[ "@", "RequestMapping", "(", "\"/submission\"", ")", "public", "final", "String", "submission", "(", "@", "RequestParam", "(", "value", "=", "\"id\"", ",", "required", "=", "false", ",", "defaultValue", "=", "\"SUBN1\"", ")", "final", "String", "idString", ",", "@", "RequestParam", "(", "value", "=", "\"db\"", ",", "required", "=", "false", ",", "defaultValue", "=", "\"schoeller\"", ")", "final", "String", "dbName", ",", "final", "Model", "model", ")", "{", "logger", ".", "debug", "(", "\"Entering source\"", ")", ";", "final", "Root", "root", "=", "fetchRoot", "(", "dbName", ")", ";", "final", "RenderingContext", "context", "=", "createRenderingContext", "(", ")", ";", "final", "Submission", "submission", "=", "(", "Submission", ")", "root", ".", "find", "(", "idString", ")", ";", "if", "(", "submission", "==", "null", ")", "{", "throw", "new", "SubmissionNotFoundException", "(", "\"Submission \"", "+", "idString", "+", "\" not found\"", ",", "idString", ",", "dbName", ",", "context", ")", ";", "}", "final", "GedRenderer", "<", "?", ">", "submissionRenderer", "=", "new", "GedRendererFactory", "(", ")", ".", "create", "(", "submission", ",", "context", ")", ";", "model", ".", "addAttribute", "(", "\"filename\"", ",", "gedbrowserHome", "+", "\"/\"", "+", "dbName", "+", "\".ged\"", ")", ";", "model", ".", "addAttribute", "(", "\"submissionString\"", ",", "submission", ".", "getString", "(", ")", ")", ";", "model", ".", "addAttribute", "(", "\"model\"", ",", "submissionRenderer", ")", ";", "model", ".", "addAttribute", "(", "\"appInfo\"", ",", "appInfo", ")", ";", "logger", ".", "debug", "(", "\"Exiting submission\"", ")", ";", "return", "\"submission\"", ";", "}" ]
Connects HTML template file with data for the submission page. @param idString id URL argument. @param dbName name of database for the lookup. @param model Spring connection between the data model wrapper. @return a string identifying which HTML template to use.
[ "Connects", "HTML", "template", "file", "with", "data", "for", "the", "submission", "page", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser/src/main/java/org/schoellerfamily/gedbrowser/controller/SubmissionController.java#L43-L73
141,610
dickschoeller/gedbrowser
gedbrowser/src/main/java/org/schoellerfamily/gedbrowser/controller/LoginController.java
LoginController.loginDestinationUrl
private String loginDestinationUrl(final HttpServletRequest request) { final HttpSession session = request.getSession(); final String requestReferer = request.getHeader("referer"); final String sessionReferer = (String) session .getAttribute(SESSION_REFERER_KEY); if (useReferer(requestReferer)) { return requestReferer; } else if (useReferer(sessionReferer)) { return sessionReferer; } else { return servletPath + "/person?db=schoeller&id=I1"; } }
java
private String loginDestinationUrl(final HttpServletRequest request) { final HttpSession session = request.getSession(); final String requestReferer = request.getHeader("referer"); final String sessionReferer = (String) session .getAttribute(SESSION_REFERER_KEY); if (useReferer(requestReferer)) { return requestReferer; } else if (useReferer(sessionReferer)) { return sessionReferer; } else { return servletPath + "/person?db=schoeller&id=I1"; } }
[ "private", "String", "loginDestinationUrl", "(", "final", "HttpServletRequest", "request", ")", "{", "final", "HttpSession", "session", "=", "request", ".", "getSession", "(", ")", ";", "final", "String", "requestReferer", "=", "request", ".", "getHeader", "(", "\"referer\"", ")", ";", "final", "String", "sessionReferer", "=", "(", "String", ")", "session", ".", "getAttribute", "(", "SESSION_REFERER_KEY", ")", ";", "if", "(", "useReferer", "(", "requestReferer", ")", ")", "{", "return", "requestReferer", ";", "}", "else", "if", "(", "useReferer", "(", "sessionReferer", ")", ")", "{", "return", "sessionReferer", ";", "}", "else", "{", "return", "servletPath", "+", "\"/person?db=schoeller&id=I1\"", ";", "}", "}" ]
Try to figure out where to go after login. We have to do a few tricks in order to carry that around. @param request the request object @return the URL
[ "Try", "to", "figure", "out", "where", "to", "go", "after", "login", ".", "We", "have", "to", "do", "a", "few", "tricks", "in", "order", "to", "carry", "that", "around", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser/src/main/java/org/schoellerfamily/gedbrowser/controller/LoginController.java#L75-L87
141,611
dickschoeller/gedbrowser
gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/BirthDateFromAncestorsEstimator.java
BirthDateFromAncestorsEstimator.estimateFromMarriage
public LocalDate estimateFromMarriage(final LocalDate localDate) { if (localDate != null) { return localDate; } final PersonNavigator navigator = new PersonNavigator(person); final List<Family> families = navigator.getFamiliesC(); LocalDate date = null; for (final Family family : families) { date = processMarriageDate(date, family); date = childAdjustment(date); date = estimateFromFatherMarriage(date, family); date = estimateFromMotherMarriage(date, family); if (date != null) { break; } } return date; }
java
public LocalDate estimateFromMarriage(final LocalDate localDate) { if (localDate != null) { return localDate; } final PersonNavigator navigator = new PersonNavigator(person); final List<Family> families = navigator.getFamiliesC(); LocalDate date = null; for (final Family family : families) { date = processMarriageDate(date, family); date = childAdjustment(date); date = estimateFromFatherMarriage(date, family); date = estimateFromMotherMarriage(date, family); if (date != null) { break; } } return date; }
[ "public", "LocalDate", "estimateFromMarriage", "(", "final", "LocalDate", "localDate", ")", "{", "if", "(", "localDate", "!=", "null", ")", "{", "return", "localDate", ";", "}", "final", "PersonNavigator", "navigator", "=", "new", "PersonNavigator", "(", "person", ")", ";", "final", "List", "<", "Family", ">", "families", "=", "navigator", ".", "getFamiliesC", "(", ")", ";", "LocalDate", "date", "=", "null", ";", "for", "(", "final", "Family", "family", ":", "families", ")", "{", "date", "=", "processMarriageDate", "(", "date", ",", "family", ")", ";", "date", "=", "childAdjustment", "(", "date", ")", ";", "date", "=", "estimateFromFatherMarriage", "(", "date", ",", "family", ")", ";", "date", "=", "estimateFromMotherMarriage", "(", "date", ",", "family", ")", ";", "if", "(", "date", "!=", "null", ")", "{", "break", ";", "}", "}", "return", "date", ";", "}" ]
Try recursing through the ancestors to find a marriage date. @param localDate if not null we already have a better estimate @return an estimate based on some ancestor's marriage date
[ "Try", "recursing", "through", "the", "ancestors", "to", "find", "a", "marriage", "date", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/BirthDateFromAncestorsEstimator.java#L161-L178
141,612
dickschoeller/gedbrowser
gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/BirthDateFromAncestorsEstimator.java
BirthDateFromAncestorsEstimator.estimateFromParentMarriage
private LocalDate estimateFromParentMarriage(final Person parent) { final BirthDateEstimator bde = createEstimator(parent); return estimateFromParentMarriage(bde); }
java
private LocalDate estimateFromParentMarriage(final Person parent) { final BirthDateEstimator bde = createEstimator(parent); return estimateFromParentMarriage(bde); }
[ "private", "LocalDate", "estimateFromParentMarriage", "(", "final", "Person", "parent", ")", "{", "final", "BirthDateEstimator", "bde", "=", "createEstimator", "(", "parent", ")", ";", "return", "estimateFromParentMarriage", "(", "bde", ")", ";", "}" ]
Estimate birth date from parent's marriage. @param parent the parent @return the date estimate
[ "Estimate", "birth", "date", "from", "parent", "s", "marriage", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/BirthDateFromAncestorsEstimator.java#L216-L219
141,613
dickschoeller/gedbrowser
gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/BirthDateFromAncestorsEstimator.java
BirthDateFromAncestorsEstimator.ancestorAdjustment
private LocalDate ancestorAdjustment(final LocalDate date) { if (date == null) { return null; } return date.plusYears(typicals.ageAtMarriage() + typicals.gapBetweenChildren()) .withMonthOfYear(1).withDayOfMonth(1); }
java
private LocalDate ancestorAdjustment(final LocalDate date) { if (date == null) { return null; } return date.plusYears(typicals.ageAtMarriage() + typicals.gapBetweenChildren()) .withMonthOfYear(1).withDayOfMonth(1); }
[ "private", "LocalDate", "ancestorAdjustment", "(", "final", "LocalDate", "date", ")", "{", "if", "(", "date", "==", "null", ")", "{", "return", "null", ";", "}", "return", "date", ".", "plusYears", "(", "typicals", ".", "ageAtMarriage", "(", ")", "+", "typicals", ".", "gapBetweenChildren", "(", ")", ")", ".", "withMonthOfYear", "(", "1", ")", ".", "withDayOfMonth", "(", "1", ")", ";", "}" ]
Apply a standard adjustment from an ancestor's marriage date to a person's birth date. @param date the ancestor's marriage date @return the adjusted date
[ "Apply", "a", "standard", "adjustment", "from", "an", "ancestor", "s", "marriage", "date", "to", "a", "person", "s", "birth", "date", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/BirthDateFromAncestorsEstimator.java#L238-L245
141,614
dickschoeller/gedbrowser
gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/BirthDateFromAncestorsEstimator.java
BirthDateFromAncestorsEstimator.childAdjustment
private LocalDate childAdjustment(final LocalDate date) { if (date == null) { return date; } return date.plusYears(typicals.gapBetweenChildren()) .withMonthOfYear(1).withDayOfMonth(1); }
java
private LocalDate childAdjustment(final LocalDate date) { if (date == null) { return date; } return date.plusYears(typicals.gapBetweenChildren()) .withMonthOfYear(1).withDayOfMonth(1); }
[ "private", "LocalDate", "childAdjustment", "(", "final", "LocalDate", "date", ")", "{", "if", "(", "date", "==", "null", ")", "{", "return", "date", ";", "}", "return", "date", ".", "plusYears", "(", "typicals", ".", "gapBetweenChildren", "(", ")", ")", ".", "withMonthOfYear", "(", "1", ")", ".", "withDayOfMonth", "(", "1", ")", ";", "}" ]
Adjust by the gap between children and to beginning of month. @param date the input date @return the adjusted date
[ "Adjust", "by", "the", "gap", "between", "children", "and", "to", "beginning", "of", "month", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/BirthDateFromAncestorsEstimator.java#L253-L259
141,615
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Head.java
Head.buildParentString
private static String buildParentString(final String tag, final String tail) { if (tail.isEmpty()) { return tag; } else { return tag + " " + tail; } }
java
private static String buildParentString(final String tag, final String tail) { if (tail.isEmpty()) { return tag; } else { return tag + " " + tail; } }
[ "private", "static", "String", "buildParentString", "(", "final", "String", "tag", ",", "final", "String", "tail", ")", "{", "if", "(", "tail", ".", "isEmpty", "(", ")", ")", "{", "return", "tag", ";", "}", "else", "{", "return", "tag", "+", "\" \"", "+", "tail", ";", "}", "}" ]
The parent can only take one string. If we need to, concatenate the strings. The argument tag should never be empty, but tail could be. @param tag tag string @param tail tail string @return the constructed string
[ "The", "parent", "can", "only", "take", "one", "string", ".", "If", "we", "need", "to", "concatenate", "the", "strings", ".", "The", "argument", "tag", "should", "never", "be", "empty", "but", "tail", "could", "be", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Head.java#L41-L48
141,616
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/FamilyVisitor.java
FamilyVisitor.visit
@Override public void visit(final Child child) { final Person person = child.getChild(); if (child.isSet() && person.isSet()) { childList.add(child); children.add(person); } }
java
@Override public void visit(final Child child) { final Person person = child.getChild(); if (child.isSet() && person.isSet()) { childList.add(child); children.add(person); } }
[ "@", "Override", "public", "void", "visit", "(", "final", "Child", "child", ")", "{", "final", "Person", "person", "=", "child", ".", "getChild", "(", ")", ";", "if", "(", "child", ".", "isSet", "(", ")", "&&", "person", ".", "isSet", "(", ")", ")", "{", "childList", ".", "add", "(", "child", ")", ";", "children", ".", "add", "(", "person", ")", ";", "}", "}" ]
Visit a Child. We track this and, if set, the Person who is the child. @see GedObjectVisitor#visit(Child)
[ "Visit", "a", "Child", ".", "We", "track", "this", "and", "if", "set", "the", "Person", "who", "is", "the", "child", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/FamilyVisitor.java#L123-L130
141,617
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/FamilyVisitor.java
FamilyVisitor.visit
@Override public void visit(final Family family) { for (final GedObject gob : family.getAttributes()) { gob.accept(this); } }
java
@Override public void visit(final Family family) { for (final GedObject gob : family.getAttributes()) { gob.accept(this); } }
[ "@", "Override", "public", "void", "visit", "(", "final", "Family", "family", ")", "{", "for", "(", "final", "GedObject", "gob", ":", "family", ".", "getAttributes", "(", ")", ")", "{", "gob", ".", "accept", "(", "this", ")", ";", "}", "}" ]
Visit a Family. This is the primary focus of the visitation. From here, interesting information is gathered from the attributes. @see GedObjectVisitor#visit(Family)
[ "Visit", "a", "Family", ".", "This", "is", "the", "primary", "focus", "of", "the", "visitation", ".", "From", "here", "interesting", "information", "is", "gathered", "from", "the", "attributes", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/FamilyVisitor.java#L138-L143
141,618
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/FamilyVisitor.java
FamilyVisitor.visit
@Override public void visit(final Husband husband) { this.husbandFound = husband; if (husband.isSet()) { father = husband.getFather(); spouses.add(father); } }
java
@Override public void visit(final Husband husband) { this.husbandFound = husband; if (husband.isSet()) { father = husband.getFather(); spouses.add(father); } }
[ "@", "Override", "public", "void", "visit", "(", "final", "Husband", "husband", ")", "{", "this", ".", "husbandFound", "=", "husband", ";", "if", "(", "husband", ".", "isSet", "(", ")", ")", "{", "father", "=", "husband", ".", "getFather", "(", ")", ";", "spouses", ".", "add", "(", "father", ")", ";", "}", "}" ]
Visit a Husband. We track this and, if set, the Person who is the father. @see GedObjectVisitor#visit(Husband)
[ "Visit", "a", "Husband", ".", "We", "track", "this", "and", "if", "set", "the", "Person", "who", "is", "the", "father", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/FamilyVisitor.java#L151-L158
141,619
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/FamilyVisitor.java
FamilyVisitor.visit
@Override public void visit(final Wife wife) { this.wifeFound = wife; if (wife.isSet()) { mother = wife.getMother(); spouses.add(mother); } }
java
@Override public void visit(final Wife wife) { this.wifeFound = wife; if (wife.isSet()) { mother = wife.getMother(); spouses.add(mother); } }
[ "@", "Override", "public", "void", "visit", "(", "final", "Wife", "wife", ")", "{", "this", ".", "wifeFound", "=", "wife", ";", "if", "(", "wife", ".", "isSet", "(", ")", ")", "{", "mother", "=", "wife", ".", "getMother", "(", ")", ";", "spouses", ".", "add", "(", "mother", ")", ";", "}", "}" ]
Visit a Wife. We track this and, if set, the Person who is the mother. @see GedObjectVisitor#visit(Wife)
[ "Visit", "a", "Wife", ".", "We", "track", "this", "and", "if", "set", "the", "Person", "who", "is", "the", "mother", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/FamilyVisitor.java#L166-L173
141,620
dickschoeller/gedbrowser
gedbrowserng/src/main/java/org/schoellerfamily/gedbrowser/api/crud/PersonCrud.java
PersonCrud.createOne
@Override public ApiPerson createOne(final String db, final ApiPerson person) { logger.info("Entering create person in db: " + db); return create(readRoot(db), person, (i, id) -> new ApiPerson(i, id)); }
java
@Override public ApiPerson createOne(final String db, final ApiPerson person) { logger.info("Entering create person in db: " + db); return create(readRoot(db), person, (i, id) -> new ApiPerson(i, id)); }
[ "@", "Override", "public", "ApiPerson", "createOne", "(", "final", "String", "db", ",", "final", "ApiPerson", "person", ")", "{", "logger", ".", "info", "(", "\"Entering create person in db: \"", "+", "db", ")", ";", "return", "create", "(", "readRoot", "(", "db", ")", ",", "person", ",", "(", "i", ",", "id", ")", "->", "new", "ApiPerson", "(", "i", ",", "id", ")", ")", ";", "}" ]
Create a new person from the passed object. @param db the name of the db to access @param person the data for the person @return the person as created
[ "Create", "a", "new", "person", "from", "the", "passed", "object", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowserng/src/main/java/org/schoellerfamily/gedbrowser/api/crud/PersonCrud.java#L61-L65
141,621
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/PersonConfidentialVisitor.java
PersonConfidentialVisitor.visit
@Override public void visit(final Attribute attribute) { if ("Restriction".equals(attribute.getString()) && "confidential".equals(attribute.getTail())) { isConfidential = true; } }
java
@Override public void visit(final Attribute attribute) { if ("Restriction".equals(attribute.getString()) && "confidential".equals(attribute.getTail())) { isConfidential = true; } }
[ "@", "Override", "public", "void", "visit", "(", "final", "Attribute", "attribute", ")", "{", "if", "(", "\"Restriction\"", ".", "equals", "(", "attribute", ".", "getString", "(", ")", ")", "&&", "\"confidential\"", ".", "equals", "(", "attribute", ".", "getTail", "(", ")", ")", ")", "{", "isConfidential", "=", "true", ";", "}", "}" ]
Visit an Attribute. Certain Attributes contribute interest data. @see GedObjectVisitor#visit(Attribute)
[ "Visit", "an", "Attribute", ".", "Certain", "Attributes", "contribute", "interest", "data", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/PersonConfidentialVisitor.java#L30-L36
141,622
dickschoeller/gedbrowser
geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java
GeocodeResultBuilder.toGeoCodeItem
public GeoCodeItem toGeoCodeItem(final GeoServiceItem gsItem) { if (gsItem == null) { return null; } return new GeoCodeItem(gsItem.getPlaceName(), gsItem.getModernPlaceName(), toGeocodingResult(gsItem.getResult())); }
java
public GeoCodeItem toGeoCodeItem(final GeoServiceItem gsItem) { if (gsItem == null) { return null; } return new GeoCodeItem(gsItem.getPlaceName(), gsItem.getModernPlaceName(), toGeocodingResult(gsItem.getResult())); }
[ "public", "GeoCodeItem", "toGeoCodeItem", "(", "final", "GeoServiceItem", "gsItem", ")", "{", "if", "(", "gsItem", "==", "null", ")", "{", "return", "null", ";", "}", "return", "new", "GeoCodeItem", "(", "gsItem", ".", "getPlaceName", "(", ")", ",", "gsItem", ".", "getModernPlaceName", "(", ")", ",", "toGeocodingResult", "(", "gsItem", ".", "getResult", "(", ")", ")", ")", ";", "}" ]
Create a GeoCodeItem from a GeoServiceItem. @param gsItem the GeoServiceItem @return the GeoCodeItem
[ "Create", "a", "GeoCodeItem", "from", "a", "GeoServiceItem", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java#L33-L40
141,623
dickschoeller/gedbrowser
geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java
GeocodeResultBuilder.toGeocodingResult
public GeocodingResult toGeocodingResult( final GeoServiceGeocodingResult gsResult) { if (gsResult == null) { return null; } final GeocodingResult result = new GeocodingResult(); final AddressComponent[] addressComponents = gsResult.getAddressComponents(); if (addressComponents == null) { result.addressComponents = null; } else { result.addressComponents = new AddressComponent[addressComponents.length]; for (int i = 0; i < addressComponents.length; i++) { result.addressComponents[i] = copy(addressComponents[i]); } } result.formattedAddress = gsResult.getFormattedAddress(); result.geometry = toGeometry(gsResult.getGeometry()); result.partialMatch = gsResult.isPartialMatch(); result.placeId = gsResult.getPlaceId(); // This is safe because the gs object returns a copy of its array. result.postcodeLocalities = gsResult.getPostcodeLocalities(); // This is safe because the gs object returns a copy of its array. result.types = gsResult.getTypes(); return result; }
java
public GeocodingResult toGeocodingResult( final GeoServiceGeocodingResult gsResult) { if (gsResult == null) { return null; } final GeocodingResult result = new GeocodingResult(); final AddressComponent[] addressComponents = gsResult.getAddressComponents(); if (addressComponents == null) { result.addressComponents = null; } else { result.addressComponents = new AddressComponent[addressComponents.length]; for (int i = 0; i < addressComponents.length; i++) { result.addressComponents[i] = copy(addressComponents[i]); } } result.formattedAddress = gsResult.getFormattedAddress(); result.geometry = toGeometry(gsResult.getGeometry()); result.partialMatch = gsResult.isPartialMatch(); result.placeId = gsResult.getPlaceId(); // This is safe because the gs object returns a copy of its array. result.postcodeLocalities = gsResult.getPostcodeLocalities(); // This is safe because the gs object returns a copy of its array. result.types = gsResult.getTypes(); return result; }
[ "public", "GeocodingResult", "toGeocodingResult", "(", "final", "GeoServiceGeocodingResult", "gsResult", ")", "{", "if", "(", "gsResult", "==", "null", ")", "{", "return", "null", ";", "}", "final", "GeocodingResult", "result", "=", "new", "GeocodingResult", "(", ")", ";", "final", "AddressComponent", "[", "]", "addressComponents", "=", "gsResult", ".", "getAddressComponents", "(", ")", ";", "if", "(", "addressComponents", "==", "null", ")", "{", "result", ".", "addressComponents", "=", "null", ";", "}", "else", "{", "result", ".", "addressComponents", "=", "new", "AddressComponent", "[", "addressComponents", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "addressComponents", ".", "length", ";", "i", "++", ")", "{", "result", ".", "addressComponents", "[", "i", "]", "=", "copy", "(", "addressComponents", "[", "i", "]", ")", ";", "}", "}", "result", ".", "formattedAddress", "=", "gsResult", ".", "getFormattedAddress", "(", ")", ";", "result", ".", "geometry", "=", "toGeometry", "(", "gsResult", ".", "getGeometry", "(", ")", ")", ";", "result", ".", "partialMatch", "=", "gsResult", ".", "isPartialMatch", "(", ")", ";", "result", ".", "placeId", "=", "gsResult", ".", "getPlaceId", "(", ")", ";", "// This is safe because the gs object returns a copy of its array.", "result", ".", "postcodeLocalities", "=", "gsResult", ".", "getPostcodeLocalities", "(", ")", ";", "// This is safe because the gs object returns a copy of its array.", "result", ".", "types", "=", "gsResult", ".", "getTypes", "(", ")", ";", "return", "result", ";", "}" ]
Create a GeocodingResult from a GeoServiceGeocodingResult. @param gsResult the GeoServiceGeocodingResult @return the GeocodingResult
[ "Create", "a", "GeocodingResult", "from", "a", "GeoServiceGeocodingResult", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java#L48-L74
141,624
dickschoeller/gedbrowser
geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java
GeocodeResultBuilder.copy
private AddressComponent copy(final AddressComponent in) { final AddressComponent out = new AddressComponent(); out.longName = in.longName; out.shortName = in.shortName; out.types = Arrays.copyOf(in.types, in.types.length); return out; }
java
private AddressComponent copy(final AddressComponent in) { final AddressComponent out = new AddressComponent(); out.longName = in.longName; out.shortName = in.shortName; out.types = Arrays.copyOf(in.types, in.types.length); return out; }
[ "private", "AddressComponent", "copy", "(", "final", "AddressComponent", "in", ")", "{", "final", "AddressComponent", "out", "=", "new", "AddressComponent", "(", ")", ";", "out", ".", "longName", "=", "in", ".", "longName", ";", "out", ".", "shortName", "=", "in", ".", "shortName", ";", "out", ".", "types", "=", "Arrays", ".", "copyOf", "(", "in", ".", "types", ",", "in", ".", "types", ".", "length", ")", ";", "return", "out", ";", "}" ]
Copy an address component. Since they are NOT immutable, I don't want to mess with the variability of the damn things. @param in the component to copy @return the copy
[ "Copy", "an", "address", "component", ".", "Since", "they", "are", "NOT", "immutable", "I", "don", "t", "want", "to", "mess", "with", "the", "variability", "of", "the", "damn", "things", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java#L83-L89
141,625
dickschoeller/gedbrowser
geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java
GeocodeResultBuilder.toGeometry
public Geometry toGeometry(final FeatureCollection featureCollection) { if (featureCollection == null) { return null; } final Geometry geometry = new Geometry(); final Feature location = populateBoundaries(geometry, featureCollection); populateLocation(geometry, location); return geometry; }
java
public Geometry toGeometry(final FeatureCollection featureCollection) { if (featureCollection == null) { return null; } final Geometry geometry = new Geometry(); final Feature location = populateBoundaries(geometry, featureCollection); populateLocation(geometry, location); return geometry; }
[ "public", "Geometry", "toGeometry", "(", "final", "FeatureCollection", "featureCollection", ")", "{", "if", "(", "featureCollection", "==", "null", ")", "{", "return", "null", ";", "}", "final", "Geometry", "geometry", "=", "new", "Geometry", "(", ")", ";", "final", "Feature", "location", "=", "populateBoundaries", "(", "geometry", ",", "featureCollection", ")", ";", "populateLocation", "(", "geometry", ",", "location", ")", ";", "return", "geometry", ";", "}" ]
Create a Geometry from a GeoServiceGeometry. @param featureCollection the feature collection representing the geometry @return the Geometry
[ "Create", "a", "Geometry", "from", "a", "GeoServiceGeometry", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java#L97-L106
141,626
dickschoeller/gedbrowser
geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java
GeocodeResultBuilder.toLocationType
private LocationType toLocationType(final Object property) { if (property == null) { return null; } return LocationType.valueOf(property.toString()); }
java
private LocationType toLocationType(final Object property) { if (property == null) { return null; } return LocationType.valueOf(property.toString()); }
[ "private", "LocationType", "toLocationType", "(", "final", "Object", "property", ")", "{", "if", "(", "property", "==", "null", ")", "{", "return", "null", ";", "}", "return", "LocationType", ".", "valueOf", "(", "property", ".", "toString", "(", ")", ")", ";", "}" ]
Convert a property to a Google LocationType. @param property we can expect this to be a string @return the LocationType
[ "Convert", "a", "property", "to", "a", "Google", "LocationType", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java#L151-L156
141,627
dickschoeller/gedbrowser
geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java
GeocodeResultBuilder.toGeoServiceItem
public GeoServiceItem toGeoServiceItem(final GeoCodeItem item) { if (item == null) { return null; } return new GeoServiceItem(item.getPlaceName(), item.getModernPlaceName(), toGeoServiceGeocodingResult(item.getGeocodingResult())); }
java
public GeoServiceItem toGeoServiceItem(final GeoCodeItem item) { if (item == null) { return null; } return new GeoServiceItem(item.getPlaceName(), item.getModernPlaceName(), toGeoServiceGeocodingResult(item.getGeocodingResult())); }
[ "public", "GeoServiceItem", "toGeoServiceItem", "(", "final", "GeoCodeItem", "item", ")", "{", "if", "(", "item", "==", "null", ")", "{", "return", "null", ";", "}", "return", "new", "GeoServiceItem", "(", "item", ".", "getPlaceName", "(", ")", ",", "item", ".", "getModernPlaceName", "(", ")", ",", "toGeoServiceGeocodingResult", "(", "item", ".", "getGeocodingResult", "(", ")", ")", ")", ";", "}" ]
Create a GeoServiceItem from a GeoCodeItem. @param item the GeoCodeItem @return the GeoServiceItem
[ "Create", "a", "GeoServiceItem", "from", "a", "GeoCodeItem", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java#L164-L171
141,628
dickschoeller/gedbrowser
geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java
GeocodeResultBuilder.toGeoServiceGeocodingResult
public GeoServiceGeocodingResult toGeoServiceGeocodingResult( final GeocodingResult result) { if (result == null) { return null; } return new GeoServiceGeocodingResult( result.addressComponents, result.formattedAddress, result.postcodeLocalities, toGeoServiceGeometry(result.geometry), result.types, result.partialMatch, result.placeId); }
java
public GeoServiceGeocodingResult toGeoServiceGeocodingResult( final GeocodingResult result) { if (result == null) { return null; } return new GeoServiceGeocodingResult( result.addressComponents, result.formattedAddress, result.postcodeLocalities, toGeoServiceGeometry(result.geometry), result.types, result.partialMatch, result.placeId); }
[ "public", "GeoServiceGeocodingResult", "toGeoServiceGeocodingResult", "(", "final", "GeocodingResult", "result", ")", "{", "if", "(", "result", "==", "null", ")", "{", "return", "null", ";", "}", "return", "new", "GeoServiceGeocodingResult", "(", "result", ".", "addressComponents", ",", "result", ".", "formattedAddress", ",", "result", ".", "postcodeLocalities", ",", "toGeoServiceGeometry", "(", "result", ".", "geometry", ")", ",", "result", ".", "types", ",", "result", ".", "partialMatch", ",", "result", ".", "placeId", ")", ";", "}" ]
Create a GeoServiceGeocodingResult from a GeocodingResult. @param result the GeocodingResult @return the GeoServiceGeocodingResult
[ "Create", "a", "GeoServiceGeocodingResult", "from", "a", "GeocodingResult", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java#L179-L192
141,629
dickschoeller/gedbrowser
geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java
GeocodeResultBuilder.toGeoServiceGeometry
public FeatureCollection toGeoServiceGeometry(final Geometry geometry) { if (geometry == null) { return GeoServiceGeometry.createFeatureCollection( toLocationFeature(new LatLng(Double.NaN, Double.NaN), LocationType.UNKNOWN), null, null); } return GeoServiceGeometry.createFeatureCollection( toLocationFeature(geometry.location, geometry.locationType), toBox("bounds", geometry.bounds), toBox("viewport", geometry.viewport)); }
java
public FeatureCollection toGeoServiceGeometry(final Geometry geometry) { if (geometry == null) { return GeoServiceGeometry.createFeatureCollection( toLocationFeature(new LatLng(Double.NaN, Double.NaN), LocationType.UNKNOWN), null, null); } return GeoServiceGeometry.createFeatureCollection( toLocationFeature(geometry.location, geometry.locationType), toBox("bounds", geometry.bounds), toBox("viewport", geometry.viewport)); }
[ "public", "FeatureCollection", "toGeoServiceGeometry", "(", "final", "Geometry", "geometry", ")", "{", "if", "(", "geometry", "==", "null", ")", "{", "return", "GeoServiceGeometry", ".", "createFeatureCollection", "(", "toLocationFeature", "(", "new", "LatLng", "(", "Double", ".", "NaN", ",", "Double", ".", "NaN", ")", ",", "LocationType", ".", "UNKNOWN", ")", ",", "null", ",", "null", ")", ";", "}", "return", "GeoServiceGeometry", ".", "createFeatureCollection", "(", "toLocationFeature", "(", "geometry", ".", "location", ",", "geometry", ".", "locationType", ")", ",", "toBox", "(", "\"bounds\"", ",", "geometry", ".", "bounds", ")", ",", "toBox", "(", "\"viewport\"", ",", "geometry", ".", "viewport", ")", ")", ";", "}" ]
Create a GeoServiceGeometry from a Geometry. @param geometry the Geometry @return the GeoServiceGeometry
[ "Create", "a", "GeoServiceGeometry", "from", "a", "Geometry", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java#L200-L211
141,630
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Wife.java
Wife.getMother
public Person getMother() { if (!isSet()) { return new Person(); } final Person mother = (Person) find(getToString()); if (mother == null) { return new Person(); } else { return mother; } }
java
public Person getMother() { if (!isSet()) { return new Person(); } final Person mother = (Person) find(getToString()); if (mother == null) { return new Person(); } else { return mother; } }
[ "public", "Person", "getMother", "(", ")", "{", "if", "(", "!", "isSet", "(", ")", ")", "{", "return", "new", "Person", "(", ")", ";", "}", "final", "Person", "mother", "=", "(", "Person", ")", "find", "(", "getToString", "(", ")", ")", ";", "if", "(", "mother", "==", "null", ")", "{", "return", "new", "Person", "(", ")", ";", "}", "else", "{", "return", "mother", ";", "}", "}" ]
Get the person that this object points to. If not found return an unset Person. @return the mother.
[ "Get", "the", "person", "that", "this", "object", "points", "to", ".", "If", "not", "found", "return", "an", "unset", "Person", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Wife.java#L32-L42
141,631
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/PlaceVisitor.java
PlaceVisitor.visit
@Override public void visit(final Attribute attribute) { for (final GedObject gob : attribute.getAttributes()) { gob.accept(this); } }
java
@Override public void visit(final Attribute attribute) { for (final GedObject gob : attribute.getAttributes()) { gob.accept(this); } }
[ "@", "Override", "public", "void", "visit", "(", "final", "Attribute", "attribute", ")", "{", "for", "(", "final", "GedObject", "gob", ":", "attribute", ".", "getAttributes", "(", ")", ")", "{", "gob", ".", "accept", "(", "this", ")", ";", "}", "}" ]
Visit an Attributes. Look at Attributes to find Places. @see GedObjectVisitor#visit(Attribute)
[ "Visit", "an", "Attributes", ".", "Look", "at", "Attributes", "to", "find", "Places", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/PlaceVisitor.java#L43-L48
141,632
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/PlaceVisitor.java
PlaceVisitor.visit
@Override public void visit(final Person person) { for (final GedObject gob : person.getAttributes()) { gob.accept(this); } final PersonNavigator navigator = new PersonNavigator(person); for (final Family family : navigator.getFamilies()) { family.accept(this); } }
java
@Override public void visit(final Person person) { for (final GedObject gob : person.getAttributes()) { gob.accept(this); } final PersonNavigator navigator = new PersonNavigator(person); for (final Family family : navigator.getFamilies()) { family.accept(this); } }
[ "@", "Override", "public", "void", "visit", "(", "final", "Person", "person", ")", "{", "for", "(", "final", "GedObject", "gob", ":", "person", ".", "getAttributes", "(", ")", ")", "{", "gob", ".", "accept", "(", "this", ")", ";", "}", "final", "PersonNavigator", "navigator", "=", "new", "PersonNavigator", "(", "person", ")", ";", "for", "(", "final", "Family", "family", ":", "navigator", ".", "getFamilies", "(", ")", ")", "{", "family", ".", "accept", "(", "this", ")", ";", "}", "}" ]
Visit a Person. Look at Attributes and Families to find Places. @see GedObjectVisitor#visit(Person)
[ "Visit", "a", "Person", ".", "Look", "at", "Attributes", "and", "Families", "to", "find", "Places", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/PlaceVisitor.java#L67-L76
141,633
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/PlaceVisitor.java
PlaceVisitor.visit
@Override public void visit(final Place place) { placeStrings.add(place.getString()); places.add(place); }
java
@Override public void visit(final Place place) { placeStrings.add(place.getString()); places.add(place); }
[ "@", "Override", "public", "void", "visit", "(", "final", "Place", "place", ")", "{", "placeStrings", ".", "add", "(", "place", ".", "getString", "(", ")", ")", ";", "places", ".", "add", "(", "place", ")", ";", "}" ]
Visit a Place. The names of Places are collected. @see GedObjectVisitor#visit(Place)
[ "Visit", "a", "Place", ".", "The", "names", "of", "Places", "are", "collected", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/PlaceVisitor.java#L83-L87
141,634
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/PlaceVisitor.java
PlaceVisitor.visit
@Override public void visit(final Root root) { for (final String letter : root.findSurnameInitialLetters()) { for (final String surname : root.findBySurnamesBeginWith(letter)) { for (final Person person : root.findBySurname(surname)) { person.accept(this); } } } }
java
@Override public void visit(final Root root) { for (final String letter : root.findSurnameInitialLetters()) { for (final String surname : root.findBySurnamesBeginWith(letter)) { for (final Person person : root.findBySurname(surname)) { person.accept(this); } } } }
[ "@", "Override", "public", "void", "visit", "(", "final", "Root", "root", ")", "{", "for", "(", "final", "String", "letter", ":", "root", ".", "findSurnameInitialLetters", "(", ")", ")", "{", "for", "(", "final", "String", "surname", ":", "root", ".", "findBySurnamesBeginWith", "(", "letter", ")", ")", "{", "for", "(", "final", "Person", "person", ":", "root", ".", "findBySurname", "(", "surname", ")", ")", "{", "person", ".", "accept", "(", "this", ")", ";", "}", "}", "}", "}" ]
Visit the Root. From here we will look through the top level objects for Persons. Persons direct to Places and Places are what we really want. @see GedObjectVisitor#visit(Root)
[ "Visit", "the", "Root", ".", "From", "here", "we", "will", "look", "through", "the", "top", "level", "objects", "for", "Persons", ".", "Persons", "direct", "to", "Places", "and", "Places", "are", "what", "we", "really", "want", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/visitor/PlaceVisitor.java#L95-L104
141,635
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Name.java
Name.init
public void init() { final String string = getString(); final int bpos = string.indexOf('/'); if (bpos == -1) { prefix = string; surname = ""; suffix = ""; } else { final int epos = string.indexOf('/', bpos + 1); prefix = string.substring(0, bpos); surname = string.substring(bpos + 1, epos); suffix = string.substring(epos + 1); } }
java
public void init() { final String string = getString(); final int bpos = string.indexOf('/'); if (bpos == -1) { prefix = string; surname = ""; suffix = ""; } else { final int epos = string.indexOf('/', bpos + 1); prefix = string.substring(0, bpos); surname = string.substring(bpos + 1, epos); suffix = string.substring(epos + 1); } }
[ "public", "void", "init", "(", ")", "{", "final", "String", "string", "=", "getString", "(", ")", ";", "final", "int", "bpos", "=", "string", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "bpos", "==", "-", "1", ")", "{", "prefix", "=", "string", ";", "surname", "=", "\"\"", ";", "suffix", "=", "\"\"", ";", "}", "else", "{", "final", "int", "epos", "=", "string", ".", "indexOf", "(", "'", "'", ",", "bpos", "+", "1", ")", ";", "prefix", "=", "string", ".", "substring", "(", "0", ",", "bpos", ")", ";", "surname", "=", "string", ".", "substring", "(", "bpos", "+", "1", ",", "epos", ")", ";", "suffix", "=", "string", ".", "substring", "(", "epos", "+", "1", ")", ";", "}", "}" ]
Parse the name string from GEDCOM normal into its component parts.
[ "Parse", "the", "name", "string", "from", "GEDCOM", "normal", "into", "its", "component", "parts", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Name.java#L51-L64
141,636
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java
Index.init
public void init() { surnameIndex.clear(); final RootVisitor visitor = new RootVisitor(); mRoot.accept(visitor); for (final Person person : visitor.getPersons()) { final String key = person.getString(); // Surname for inclusion in the index. // This is the string by which the person will be indexed. final String indexName = person.getIndexName(); if (!indexName.isEmpty()) { final SortedMap<String, SortedSet<String>> names = findNamesPerSurname(person.getSurname()); final SortedSet<String> ids = findIdsPerName(indexName, names); ids.add(key); } } }
java
public void init() { surnameIndex.clear(); final RootVisitor visitor = new RootVisitor(); mRoot.accept(visitor); for (final Person person : visitor.getPersons()) { final String key = person.getString(); // Surname for inclusion in the index. // This is the string by which the person will be indexed. final String indexName = person.getIndexName(); if (!indexName.isEmpty()) { final SortedMap<String, SortedSet<String>> names = findNamesPerSurname(person.getSurname()); final SortedSet<String> ids = findIdsPerName(indexName, names); ids.add(key); } } }
[ "public", "void", "init", "(", ")", "{", "surnameIndex", ".", "clear", "(", ")", ";", "final", "RootVisitor", "visitor", "=", "new", "RootVisitor", "(", ")", ";", "mRoot", ".", "accept", "(", "visitor", ")", ";", "for", "(", "final", "Person", "person", ":", "visitor", ".", "getPersons", "(", ")", ")", "{", "final", "String", "key", "=", "person", ".", "getString", "(", ")", ";", "// Surname for inclusion in the index.", "// This is the string by which the person will be indexed.", "final", "String", "indexName", "=", "person", ".", "getIndexName", "(", ")", ";", "if", "(", "!", "indexName", ".", "isEmpty", "(", ")", ")", "{", "final", "SortedMap", "<", "String", ",", "SortedSet", "<", "String", ">", ">", "names", "=", "findNamesPerSurname", "(", "person", ".", "getSurname", "(", ")", ")", ";", "final", "SortedSet", "<", "String", ">", "ids", "=", "findIdsPerName", "(", "indexName", ",", "names", ")", ";", "ids", ".", "add", "(", "key", ")", ";", "}", "}", "}" ]
Initialize the index from the root's objects.
[ "Initialize", "the", "index", "from", "the", "root", "s", "objects", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java#L47-L65
141,637
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java
Index.findNamesPerSurname
private SortedMap<String, SortedSet<String>> findNamesPerSurname( final String surname) { if (surnameIndex.containsKey(surname)) { return surnameIndex.get(surname); } final SortedMap<String, SortedSet<String>> namesPerSurname = new TreeMap<String, SortedSet<String>>(); surnameIndex.put(surname, namesPerSurname); return namesPerSurname; }
java
private SortedMap<String, SortedSet<String>> findNamesPerSurname( final String surname) { if (surnameIndex.containsKey(surname)) { return surnameIndex.get(surname); } final SortedMap<String, SortedSet<String>> namesPerSurname = new TreeMap<String, SortedSet<String>>(); surnameIndex.put(surname, namesPerSurname); return namesPerSurname; }
[ "private", "SortedMap", "<", "String", ",", "SortedSet", "<", "String", ">", ">", "findNamesPerSurname", "(", "final", "String", "surname", ")", "{", "if", "(", "surnameIndex", ".", "containsKey", "(", "surname", ")", ")", "{", "return", "surnameIndex", ".", "get", "(", "surname", ")", ";", "}", "final", "SortedMap", "<", "String", ",", "SortedSet", "<", "String", ">", ">", "namesPerSurname", "=", "new", "TreeMap", "<", "String", ",", "SortedSet", "<", "String", ">", ">", "(", ")", ";", "surnameIndex", ".", "put", "(", "surname", ",", "namesPerSurname", ")", ";", "return", "namesPerSurname", ";", "}" ]
Find the map of full names to a sets of IDs for the given surname. If the surname is not already present, create a new map and add it to the index. @param surname surname to search @return the associated map
[ "Find", "the", "map", "of", "full", "names", "to", "a", "sets", "of", "IDs", "for", "the", "given", "surname", ".", "If", "the", "surname", "is", "not", "already", "present", "create", "a", "new", "map", "and", "add", "it", "to", "the", "index", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java#L74-L83
141,638
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java
Index.findIdsPerName
private SortedSet<String> findIdsPerName(final String indexName, final SortedMap<String, SortedSet<String>> names) { if (names.containsKey(indexName)) { return names.get(indexName); } final TreeSet<String> idsPerName = new TreeSet<String>(); names.put(indexName, idsPerName); return idsPerName; }
java
private SortedSet<String> findIdsPerName(final String indexName, final SortedMap<String, SortedSet<String>> names) { if (names.containsKey(indexName)) { return names.get(indexName); } final TreeSet<String> idsPerName = new TreeSet<String>(); names.put(indexName, idsPerName); return idsPerName; }
[ "private", "SortedSet", "<", "String", ">", "findIdsPerName", "(", "final", "String", "indexName", ",", "final", "SortedMap", "<", "String", ",", "SortedSet", "<", "String", ">", ">", "names", ")", "{", "if", "(", "names", ".", "containsKey", "(", "indexName", ")", ")", "{", "return", "names", ".", "get", "(", "indexName", ")", ";", "}", "final", "TreeSet", "<", "String", ">", "idsPerName", "=", "new", "TreeSet", "<", "String", ">", "(", ")", ";", "names", ".", "put", "(", "indexName", ",", "idsPerName", ")", ";", "return", "idsPerName", ";", "}" ]
Find the set of IDs associated with a full name in the provided map. @param indexName the full name in index form @param names the map of full names to sets of IDs @return the set of ID strings
[ "Find", "the", "set", "of", "IDs", "associated", "with", "a", "full", "name", "in", "the", "provided", "map", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java#L92-L100
141,639
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java
Index.getNamesPerSurname
public Set<String> getNamesPerSurname(final String surname) { if (surname == null) { return Collections.emptySet(); } if (!surnameIndex.containsKey(surname)) { return Collections.emptySet(); } return Collections.unmodifiableSet(surnameIndex.get(surname).keySet()); }
java
public Set<String> getNamesPerSurname(final String surname) { if (surname == null) { return Collections.emptySet(); } if (!surnameIndex.containsKey(surname)) { return Collections.emptySet(); } return Collections.unmodifiableSet(surnameIndex.get(surname).keySet()); }
[ "public", "Set", "<", "String", ">", "getNamesPerSurname", "(", "final", "String", "surname", ")", "{", "if", "(", "surname", "==", "null", ")", "{", "return", "Collections", ".", "emptySet", "(", ")", ";", "}", "if", "(", "!", "surnameIndex", ".", "containsKey", "(", "surname", ")", ")", "{", "return", "Collections", ".", "emptySet", "(", ")", ";", "}", "return", "Collections", ".", "unmodifiableSet", "(", "surnameIndex", ".", "get", "(", "surname", ")", ".", "keySet", "(", ")", ")", ";", "}" ]
Get the set of full names that occur for a given surname. @param surname the surname to search. @return the keys
[ "Get", "the", "set", "of", "full", "names", "that", "occur", "for", "a", "given", "surname", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java#L122-L130
141,640
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java
Index.getNamesPerSurnameMap
private Map<String, SortedSet<String>> getNamesPerSurnameMap( final String surname) { if (!surnameIndex.containsKey(surname)) { return Collections.emptyMap(); } return surnameIndex.get(surname); }
java
private Map<String, SortedSet<String>> getNamesPerSurnameMap( final String surname) { if (!surnameIndex.containsKey(surname)) { return Collections.emptyMap(); } return surnameIndex.get(surname); }
[ "private", "Map", "<", "String", ",", "SortedSet", "<", "String", ">", ">", "getNamesPerSurnameMap", "(", "final", "String", "surname", ")", "{", "if", "(", "!", "surnameIndex", ".", "containsKey", "(", "surname", ")", ")", "{", "return", "Collections", ".", "emptyMap", "(", ")", ";", "}", "return", "surnameIndex", ".", "get", "(", "surname", ")", ";", "}" ]
Get map of full names to sets of IDs for the provided surname. @param surname the surname to search. @return the map
[ "Get", "map", "of", "full", "names", "to", "sets", "of", "IDs", "for", "the", "provided", "surname", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java#L142-L148
141,641
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java
Index.getIdsPerName
public Set<String> getIdsPerName(final String surname, final String name) { if (surname == null || name == null) { return Collections.emptySet(); } final Map<String, SortedSet<String>> namesPerSurname = getNamesPerSurnameMap(surname); if (!namesPerSurname.containsKey(name)) { return Collections.emptySet(); } return Collections.unmodifiableSet(namesPerSurname.get(name)); }
java
public Set<String> getIdsPerName(final String surname, final String name) { if (surname == null || name == null) { return Collections.emptySet(); } final Map<String, SortedSet<String>> namesPerSurname = getNamesPerSurnameMap(surname); if (!namesPerSurname.containsKey(name)) { return Collections.emptySet(); } return Collections.unmodifiableSet(namesPerSurname.get(name)); }
[ "public", "Set", "<", "String", ">", "getIdsPerName", "(", "final", "String", "surname", ",", "final", "String", "name", ")", "{", "if", "(", "surname", "==", "null", "||", "name", "==", "null", ")", "{", "return", "Collections", ".", "emptySet", "(", ")", ";", "}", "final", "Map", "<", "String", ",", "SortedSet", "<", "String", ">", ">", "namesPerSurname", "=", "getNamesPerSurnameMap", "(", "surname", ")", ";", "if", "(", "!", "namesPerSurname", ".", "containsKey", "(", "name", ")", ")", "{", "return", "Collections", ".", "emptySet", "(", ")", ";", "}", "return", "Collections", ".", "unmodifiableSet", "(", "namesPerSurname", ".", "get", "(", "name", ")", ")", ";", "}" ]
Get the set of IDs for the given surname and full name. @param surname the surname to search @param name the full name in index form @return the set of IDs
[ "Get", "the", "set", "of", "IDs", "for", "the", "given", "surname", "and", "full", "name", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Index.java#L157-L167
141,642
dickschoeller/gedbrowser
gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/BasicBirthDateEstimator.java
BasicBirthDateEstimator.estimateFromOtherEvents
protected final LocalDate estimateFromOtherEvents( final LocalDate localDate) { if (localDate != null) { return localDate; } final PersonAnalysisVisitor visitor = new PersonAnalysisVisitor(); person.accept(visitor); for (final Attribute attr : visitor.getAttributes()) { final String dateString = getDate(attr); final LocalDate date = estimateFromEvent(attr, dateString); if (date != null) { return date; } } return null; }
java
protected final LocalDate estimateFromOtherEvents( final LocalDate localDate) { if (localDate != null) { return localDate; } final PersonAnalysisVisitor visitor = new PersonAnalysisVisitor(); person.accept(visitor); for (final Attribute attr : visitor.getAttributes()) { final String dateString = getDate(attr); final LocalDate date = estimateFromEvent(attr, dateString); if (date != null) { return date; } } return null; }
[ "protected", "final", "LocalDate", "estimateFromOtherEvents", "(", "final", "LocalDate", "localDate", ")", "{", "if", "(", "localDate", "!=", "null", ")", "{", "return", "localDate", ";", "}", "final", "PersonAnalysisVisitor", "visitor", "=", "new", "PersonAnalysisVisitor", "(", ")", ";", "person", ".", "accept", "(", "visitor", ")", ";", "for", "(", "final", "Attribute", "attr", ":", "visitor", ".", "getAttributes", "(", ")", ")", "{", "final", "String", "dateString", "=", "getDate", "(", "attr", ")", ";", "final", "LocalDate", "date", "=", "estimateFromEvent", "(", "attr", ",", "dateString", ")", ";", "if", "(", "date", "!=", "null", ")", "{", "return", "date", ";", "}", "}", "return", "null", ";", "}" ]
Try other lifecycle events. @param localDate if not null we already have a better estimate @return estimate
[ "Try", "other", "lifecycle", "events", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/BasicBirthDateEstimator.java#L84-L99
141,643
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Husband.java
Husband.getFather
public Person getFather() { if (!isSet()) { return new Person(); } final Person father = (Person) find(getToString()); if (father == null) { return new Person(); } else { return father; } }
java
public Person getFather() { if (!isSet()) { return new Person(); } final Person father = (Person) find(getToString()); if (father == null) { return new Person(); } else { return father; } }
[ "public", "Person", "getFather", "(", ")", "{", "if", "(", "!", "isSet", "(", ")", ")", "{", "return", "new", "Person", "(", ")", ";", "}", "final", "Person", "father", "=", "(", "Person", ")", "find", "(", "getToString", "(", ")", ")", ";", "if", "(", "father", "==", "null", ")", "{", "return", "new", "Person", "(", ")", ";", "}", "else", "{", "return", "father", ";", "}", "}" ]
Get the person that this object refers to. If not found return an unset Person. @return the father
[ "Get", "the", "person", "that", "this", "object", "refers", "to", ".", "If", "not", "found", "return", "an", "unset", "Person", "." ]
e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/Husband.java#L32-L42
141,644
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/FinanceUtils.java
FinanceUtils.toCorrelations
public static PrimitiveMatrix toCorrelations(Access2D<?> covariances, boolean clean) { int size = Math.toIntExact(Math.min(covariances.countRows(), covariances.countColumns())); MatrixStore<Double> covarianceMtrx = MatrixStore.PRIMITIVE.makeWrapper(covariances).get(); if (clean) { Eigenvalue<Double> evd = Eigenvalue.PRIMITIVE.make(covarianceMtrx, true); evd.decompose(covarianceMtrx); MatrixStore<Double> mtrxV = evd.getV(); PhysicalStore<Double> mtrxD = evd.getD().copy(); double largest = evd.getEigenvalues().get(0).norm(); double limit = largest * size * PrimitiveMath.RELATIVELY_SMALL; for (int ij = 0; ij < size; ij++) { if (mtrxD.doubleValue(ij, ij) < limit) { mtrxD.set(ij, ij, limit); } } covarianceMtrx = mtrxV.multiply(mtrxD).multiply(mtrxV.transpose()); } PrimitiveMatrix.DenseReceiver retVal = PrimitiveMatrix.FACTORY.makeDense(size, size); double[] volatilities = new double[size]; for (int ij = 0; ij < size; ij++) { volatilities[ij] = PrimitiveMath.SQRT.invoke(covarianceMtrx.doubleValue(ij, ij)); } for (int j = 0; j < size; j++) { double colVol = volatilities[j]; retVal.set(j, j, PrimitiveMath.ONE); for (int i = j + 1; i < size; i++) { double rowVol = volatilities[i]; if ((rowVol <= PrimitiveMath.ZERO) || (colVol <= PrimitiveMath.ZERO)) { retVal.set(i, j, PrimitiveMath.ZERO); retVal.set(j, i, PrimitiveMath.ZERO); } else { double covariance = covarianceMtrx.doubleValue(i, j); double correlation = covariance / (rowVol * colVol); retVal.set(i, j, correlation); retVal.set(j, i, correlation); } } } return retVal.get(); }
java
public static PrimitiveMatrix toCorrelations(Access2D<?> covariances, boolean clean) { int size = Math.toIntExact(Math.min(covariances.countRows(), covariances.countColumns())); MatrixStore<Double> covarianceMtrx = MatrixStore.PRIMITIVE.makeWrapper(covariances).get(); if (clean) { Eigenvalue<Double> evd = Eigenvalue.PRIMITIVE.make(covarianceMtrx, true); evd.decompose(covarianceMtrx); MatrixStore<Double> mtrxV = evd.getV(); PhysicalStore<Double> mtrxD = evd.getD().copy(); double largest = evd.getEigenvalues().get(0).norm(); double limit = largest * size * PrimitiveMath.RELATIVELY_SMALL; for (int ij = 0; ij < size; ij++) { if (mtrxD.doubleValue(ij, ij) < limit) { mtrxD.set(ij, ij, limit); } } covarianceMtrx = mtrxV.multiply(mtrxD).multiply(mtrxV.transpose()); } PrimitiveMatrix.DenseReceiver retVal = PrimitiveMatrix.FACTORY.makeDense(size, size); double[] volatilities = new double[size]; for (int ij = 0; ij < size; ij++) { volatilities[ij] = PrimitiveMath.SQRT.invoke(covarianceMtrx.doubleValue(ij, ij)); } for (int j = 0; j < size; j++) { double colVol = volatilities[j]; retVal.set(j, j, PrimitiveMath.ONE); for (int i = j + 1; i < size; i++) { double rowVol = volatilities[i]; if ((rowVol <= PrimitiveMath.ZERO) || (colVol <= PrimitiveMath.ZERO)) { retVal.set(i, j, PrimitiveMath.ZERO); retVal.set(j, i, PrimitiveMath.ZERO); } else { double covariance = covarianceMtrx.doubleValue(i, j); double correlation = covariance / (rowVol * colVol); retVal.set(i, j, correlation); retVal.set(j, i, correlation); } } } return retVal.get(); }
[ "public", "static", "PrimitiveMatrix", "toCorrelations", "(", "Access2D", "<", "?", ">", "covariances", ",", "boolean", "clean", ")", "{", "int", "size", "=", "Math", ".", "toIntExact", "(", "Math", ".", "min", "(", "covariances", ".", "countRows", "(", ")", ",", "covariances", ".", "countColumns", "(", ")", ")", ")", ";", "MatrixStore", "<", "Double", ">", "covarianceMtrx", "=", "MatrixStore", ".", "PRIMITIVE", ".", "makeWrapper", "(", "covariances", ")", ".", "get", "(", ")", ";", "if", "(", "clean", ")", "{", "Eigenvalue", "<", "Double", ">", "evd", "=", "Eigenvalue", ".", "PRIMITIVE", ".", "make", "(", "covarianceMtrx", ",", "true", ")", ";", "evd", ".", "decompose", "(", "covarianceMtrx", ")", ";", "MatrixStore", "<", "Double", ">", "mtrxV", "=", "evd", ".", "getV", "(", ")", ";", "PhysicalStore", "<", "Double", ">", "mtrxD", "=", "evd", ".", "getD", "(", ")", ".", "copy", "(", ")", ";", "double", "largest", "=", "evd", ".", "getEigenvalues", "(", ")", ".", "get", "(", "0", ")", ".", "norm", "(", ")", ";", "double", "limit", "=", "largest", "*", "size", "*", "PrimitiveMath", ".", "RELATIVELY_SMALL", ";", "for", "(", "int", "ij", "=", "0", ";", "ij", "<", "size", ";", "ij", "++", ")", "{", "if", "(", "mtrxD", ".", "doubleValue", "(", "ij", ",", "ij", ")", "<", "limit", ")", "{", "mtrxD", ".", "set", "(", "ij", ",", "ij", ",", "limit", ")", ";", "}", "}", "covarianceMtrx", "=", "mtrxV", ".", "multiply", "(", "mtrxD", ")", ".", "multiply", "(", "mtrxV", ".", "transpose", "(", ")", ")", ";", "}", "PrimitiveMatrix", ".", "DenseReceiver", "retVal", "=", "PrimitiveMatrix", ".", "FACTORY", ".", "makeDense", "(", "size", ",", "size", ")", ";", "double", "[", "]", "volatilities", "=", "new", "double", "[", "size", "]", ";", "for", "(", "int", "ij", "=", "0", ";", "ij", "<", "size", ";", "ij", "++", ")", "{", "volatilities", "[", "ij", "]", "=", "PrimitiveMath", ".", "SQRT", ".", "invoke", "(", "covarianceMtrx", ".", "doubleValue", "(", "ij", ",", "ij", ")", ")", ";", "}", "for", "(", "int", "j", "=", "0", ";", "j", "<", "size", ";", "j", "++", ")", "{", "double", "colVol", "=", "volatilities", "[", "j", "]", ";", "retVal", ".", "set", "(", "j", ",", "j", ",", "PrimitiveMath", ".", "ONE", ")", ";", "for", "(", "int", "i", "=", "j", "+", "1", ";", "i", "<", "size", ";", "i", "++", ")", "{", "double", "rowVol", "=", "volatilities", "[", "i", "]", ";", "if", "(", "(", "rowVol", "<=", "PrimitiveMath", ".", "ZERO", ")", "||", "(", "colVol", "<=", "PrimitiveMath", ".", "ZERO", ")", ")", "{", "retVal", ".", "set", "(", "i", ",", "j", ",", "PrimitiveMath", ".", "ZERO", ")", ";", "retVal", ".", "set", "(", "j", ",", "i", ",", "PrimitiveMath", ".", "ZERO", ")", ";", "}", "else", "{", "double", "covariance", "=", "covarianceMtrx", ".", "doubleValue", "(", "i", ",", "j", ")", ";", "double", "correlation", "=", "covariance", "/", "(", "rowVol", "*", "colVol", ")", ";", "retVal", ".", "set", "(", "i", ",", "j", ",", "correlation", ")", ";", "retVal", ".", "set", "(", "j", ",", "i", ",", "correlation", ")", ";", "}", "}", "}", "return", "retVal", ".", "get", "(", ")", ";", "}" ]
Will extract the correlation coefficients from the input covariance matrix. If "cleaning" is enabled small and negative eigenvalues of the covariance matrix will be replaced with a new minimal value.
[ "Will", "extract", "the", "correlation", "coefficients", "from", "the", "input", "covariance", "matrix", ".", "If", "cleaning", "is", "enabled", "small", "and", "negative", "eigenvalues", "of", "the", "covariance", "matrix", "will", "be", "replaced", "with", "a", "new", "minimal", "value", "." ]
c8d3f7e1894d4263b7334bca3f4c060e466f8b15
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/FinanceUtils.java#L354-L412
141,645
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/data/fetcher/YahooSession.java
YahooSession.buildChallengeRequest
static ResourceLocator.Request buildChallengeRequest(ResourceLocator.Session session, String symbol) { // The "options" part causes the cookie to be set. // Other path endings may also work, // but there has to be something after the symbol return session.request().host(FINANCE_YAHOO_COM).path("/quote/" + symbol + "/options"); }
java
static ResourceLocator.Request buildChallengeRequest(ResourceLocator.Session session, String symbol) { // The "options" part causes the cookie to be set. // Other path endings may also work, // but there has to be something after the symbol return session.request().host(FINANCE_YAHOO_COM).path("/quote/" + symbol + "/options"); }
[ "static", "ResourceLocator", ".", "Request", "buildChallengeRequest", "(", "ResourceLocator", ".", "Session", "session", ",", "String", "symbol", ")", "{", "// The \"options\" part causes the cookie to be set.", "// Other path endings may also work,", "// but there has to be something after the symbol", "return", "session", ".", "request", "(", ")", ".", "host", "(", "FINANCE_YAHOO_COM", ")", ".", "path", "(", "\"/quote/\"", "+", "symbol", "+", "\"/options\"", ")", ";", "}" ]
A request that requires consent and will set the "B" cookie, but not the crumb
[ "A", "request", "that", "requires", "consent", "and", "will", "set", "the", "B", "cookie", "but", "not", "the", "crumb" ]
c8d3f7e1894d4263b7334bca3f4c060e466f8b15
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/data/fetcher/YahooSession.java#L139-L144
141,646
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/portfolio/MarkowitzModel.java
MarkowitzModel.calculateAssetWeights
@Override protected PrimitiveMatrix calculateAssetWeights() { if (this.getOptimisationOptions().logger_appender != null) { BasicLogger.debug(); BasicLogger.debug("###################################################"); BasicLogger.debug("BEGIN RAF: {} MarkowitzModel optimisation", this.getRiskAversion()); BasicLogger.debug("###################################################"); BasicLogger.debug(); } Optimisation.Result tmpResult; if ((myTargetReturn != null) || (myTargetVariance != null)) { final double tmpTargetValue; if (myTargetVariance != null) { tmpTargetValue = myTargetVariance.doubleValue(); } else if (myTargetReturn != null) { tmpTargetValue = myTargetReturn.doubleValue(); } else { tmpTargetValue = _0_0; } tmpResult = this.generateOptimisationModel(_0_0).minimise(); double tmpTargetNow = _0_0; double tmpTargetDiff = _0_0; double tmpTargetLast = _0_0; if (tmpResult.getState().isFeasible()) { double tmpCurrent; double tmpLow; double tmpHigh; if (this.isDefaultRiskAversion()) { tmpCurrent = INIT; tmpLow = MAX; tmpHigh = MIN; } else { tmpCurrent = this.getRiskAversion().doubleValue(); tmpLow = tmpCurrent * INIT; tmpHigh = tmpCurrent / INIT; } do { final ExpressionsBasedModel tmpModel = this.generateOptimisationModel(tmpCurrent); tmpResult = tmpModel.minimise(); tmpTargetLast = tmpTargetNow; if (myTargetVariance != null) { tmpTargetNow = this.calculatePortfolioVariance(tmpResult).doubleValue(); } else if (myTargetReturn != null) { tmpTargetNow = this.calculatePortfolioReturn(tmpResult, this.calculateAssetReturns()).doubleValue(); } else { tmpTargetNow = tmpTargetValue; } tmpTargetDiff = tmpTargetNow - tmpTargetValue; if (this.getOptimisationOptions().logger_appender != null) { BasicLogger.debug(); BasicLogger.debug("RAF: {}", tmpCurrent); BasicLogger.debug("Last: {}", tmpTargetLast); BasicLogger.debug("Now: {}", tmpTargetNow); BasicLogger.debug("Target: {}", tmpTargetValue); BasicLogger.debug("Diff: {}", tmpTargetDiff); BasicLogger.debug("Iteration: {}", tmpResult); BasicLogger.debug(); } if (tmpTargetDiff < _0_0) { tmpLow = tmpCurrent; } else if (tmpTargetDiff > _0_0) { tmpHigh = tmpCurrent; } tmpCurrent = PrimitiveMath.SQRT.invoke(tmpLow * tmpHigh); } while (!TARGET_CONTEXT.isSmall(tmpTargetValue, tmpTargetDiff) && TARGET_CONTEXT.isDifferent(tmpHigh, tmpLow)); } } else { tmpResult = this.generateOptimisationModel(this.getRiskAversion().doubleValue()).minimise(); } return this.handle(tmpResult); }
java
@Override protected PrimitiveMatrix calculateAssetWeights() { if (this.getOptimisationOptions().logger_appender != null) { BasicLogger.debug(); BasicLogger.debug("###################################################"); BasicLogger.debug("BEGIN RAF: {} MarkowitzModel optimisation", this.getRiskAversion()); BasicLogger.debug("###################################################"); BasicLogger.debug(); } Optimisation.Result tmpResult; if ((myTargetReturn != null) || (myTargetVariance != null)) { final double tmpTargetValue; if (myTargetVariance != null) { tmpTargetValue = myTargetVariance.doubleValue(); } else if (myTargetReturn != null) { tmpTargetValue = myTargetReturn.doubleValue(); } else { tmpTargetValue = _0_0; } tmpResult = this.generateOptimisationModel(_0_0).minimise(); double tmpTargetNow = _0_0; double tmpTargetDiff = _0_0; double tmpTargetLast = _0_0; if (tmpResult.getState().isFeasible()) { double tmpCurrent; double tmpLow; double tmpHigh; if (this.isDefaultRiskAversion()) { tmpCurrent = INIT; tmpLow = MAX; tmpHigh = MIN; } else { tmpCurrent = this.getRiskAversion().doubleValue(); tmpLow = tmpCurrent * INIT; tmpHigh = tmpCurrent / INIT; } do { final ExpressionsBasedModel tmpModel = this.generateOptimisationModel(tmpCurrent); tmpResult = tmpModel.minimise(); tmpTargetLast = tmpTargetNow; if (myTargetVariance != null) { tmpTargetNow = this.calculatePortfolioVariance(tmpResult).doubleValue(); } else if (myTargetReturn != null) { tmpTargetNow = this.calculatePortfolioReturn(tmpResult, this.calculateAssetReturns()).doubleValue(); } else { tmpTargetNow = tmpTargetValue; } tmpTargetDiff = tmpTargetNow - tmpTargetValue; if (this.getOptimisationOptions().logger_appender != null) { BasicLogger.debug(); BasicLogger.debug("RAF: {}", tmpCurrent); BasicLogger.debug("Last: {}", tmpTargetLast); BasicLogger.debug("Now: {}", tmpTargetNow); BasicLogger.debug("Target: {}", tmpTargetValue); BasicLogger.debug("Diff: {}", tmpTargetDiff); BasicLogger.debug("Iteration: {}", tmpResult); BasicLogger.debug(); } if (tmpTargetDiff < _0_0) { tmpLow = tmpCurrent; } else if (tmpTargetDiff > _0_0) { tmpHigh = tmpCurrent; } tmpCurrent = PrimitiveMath.SQRT.invoke(tmpLow * tmpHigh); } while (!TARGET_CONTEXT.isSmall(tmpTargetValue, tmpTargetDiff) && TARGET_CONTEXT.isDifferent(tmpHigh, tmpLow)); } } else { tmpResult = this.generateOptimisationModel(this.getRiskAversion().doubleValue()).minimise(); } return this.handle(tmpResult); }
[ "@", "Override", "protected", "PrimitiveMatrix", "calculateAssetWeights", "(", ")", "{", "if", "(", "this", ".", "getOptimisationOptions", "(", ")", ".", "logger_appender", "!=", "null", ")", "{", "BasicLogger", ".", "debug", "(", ")", ";", "BasicLogger", ".", "debug", "(", "\"###################################################\"", ")", ";", "BasicLogger", ".", "debug", "(", "\"BEGIN RAF: {} MarkowitzModel optimisation\"", ",", "this", ".", "getRiskAversion", "(", ")", ")", ";", "BasicLogger", ".", "debug", "(", "\"###################################################\"", ")", ";", "BasicLogger", ".", "debug", "(", ")", ";", "}", "Optimisation", ".", "Result", "tmpResult", ";", "if", "(", "(", "myTargetReturn", "!=", "null", ")", "||", "(", "myTargetVariance", "!=", "null", ")", ")", "{", "final", "double", "tmpTargetValue", ";", "if", "(", "myTargetVariance", "!=", "null", ")", "{", "tmpTargetValue", "=", "myTargetVariance", ".", "doubleValue", "(", ")", ";", "}", "else", "if", "(", "myTargetReturn", "!=", "null", ")", "{", "tmpTargetValue", "=", "myTargetReturn", ".", "doubleValue", "(", ")", ";", "}", "else", "{", "tmpTargetValue", "=", "_0_0", ";", "}", "tmpResult", "=", "this", ".", "generateOptimisationModel", "(", "_0_0", ")", ".", "minimise", "(", ")", ";", "double", "tmpTargetNow", "=", "_0_0", ";", "double", "tmpTargetDiff", "=", "_0_0", ";", "double", "tmpTargetLast", "=", "_0_0", ";", "if", "(", "tmpResult", ".", "getState", "(", ")", ".", "isFeasible", "(", ")", ")", "{", "double", "tmpCurrent", ";", "double", "tmpLow", ";", "double", "tmpHigh", ";", "if", "(", "this", ".", "isDefaultRiskAversion", "(", ")", ")", "{", "tmpCurrent", "=", "INIT", ";", "tmpLow", "=", "MAX", ";", "tmpHigh", "=", "MIN", ";", "}", "else", "{", "tmpCurrent", "=", "this", ".", "getRiskAversion", "(", ")", ".", "doubleValue", "(", ")", ";", "tmpLow", "=", "tmpCurrent", "*", "INIT", ";", "tmpHigh", "=", "tmpCurrent", "/", "INIT", ";", "}", "do", "{", "final", "ExpressionsBasedModel", "tmpModel", "=", "this", ".", "generateOptimisationModel", "(", "tmpCurrent", ")", ";", "tmpResult", "=", "tmpModel", ".", "minimise", "(", ")", ";", "tmpTargetLast", "=", "tmpTargetNow", ";", "if", "(", "myTargetVariance", "!=", "null", ")", "{", "tmpTargetNow", "=", "this", ".", "calculatePortfolioVariance", "(", "tmpResult", ")", ".", "doubleValue", "(", ")", ";", "}", "else", "if", "(", "myTargetReturn", "!=", "null", ")", "{", "tmpTargetNow", "=", "this", ".", "calculatePortfolioReturn", "(", "tmpResult", ",", "this", ".", "calculateAssetReturns", "(", ")", ")", ".", "doubleValue", "(", ")", ";", "}", "else", "{", "tmpTargetNow", "=", "tmpTargetValue", ";", "}", "tmpTargetDiff", "=", "tmpTargetNow", "-", "tmpTargetValue", ";", "if", "(", "this", ".", "getOptimisationOptions", "(", ")", ".", "logger_appender", "!=", "null", ")", "{", "BasicLogger", ".", "debug", "(", ")", ";", "BasicLogger", ".", "debug", "(", "\"RAF: {}\"", ",", "tmpCurrent", ")", ";", "BasicLogger", ".", "debug", "(", "\"Last: {}\"", ",", "tmpTargetLast", ")", ";", "BasicLogger", ".", "debug", "(", "\"Now: {}\"", ",", "tmpTargetNow", ")", ";", "BasicLogger", ".", "debug", "(", "\"Target: {}\"", ",", "tmpTargetValue", ")", ";", "BasicLogger", ".", "debug", "(", "\"Diff: {}\"", ",", "tmpTargetDiff", ")", ";", "BasicLogger", ".", "debug", "(", "\"Iteration: {}\"", ",", "tmpResult", ")", ";", "BasicLogger", ".", "debug", "(", ")", ";", "}", "if", "(", "tmpTargetDiff", "<", "_0_0", ")", "{", "tmpLow", "=", "tmpCurrent", ";", "}", "else", "if", "(", "tmpTargetDiff", ">", "_0_0", ")", "{", "tmpHigh", "=", "tmpCurrent", ";", "}", "tmpCurrent", "=", "PrimitiveMath", ".", "SQRT", ".", "invoke", "(", "tmpLow", "*", "tmpHigh", ")", ";", "}", "while", "(", "!", "TARGET_CONTEXT", ".", "isSmall", "(", "tmpTargetValue", ",", "tmpTargetDiff", ")", "&&", "TARGET_CONTEXT", ".", "isDifferent", "(", "tmpHigh", ",", "tmpLow", ")", ")", ";", "}", "}", "else", "{", "tmpResult", "=", "this", ".", "generateOptimisationModel", "(", "this", ".", "getRiskAversion", "(", ")", ".", "doubleValue", "(", ")", ")", ".", "minimise", "(", ")", ";", "}", "return", "this", ".", "handle", "(", "tmpResult", ")", ";", "}" ]
Constrained optimisation.
[ "Constrained", "optimisation", "." ]
c8d3f7e1894d4263b7334bca3f4c060e466f8b15
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/portfolio/MarkowitzModel.java#L222-L310
141,647
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java
MarketEquilibrium.calculatePortfolioReturn
public static Scalar<?> calculatePortfolioReturn(final PrimitiveMatrix assetWeights, final PrimitiveMatrix assetReturns) { return PrimitiveScalar.valueOf(assetWeights.dot(assetReturns)); }
java
public static Scalar<?> calculatePortfolioReturn(final PrimitiveMatrix assetWeights, final PrimitiveMatrix assetReturns) { return PrimitiveScalar.valueOf(assetWeights.dot(assetReturns)); }
[ "public", "static", "Scalar", "<", "?", ">", "calculatePortfolioReturn", "(", "final", "PrimitiveMatrix", "assetWeights", ",", "final", "PrimitiveMatrix", "assetReturns", ")", "{", "return", "PrimitiveScalar", ".", "valueOf", "(", "assetWeights", ".", "dot", "(", "assetReturns", ")", ")", ";", "}" ]
Calculates the portfolio return using the input asset weights and returns.
[ "Calculates", "the", "portfolio", "return", "using", "the", "input", "asset", "weights", "and", "returns", "." ]
c8d3f7e1894d4263b7334bca3f4c060e466f8b15
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java#L66-L68
141,648
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java
MarketEquilibrium.calculateAssetReturns
public PrimitiveMatrix calculateAssetReturns(final PrimitiveMatrix assetWeights) { final PrimitiveMatrix tmpAssetWeights = myRiskAversion.compareTo(DEFAULT_RISK_AVERSION) == 0 ? assetWeights : assetWeights.multiply(myRiskAversion); return myCovariances.multiply(tmpAssetWeights); }
java
public PrimitiveMatrix calculateAssetReturns(final PrimitiveMatrix assetWeights) { final PrimitiveMatrix tmpAssetWeights = myRiskAversion.compareTo(DEFAULT_RISK_AVERSION) == 0 ? assetWeights : assetWeights.multiply(myRiskAversion); return myCovariances.multiply(tmpAssetWeights); }
[ "public", "PrimitiveMatrix", "calculateAssetReturns", "(", "final", "PrimitiveMatrix", "assetWeights", ")", "{", "final", "PrimitiveMatrix", "tmpAssetWeights", "=", "myRiskAversion", ".", "compareTo", "(", "DEFAULT_RISK_AVERSION", ")", "==", "0", "?", "assetWeights", ":", "assetWeights", ".", "multiply", "(", "myRiskAversion", ")", ";", "return", "myCovariances", ".", "multiply", "(", "tmpAssetWeights", ")", ";", "}" ]
If the input vector of asset weights are the weights of the market portfolio, then the ouput is the equilibrium excess returns.
[ "If", "the", "input", "vector", "of", "asset", "weights", "are", "the", "weights", "of", "the", "market", "portfolio", "then", "the", "ouput", "is", "the", "equilibrium", "excess", "returns", "." ]
c8d3f7e1894d4263b7334bca3f4c060e466f8b15
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java#L126-L129
141,649
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java
MarketEquilibrium.calculateAssetWeights
public PrimitiveMatrix calculateAssetWeights(final PrimitiveMatrix assetReturns) { final PrimitiveMatrix tmpAssetWeights = myCovariances.solve(assetReturns); if (myRiskAversion.compareTo(DEFAULT_RISK_AVERSION) == 0) { return tmpAssetWeights; } else { return tmpAssetWeights.divide(myRiskAversion); } }
java
public PrimitiveMatrix calculateAssetWeights(final PrimitiveMatrix assetReturns) { final PrimitiveMatrix tmpAssetWeights = myCovariances.solve(assetReturns); if (myRiskAversion.compareTo(DEFAULT_RISK_AVERSION) == 0) { return tmpAssetWeights; } else { return tmpAssetWeights.divide(myRiskAversion); } }
[ "public", "PrimitiveMatrix", "calculateAssetWeights", "(", "final", "PrimitiveMatrix", "assetReturns", ")", "{", "final", "PrimitiveMatrix", "tmpAssetWeights", "=", "myCovariances", ".", "solve", "(", "assetReturns", ")", ";", "if", "(", "myRiskAversion", ".", "compareTo", "(", "DEFAULT_RISK_AVERSION", ")", "==", "0", ")", "{", "return", "tmpAssetWeights", ";", "}", "else", "{", "return", "tmpAssetWeights", ".", "divide", "(", "myRiskAversion", ")", ";", "}", "}" ]
If the input vector of returns are the equilibrium excess returns then the output is the market portfolio weights. This is unconstrained optimisation - there are no constraints on the resulting instrument weights.
[ "If", "the", "input", "vector", "of", "returns", "are", "the", "equilibrium", "excess", "returns", "then", "the", "output", "is", "the", "market", "portfolio", "weights", ".", "This", "is", "unconstrained", "optimisation", "-", "there", "are", "no", "constraints", "on", "the", "resulting", "instrument", "weights", "." ]
c8d3f7e1894d4263b7334bca3f4c060e466f8b15
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java#L136-L143
141,650
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java
MarketEquilibrium.calculatePortfolioVariance
public Scalar<?> calculatePortfolioVariance(final PrimitiveMatrix assetWeights) { PrimitiveMatrix tmpLeft; PrimitiveMatrix tmpRight; if (assetWeights.countColumns() == 1L) { tmpLeft = assetWeights.transpose(); tmpRight = assetWeights; } else { tmpLeft = assetWeights; tmpRight = assetWeights.transpose(); } return tmpLeft.multiply(myCovariances.multiply(tmpRight)).toScalar(0, 0); }
java
public Scalar<?> calculatePortfolioVariance(final PrimitiveMatrix assetWeights) { PrimitiveMatrix tmpLeft; PrimitiveMatrix tmpRight; if (assetWeights.countColumns() == 1L) { tmpLeft = assetWeights.transpose(); tmpRight = assetWeights; } else { tmpLeft = assetWeights; tmpRight = assetWeights.transpose(); } return tmpLeft.multiply(myCovariances.multiply(tmpRight)).toScalar(0, 0); }
[ "public", "Scalar", "<", "?", ">", "calculatePortfolioVariance", "(", "final", "PrimitiveMatrix", "assetWeights", ")", "{", "PrimitiveMatrix", "tmpLeft", ";", "PrimitiveMatrix", "tmpRight", ";", "if", "(", "assetWeights", ".", "countColumns", "(", ")", "==", "1L", ")", "{", "tmpLeft", "=", "assetWeights", ".", "transpose", "(", ")", ";", "tmpRight", "=", "assetWeights", ";", "}", "else", "{", "tmpLeft", "=", "assetWeights", ";", "tmpRight", "=", "assetWeights", ".", "transpose", "(", ")", ";", "}", "return", "tmpLeft", ".", "multiply", "(", "myCovariances", ".", "multiply", "(", "tmpRight", ")", ")", ".", "toScalar", "(", "0", ",", "0", ")", ";", "}" ]
Calculates the portfolio variance using the input instrument weights.
[ "Calculates", "the", "portfolio", "variance", "using", "the", "input", "instrument", "weights", "." ]
c8d3f7e1894d4263b7334bca3f4c060e466f8b15
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java#L148-L162
141,651
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java
MarketEquilibrium.clean
public MarketEquilibrium clean() { final PrimitiveMatrix tmpAssetVolatilities = FinanceUtils.toVolatilities(myCovariances, true); final PrimitiveMatrix tmpCleanedCorrelations = FinanceUtils.toCorrelations(myCovariances, true); final PrimitiveMatrix tmpCovariances = FinanceUtils.toCovariances(tmpAssetVolatilities, tmpCleanedCorrelations); return new MarketEquilibrium(myAssetKeys, tmpCovariances, myRiskAversion); }
java
public MarketEquilibrium clean() { final PrimitiveMatrix tmpAssetVolatilities = FinanceUtils.toVolatilities(myCovariances, true); final PrimitiveMatrix tmpCleanedCorrelations = FinanceUtils.toCorrelations(myCovariances, true); final PrimitiveMatrix tmpCovariances = FinanceUtils.toCovariances(tmpAssetVolatilities, tmpCleanedCorrelations); return new MarketEquilibrium(myAssetKeys, tmpCovariances, myRiskAversion); }
[ "public", "MarketEquilibrium", "clean", "(", ")", "{", "final", "PrimitiveMatrix", "tmpAssetVolatilities", "=", "FinanceUtils", ".", "toVolatilities", "(", "myCovariances", ",", "true", ")", ";", "final", "PrimitiveMatrix", "tmpCleanedCorrelations", "=", "FinanceUtils", ".", "toCorrelations", "(", "myCovariances", ",", "true", ")", ";", "final", "PrimitiveMatrix", "tmpCovariances", "=", "FinanceUtils", ".", "toCovariances", "(", "tmpAssetVolatilities", ",", "tmpCleanedCorrelations", ")", ";", "return", "new", "MarketEquilibrium", "(", "myAssetKeys", ",", "tmpCovariances", ",", "myRiskAversion", ")", ";", "}" ]
Equivalent to copying, but additionally the covariance matrix will be cleaned of negative and very small eigenvalues to make it positive definite.
[ "Equivalent", "to", "copying", "but", "additionally", "the", "covariance", "matrix", "will", "be", "cleaned", "of", "negative", "and", "very", "small", "eigenvalues", "to", "make", "it", "positive", "definite", "." ]
c8d3f7e1894d4263b7334bca3f4c060e466f8b15
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/portfolio/MarketEquilibrium.java#L179-L187
141,652
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/portfolio/BlackLittermanModel.java
BlackLittermanModel.getViewReturns
protected PrimitiveMatrix getViewReturns() { final int tmpRowDim = myViews.size(); final int tmpColDim = 1; final PrimitiveMatrix.DenseReceiver retVal = MATRIX_FACTORY.makeDense(tmpRowDim, tmpColDim); double tmpRet; final double tmpRAF = this.getRiskAversion().doubleValue(); for (int i = 0; i < tmpRowDim; i++) { tmpRet = myViews.get(i).getMeanReturn(); retVal.set(i, 0, PrimitiveMath.DIVIDE.invoke(tmpRet, tmpRAF)); } return retVal.build(); }
java
protected PrimitiveMatrix getViewReturns() { final int tmpRowDim = myViews.size(); final int tmpColDim = 1; final PrimitiveMatrix.DenseReceiver retVal = MATRIX_FACTORY.makeDense(tmpRowDim, tmpColDim); double tmpRet; final double tmpRAF = this.getRiskAversion().doubleValue(); for (int i = 0; i < tmpRowDim; i++) { tmpRet = myViews.get(i).getMeanReturn(); retVal.set(i, 0, PrimitiveMath.DIVIDE.invoke(tmpRet, tmpRAF)); } return retVal.build(); }
[ "protected", "PrimitiveMatrix", "getViewReturns", "(", ")", "{", "final", "int", "tmpRowDim", "=", "myViews", ".", "size", "(", ")", ";", "final", "int", "tmpColDim", "=", "1", ";", "final", "PrimitiveMatrix", ".", "DenseReceiver", "retVal", "=", "MATRIX_FACTORY", ".", "makeDense", "(", "tmpRowDim", ",", "tmpColDim", ")", ";", "double", "tmpRet", ";", "final", "double", "tmpRAF", "=", "this", ".", "getRiskAversion", "(", ")", ".", "doubleValue", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tmpRowDim", ";", "i", "++", ")", "{", "tmpRet", "=", "myViews", ".", "get", "(", "i", ")", ".", "getMeanReturn", "(", ")", ";", "retVal", ".", "set", "(", "i", ",", "0", ",", "PrimitiveMath", ".", "DIVIDE", ".", "invoke", "(", "tmpRet", ",", "tmpRAF", ")", ")", ";", "}", "return", "retVal", ".", "build", "(", ")", ";", "}" ]
Scaled by risk aversion factor.
[ "Scaled", "by", "risk", "aversion", "factor", "." ]
c8d3f7e1894d4263b7334bca3f4c060e466f8b15
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/portfolio/BlackLittermanModel.java#L280-L298
141,653
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/WorkspaceApi.java
WorkspaceApi.initialize
public User initialize(String authCode, String redirectUri) throws WorkspaceApiException { return initialize(authCode, redirectUri, null, null); }
java
public User initialize(String authCode, String redirectUri) throws WorkspaceApiException { return initialize(authCode, redirectUri, null, null); }
[ "public", "User", "initialize", "(", "String", "authCode", ",", "String", "redirectUri", ")", "throws", "WorkspaceApiException", "{", "return", "initialize", "(", "authCode", ",", "redirectUri", ",", "null", ",", "null", ")", ";", "}" ]
Initialize the API using the provided authorization code and redirect URI. The authorization code comes from using the Authorization Code Grant flow to authenticate with the Authentication API. @param authCode The authorization code you received during authentication. @param redirectUri The redirect URI you used during authentication. Since this is not sent by the UI, it needs to match the redirectUri that you sent when using the Authentication API to get the authCode. @return CompletableFuture<User>
[ "Initialize", "the", "API", "using", "the", "provided", "authorization", "code", "and", "redirect", "URI", ".", "The", "authorization", "code", "comes", "from", "using", "the", "Authorization", "Code", "Grant", "flow", "to", "authenticate", "with", "the", "Authentication", "API", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/WorkspaceApi.java#L256-L258
141,654
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/WorkspaceApi.java
WorkspaceApi.initialize
public User initialize(String token) throws WorkspaceApiException { return initialize(null, null, null, token); }
java
public User initialize(String token) throws WorkspaceApiException { return initialize(null, null, null, token); }
[ "public", "User", "initialize", "(", "String", "token", ")", "throws", "WorkspaceApiException", "{", "return", "initialize", "(", "null", ",", "null", ",", "null", ",", "token", ")", ";", "}" ]
Initialize the API using the provided access token. @param token The access token to use for initialization.
[ "Initialize", "the", "API", "using", "the", "provided", "access", "token", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/WorkspaceApi.java#L264-L266
141,655
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/WorkspaceApi.java
WorkspaceApi.destroy
public void destroy(long disconnectRequestTimeout) throws WorkspaceApiException { try { if (this.workspaceInitialized) { notifications.disconnect(disconnectRequestTimeout); sessionApi.logout(); } } catch (Exception e) { throw new WorkspaceApiException("destroy failed.", e); } finally { this.workspaceInitialized = false; } }
java
public void destroy(long disconnectRequestTimeout) throws WorkspaceApiException { try { if (this.workspaceInitialized) { notifications.disconnect(disconnectRequestTimeout); sessionApi.logout(); } } catch (Exception e) { throw new WorkspaceApiException("destroy failed.", e); } finally { this.workspaceInitialized = false; } }
[ "public", "void", "destroy", "(", "long", "disconnectRequestTimeout", ")", "throws", "WorkspaceApiException", "{", "try", "{", "if", "(", "this", ".", "workspaceInitialized", ")", "{", "notifications", ".", "disconnect", "(", "disconnectRequestTimeout", ")", ";", "sessionApi", ".", "logout", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"destroy failed.\"", ",", "e", ")", ";", "}", "finally", "{", "this", ".", "workspaceInitialized", "=", "false", ";", "}", "}" ]
Ends the current agent's session. This request logs out the agent on all activated channels, ends the HTTP session, and cleans up related resources. After you end the session, you'll need to make a login request before making any new calls to the API. @param disconnectRequestTimeout The timeout in ms to wait for the disconnect to complete
[ "Ends", "the", "current", "agent", "s", "session", ".", "This", "request", "logs", "out", "the", "agent", "on", "all", "activated", "channels", "ends", "the", "HTTP", "session", "and", "cleans", "up", "related", "resources", ".", "After", "you", "end", "the", "session", "you", "ll", "need", "to", "make", "a", "login", "request", "before", "making", "any", "new", "calls", "to", "the", "API", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/WorkspaceApi.java#L354-L365
141,656
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.setAgentReady
public void setAgentReady(KeyValueCollection reasons, KeyValueCollection extensions) throws WorkspaceApiException { try { VoicereadyData readyData = new VoicereadyData(); readyData.setReasons(Util.toKVList(reasons)); readyData.setExtensions(Util.toKVList(extensions)); ReadyData data = new ReadyData(); data.data(readyData); ApiSuccessResponse response = this.voiceApi.setAgentStateReady(data); throwIfNotOk("setAgentReady", response); } catch (ApiException e) { throw new WorkspaceApiException("setAgentReady failed.", e); } }
java
public void setAgentReady(KeyValueCollection reasons, KeyValueCollection extensions) throws WorkspaceApiException { try { VoicereadyData readyData = new VoicereadyData(); readyData.setReasons(Util.toKVList(reasons)); readyData.setExtensions(Util.toKVList(extensions)); ReadyData data = new ReadyData(); data.data(readyData); ApiSuccessResponse response = this.voiceApi.setAgentStateReady(data); throwIfNotOk("setAgentReady", response); } catch (ApiException e) { throw new WorkspaceApiException("setAgentReady failed.", e); } }
[ "public", "void", "setAgentReady", "(", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicereadyData", "readyData", "=", "new", "VoicereadyData", "(", ")", ";", "readyData", ".", "setReasons", "(", "Util", ".", "toKVList", "(", "reasons", ")", ")", ";", "readyData", ".", "setExtensions", "(", "Util", ".", "toKVList", "(", "extensions", ")", ")", ";", "ReadyData", "data", "=", "new", "ReadyData", "(", ")", ";", "data", ".", "data", "(", "readyData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "setAgentStateReady", "(", "data", ")", ";", "throwIfNotOk", "(", "\"setAgentReady\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"setAgentReady failed.\"", ",", "e", ")", ";", "}", "}" ]
Set the current agent's state to Ready on the voice channel. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Set", "the", "current", "agent", "s", "state", "to", "Ready", "on", "the", "voice", "channel", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L321-L334
141,657
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.dndOn
public void dndOn() throws WorkspaceApiException { try { ApiSuccessResponse response = this.voiceApi.setDNDOn(null); throwIfNotOk("dndOn", response); } catch (ApiException e) { throw new WorkspaceApiException("dndOn failed.", e); } }
java
public void dndOn() throws WorkspaceApiException { try { ApiSuccessResponse response = this.voiceApi.setDNDOn(null); throwIfNotOk("dndOn", response); } catch (ApiException e) { throw new WorkspaceApiException("dndOn failed.", e); } }
[ "public", "void", "dndOn", "(", ")", "throws", "WorkspaceApiException", "{", "try", "{", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "setDNDOn", "(", "null", ")", ";", "throwIfNotOk", "(", "\"dndOn\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"dndOn failed.\"", ",", "e", ")", ";", "}", "}" ]
Set the current agent's state to Do Not Disturb on the voice channel.
[ "Set", "the", "current", "agent", "s", "state", "to", "Do", "Not", "Disturb", "on", "the", "voice", "channel", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L389-L396
141,658
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.dndOff
public void dndOff() throws WorkspaceApiException { try { ApiSuccessResponse response = this.voiceApi.setDNDOff(null); throwIfNotOk("dndOff", response); } catch (ApiException e) { throw new WorkspaceApiException("dndOff failed.", e); } }
java
public void dndOff() throws WorkspaceApiException { try { ApiSuccessResponse response = this.voiceApi.setDNDOff(null); throwIfNotOk("dndOff", response); } catch (ApiException e) { throw new WorkspaceApiException("dndOff failed.", e); } }
[ "public", "void", "dndOff", "(", ")", "throws", "WorkspaceApiException", "{", "try", "{", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "setDNDOff", "(", "null", ")", ";", "throwIfNotOk", "(", "\"dndOff\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"dndOff failed.\"", ",", "e", ")", ";", "}", "}" ]
Turn off Do Not Disturb for the current agent on the voice channel.
[ "Turn", "off", "Do", "Not", "Disturb", "for", "the", "current", "agent", "on", "the", "voice", "channel", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L401-L408
141,659
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.setForward
public void setForward(String destination) throws WorkspaceApiException { try { VoicesetforwardData forwardData = new VoicesetforwardData(); forwardData.setForwardTo(destination); ForwardData data = new ForwardData(); data.data(forwardData); ApiSuccessResponse response = this.voiceApi.forward(data); throwIfNotOk("setForward", response); } catch (ApiException e) { throw new WorkspaceApiException("setForward failed.", e); } }
java
public void setForward(String destination) throws WorkspaceApiException { try { VoicesetforwardData forwardData = new VoicesetforwardData(); forwardData.setForwardTo(destination); ForwardData data = new ForwardData(); data.data(forwardData); ApiSuccessResponse response = this.voiceApi.forward(data); throwIfNotOk("setForward", response); } catch (ApiException e) { throw new WorkspaceApiException("setForward failed.", e); } }
[ "public", "void", "setForward", "(", "String", "destination", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicesetforwardData", "forwardData", "=", "new", "VoicesetforwardData", "(", ")", ";", "forwardData", ".", "setForwardTo", "(", "destination", ")", ";", "ForwardData", "data", "=", "new", "ForwardData", "(", ")", ";", "data", ".", "data", "(", "forwardData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "forward", "(", "data", ")", ";", "throwIfNotOk", "(", "\"setForward\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"setForward failed.\"", ",", "e", ")", ";", "}", "}" ]
Set call forwarding on the current agent's DN to the specified destination. @param destination The number where Workspace should forward calls.
[ "Set", "call", "forwarding", "on", "the", "current", "agent", "s", "DN", "to", "the", "specified", "destination", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L443-L456
141,660
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.cancelForward
public void cancelForward() throws WorkspaceApiException { try { ApiSuccessResponse response = this.voiceApi.cancelForward(null); throwIfNotOk("cancelForward", response); } catch (ApiException e) { throw new WorkspaceApiException("cancelForward failed.", e); } }
java
public void cancelForward() throws WorkspaceApiException { try { ApiSuccessResponse response = this.voiceApi.cancelForward(null); throwIfNotOk("cancelForward", response); } catch (ApiException e) { throw new WorkspaceApiException("cancelForward failed.", e); } }
[ "public", "void", "cancelForward", "(", ")", "throws", "WorkspaceApiException", "{", "try", "{", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "cancelForward", "(", "null", ")", ";", "throwIfNotOk", "(", "\"cancelForward\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"cancelForward failed.\"", ",", "e", ")", ";", "}", "}" ]
Cancel call forwarding for the current agent.
[ "Cancel", "call", "forwarding", "for", "the", "current", "agent", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L461-L468
141,661
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.answerCall
public void answerCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData answerData = new VoicecallsidanswerData(); answerData.setReasons(Util.toKVList(reasons)); answerData.setExtensions(Util.toKVList(extensions)); AnswerData data = new AnswerData(); data.setData(answerData); ApiSuccessResponse response = this.voiceApi.answer(connId, data); throwIfNotOk("answerCall", response); } catch (ApiException e) { throw new WorkspaceApiException("answerCall failed.", e); } }
java
public void answerCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData answerData = new VoicecallsidanswerData(); answerData.setReasons(Util.toKVList(reasons)); answerData.setExtensions(Util.toKVList(extensions)); AnswerData data = new AnswerData(); data.setData(answerData); ApiSuccessResponse response = this.voiceApi.answer(connId, data); throwIfNotOk("answerCall", response); } catch (ApiException e) { throw new WorkspaceApiException("answerCall failed.", e); } }
[ "public", "void", "answerCall", "(", "String", "connId", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidanswerData", "answerData", "=", "new", "VoicecallsidanswerData", "(", ")", ";", "answerData", ".", "setReasons", "(", "Util", ".", "toKVList", "(", "reasons", ")", ")", ";", "answerData", ".", "setExtensions", "(", "Util", ".", "toKVList", "(", "extensions", ")", ")", ";", "AnswerData", "data", "=", "new", "AnswerData", "(", ")", ";", "data", ".", "setData", "(", "answerData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "answer", "(", "connId", ",", "data", ")", ";", "throwIfNotOk", "(", "\"answerCall\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"answerCall failed.\"", ",", "e", ")", ";", "}", "}" ]
Answer the specified call. @param connId The connection ID of the call. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Answer", "the", "specified", "call", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L533-L551
141,662
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.holdCall
public void holdCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData holdData = new VoicecallsidanswerData(); holdData.setReasons(Util.toKVList(reasons)); holdData.setExtensions(Util.toKVList(extensions)); HoldData data = new HoldData(); data.data(holdData); ApiSuccessResponse response = this.voiceApi.hold(connId, data); throwIfNotOk("holdCall", response); } catch (ApiException e) { throw new WorkspaceApiException("holdCall failed.", e); } }
java
public void holdCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData holdData = new VoicecallsidanswerData(); holdData.setReasons(Util.toKVList(reasons)); holdData.setExtensions(Util.toKVList(extensions)); HoldData data = new HoldData(); data.data(holdData); ApiSuccessResponse response = this.voiceApi.hold(connId, data); throwIfNotOk("holdCall", response); } catch (ApiException e) { throw new WorkspaceApiException("holdCall failed.", e); } }
[ "public", "void", "holdCall", "(", "String", "connId", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidanswerData", "holdData", "=", "new", "VoicecallsidanswerData", "(", ")", ";", "holdData", ".", "setReasons", "(", "Util", ".", "toKVList", "(", "reasons", ")", ")", ";", "holdData", ".", "setExtensions", "(", "Util", ".", "toKVList", "(", "extensions", ")", ")", ";", "HoldData", "data", "=", "new", "HoldData", "(", ")", ";", "data", ".", "data", "(", "holdData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "hold", "(", "connId", ",", "data", ")", ";", "throwIfNotOk", "(", "\"holdCall\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"holdCall failed.\"", ",", "e", ")", ";", "}", "}" ]
Place the specified call on hold. @param connId The connection ID of the call. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Place", "the", "specified", "call", "on", "hold", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L567-L585
141,663
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.retrieveCall
public void retrieveCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData retrieveData = new VoicecallsidanswerData(); retrieveData.setReasons(Util.toKVList(reasons)); retrieveData.setExtensions(Util.toKVList(extensions)); RetrieveData data = new RetrieveData(); data.data(retrieveData); ApiSuccessResponse response = this.voiceApi.retrieve(connId, data); throwIfNotOk("retrieveCall", response); } catch (ApiException e) { throw new WorkspaceApiException("retrieveCall failed.", e); } }
java
public void retrieveCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData retrieveData = new VoicecallsidanswerData(); retrieveData.setReasons(Util.toKVList(reasons)); retrieveData.setExtensions(Util.toKVList(extensions)); RetrieveData data = new RetrieveData(); data.data(retrieveData); ApiSuccessResponse response = this.voiceApi.retrieve(connId, data); throwIfNotOk("retrieveCall", response); } catch (ApiException e) { throw new WorkspaceApiException("retrieveCall failed.", e); } }
[ "public", "void", "retrieveCall", "(", "String", "connId", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidanswerData", "retrieveData", "=", "new", "VoicecallsidanswerData", "(", ")", ";", "retrieveData", ".", "setReasons", "(", "Util", ".", "toKVList", "(", "reasons", ")", ")", ";", "retrieveData", ".", "setExtensions", "(", "Util", ".", "toKVList", "(", "extensions", ")", ")", ";", "RetrieveData", "data", "=", "new", "RetrieveData", "(", ")", ";", "data", ".", "data", "(", "retrieveData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "retrieve", "(", "connId", ",", "data", ")", ";", "throwIfNotOk", "(", "\"retrieveCall\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"retrieveCall failed.\"", ",", "e", ")", ";", "}", "}" ]
Retrieve the specified call from hold. @param connId The connection ID of the call. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Retrieve", "the", "specified", "call", "from", "hold", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L601-L619
141,664
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.releaseCall
public void releaseCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData releaseData = new VoicecallsidanswerData(); releaseData.setReasons(Util.toKVList(reasons)); releaseData.setExtensions(Util.toKVList(extensions)); ReleaseData data = new ReleaseData(); data.data(releaseData); ApiSuccessResponse response = this.voiceApi.release(connId, data); throwIfNotOk("releaseCall", response); } catch (ApiException e) { throw new WorkspaceApiException("releaseCall failed.", e); } }
java
public void releaseCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData releaseData = new VoicecallsidanswerData(); releaseData.setReasons(Util.toKVList(reasons)); releaseData.setExtensions(Util.toKVList(extensions)); ReleaseData data = new ReleaseData(); data.data(releaseData); ApiSuccessResponse response = this.voiceApi.release(connId, data); throwIfNotOk("releaseCall", response); } catch (ApiException e) { throw new WorkspaceApiException("releaseCall failed.", e); } }
[ "public", "void", "releaseCall", "(", "String", "connId", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidanswerData", "releaseData", "=", "new", "VoicecallsidanswerData", "(", ")", ";", "releaseData", ".", "setReasons", "(", "Util", ".", "toKVList", "(", "reasons", ")", ")", ";", "releaseData", ".", "setExtensions", "(", "Util", ".", "toKVList", "(", "extensions", ")", ")", ";", "ReleaseData", "data", "=", "new", "ReleaseData", "(", ")", ";", "data", ".", "data", "(", "releaseData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "release", "(", "connId", ",", "data", ")", ";", "throwIfNotOk", "(", "\"releaseCall\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"releaseCall failed.\"", ",", "e", ")", ";", "}", "}" ]
Release the specified call. @param connId The connection ID of the call. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Release", "the", "specified", "call", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L635-L654
141,665
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.initiateConference
public void initiateConference( String connId, String destination, String location, String outboundCallerId, KeyValueCollection userData, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidinitiateconferenceData initData = new VoicecallsidinitiateconferenceData(); initData.setDestination(destination); initData.setLocation(location); initData.setOutboundCallerId(outboundCallerId); initData.setUserData(Util.toKVList(userData)); initData.setReasons(Util.toKVList(reasons)); initData.setExtensions(Util.toKVList(extensions)); InitiateConferenceData data = new InitiateConferenceData(); data.data(initData); ApiSuccessResponse response = this.voiceApi.initiateConference(connId, data); throwIfNotOk("initiateConference", response); } catch (ApiException e) { throw new WorkspaceApiException("initiateConference failed.", e); } }
java
public void initiateConference( String connId, String destination, String location, String outboundCallerId, KeyValueCollection userData, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidinitiateconferenceData initData = new VoicecallsidinitiateconferenceData(); initData.setDestination(destination); initData.setLocation(location); initData.setOutboundCallerId(outboundCallerId); initData.setUserData(Util.toKVList(userData)); initData.setReasons(Util.toKVList(reasons)); initData.setExtensions(Util.toKVList(extensions)); InitiateConferenceData data = new InitiateConferenceData(); data.data(initData); ApiSuccessResponse response = this.voiceApi.initiateConference(connId, data); throwIfNotOk("initiateConference", response); } catch (ApiException e) { throw new WorkspaceApiException("initiateConference failed.", e); } }
[ "public", "void", "initiateConference", "(", "String", "connId", ",", "String", "destination", ",", "String", "location", ",", "String", "outboundCallerId", ",", "KeyValueCollection", "userData", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidinitiateconferenceData", "initData", "=", "new", "VoicecallsidinitiateconferenceData", "(", ")", ";", "initData", ".", "setDestination", "(", "destination", ")", ";", "initData", ".", "setLocation", "(", "location", ")", ";", "initData", ".", "setOutboundCallerId", "(", "outboundCallerId", ")", ";", "initData", ".", "setUserData", "(", "Util", ".", "toKVList", "(", "userData", ")", ")", ";", "initData", ".", "setReasons", "(", "Util", ".", "toKVList", "(", "reasons", ")", ")", ";", "initData", ".", "setExtensions", "(", "Util", ".", "toKVList", "(", "extensions", ")", ")", ";", "InitiateConferenceData", "data", "=", "new", "InitiateConferenceData", "(", ")", ";", "data", ".", "data", "(", "initData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "initiateConference", "(", "connId", ",", "data", ")", ";", "throwIfNotOk", "(", "\"initiateConference\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"initiateConference failed.\"", ",", "e", ")", ";", "}", "}" ]
Initiate a two-step conference to the specified destination. This places the existing call on hold and creates a new call in the dialing state. After initiating the conference you can use completeConference to complete the conference and bring all parties into the same call. @param connId The connection ID of the call to start the conference from. This call will be placed on hold. @param destination The number to be dialed. @param location Name of the remote location in the form of <SwitchName> or <T-ServerApplicationName>@<SwitchName>. This value is used by Workspace to set the location attribute for the corresponding T-Server requests. (optional) @param outboundCallerId The caller ID information to display on the destination party's phone. The value should be set as CPNDigits. For more information about caller ID, see the SIP Server Deployment Guide. (optional) @param userData Key/value data to include with the call. (optional) @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Initiate", "a", "two", "-", "step", "conference", "to", "the", "specified", "destination", ".", "This", "places", "the", "existing", "call", "on", "hold", "and", "creates", "a", "new", "call", "in", "the", "dialing", "state", ".", "After", "initiating", "the", "conference", "you", "can", "use", "completeConference", "to", "complete", "the", "conference", "and", "bring", "all", "parties", "into", "the", "same", "call", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L695-L721
141,666
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.completeConference
public void completeConference(String connId, String parentConnId) throws WorkspaceApiException { this.completeConference(connId, parentConnId, null, null); }
java
public void completeConference(String connId, String parentConnId) throws WorkspaceApiException { this.completeConference(connId, parentConnId, null, null); }
[ "public", "void", "completeConference", "(", "String", "connId", ",", "String", "parentConnId", ")", "throws", "WorkspaceApiException", "{", "this", ".", "completeConference", "(", "connId", ",", "parentConnId", ",", "null", ",", "null", ")", ";", "}" ]
Complete a previously initiated two-step conference identified by the provided IDs. Once completed, the two separate calls are brought together so that all three parties are participating in the same call. @param connId The connection ID of the consult call (established). @param parentConnId The connection ID of the parent call (held).
[ "Complete", "a", "previously", "initiated", "two", "-", "step", "conference", "identified", "by", "the", "provided", "IDs", ".", "Once", "completed", "the", "two", "separate", "calls", "are", "brought", "together", "so", "that", "all", "three", "parties", "are", "participating", "in", "the", "same", "call", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L729-L731
141,667
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.attachUserData
public void attachUserData(String connId, KeyValueCollection userData) throws WorkspaceApiException { try { VoicecallsidcompleteData completeData = new VoicecallsidcompleteData(); completeData.setUserData(Util.toKVList(userData)); UserDataOperationId data = new UserDataOperationId(); data.data(completeData); ApiSuccessResponse response = this.voiceApi.attachUserData(connId, data); throwIfNotOk("attachUserData", response); } catch (ApiException e) { throw new WorkspaceApiException("attachUserData failed.", e); } }
java
public void attachUserData(String connId, KeyValueCollection userData) throws WorkspaceApiException { try { VoicecallsidcompleteData completeData = new VoicecallsidcompleteData(); completeData.setUserData(Util.toKVList(userData)); UserDataOperationId data = new UserDataOperationId(); data.data(completeData); ApiSuccessResponse response = this.voiceApi.attachUserData(connId, data); throwIfNotOk("attachUserData", response); } catch (ApiException e) { throw new WorkspaceApiException("attachUserData failed.", e); } }
[ "public", "void", "attachUserData", "(", "String", "connId", ",", "KeyValueCollection", "userData", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidcompleteData", "completeData", "=", "new", "VoicecallsidcompleteData", "(", ")", ";", "completeData", ".", "setUserData", "(", "Util", ".", "toKVList", "(", "userData", ")", ")", ";", "UserDataOperationId", "data", "=", "new", "UserDataOperationId", "(", ")", ";", "data", ".", "data", "(", "completeData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "attachUserData", "(", "connId", ",", "data", ")", ";", "throwIfNotOk", "(", "\"attachUserData\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"attachUserData failed.\"", ",", "e", ")", ";", "}", "}" ]
Attach the provided data to the call. This adds the data to the call even if data already exists with the provided keys. @param connId The connection ID of the call. @param userData The data to attach to the call. This is an array of objects with the properties key, type, and value.
[ "Attach", "the", "provided", "data", "to", "the", "call", ".", "This", "adds", "the", "data", "to", "the", "call", "even", "if", "data", "already", "exists", "with", "the", "provided", "keys", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1066-L1078
141,668
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.deleteUserDataPair
public void deleteUserDataPair(String connId, String key) throws WorkspaceApiException { try { VoicecallsiddeleteuserdatapairData deletePairData = new VoicecallsiddeleteuserdatapairData(); deletePairData.setKey(key); KeyData data = new KeyData(); data.data(deletePairData); ApiSuccessResponse response = this.voiceApi.deleteUserDataPair(connId, data); throwIfNotOk("deleteUserDataPair", response); } catch (ApiException e) { throw new WorkspaceApiException("deleteUserDataPair failed.", e); } }
java
public void deleteUserDataPair(String connId, String key) throws WorkspaceApiException { try { VoicecallsiddeleteuserdatapairData deletePairData = new VoicecallsiddeleteuserdatapairData(); deletePairData.setKey(key); KeyData data = new KeyData(); data.data(deletePairData); ApiSuccessResponse response = this.voiceApi.deleteUserDataPair(connId, data); throwIfNotOk("deleteUserDataPair", response); } catch (ApiException e) { throw new WorkspaceApiException("deleteUserDataPair failed.", e); } }
[ "public", "void", "deleteUserDataPair", "(", "String", "connId", ",", "String", "key", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsiddeleteuserdatapairData", "deletePairData", "=", "new", "VoicecallsiddeleteuserdatapairData", "(", ")", ";", "deletePairData", ".", "setKey", "(", "key", ")", ";", "KeyData", "data", "=", "new", "KeyData", "(", ")", ";", "data", ".", "data", "(", "deletePairData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "deleteUserDataPair", "(", "connId", ",", "data", ")", ";", "throwIfNotOk", "(", "\"deleteUserDataPair\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"deleteUserDataPair failed.\"", ",", "e", ")", ";", "}", "}" ]
Delete data with the specified key from the call's user data. @param connId The connection ID of the call. @param key The key of the data to remove.
[ "Delete", "data", "with", "the", "specified", "key", "from", "the", "call", "s", "user", "data", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1104-L1117
141,669
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.redirectCall
public void redirectCall(String connId, String destination) throws WorkspaceApiException { this.redirectCall(connId, destination, null, null); }
java
public void redirectCall(String connId, String destination) throws WorkspaceApiException { this.redirectCall(connId, destination, null, null); }
[ "public", "void", "redirectCall", "(", "String", "connId", ",", "String", "destination", ")", "throws", "WorkspaceApiException", "{", "this", ".", "redirectCall", "(", "connId", ",", "destination", ",", "null", ",", "null", ")", ";", "}" ]
Redirect a call to the specified destination. @param connId The connection ID of the call to redirect. @param destination The number where Workspace should redirect the call.
[ "Redirect", "a", "call", "to", "the", "specified", "destination", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1204-L1206
141,670
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.redirectCall
public void redirectCall( String connId, String destination, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidredirectData redirectData = new VoicecallsidredirectData(); redirectData.setDestination(destination); redirectData.setReasons(Util.toKVList(reasons)); redirectData.setExtensions(Util.toKVList(extensions)); RedirectData data = new RedirectData(); data.data(redirectData); ApiSuccessResponse response = this.voiceApi.redirect(connId, data); throwIfNotOk("redirectCall", response); } catch (ApiException e) { throw new WorkspaceApiException("redirectCall failed.", e); } }
java
public void redirectCall( String connId, String destination, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidredirectData redirectData = new VoicecallsidredirectData(); redirectData.setDestination(destination); redirectData.setReasons(Util.toKVList(reasons)); redirectData.setExtensions(Util.toKVList(extensions)); RedirectData data = new RedirectData(); data.data(redirectData); ApiSuccessResponse response = this.voiceApi.redirect(connId, data); throwIfNotOk("redirectCall", response); } catch (ApiException e) { throw new WorkspaceApiException("redirectCall failed.", e); } }
[ "public", "void", "redirectCall", "(", "String", "connId", ",", "String", "destination", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidredirectData", "redirectData", "=", "new", "VoicecallsidredirectData", "(", ")", ";", "redirectData", ".", "setDestination", "(", "destination", ")", ";", "redirectData", ".", "setReasons", "(", "Util", ".", "toKVList", "(", "reasons", ")", ")", ";", "redirectData", ".", "setExtensions", "(", "Util", ".", "toKVList", "(", "extensions", ")", ")", ";", "RedirectData", "data", "=", "new", "RedirectData", "(", ")", ";", "data", ".", "data", "(", "redirectData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "redirect", "(", "connId", ",", "data", ")", ";", "throwIfNotOk", "(", "\"redirectCall\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"redirectCall failed.\"", ",", "e", ")", ";", "}", "}" ]
Redirect a call to the specified destination @param connId The connection ID of the call to redirect. @param destination The number where Workspace should redirect the call. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Redirect", "a", "call", "to", "the", "specified", "destination" ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1215-L1234
141,671
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.clearCall
public void clearCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData clearData = new VoicecallsidanswerData(); clearData.setReasons(Util.toKVList(reasons)); clearData.setExtensions(Util.toKVList(extensions)); ClearData data = new ClearData(); data.data(clearData); ApiSuccessResponse response = this.voiceApi.clear(connId, data); throwIfNotOk("clearCall", response); } catch (ApiException e) { throw new WorkspaceApiException("clearCall failed.", e); } }
java
public void clearCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData clearData = new VoicecallsidanswerData(); clearData.setReasons(Util.toKVList(reasons)); clearData.setExtensions(Util.toKVList(extensions)); ClearData data = new ClearData(); data.data(clearData); ApiSuccessResponse response = this.voiceApi.clear(connId, data); throwIfNotOk("clearCall", response); } catch (ApiException e) { throw new WorkspaceApiException("clearCall failed.", e); } }
[ "public", "void", "clearCall", "(", "String", "connId", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidanswerData", "clearData", "=", "new", "VoicecallsidanswerData", "(", ")", ";", "clearData", ".", "setReasons", "(", "Util", ".", "toKVList", "(", "reasons", ")", ")", ";", "clearData", ".", "setExtensions", "(", "Util", ".", "toKVList", "(", "extensions", ")", ")", ";", "ClearData", "data", "=", "new", "ClearData", "(", ")", ";", "data", ".", "data", "(", "clearData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "clear", "(", "connId", ",", "data", ")", ";", "throwIfNotOk", "(", "\"clearCall\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"clearCall failed.\"", ",", "e", ")", ";", "}", "}" ]
End the conference call for all parties. This can be performed by any agent participating in the conference. @param connId The connection ID of the call to clear. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "End", "the", "conference", "call", "for", "all", "parties", ".", "This", "can", "be", "performed", "by", "any", "agent", "participating", "in", "the", "conference", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1328-L1346
141,672
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/SessionApi.java
SessionApi.getCurrentSessionWithHttpInfo
public ApiResponse<CurrentSession> getCurrentSessionWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getCurrentSessionValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<CurrentSession>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
public ApiResponse<CurrentSession> getCurrentSessionWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getCurrentSessionValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<CurrentSession>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
[ "public", "ApiResponse", "<", "CurrentSession", ">", "getCurrentSessionWithHttpInfo", "(", ")", "throws", "ApiException", "{", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "getCurrentSessionValidateBeforeCall", "(", "null", ",", "null", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "CurrentSession", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "return", "apiClient", ".", "execute", "(", "call", ",", "localVarReturnType", ")", ";", "}" ]
Get information about the current user Get information about the current user, including any existing media logins, calls, and interactions. The returned user information includes state recovery information about the active session. You can make this request at startup to check for an existing session. @return ApiResponse&lt;CurrentSession&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "information", "about", "the", "current", "user", "Get", "information", "about", "the", "current", "user", "including", "any", "existing", "media", "logins", "calls", "and", "interactions", ".", "The", "returned", "user", "information", "includes", "state", "recovery", "information", "about", "the", "active", "session", ".", "You", "can", "make", "this", "request", "at", "startup", "to", "check", "for", "an", "existing", "session", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/SessionApi.java#L609-L613
141,673
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/SessionApi.java
SessionApi.getUserInfoWithHttpInfo
public ApiResponse<CurrentSession> getUserInfoWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getUserInfoValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<CurrentSession>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
public ApiResponse<CurrentSession> getUserInfoWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getUserInfoValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<CurrentSession>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
[ "public", "ApiResponse", "<", "CurrentSession", ">", "getUserInfoWithHttpInfo", "(", ")", "throws", "ApiException", "{", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "getUserInfoValidateBeforeCall", "(", "null", ",", "null", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "CurrentSession", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "return", "apiClient", ".", "execute", "(", "call", ",", "localVarReturnType", ")", ";", "}" ]
Retrieve encrypted data about the current user This request can be used to retrieve encrypted data about the user to use with other services @return ApiResponse&lt;CurrentSession&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Retrieve", "encrypted", "data", "about", "the", "current", "user", "This", "request", "can", "be", "used", "to", "retrieve", "encrypted", "data", "about", "the", "user", "to", "use", "with", "other", "services" ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/SessionApi.java#L979-L983
141,674
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/ReportingApi.java
ReportingApi.peek
public List<StatisticValue> peek(String subscriptionId) throws WorkspaceApiException { try { InlineResponse2002 resp = api.peek(subscriptionId); Util.throwIfNotOk(resp.getStatus()); InlineResponse2002Data data = resp.getData(); if(data == null) { throw new WorkspaceApiException("Response data is empty"); } return data.getStatistics(); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot peek", ex); } }
java
public List<StatisticValue> peek(String subscriptionId) throws WorkspaceApiException { try { InlineResponse2002 resp = api.peek(subscriptionId); Util.throwIfNotOk(resp.getStatus()); InlineResponse2002Data data = resp.getData(); if(data == null) { throw new WorkspaceApiException("Response data is empty"); } return data.getStatistics(); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot peek", ex); } }
[ "public", "List", "<", "StatisticValue", ">", "peek", "(", "String", "subscriptionId", ")", "throws", "WorkspaceApiException", "{", "try", "{", "InlineResponse2002", "resp", "=", "api", ".", "peek", "(", "subscriptionId", ")", ";", "Util", ".", "throwIfNotOk", "(", "resp", ".", "getStatus", "(", ")", ")", ";", "InlineResponse2002Data", "data", "=", "resp", ".", "getData", "(", ")", ";", "if", "(", "data", "==", "null", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"Response data is empty\"", ")", ";", "}", "return", "data", ".", "getStatistics", "(", ")", ";", "}", "catch", "(", "ApiException", "ex", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"Cannot peek\"", ",", "ex", ")", ";", "}", "}" ]
Get the statistics for the specified subscription ID. @param subscriptionId The unique ID of the subscription.
[ "Get", "the", "statistics", "for", "the", "specified", "subscription", "ID", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/ReportingApi.java#L33-L48
141,675
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/ReportingApi.java
ReportingApi.unsubscribe
public void unsubscribe(String subscriptionId) throws WorkspaceApiException { try { ApiSuccessResponse resp = api.unsubscribe(subscriptionId); Util.throwIfNotOk(resp); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot unsubscribe", ex); } }
java
public void unsubscribe(String subscriptionId) throws WorkspaceApiException { try { ApiSuccessResponse resp = api.unsubscribe(subscriptionId); Util.throwIfNotOk(resp); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot unsubscribe", ex); } }
[ "public", "void", "unsubscribe", "(", "String", "subscriptionId", ")", "throws", "WorkspaceApiException", "{", "try", "{", "ApiSuccessResponse", "resp", "=", "api", ".", "unsubscribe", "(", "subscriptionId", ")", ";", "Util", ".", "throwIfNotOk", "(", "resp", ")", ";", "}", "catch", "(", "ApiException", "ex", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"Cannot unsubscribe\"", ",", "ex", ")", ";", "}", "}" ]
Unsubscribe from the specified group of statistics. @param subscriptionId The unique ID of the subscription.
[ "Unsubscribe", "from", "the", "specified", "group", "of", "statistics", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/ReportingApi.java#L85-L93
141,676
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/TargetsApi.java
TargetsApi.ackRecentMissedCallsWithHttpInfo
public ApiResponse<ApiSuccessResponse> ackRecentMissedCallsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = ackRecentMissedCallsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
public ApiResponse<ApiSuccessResponse> ackRecentMissedCallsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = ackRecentMissedCallsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
[ "public", "ApiResponse", "<", "ApiSuccessResponse", ">", "ackRecentMissedCallsWithHttpInfo", "(", ")", "throws", "ApiException", "{", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "ackRecentMissedCallsValidateBeforeCall", "(", "null", ",", "null", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "ApiSuccessResponse", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "return", "apiClient", ".", "execute", "(", "call", ",", "localVarReturnType", ")", ";", "}" ]
Acknowledge missed calls Acknowledge missed calls in the list of recent targets. @return ApiResponse&lt;ApiSuccessResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Acknowledge", "missed", "calls", "Acknowledge", "missed", "calls", "in", "the", "list", "of", "recent", "targets", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/TargetsApi.java#L136-L140
141,677
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/DocumentationApi.java
DocumentationApi.swaggerDocWithHttpInfo
public ApiResponse<Void> swaggerDocWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = swaggerDocValidateBeforeCall(null, null); return apiClient.execute(call); }
java
public ApiResponse<Void> swaggerDocWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = swaggerDocValidateBeforeCall(null, null); return apiClient.execute(call); }
[ "public", "ApiResponse", "<", "Void", ">", "swaggerDocWithHttpInfo", "(", ")", "throws", "ApiException", "{", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "swaggerDocValidateBeforeCall", "(", "null", ",", "null", ")", ";", "return", "apiClient", ".", "execute", "(", "call", ")", ";", "}" ]
Returns API description in Swagger format Returns API description in Swagger format @return ApiResponse&lt;Void&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Returns", "API", "description", "in", "Swagger", "format", "Returns", "API", "description", "in", "Swagger", "format" ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/DocumentationApi.java#L129-L132
141,678
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/DocumentationApi.java
DocumentationApi.versionInfoWithHttpInfo
public ApiResponse<Info> versionInfoWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = versionInfoValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<Info>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
public ApiResponse<Info> versionInfoWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = versionInfoValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<Info>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
[ "public", "ApiResponse", "<", "Info", ">", "versionInfoWithHttpInfo", "(", ")", "throws", "ApiException", "{", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "versionInfoValidateBeforeCall", "(", "null", ",", "null", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "Info", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "return", "apiClient", ".", "execute", "(", "call", ",", "localVarReturnType", ")", ";", "}" ]
Returns version information Returns version information @return ApiResponse&lt;Info&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Returns", "version", "information", "Returns", "version", "information" ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/DocumentationApi.java#L240-L244
141,679
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/NotificationsApi.java
NotificationsApi.notificationsWithHttpInfo
public ApiResponse<Void> notificationsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = notificationsValidateBeforeCall(null, null); return apiClient.execute(call); }
java
public ApiResponse<Void> notificationsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = notificationsValidateBeforeCall(null, null); return apiClient.execute(call); }
[ "public", "ApiResponse", "<", "Void", ">", "notificationsWithHttpInfo", "(", ")", "throws", "ApiException", "{", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "notificationsValidateBeforeCall", "(", "null", ",", "null", ")", ";", "return", "apiClient", ".", "execute", "(", "call", ")", ";", "}" ]
CometD endpoint Subscribe to the CometD notification API. @return ApiResponse&lt;Void&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "CometD", "endpoint", "Subscribe", "to", "the", "CometD", "notification", "API", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/NotificationsApi.java#L128-L131
141,680
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/TargetsApi.java
TargetsApi.search
public SearchResult<Target> search(String searchTerm, TargetsSearchOptions options) throws WorkspaceApiException { try { String types = null; List<String> typesArray = null; if(options.getTypes() != null){ typesArray = new ArrayList<>(10); for(TargetType targetType: options.getTypes()){ typesArray.add(targetType.getValue()); } types = StringUtil.join(typesArray.toArray(new String[typesArray.size()]),","); } String excludeGroups = options.getExcludeGroups() !=null? StringUtil.join(options.getExcludeGroups(),","):null; String restrictGroups = options.getRestrictGroups() !=null? StringUtil.join(options.getRestrictGroups(),","):null; String excludeFromGroups = options.getExcludeFromGroups() !=null? StringUtil.join(options.getExcludeFromGroups(),","): null; String restrictToGroups = options.getRestrictToGroups() !=null? StringUtil.join (options.getRestrictToGroups(),","): null; TargetsResponse response = this.targetsApi.getTargets(searchTerm, options.getFilterName(), types, excludeGroups, restrictGroups, excludeFromGroups, restrictToGroups, options.isDesc()? "desc": null, options.getLimit() < 1? null: new BigDecimal(options.getLimit()), options.isExact()? "exact": null); TargetsResponseData data = response.getData(); List<Target> targets = new ArrayList<>(); if (data.getTargets() != null) { for (com.genesys.internal.workspace.model.Target t : data.getTargets()) { Target target = Target.fromTarget(t); targets.add(target); } } return new SearchResult<>(data.getTotalMatches(), targets); } catch (ApiException e) { throw new WorkspaceApiException("searchTargets failed.", e); } }
java
public SearchResult<Target> search(String searchTerm, TargetsSearchOptions options) throws WorkspaceApiException { try { String types = null; List<String> typesArray = null; if(options.getTypes() != null){ typesArray = new ArrayList<>(10); for(TargetType targetType: options.getTypes()){ typesArray.add(targetType.getValue()); } types = StringUtil.join(typesArray.toArray(new String[typesArray.size()]),","); } String excludeGroups = options.getExcludeGroups() !=null? StringUtil.join(options.getExcludeGroups(),","):null; String restrictGroups = options.getRestrictGroups() !=null? StringUtil.join(options.getRestrictGroups(),","):null; String excludeFromGroups = options.getExcludeFromGroups() !=null? StringUtil.join(options.getExcludeFromGroups(),","): null; String restrictToGroups = options.getRestrictToGroups() !=null? StringUtil.join (options.getRestrictToGroups(),","): null; TargetsResponse response = this.targetsApi.getTargets(searchTerm, options.getFilterName(), types, excludeGroups, restrictGroups, excludeFromGroups, restrictToGroups, options.isDesc()? "desc": null, options.getLimit() < 1? null: new BigDecimal(options.getLimit()), options.isExact()? "exact": null); TargetsResponseData data = response.getData(); List<Target> targets = new ArrayList<>(); if (data.getTargets() != null) { for (com.genesys.internal.workspace.model.Target t : data.getTargets()) { Target target = Target.fromTarget(t); targets.add(target); } } return new SearchResult<>(data.getTotalMatches(), targets); } catch (ApiException e) { throw new WorkspaceApiException("searchTargets failed.", e); } }
[ "public", "SearchResult", "<", "Target", ">", "search", "(", "String", "searchTerm", ",", "TargetsSearchOptions", "options", ")", "throws", "WorkspaceApiException", "{", "try", "{", "String", "types", "=", "null", ";", "List", "<", "String", ">", "typesArray", "=", "null", ";", "if", "(", "options", ".", "getTypes", "(", ")", "!=", "null", ")", "{", "typesArray", "=", "new", "ArrayList", "<>", "(", "10", ")", ";", "for", "(", "TargetType", "targetType", ":", "options", ".", "getTypes", "(", ")", ")", "{", "typesArray", ".", "add", "(", "targetType", ".", "getValue", "(", ")", ")", ";", "}", "types", "=", "StringUtil", ".", "join", "(", "typesArray", ".", "toArray", "(", "new", "String", "[", "typesArray", ".", "size", "(", ")", "]", ")", ",", "\",\"", ")", ";", "}", "String", "excludeGroups", "=", "options", ".", "getExcludeGroups", "(", ")", "!=", "null", "?", "StringUtil", ".", "join", "(", "options", ".", "getExcludeGroups", "(", ")", ",", "\",\"", ")", ":", "null", ";", "String", "restrictGroups", "=", "options", ".", "getRestrictGroups", "(", ")", "!=", "null", "?", "StringUtil", ".", "join", "(", "options", ".", "getRestrictGroups", "(", ")", ",", "\",\"", ")", ":", "null", ";", "String", "excludeFromGroups", "=", "options", ".", "getExcludeFromGroups", "(", ")", "!=", "null", "?", "StringUtil", ".", "join", "(", "options", ".", "getExcludeFromGroups", "(", ")", ",", "\",\"", ")", ":", "null", ";", "String", "restrictToGroups", "=", "options", ".", "getRestrictToGroups", "(", ")", "!=", "null", "?", "StringUtil", ".", "join", "(", "options", ".", "getRestrictToGroups", "(", ")", ",", "\",\"", ")", ":", "null", ";", "TargetsResponse", "response", "=", "this", ".", "targetsApi", ".", "getTargets", "(", "searchTerm", ",", "options", ".", "getFilterName", "(", ")", ",", "types", ",", "excludeGroups", ",", "restrictGroups", ",", "excludeFromGroups", ",", "restrictToGroups", ",", "options", ".", "isDesc", "(", ")", "?", "\"desc\"", ":", "null", ",", "options", ".", "getLimit", "(", ")", "<", "1", "?", "null", ":", "new", "BigDecimal", "(", "options", ".", "getLimit", "(", ")", ")", ",", "options", ".", "isExact", "(", ")", "?", "\"exact\"", ":", "null", ")", ";", "TargetsResponseData", "data", "=", "response", ".", "getData", "(", ")", ";", "List", "<", "Target", ">", "targets", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "data", ".", "getTargets", "(", ")", "!=", "null", ")", "{", "for", "(", "com", ".", "genesys", ".", "internal", ".", "workspace", ".", "model", ".", "Target", "t", ":", "data", ".", "getTargets", "(", ")", ")", "{", "Target", "target", "=", "Target", ".", "fromTarget", "(", "t", ")", ";", "targets", ".", "add", "(", "target", ")", ";", "}", "}", "return", "new", "SearchResult", "<>", "(", "data", ".", "getTotalMatches", "(", ")", ",", "targets", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"searchTargets failed.\"", ",", "e", ")", ";", "}", "}" ]
Search for targets by the specified search term. @param searchTerm The text to search for in targets. @param options Options used to refine the search. (optional) @return SearchResult<Target>
[ "Search", "for", "targets", "by", "the", "specified", "search", "term", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/TargetsApi.java#L54-L94
141,681
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/TargetsApi.java
TargetsApi.getTarget
public Target getTarget(long id, TargetType type) throws WorkspaceApiException { try { TargetsResponse resp = targetsApi.getTarget(new BigDecimal(id), type.getValue()); Util.throwIfNotOk(resp.getStatus()); Target target = null; if(resp.getData() != null) { List<com.genesys.internal.workspace.model.Target> targets = resp.getData().getTargets(); if(targets != null && targets.size() > 0) { target = Target.fromTarget(targets.get(0)); } } return target; } catch(ApiException ex) { throw new WorkspaceApiException("Cannot get target", ex); } }
java
public Target getTarget(long id, TargetType type) throws WorkspaceApiException { try { TargetsResponse resp = targetsApi.getTarget(new BigDecimal(id), type.getValue()); Util.throwIfNotOk(resp.getStatus()); Target target = null; if(resp.getData() != null) { List<com.genesys.internal.workspace.model.Target> targets = resp.getData().getTargets(); if(targets != null && targets.size() > 0) { target = Target.fromTarget(targets.get(0)); } } return target; } catch(ApiException ex) { throw new WorkspaceApiException("Cannot get target", ex); } }
[ "public", "Target", "getTarget", "(", "long", "id", ",", "TargetType", "type", ")", "throws", "WorkspaceApiException", "{", "try", "{", "TargetsResponse", "resp", "=", "targetsApi", ".", "getTarget", "(", "new", "BigDecimal", "(", "id", ")", ",", "type", ".", "getValue", "(", ")", ")", ";", "Util", ".", "throwIfNotOk", "(", "resp", ".", "getStatus", "(", ")", ")", ";", "Target", "target", "=", "null", ";", "if", "(", "resp", ".", "getData", "(", ")", "!=", "null", ")", "{", "List", "<", "com", ".", "genesys", ".", "internal", ".", "workspace", ".", "model", ".", "Target", ">", "targets", "=", "resp", ".", "getData", "(", ")", ".", "getTargets", "(", ")", ";", "if", "(", "targets", "!=", "null", "&&", "targets", ".", "size", "(", ")", ">", "0", ")", "{", "target", "=", "Target", ".", "fromTarget", "(", "targets", ".", "get", "(", "0", ")", ")", ";", "}", "}", "return", "target", ";", "}", "catch", "(", "ApiException", "ex", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"Cannot get target\"", ",", "ex", ")", ";", "}", "}" ]
Get a specific target by type and ID. Targets can be agents, agent groups, queues, route points, skills, and custom contacts. @param id The ID of the target. @param type The type of target to retrieve. The possible values are AGENT, AGENT_GROUP, ACD_QUEUE, ROUTE_POINT, SKILL, and CUSTOM_CONTACT. @return Target
[ "Get", "a", "specific", "target", "by", "type", "and", "ID", ".", "Targets", "can", "be", "agents", "agent", "groups", "queues", "route", "points", "skills", "and", "custom", "contacts", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/TargetsApi.java#L188-L207
141,682
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/TargetsApi.java
TargetsApi.deletePersonalFavorite
public void deletePersonalFavorite(Target target) throws WorkspaceApiException { try { ApiSuccessResponse resp = targetsApi.deletePersonalFavorite(String.valueOf(target.getId()), target.getType().getValue()); Util.throwIfNotOk(resp); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot delete personal favorite", ex); } }
java
public void deletePersonalFavorite(Target target) throws WorkspaceApiException { try { ApiSuccessResponse resp = targetsApi.deletePersonalFavorite(String.valueOf(target.getId()), target.getType().getValue()); Util.throwIfNotOk(resp); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot delete personal favorite", ex); } }
[ "public", "void", "deletePersonalFavorite", "(", "Target", "target", ")", "throws", "WorkspaceApiException", "{", "try", "{", "ApiSuccessResponse", "resp", "=", "targetsApi", ".", "deletePersonalFavorite", "(", "String", ".", "valueOf", "(", "target", ".", "getId", "(", ")", ")", ",", "target", ".", "getType", "(", ")", ".", "getValue", "(", ")", ")", ";", "Util", ".", "throwIfNotOk", "(", "resp", ")", ";", "}", "catch", "(", "ApiException", "ex", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"Cannot delete personal favorite\"", ",", "ex", ")", ";", "}", "}" ]
Delete the target from the agent's personal favorites. @param target The target to delete.
[ "Delete", "the", "target", "from", "the", "agent", "s", "personal", "favorites", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/TargetsApi.java#L213-L221
141,683
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/TargetsApi.java
TargetsApi.getPersonalFavorites
public SearchResult<Target> getPersonalFavorites(int limit) throws WorkspaceApiException { try { TargetsResponse resp = targetsApi.getPersonalFavorites(limit > 0? new BigDecimal(limit): null); Util.throwIfNotOk(resp.getStatus()); TargetsResponseData data = resp.getData(); int total = 0; List<Target> list = new ArrayList<>(); if(data != null) { total = data.getTotalMatches(); if(data.getTargets() != null) { for (com.genesys.internal.workspace.model.Target t : data.getTargets()) { Target target = Target.fromTarget(t); list.add(target); } } } return new SearchResult<>(total, list); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot personal favorites", ex); } }
java
public SearchResult<Target> getPersonalFavorites(int limit) throws WorkspaceApiException { try { TargetsResponse resp = targetsApi.getPersonalFavorites(limit > 0? new BigDecimal(limit): null); Util.throwIfNotOk(resp.getStatus()); TargetsResponseData data = resp.getData(); int total = 0; List<Target> list = new ArrayList<>(); if(data != null) { total = data.getTotalMatches(); if(data.getTargets() != null) { for (com.genesys.internal.workspace.model.Target t : data.getTargets()) { Target target = Target.fromTarget(t); list.add(target); } } } return new SearchResult<>(total, list); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot personal favorites", ex); } }
[ "public", "SearchResult", "<", "Target", ">", "getPersonalFavorites", "(", "int", "limit", ")", "throws", "WorkspaceApiException", "{", "try", "{", "TargetsResponse", "resp", "=", "targetsApi", ".", "getPersonalFavorites", "(", "limit", ">", "0", "?", "new", "BigDecimal", "(", "limit", ")", ":", "null", ")", ";", "Util", ".", "throwIfNotOk", "(", "resp", ".", "getStatus", "(", ")", ")", ";", "TargetsResponseData", "data", "=", "resp", ".", "getData", "(", ")", ";", "int", "total", "=", "0", ";", "List", "<", "Target", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "data", "!=", "null", ")", "{", "total", "=", "data", ".", "getTotalMatches", "(", ")", ";", "if", "(", "data", ".", "getTargets", "(", ")", "!=", "null", ")", "{", "for", "(", "com", ".", "genesys", ".", "internal", ".", "workspace", ".", "model", ".", "Target", "t", ":", "data", ".", "getTargets", "(", ")", ")", "{", "Target", "target", "=", "Target", ".", "fromTarget", "(", "t", ")", ";", "list", ".", "add", "(", "target", ")", ";", "}", "}", "}", "return", "new", "SearchResult", "<>", "(", "total", ",", "list", ")", ";", "}", "catch", "(", "ApiException", "ex", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"Cannot personal favorites\"", ",", "ex", ")", ";", "}", "}" ]
Get the agent's personal favorites. @param limit Number of results to return. The default value is 50. (optional) @return SearchResult<Target>
[ "Get", "the", "agent", "s", "personal", "favorites", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/TargetsApi.java#L236-L259
141,684
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/TargetsApi.java
TargetsApi.savePersonalFavorite
public void savePersonalFavorite(Target target, String category) throws WorkspaceApiException { TargetspersonalfavoritessaveData data = new TargetspersonalfavoritessaveData(); data.setCategory(category); data.setTarget(toInformation(target)); PersonalFavoriteData favData = new PersonalFavoriteData(); favData.setData(data); try { ApiSuccessResponse resp = targetsApi.savePersonalFavorite(favData); Util.throwIfNotOk(resp); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot save personal favorites", ex); } }
java
public void savePersonalFavorite(Target target, String category) throws WorkspaceApiException { TargetspersonalfavoritessaveData data = new TargetspersonalfavoritessaveData(); data.setCategory(category); data.setTarget(toInformation(target)); PersonalFavoriteData favData = new PersonalFavoriteData(); favData.setData(data); try { ApiSuccessResponse resp = targetsApi.savePersonalFavorite(favData); Util.throwIfNotOk(resp); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot save personal favorites", ex); } }
[ "public", "void", "savePersonalFavorite", "(", "Target", "target", ",", "String", "category", ")", "throws", "WorkspaceApiException", "{", "TargetspersonalfavoritessaveData", "data", "=", "new", "TargetspersonalfavoritessaveData", "(", ")", ";", "data", ".", "setCategory", "(", "category", ")", ";", "data", ".", "setTarget", "(", "toInformation", "(", "target", ")", ")", ";", "PersonalFavoriteData", "favData", "=", "new", "PersonalFavoriteData", "(", ")", ";", "favData", ".", "setData", "(", "data", ")", ";", "try", "{", "ApiSuccessResponse", "resp", "=", "targetsApi", ".", "savePersonalFavorite", "(", "favData", ")", ";", "Util", ".", "throwIfNotOk", "(", "resp", ")", ";", "}", "catch", "(", "ApiException", "ex", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"Cannot save personal favorites\"", ",", "ex", ")", ";", "}", "}" ]
Save a target to the agent's personal favorites in the specified category. @param target The target to save. @param category The agent's personal favorites category.
[ "Save", "a", "target", "to", "the", "agent", "s", "personal", "favorites", "in", "the", "specified", "category", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/TargetsApi.java#L266-L280
141,685
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/TargetsApi.java
TargetsApi.ackRecentMissedCalls
public void ackRecentMissedCalls() throws WorkspaceApiException { try { ApiSuccessResponse resp = targetsApi.ackRecentMissedCalls(); Util.throwIfNotOk(resp); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot ack recent missed calls", ex); } }
java
public void ackRecentMissedCalls() throws WorkspaceApiException { try { ApiSuccessResponse resp = targetsApi.ackRecentMissedCalls(); Util.throwIfNotOk(resp); } catch(ApiException ex) { throw new WorkspaceApiException("Cannot ack recent missed calls", ex); } }
[ "public", "void", "ackRecentMissedCalls", "(", ")", "throws", "WorkspaceApiException", "{", "try", "{", "ApiSuccessResponse", "resp", "=", "targetsApi", ".", "ackRecentMissedCalls", "(", ")", ";", "Util", ".", "throwIfNotOk", "(", "resp", ")", ";", "}", "catch", "(", "ApiException", "ex", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"Cannot ack recent missed calls\"", ",", "ex", ")", ";", "}", "}" ]
Acknowledge missed calls in the list of recent targets.
[ "Acknowledge", "missed", "calls", "in", "the", "list", "of", "recent", "targets", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/TargetsApi.java#L285-L293
141,686
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.getCallsWithHttpInfo
public ApiResponse<InlineResponse200> getCallsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getCallsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<InlineResponse200>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
public ApiResponse<InlineResponse200> getCallsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getCallsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<InlineResponse200>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
[ "public", "ApiResponse", "<", "InlineResponse200", ">", "getCallsWithHttpInfo", "(", ")", "throws", "ApiException", "{", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "getCallsValidateBeforeCall", "(", "null", ",", "null", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "InlineResponse200", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "return", "apiClient", ".", "execute", "(", "call", ",", "localVarReturnType", ")", ";", "}" ]
Get all calls Get all active calls for the current agent. @return ApiResponse&lt;InlineResponse200&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "all", "calls", "Get", "all", "active", "calls", "for", "the", "current", "agent", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L1593-L1597
141,687
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.switchToBargeIn
public ApiSuccessResponse switchToBargeIn(String id, MonitoringScopeData monitoringScopeData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = switchToBargeInWithHttpInfo(id, monitoringScopeData); return resp.getData(); }
java
public ApiSuccessResponse switchToBargeIn(String id, MonitoringScopeData monitoringScopeData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = switchToBargeInWithHttpInfo(id, monitoringScopeData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "switchToBargeIn", "(", "String", "id", ",", "MonitoringScopeData", "monitoringScopeData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "switchToBargeInWithHttpInfo", "(", "id", ",", "monitoringScopeData", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Switch to barge-in Switch to the barge-in monitoring mode. If the agent is currently on a call and T-Server is configured to allow barge-in, the supervisor is immediately added to the call. Both the monitored agent and the customer are able to hear and speak with the supervisor. If the target agent is not on a call at the time of the request, the supervisor is brought into the call when the agent receives a new call. @param id The connection ID of the call being monitored. (required) @param monitoringScopeData (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Switch", "to", "barge", "-", "in", "Switch", "to", "the", "barge", "-", "in", "monitoring", "mode", ".", "If", "the", "agent", "is", "currently", "on", "a", "call", "and", "T", "-", "Server", "is", "configured", "to", "allow", "barge", "-", "in", "the", "supervisor", "is", "immediately", "added", "to", "the", "call", ".", "Both", "the", "monitored", "agent", "and", "the", "customer", "are", "able", "to", "hear", "and", "speak", "with", "the", "supervisor", ".", "If", "the", "target", "agent", "is", "not", "on", "a", "call", "at", "the", "time", "of", "the", "request", "the", "supervisor", "is", "brought", "into", "the", "call", "when", "the", "agent", "receives", "a", "new", "call", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L4972-L4975
141,688
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.switchToCoaching
public ApiSuccessResponse switchToCoaching(String id, MonitoringScopeData monitoringScopeData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = switchToCoachingWithHttpInfo(id, monitoringScopeData); return resp.getData(); }
java
public ApiSuccessResponse switchToCoaching(String id, MonitoringScopeData monitoringScopeData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = switchToCoachingWithHttpInfo(id, monitoringScopeData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "switchToCoaching", "(", "String", "id", ",", "MonitoringScopeData", "monitoringScopeData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "switchToCoachingWithHttpInfo", "(", "id", ",", "monitoringScopeData", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Switch to coach Switch to the coach monitoring mode. When coaching is enabled and the agent receives a call, the supervisor is brought into the call. Only the agent can hear the supervisor. @param id The connection ID of the call being monitored. (required) @param monitoringScopeData (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Switch", "to", "coach", "Switch", "to", "the", "coach", "monitoring", "mode", ".", "When", "coaching", "is", "enabled", "and", "the", "agent", "receives", "a", "call", "the", "supervisor", "is", "brought", "into", "the", "call", ".", "Only", "the", "agent", "can", "hear", "the", "supervisor", "." ]
509fdd9e89b9359d012f9a72be95037a3cef53e6
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L5099-L5102
141,689
fuinorg/units4j
src/main/java/org/fuin/units4j/dependency/DependencyAnalyzer.java
DependencyAnalyzer.checkAllowedSection
private List<DependencyError> checkAllowedSection(final Dependencies dependencies, final Package<DependsOn> allowedPkg, final ClassInfo classInfo) { final List<DependencyError> errors = new ArrayList<DependencyError>(); final Iterator<String> it = classInfo.getImports().iterator(); while (it.hasNext()) { final String importedPkg = it.next(); if (!importedPkg.equals(allowedPkg.getName()) && !dependencies.isAlwaysAllowed(importedPkg)) { final DependsOn dep = Utils.findAllowedByName(allowedPkg.getDependencies(), importedPkg); if (dep == null) { errors.add(new DependencyError(classInfo.getName(), importedPkg, allowedPkg.getComment())); } } } return errors; }
java
private List<DependencyError> checkAllowedSection(final Dependencies dependencies, final Package<DependsOn> allowedPkg, final ClassInfo classInfo) { final List<DependencyError> errors = new ArrayList<DependencyError>(); final Iterator<String> it = classInfo.getImports().iterator(); while (it.hasNext()) { final String importedPkg = it.next(); if (!importedPkg.equals(allowedPkg.getName()) && !dependencies.isAlwaysAllowed(importedPkg)) { final DependsOn dep = Utils.findAllowedByName(allowedPkg.getDependencies(), importedPkg); if (dep == null) { errors.add(new DependencyError(classInfo.getName(), importedPkg, allowedPkg.getComment())); } } } return errors; }
[ "private", "List", "<", "DependencyError", ">", "checkAllowedSection", "(", "final", "Dependencies", "dependencies", ",", "final", "Package", "<", "DependsOn", ">", "allowedPkg", ",", "final", "ClassInfo", "classInfo", ")", "{", "final", "List", "<", "DependencyError", ">", "errors", "=", "new", "ArrayList", "<", "DependencyError", ">", "(", ")", ";", "final", "Iterator", "<", "String", ">", "it", "=", "classInfo", ".", "getImports", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "final", "String", "importedPkg", "=", "it", ".", "next", "(", ")", ";", "if", "(", "!", "importedPkg", ".", "equals", "(", "allowedPkg", ".", "getName", "(", ")", ")", "&&", "!", "dependencies", ".", "isAlwaysAllowed", "(", "importedPkg", ")", ")", "{", "final", "DependsOn", "dep", "=", "Utils", ".", "findAllowedByName", "(", "allowedPkg", ".", "getDependencies", "(", ")", ",", "importedPkg", ")", ";", "if", "(", "dep", "==", "null", ")", "{", "errors", ".", "add", "(", "new", "DependencyError", "(", "classInfo", ".", "getName", "(", ")", ",", "importedPkg", ",", "allowedPkg", ".", "getComment", "(", ")", ")", ")", ";", "}", "}", "}", "return", "errors", ";", "}" ]
Checks the dependencies for a package from the "allowed" section. @param dependencies Dependency definition to use. @param allowedPkg Package with allowed imports. @param classInfo Information extracted from the class. @return List of errors - may be empty but is never <code>null</code>.
[ "Checks", "the", "dependencies", "for", "a", "package", "from", "the", "allowed", "section", "." ]
29383e30b0f9c246b309e734df9cc63dc5d5499e
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/dependency/DependencyAnalyzer.java#L105-L122
141,690
fuinorg/units4j
src/main/java/org/fuin/units4j/dependency/DependencyAnalyzer.java
DependencyAnalyzer.checkForbiddenSection
private static List<DependencyError> checkForbiddenSection(final Dependencies dependencies, final Package<NotDependsOn> forbiddenPkg, final ClassInfo classInfo) { final List<DependencyError> errors = new ArrayList<DependencyError>(); final Iterator<String> it = classInfo.getImports().iterator(); while (it.hasNext()) { final String importedPkg = it.next(); if (!importedPkg.equals(classInfo.getPackageName())) { final NotDependsOn ndo = Utils.findForbiddenByName(dependencies.getAlwaysForbidden(), importedPkg); if (ndo != null) { errors.add(new DependencyError(classInfo.getName(), importedPkg, ndo.getComment())); } else { final NotDependsOn dep = Utils.findForbiddenByName(forbiddenPkg.getDependencies(), importedPkg); if (dep != null) { final String comment; if (dep.getComment() == null) { comment = forbiddenPkg.getComment(); } else { comment = dep.getComment(); } errors.add(new DependencyError(classInfo.getName(), importedPkg, comment)); } } } } return errors; }
java
private static List<DependencyError> checkForbiddenSection(final Dependencies dependencies, final Package<NotDependsOn> forbiddenPkg, final ClassInfo classInfo) { final List<DependencyError> errors = new ArrayList<DependencyError>(); final Iterator<String> it = classInfo.getImports().iterator(); while (it.hasNext()) { final String importedPkg = it.next(); if (!importedPkg.equals(classInfo.getPackageName())) { final NotDependsOn ndo = Utils.findForbiddenByName(dependencies.getAlwaysForbidden(), importedPkg); if (ndo != null) { errors.add(new DependencyError(classInfo.getName(), importedPkg, ndo.getComment())); } else { final NotDependsOn dep = Utils.findForbiddenByName(forbiddenPkg.getDependencies(), importedPkg); if (dep != null) { final String comment; if (dep.getComment() == null) { comment = forbiddenPkg.getComment(); } else { comment = dep.getComment(); } errors.add(new DependencyError(classInfo.getName(), importedPkg, comment)); } } } } return errors; }
[ "private", "static", "List", "<", "DependencyError", ">", "checkForbiddenSection", "(", "final", "Dependencies", "dependencies", ",", "final", "Package", "<", "NotDependsOn", ">", "forbiddenPkg", ",", "final", "ClassInfo", "classInfo", ")", "{", "final", "List", "<", "DependencyError", ">", "errors", "=", "new", "ArrayList", "<", "DependencyError", ">", "(", ")", ";", "final", "Iterator", "<", "String", ">", "it", "=", "classInfo", ".", "getImports", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "final", "String", "importedPkg", "=", "it", ".", "next", "(", ")", ";", "if", "(", "!", "importedPkg", ".", "equals", "(", "classInfo", ".", "getPackageName", "(", ")", ")", ")", "{", "final", "NotDependsOn", "ndo", "=", "Utils", ".", "findForbiddenByName", "(", "dependencies", ".", "getAlwaysForbidden", "(", ")", ",", "importedPkg", ")", ";", "if", "(", "ndo", "!=", "null", ")", "{", "errors", ".", "add", "(", "new", "DependencyError", "(", "classInfo", ".", "getName", "(", ")", ",", "importedPkg", ",", "ndo", ".", "getComment", "(", ")", ")", ")", ";", "}", "else", "{", "final", "NotDependsOn", "dep", "=", "Utils", ".", "findForbiddenByName", "(", "forbiddenPkg", ".", "getDependencies", "(", ")", ",", "importedPkg", ")", ";", "if", "(", "dep", "!=", "null", ")", "{", "final", "String", "comment", ";", "if", "(", "dep", ".", "getComment", "(", ")", "==", "null", ")", "{", "comment", "=", "forbiddenPkg", ".", "getComment", "(", ")", ";", "}", "else", "{", "comment", "=", "dep", ".", "getComment", "(", ")", ";", "}", "errors", ".", "add", "(", "new", "DependencyError", "(", "classInfo", ".", "getName", "(", ")", ",", "importedPkg", ",", "comment", ")", ")", ";", "}", "}", "}", "}", "return", "errors", ";", "}" ]
Checks the dependencies for a package from the "forbidden" section. @param dependencies Dependency definition to use. @param forbiddenPkg Package with forbidden imports. @param classInfo Information extracted from the class. @return List of errors - may be empty but is never <code>null</code>.
[ "Checks", "the", "dependencies", "for", "a", "package", "from", "the", "forbidden", "section", "." ]
29383e30b0f9c246b309e734df9cc63dc5d5499e
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/dependency/DependencyAnalyzer.java#L136-L163
141,691
fuinorg/units4j
src/main/java/org/fuin/units4j/dependency/DependencyAnalyzer.java
DependencyAnalyzer.nameOnly
private static String nameOnly(final String filename) { final int p = filename.lastIndexOf('.'); if (p == -1) { return filename; } return filename.substring(0, p); }
java
private static String nameOnly(final String filename) { final int p = filename.lastIndexOf('.'); if (p == -1) { return filename; } return filename.substring(0, p); }
[ "private", "static", "String", "nameOnly", "(", "final", "String", "filename", ")", "{", "final", "int", "p", "=", "filename", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "p", "==", "-", "1", ")", "{", "return", "filename", ";", "}", "return", "filename", ".", "substring", "(", "0", ",", "p", ")", ";", "}" ]
Returns the name of the file without path an extension. @param filename Filename to extract the name from. @return Simple name.
[ "Returns", "the", "name", "of", "the", "file", "without", "path", "an", "extension", "." ]
29383e30b0f9c246b309e734df9cc63dc5d5499e
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/dependency/DependencyAnalyzer.java#L173-L179
141,692
fuinorg/units4j
src/main/java/org/fuin/units4j/dependency/DependencyAnalyzer.java
DependencyAnalyzer.checkAlwaysForbiddenSection
private static List<DependencyError> checkAlwaysForbiddenSection(final Dependencies dependencies, final ClassInfo classInfo) { final List<DependencyError> errors = new ArrayList<DependencyError>(); final Iterator<String> importedPackages = classInfo.getImports().iterator(); while (importedPackages.hasNext()) { final String importedPackage = importedPackages.next(); final NotDependsOn ndo = Utils.findForbiddenByName(dependencies.getAlwaysForbidden(), importedPackage); if (ndo != null) { errors.add(new DependencyError(classInfo.getName(), importedPackage, ndo.getComment())); } } return errors; }
java
private static List<DependencyError> checkAlwaysForbiddenSection(final Dependencies dependencies, final ClassInfo classInfo) { final List<DependencyError> errors = new ArrayList<DependencyError>(); final Iterator<String> importedPackages = classInfo.getImports().iterator(); while (importedPackages.hasNext()) { final String importedPackage = importedPackages.next(); final NotDependsOn ndo = Utils.findForbiddenByName(dependencies.getAlwaysForbidden(), importedPackage); if (ndo != null) { errors.add(new DependencyError(classInfo.getName(), importedPackage, ndo.getComment())); } } return errors; }
[ "private", "static", "List", "<", "DependencyError", ">", "checkAlwaysForbiddenSection", "(", "final", "Dependencies", "dependencies", ",", "final", "ClassInfo", "classInfo", ")", "{", "final", "List", "<", "DependencyError", ">", "errors", "=", "new", "ArrayList", "<", "DependencyError", ">", "(", ")", ";", "final", "Iterator", "<", "String", ">", "importedPackages", "=", "classInfo", ".", "getImports", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "importedPackages", ".", "hasNext", "(", ")", ")", "{", "final", "String", "importedPackage", "=", "importedPackages", ".", "next", "(", ")", ";", "final", "NotDependsOn", "ndo", "=", "Utils", ".", "findForbiddenByName", "(", "dependencies", ".", "getAlwaysForbidden", "(", ")", ",", "importedPackage", ")", ";", "if", "(", "ndo", "!=", "null", ")", "{", "errors", ".", "add", "(", "new", "DependencyError", "(", "classInfo", ".", "getName", "(", ")", ",", "importedPackage", ",", "ndo", ".", "getComment", "(", ")", ")", ")", ";", "}", "}", "return", "errors", ";", "}" ]
Checks if any of the imports is listed in the "alwaysForbidden" section. @param dependencies Dependencies to use. @param classInfo Information extracted from the class. @return List of errors - may be empty but is never <code>null</code>.
[ "Checks", "if", "any", "of", "the", "imports", "is", "listed", "in", "the", "alwaysForbidden", "section", "." ]
29383e30b0f9c246b309e734df9cc63dc5d5499e
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/dependency/DependencyAnalyzer.java#L191-L205
141,693
fuinorg/units4j
src/main/java/org/fuin/units4j/dependency/DependencyAnalyzer.java
DependencyAnalyzer.analyze
public final void analyze(final File classesDir) { final FileProcessor fileProcessor = new FileProcessor(new FileHandler() { @Override public final FileHandlerResult handleFile(final File classFile) { if (!classFile.getName().endsWith(".class")) { return FileHandlerResult.CONTINUE; } try { final ClassInfo classInfo = new ClassInfo(classFile); final Package<DependsOn> allowedPkg = dependencies.findAllowedByName(classInfo.getPackageName()); if (allowedPkg == null) { final Package<NotDependsOn> forbiddenPkg = dependencies.findForbiddenByName(classInfo.getPackageName()); if (forbiddenPkg == null) { dependencyErrors.addAll(checkAlwaysForbiddenSection(dependencies, classInfo)); } else { dependencyErrors.addAll(checkForbiddenSection(dependencies, forbiddenPkg, classInfo)); } } else { dependencyErrors.addAll(checkAllowedSection(dependencies, allowedPkg, classInfo)); } } catch (final IOException ex) { throw new RuntimeException("Error handling file: " + classFile, ex); } return FileHandlerResult.CONTINUE; } }); dependencyErrors.clear(); fileProcessor.process(classesDir); }
java
public final void analyze(final File classesDir) { final FileProcessor fileProcessor = new FileProcessor(new FileHandler() { @Override public final FileHandlerResult handleFile(final File classFile) { if (!classFile.getName().endsWith(".class")) { return FileHandlerResult.CONTINUE; } try { final ClassInfo classInfo = new ClassInfo(classFile); final Package<DependsOn> allowedPkg = dependencies.findAllowedByName(classInfo.getPackageName()); if (allowedPkg == null) { final Package<NotDependsOn> forbiddenPkg = dependencies.findForbiddenByName(classInfo.getPackageName()); if (forbiddenPkg == null) { dependencyErrors.addAll(checkAlwaysForbiddenSection(dependencies, classInfo)); } else { dependencyErrors.addAll(checkForbiddenSection(dependencies, forbiddenPkg, classInfo)); } } else { dependencyErrors.addAll(checkAllowedSection(dependencies, allowedPkg, classInfo)); } } catch (final IOException ex) { throw new RuntimeException("Error handling file: " + classFile, ex); } return FileHandlerResult.CONTINUE; } }); dependencyErrors.clear(); fileProcessor.process(classesDir); }
[ "public", "final", "void", "analyze", "(", "final", "File", "classesDir", ")", "{", "final", "FileProcessor", "fileProcessor", "=", "new", "FileProcessor", "(", "new", "FileHandler", "(", ")", "{", "@", "Override", "public", "final", "FileHandlerResult", "handleFile", "(", "final", "File", "classFile", ")", "{", "if", "(", "!", "classFile", ".", "getName", "(", ")", ".", "endsWith", "(", "\".class\"", ")", ")", "{", "return", "FileHandlerResult", ".", "CONTINUE", ";", "}", "try", "{", "final", "ClassInfo", "classInfo", "=", "new", "ClassInfo", "(", "classFile", ")", ";", "final", "Package", "<", "DependsOn", ">", "allowedPkg", "=", "dependencies", ".", "findAllowedByName", "(", "classInfo", ".", "getPackageName", "(", ")", ")", ";", "if", "(", "allowedPkg", "==", "null", ")", "{", "final", "Package", "<", "NotDependsOn", ">", "forbiddenPkg", "=", "dependencies", ".", "findForbiddenByName", "(", "classInfo", ".", "getPackageName", "(", ")", ")", ";", "if", "(", "forbiddenPkg", "==", "null", ")", "{", "dependencyErrors", ".", "addAll", "(", "checkAlwaysForbiddenSection", "(", "dependencies", ",", "classInfo", ")", ")", ";", "}", "else", "{", "dependencyErrors", ".", "addAll", "(", "checkForbiddenSection", "(", "dependencies", ",", "forbiddenPkg", ",", "classInfo", ")", ")", ";", "}", "}", "else", "{", "dependencyErrors", ".", "addAll", "(", "checkAllowedSection", "(", "dependencies", ",", "allowedPkg", ",", "classInfo", ")", ")", ";", "}", "}", "catch", "(", "final", "IOException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "\"Error handling file: \"", "+", "classFile", ",", "ex", ")", ";", "}", "return", "FileHandlerResult", ".", "CONTINUE", ";", "}", "}", ")", ";", "dependencyErrors", ".", "clear", "(", ")", ";", "fileProcessor", ".", "process", "(", "classesDir", ")", ";", "}" ]
Analyze the dependencies for all classes in the directory and it's sub directories. @param classesDir Directory where the "*.class" files are located (something like "bin" or "classes").
[ "Analyze", "the", "dependencies", "for", "all", "classes", "in", "the", "directory", "and", "it", "s", "sub", "directories", "." ]
29383e30b0f9c246b309e734df9cc63dc5d5499e
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/dependency/DependencyAnalyzer.java#L213-L247
141,694
fuinorg/units4j
src/main/java/org/fuin/units4j/AssertCoverage.java
AssertCoverage.analyzeDir
static void analyzeDir(final Set<Class<?>> classes, final File baseDir, final File srcDir, final boolean recursive, final ClassFilter classFilter) { final FileProcessor fileProcessor = new FileProcessor(new FileHandler() { @Override public final FileHandlerResult handleFile(final File file) { if (file.isDirectory()) { // Directory if (recursive) { return FileHandlerResult.CONTINUE; } return FileHandlerResult.SKIP_SUBDIRS; } // File final String name = file.getName(); if (name.endsWith(".java") && !name.equals("package-info.java")) { final String packageName = Utils4J.getRelativePath(baseDir, file.getParentFile()).replace(File.separatorChar, '.'); final String simpleName = name.substring(0, name.length() - 5); final String className = packageName + "." + simpleName; final Class<?> clasz = classForName(className); if (isInclude(clasz, classFilter)) { classes.add(clasz); } } return FileHandlerResult.CONTINUE; } }); fileProcessor.process(srcDir); }
java
static void analyzeDir(final Set<Class<?>> classes, final File baseDir, final File srcDir, final boolean recursive, final ClassFilter classFilter) { final FileProcessor fileProcessor = new FileProcessor(new FileHandler() { @Override public final FileHandlerResult handleFile(final File file) { if (file.isDirectory()) { // Directory if (recursive) { return FileHandlerResult.CONTINUE; } return FileHandlerResult.SKIP_SUBDIRS; } // File final String name = file.getName(); if (name.endsWith(".java") && !name.equals("package-info.java")) { final String packageName = Utils4J.getRelativePath(baseDir, file.getParentFile()).replace(File.separatorChar, '.'); final String simpleName = name.substring(0, name.length() - 5); final String className = packageName + "." + simpleName; final Class<?> clasz = classForName(className); if (isInclude(clasz, classFilter)) { classes.add(clasz); } } return FileHandlerResult.CONTINUE; } }); fileProcessor.process(srcDir); }
[ "static", "void", "analyzeDir", "(", "final", "Set", "<", "Class", "<", "?", ">", ">", "classes", ",", "final", "File", "baseDir", ",", "final", "File", "srcDir", ",", "final", "boolean", "recursive", ",", "final", "ClassFilter", "classFilter", ")", "{", "final", "FileProcessor", "fileProcessor", "=", "new", "FileProcessor", "(", "new", "FileHandler", "(", ")", "{", "@", "Override", "public", "final", "FileHandlerResult", "handleFile", "(", "final", "File", "file", ")", "{", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "// Directory\r", "if", "(", "recursive", ")", "{", "return", "FileHandlerResult", ".", "CONTINUE", ";", "}", "return", "FileHandlerResult", ".", "SKIP_SUBDIRS", ";", "}", "// File\r", "final", "String", "name", "=", "file", ".", "getName", "(", ")", ";", "if", "(", "name", ".", "endsWith", "(", "\".java\"", ")", "&&", "!", "name", ".", "equals", "(", "\"package-info.java\"", ")", ")", "{", "final", "String", "packageName", "=", "Utils4J", ".", "getRelativePath", "(", "baseDir", ",", "file", ".", "getParentFile", "(", ")", ")", ".", "replace", "(", "File", ".", "separatorChar", ",", "'", "'", ")", ";", "final", "String", "simpleName", "=", "name", ".", "substring", "(", "0", ",", "name", ".", "length", "(", ")", "-", "5", ")", ";", "final", "String", "className", "=", "packageName", "+", "\".\"", "+", "simpleName", ";", "final", "Class", "<", "?", ">", "clasz", "=", "classForName", "(", "className", ")", ";", "if", "(", "isInclude", "(", "clasz", ",", "classFilter", ")", ")", "{", "classes", ".", "add", "(", "clasz", ")", ";", "}", "}", "return", "FileHandlerResult", ".", "CONTINUE", ";", "}", "}", ")", ";", "fileProcessor", ".", "process", "(", "srcDir", ")", ";", "}" ]
Populates a list of classes from a given java source directory. All source files must have a ".class" file in the class path. @param classes Set to populate. @param baseDir Root directory like "src/main/java". @param srcDir A directory inside the root directory like "a/b/c" (path of the package "a.b.c"). @param recursive If sub directories should be included <code>true</code> else <code>false</code>. @param classFilter Filter that decides if a class should have a corresponding test or not.
[ "Populates", "a", "list", "of", "classes", "from", "a", "given", "java", "source", "directory", ".", "All", "source", "files", "must", "have", "a", ".", "class", "file", "in", "the", "class", "path", "." ]
29383e30b0f9c246b309e734df9cc63dc5d5499e
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/AssertCoverage.java#L161-L191
141,695
scottescue/dropwizard-entitymanager
src/main/java/com/scottescue/dropwizard/entitymanager/EntityManagerContext.java
EntityManagerContext.bind
static EntityManager bind(EntityManager entityManager) { return entityManagerMap( true ).put( entityManager.getEntityManagerFactory(), entityManager ); }
java
static EntityManager bind(EntityManager entityManager) { return entityManagerMap( true ).put( entityManager.getEntityManagerFactory(), entityManager ); }
[ "static", "EntityManager", "bind", "(", "EntityManager", "entityManager", ")", "{", "return", "entityManagerMap", "(", "true", ")", ".", "put", "(", "entityManager", ".", "getEntityManagerFactory", "(", ")", ",", "entityManager", ")", ";", "}" ]
Binds the given EntityManager to the current context for its EntityManagerFactory. @param entityManager the EntityManager to be bound. @return any previously bound EntityManager (should be null in most cases).
[ "Binds", "the", "given", "EntityManager", "to", "the", "current", "context", "for", "its", "EntityManagerFactory", "." ]
c45106030bfd3f1977d270bc178e7edb2968cf83
https://github.com/scottescue/dropwizard-entitymanager/blob/c45106030bfd3f1977d270bc178e7edb2968cf83/src/main/java/com/scottescue/dropwizard/entitymanager/EntityManagerContext.java#L64-L66
141,696
scottescue/dropwizard-entitymanager
src/main/java/com/scottescue/dropwizard/entitymanager/EntityManagerContext.java
EntityManagerContext.unbind
static EntityManager unbind(EntityManagerFactory factory) { final Map<EntityManagerFactory,EntityManager> entityManagerMap = entityManagerMap(false); EntityManager existing = null; if ( entityManagerMap != null ) { existing = entityManagerMap.remove( factory ); doCleanup(); } return existing; }
java
static EntityManager unbind(EntityManagerFactory factory) { final Map<EntityManagerFactory,EntityManager> entityManagerMap = entityManagerMap(false); EntityManager existing = null; if ( entityManagerMap != null ) { existing = entityManagerMap.remove( factory ); doCleanup(); } return existing; }
[ "static", "EntityManager", "unbind", "(", "EntityManagerFactory", "factory", ")", "{", "final", "Map", "<", "EntityManagerFactory", ",", "EntityManager", ">", "entityManagerMap", "=", "entityManagerMap", "(", "false", ")", ";", "EntityManager", "existing", "=", "null", ";", "if", "(", "entityManagerMap", "!=", "null", ")", "{", "existing", "=", "entityManagerMap", ".", "remove", "(", "factory", ")", ";", "doCleanup", "(", ")", ";", "}", "return", "existing", ";", "}" ]
Unbinds the EntityManager, if any, currently associated with the context for the given EntityManagerFactory. @param factory the factory for which to unbind the current EntityManager. @return the bound entity manager, if any; else null.
[ "Unbinds", "the", "EntityManager", "if", "any", "currently", "associated", "with", "the", "context", "for", "the", "given", "EntityManagerFactory", "." ]
c45106030bfd3f1977d270bc178e7edb2968cf83
https://github.com/scottescue/dropwizard-entitymanager/blob/c45106030bfd3f1977d270bc178e7edb2968cf83/src/main/java/com/scottescue/dropwizard/entitymanager/EntityManagerContext.java#L75-L83
141,697
scottescue/dropwizard-entitymanager
src/main/java/com/scottescue/dropwizard/entitymanager/EntityManagerContext.java
EntityManagerContext.unBindAll
static void unBindAll(Consumer<EntityManager> function) { final Map<EntityManagerFactory,EntityManager> entityManagerMap = entityManagerMap(false); if ( entityManagerMap != null ) { Iterator<EntityManager> iterator = entityManagerMap.values().iterator(); while (iterator.hasNext()) { EntityManager entityManager = iterator.next(); function.accept(entityManager); iterator.remove(); } doCleanup(); } }
java
static void unBindAll(Consumer<EntityManager> function) { final Map<EntityManagerFactory,EntityManager> entityManagerMap = entityManagerMap(false); if ( entityManagerMap != null ) { Iterator<EntityManager> iterator = entityManagerMap.values().iterator(); while (iterator.hasNext()) { EntityManager entityManager = iterator.next(); function.accept(entityManager); iterator.remove(); } doCleanup(); } }
[ "static", "void", "unBindAll", "(", "Consumer", "<", "EntityManager", ">", "function", ")", "{", "final", "Map", "<", "EntityManagerFactory", ",", "EntityManager", ">", "entityManagerMap", "=", "entityManagerMap", "(", "false", ")", ";", "if", "(", "entityManagerMap", "!=", "null", ")", "{", "Iterator", "<", "EntityManager", ">", "iterator", "=", "entityManagerMap", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "EntityManager", "entityManager", "=", "iterator", ".", "next", "(", ")", ";", "function", ".", "accept", "(", "entityManager", ")", ";", "iterator", ".", "remove", "(", ")", ";", "}", "doCleanup", "(", ")", ";", "}", "}" ]
Unbinds all EntityManagers, regardless of EntityManagerFactory, currently associated with the context. @param function the function to apply to each EntityManager removed
[ "Unbinds", "all", "EntityManagers", "regardless", "of", "EntityManagerFactory", "currently", "associated", "with", "the", "context", "." ]
c45106030bfd3f1977d270bc178e7edb2968cf83
https://github.com/scottescue/dropwizard-entitymanager/blob/c45106030bfd3f1977d270bc178e7edb2968cf83/src/main/java/com/scottescue/dropwizard/entitymanager/EntityManagerContext.java#L90-L101
141,698
scottescue/dropwizard-entitymanager
src/main/java/com/scottescue/dropwizard/entitymanager/SharedEntityManagerFactory.java
SharedEntityManagerFactory.build
EntityManager build(EntityManagerContext entityManagerContext) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); return (EntityManager) Proxy.newProxyInstance( classLoader, new Class[]{EntityManager.class}, new SharedEntityManagerInvocationHandler(entityManagerContext)); }
java
EntityManager build(EntityManagerContext entityManagerContext) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); return (EntityManager) Proxy.newProxyInstance( classLoader, new Class[]{EntityManager.class}, new SharedEntityManagerInvocationHandler(entityManagerContext)); }
[ "EntityManager", "build", "(", "EntityManagerContext", "entityManagerContext", ")", "{", "ClassLoader", "classLoader", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "return", "(", "EntityManager", ")", "Proxy", ".", "newProxyInstance", "(", "classLoader", ",", "new", "Class", "[", "]", "{", "EntityManager", ".", "class", "}", ",", "new", "SharedEntityManagerInvocationHandler", "(", "entityManagerContext", ")", ")", ";", "}" ]
Create an EntityManager proxy for the given EntityManagerContext. @param entityManagerContext the EntityManagerContext responsible for fetching the EntityManager delegate @return a shareable EntityManager proxy
[ "Create", "an", "EntityManager", "proxy", "for", "the", "given", "EntityManagerContext", "." ]
c45106030bfd3f1977d270bc178e7edb2968cf83
https://github.com/scottescue/dropwizard-entitymanager/blob/c45106030bfd3f1977d270bc178e7edb2968cf83/src/main/java/com/scottescue/dropwizard/entitymanager/SharedEntityManagerFactory.java#L40-L46
141,699
fuinorg/units4j
src/main/java/org/fuin/units4j/assertionrules/Utils.java
Utils.hasAnnotation
public static boolean hasAnnotation(final List<AnnotationInstance> annotations, final String annotationClaszName) { final DotName annotationName = DotName.createSimple(annotationClaszName); for (final AnnotationInstance annotation : annotations) { if (annotation.name().equals(annotationName)) { return true; } } return false; }
java
public static boolean hasAnnotation(final List<AnnotationInstance> annotations, final String annotationClaszName) { final DotName annotationName = DotName.createSimple(annotationClaszName); for (final AnnotationInstance annotation : annotations) { if (annotation.name().equals(annotationName)) { return true; } } return false; }
[ "public", "static", "boolean", "hasAnnotation", "(", "final", "List", "<", "AnnotationInstance", ">", "annotations", ",", "final", "String", "annotationClaszName", ")", "{", "final", "DotName", "annotationName", "=", "DotName", ".", "createSimple", "(", "annotationClaszName", ")", ";", "for", "(", "final", "AnnotationInstance", "annotation", ":", "annotations", ")", "{", "if", "(", "annotation", ".", "name", "(", ")", ".", "equals", "(", "annotationName", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Verifies if a list of annotations contains a given one. @param annotations List with annotations to check. @param annotationClaszName Full qualified name of annotation class to find. @return TRUE if the list contains the annotation, else FALSE.
[ "Verifies", "if", "a", "list", "of", "annotations", "contains", "a", "given", "one", "." ]
29383e30b0f9c246b309e734df9cc63dc5d5499e
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/assertionrules/Utils.java#L56-L64