id
stringlengths
7
14
text
stringlengths
1
106k
1711467_5
@Override public void initialize(Map<String, Object> puProperties) { this.externalProperties = puProperties; this.propertyReader = new ESClientPropertyReader(externalProperties, kunderaMetadata.getApplicationMetadata() .getPersistenceUnitMetadata(getPersistenceUnit())); propertyReader.read(getPersistenceUnit()); }
1711467_6
public static String toString(Collection<?> input, Class<?> genericClass, String mediaType) { if (MediaType.APPLICATION_XML.equals(mediaType)) { StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>") .append("<").append(genericClass.getSimpleName().toLowerCase()).append("s>"); for (Object obj : input) { if (obj != null) { String s = JAXBUtils.toString(obj, mediaType); if (s.startsWith("<?xml")) { s = s.substring(s.indexOf(">") + 1, s.length()); } sb.append(s); } } sb.append("<").append(genericClass.getSimpleName().toLowerCase()).append("s>"); return sb.toString(); } else if (MediaType.APPLICATION_JSON.equals(mediaType)) { int i = 0; StringBuilder sb = new StringBuilder("["); for (Object obj : input) { if (obj != null) { String s = JAXBUtils.toString(obj, mediaType); i++; sb.append(s); if(i < input.size()) { sb.append(","); } } } sb.append("]"); return sb.toString(); } return null; }
1711467_7
public static Collection toCollection(String input, Class<?> collectionClass, Class<?> genericClass, String mediaType) { try { if (MediaType.APPLICATION_XML.equals(mediaType)) { Collection c = (Collection) collectionClass.newInstance(); if (input.startsWith("<?xml")) { input = input.substring(input.indexOf(">") + 1, input.length()); } input = input.replaceAll("<" + genericClass.getSimpleName().toLowerCase() + "s>", ""); while (!input.equals("")) { int i = input.indexOf("</" + genericClass.getSimpleName().toLowerCase() + ">"); String s = input.substring(0, i + 3 + genericClass.getSimpleName().length()); input = input.substring(i + 3 + genericClass.getSimpleName().length(), input.length()); Object o = JAXBUtils.toObject(StreamUtils.toInputStream(s), genericClass, mediaType); c.add(o); } return c; } else if (MediaType.APPLICATION_JSON.equals(mediaType)) { return JAXBUtils.mapper.readValue(input, JAXBUtils.mapper.getTypeFactory() .constructCollectionType((Class<? extends Collection>) collectionClass, genericClass)); } return null; } catch (InstantiationException e) { log.error("Error during translation, Caused by:" + e.getMessage() + ", returning null"); return null; } catch (IllegalAccessException e) { log.error("Error during translation, Caused by:" + e.getMessage() + ", returning null"); return null; } catch (JsonParseException e) { log.error("Error during translation, Caused by:" + e.getMessage() + ", returning null"); return null; } catch (JsonMappingException e) { log.error("Error during translation, Caused by:" + e.getMessage() + ", returning null"); return null; } catch (IOException e) { log.error("Error during translation, Caused by:" + e.getMessage() + ", returning null"); return null; } }
1711467_8
public static String toString(Collection<?> input, Class<?> genericClass, String mediaType) { if (MediaType.APPLICATION_XML.equals(mediaType)) { StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>") .append("<").append(genericClass.getSimpleName().toLowerCase()).append("s>"); for (Object obj : input) { if (obj != null) { String s = JAXBUtils.toString(obj, mediaType); if (s.startsWith("<?xml")) { s = s.substring(s.indexOf(">") + 1, s.length()); } sb.append(s); } } sb.append("<").append(genericClass.getSimpleName().toLowerCase()).append("s>"); return sb.toString(); } else if (MediaType.APPLICATION_JSON.equals(mediaType)) { int i = 0; StringBuilder sb = new StringBuilder("["); for (Object obj : input) { if (obj != null) { String s = JAXBUtils.toString(obj, mediaType); i++; sb.append(s); if(i < input.size()) { sb.append(","); } } } sb.append("]"); return sb.toString(); } return null; }
1711467_9
public static boolean isValidQuery(String queryString, String httpMethod) { if (queryString == null || httpMethod == null) { return false; } queryString = queryString.trim(); if (queryString.length() < 6) return false; String firstKeyword = queryString.substring(0, 6); String allowedKeyword = httpMethods.get(httpMethod); if (allowedKeyword != null && firstKeyword.equalsIgnoreCase(allowedKeyword)) { return true; } else { return false; } }
1720284_0
@Override public void run() { try { String userId = env.getEnv().get(Environment.ENV_USER); this.committer = userService.find(userId); if (readStdin) { String line = null; while((line = stdin.readLine()) != null) { if ("--".equals(line)) { break; } handle(line); } } else { handle(this.sha1); } callback.onExit(0); } catch (AccessControlException e) { log.error(e.getMessage()); callback.onExit(2, e.getMessage()); } catch (Exception e) { log.error(e.getMessage()); callback.onExit(1, e.getMessage()); } }
1720284_1
@Override public Iterable<CommandProvider<?>> get() { Collection<CommandProvider<?>> commands = new ArrayList<CommandProvider<?>>(); bind(commands, ReceivePackCommandProvider.class); bind(commands, GetStatusCommandProvider.class); bind(commands, MonitorCommandProvider.class); bind(commands, SendBuildCommandProvider.class); bind(commands, CatBuildCommandProvider.class); bind(commands, PingCommandProvider.class); bind(commands, WaitForCommandProvider.class); return commands; }
1720284_2
@Override public CatBuildCommand command(String command) throws Exception { // magrit cat-build SHA1 Scanner s = new Scanner(command); s.useDelimiter("\\s{1,}"); check(s.next(), "magrit"); check(s.next(), "cat-build"); check(command, s.hasNext()); this.repository = createRepository(s.next()); check(command, s.hasNext()); checkSha1(sha1 = s.next()); return this; }
1720284_3
@Override public void run() { PrintStream pOut =null; try { BuildResult last = dao.getLast(repository, sha1); pOut = new PrintStream(out); if (last != null) { out.write(last.getLog()); } else { pOut.println("No log found for this commit."); } out.flush(); callback.onExit(0); } catch (Throwable e) { e.printStackTrace(); callback.onExit(1, e.getMessage()); } finally { if (pOut != null) { pOut.close(); } } }
1720284_4
@Override public void setInputStream(InputStream in) { if (logStreams && !(in instanceof LoggerInputStream)) { this.in = new LoggerInputStream(in); } else { this.in = in; } }
1720284_5
@Override public void setOutputStream(OutputStream out) { if (logStreams && !(out instanceof LoggerOutputStream)) { this.out = new LoggerOutputStream(out); } else { this.out = out; } }
1720284_6
@Override public void setErrorStream(OutputStream err) { if (logStreams && !(err instanceof LoggerOutputStream)) { this.err = new LoggerOutputStream(err); } else { this.err = err; } }
1720284_7
protected void checkSha1(String sha1) { if (!gitUtils.isSha1(sha1)) { throw new IllegalArgumentException(String.format("%s isn't a valid 40 bytes SHA1", sha1)); } }
1720284_8
protected void checkSha1(String sha1) { if (!gitUtils.isSha1(sha1)) { throw new IllegalArgumentException(String.format("%s isn't a valid 40 bytes SHA1", sha1)); } }
1720284_9
protected Repository createRepository(String repoPath) throws IOException { return gitUtils.createRepository( new File( ctx.configuration().getRepositoriesHomeDir(), repoPath ) ); }
1724015_0
public Object execute(final File script) throws Exception { final GroovyShell shell = new GroovyShell(binding()); final Object result = shell.evaluate(script); return result; }
1724015_1
public Object execute(final File script) throws Exception { final GroovyShell shell = new GroovyShell(binding()); final Object result = shell.evaluate(script); return result; }
1724015_2
static String mvnToAether(String name) { Matcher m = mvnPattern.matcher(name); if (!m.matches()) { return name; } StringBuilder b = new StringBuilder(); b.append(m.group(1)).append(":");//groupId b.append(m.group(2)).append(":");//artifactId String extension = m.group(5); String classifier = m.group(7); if (present(classifier)) { if (present(extension)) { b.append(extension).append(":"); } else { b.append("jar:"); } b.append(classifier).append(":"); } else { if (present(extension) && !"jar".equals(extension)) { b.append(extension).append(":"); } } b.append(m.group(3)); return b.toString(); }
1724015_3
static String aetherToMvn(String name) { Matcher m = aetherPattern.matcher(name); if (!m.matches()) { return name; } StringBuilder b = new StringBuilder("mvn:"); b.append(m.group(1)).append("/");//groupId b.append(m.group(2)).append("/");//artifactId b.append(m.group(7));//version String extension = m.group(4); String classifier = m.group(6); if (present(classifier)) { if (present(extension)) { b.append("/").append(extension); } else { b.append("/jar"); } b.append("/").append(classifier); } else if (present(extension)) { b.append("/").append(extension); } return b.toString(); }
1724015_4
static String pathFromMaven(String name) { if (name.indexOf(':') == -1) { return name; } name = mvnToAether(name); return pathFromAether(name); }
1724015_5
static String pathFromAether(String name) { DefaultArtifact artifact = new DefaultArtifact(name); Artifact mavenArtifact = RepositoryUtils.toArtifact(artifact); return layout.pathOf(mavenArtifact); }
1724015_6
static String artifactToMvn(Artifact artifact) { return artifactToMvn(RepositoryUtils.toArtifact(artifact)); }
1742658_0
void visitItem(final String name, FormItemVisitor visitor) { String namePrefix = name + "_"; for(Map<String, FormItem> groupItems : formItems.values()) { for(String key : groupItems.keySet()) { if(key.equals(name) || key.startsWith(namePrefix)) { visitor.visit(groupItems.get(key)); } } } }
1742658_1
public ListBoxItem(String name, String title) { super(name, title); listBox = new ListBox(); listBox.setName(name); listBox.setTitle(title); listBox.setVisibleItemCount(1); listBox.setTabIndex(0); valueChangeHandler = new ChangeHandler() { @Override public void onChange(ChangeEvent event) { setModified(true); } }; listBox.addChangeHandler(valueChangeHandler); wrapper = new HorizontalPanel(); wrapper.add(listBox); }
1742658_2
public void setChoices(Collection<String> choices, String defaultChoice) { Set<String> sortedChoices = new TreeSet<String>(choices); int i = 0; int idx = -1; listBox.clear(); for (String c : sortedChoices) { listBox.addItem(c); if (c.equals(defaultChoice)) idx = i; i++; } if (idx >= 0) listBox.setSelectedIndex(idx); else listBox.setSelectedIndex(-1); }
1742658_3
public TextAreaItem(String name, String title) { super(name, title); setup(); }
1742658_4
@Override public void resetMetaData() { super.resetMetaData(); textArea.setValue(null); }
1742658_5
@Override public boolean validate(String value) { return !(isRequired() && value.trim().equals("")); }
1742658_6
@Override public boolean validate(String value) { return !(isRequired() && value.trim().equals("")); }
1742658_7
@Override public boolean validate(T value) { if (valueClass.equals(Long.class)) // Currently supported values are always >= 0. A -1 return value signals incorrect input. return (Long) value != -1l; if (valueClass.equals(Integer.class)) // Currently supported values are always >= 0. A -1 return value signals incorrect input. return (Integer) value != -1; if (valueClass.equals(String.class)) { String strVal = (String) value; if (isRequired() && strVal.equals("")) return false; else return !strVal.contains(" "); } // can't validate this type return false; }
1742658_8
@Override public Widget render(RenderMetaData metaData, String groupName, Map<String, FormItem> groupItems) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendHtmlConstant(tablePrefix); // build html structure ArrayList<String> itemKeys = new ArrayList<String>(groupItems.keySet()); ArrayList<FormItem> values = new ArrayList<FormItem>(groupItems.values()); // Remove the hidden items from both lists. Iterate from the back so that removal doesn't // require adjustment of the numbering. for (int i=values.size() - 1; i >= 0; i--) { if (!values.get(i).render()) { values.remove(i); itemKeys.remove(i); } } //int colWidth = 100/(metaData.getNumColumns()*2); builder.appendHtmlConstant("<colgroup id='cols_"+metaData.getNumColumns()+"'>"); for(int col=0; col<metaData.getNumColumns(); col++) { // it's two TD's per item (title & value) //builder.appendHtmlConstant("<col width='"+(colWidth-10)+"%'/>"); //builder.appendHtmlConstant("<col width='"+(colWidth+10)+"%'/>"); builder.appendHtmlConstant("<col class='form-item-title-col'/>"); builder.appendHtmlConstant("<col class='form-item-col'/>"); } builder.appendHtmlConstant("</colgroup>"); int i=0; while(i<itemKeys.size()) { builder.appendHtmlConstant("<tr>"); int col=0; for(col=0; col<metaData.getNumColumns(); col++) { int next = i + col; if(next<itemKeys.size()) { FormItem item = values.get(next); createItemCell(metaData, builder, itemKeys.get(next), item); } else { break; } } builder.appendHtmlConstant("</tr>"); i+=col; } builder.appendHtmlConstant(tableSuffix); HTMLPanel panel = new HTMLPanel(builder.toSafeHtml()); // inline widget for(String key : itemKeys) { FormItem item = groupItems.get(key); final String widgetId = id + key; final String labelId = id + key+"_l"; // aria property key final String insertId = id + key+"_i"; Element input = item.getInputElement(); if(input!=null) { input.setAttribute("id", widgetId); //widget.getElement().setAttribute("tabindex", "0"); input.setAttribute("aria-labelledby", labelId); input.setAttribute("aria-required", String.valueOf(item.isRequired())); } panel.add(item.asWidget(), insertId); } return panel; }
1743159_0
public static ServiceObject build(JSONObject jobj) throws JSONException{ ServiceObject s = new ServiceObject(jobj.toString()); return s; }
1743159_1
@Override public void deleteByEndpointID(String endpointID) throws MultipleResourceException, NonExistingResourceException, PersistentStoreFailureException { database.requestStart(); database.requestEnsureConnection(); BasicDBObject query = new BasicDBObject(); query.put(ServiceBasicAttributeNames.SERVICE_ENDPOINT_ID .getAttributeName(), endpointID); DBObject d = serviceCollection.findAndRemove(query); database.requestDone(); if (d == null) { if (logger.isDebugEnabled()) { String msg = "No service description with the Endpoint ID:" + endpointID + " exists"; logger.debug(msg); } throw new NonExistingResourceException( "No service description with the Endpoint ID:" + endpointID + " exists"); } logger.info("DELETED Service Endpoint Record with ID: " + endpointID); // sending delete event to the receivers try { JSONObject deletedEntry = new JSONObject(d.toString()); EventDispatcher.notifyRecievers(new Event( EventTypes.SERVICE_DELETE, deletedEntry)); } catch (JSONException e) { logger.warn(e.getCause()); } }
1743159_2
@Override public void insert(ServiceObject item) throws ExistingResourceException, PersistentStoreFailureException { try { if (logger.isDebugEnabled()) { logger.debug("inserting: " + item.toDBObject()); } database.requestStart(); database.requestEnsureConnection(); DBObject db = item.toDBObject(); // db.put(ServiceBasicAttributeNames.SERVICE_CREATED_ON // .getAttributeName(), new Date()); serviceCollection.insert(db, WriteConcern.SAFE); database.requestDone(); logger.info("inserted Service Endpoint record with ID: " + item.getEndpointID()); // EventDispatcher.notifyRecievers(new Event(EventTypes.SERVICE_ADD, // item // .toJSON())); } catch (MongoException e) { if (e instanceof DuplicateKey) { throw new ExistingResourceException("Endpoint record with ID: " + item.getEndpointID() + " - already exists", e); } else { throw new PersistentStoreFailureException(e); } } }
1743159_3
public Response registerService(JSONObject serviceInfo) throws WebApplicationException, JSONException { Integer length = serviceInfo.length(); if (length <= 0 || length > 100) { throw new WebApplicationException(Status.FORBIDDEN); } try { Client c = (Client) req.getAttribute("client"); if (!EMIRServer.getServerSecurityProperties().isSslEnabled() && c == null) { c = Client.getAnonymousClient(); } serviceInfo.put(ServiceBasicAttributeNames.SERVICE_OWNER_DN .getAttributeName(), c.getDistinguishedName()); JSONObject res = serviceAdmin.addService(serviceInfo); return Response.ok(res).build(); } catch (ExistingResourceException e) { return Response.status(Status.CONFLICT).entity(serviceInfo).build(); } catch (Exception e) { JSONArray err = new JSONArray(); err.put(ExceptionUtil.toJson(e)); throw new WebApplicationException(Response .status(Status.INTERNAL_SERVER_ERROR).entity(err).build()); } }
1743159_4
@POST @Produces({MediaType.APPLICATION_JSON}) @Consumes(MediaType.APPLICATION_JSON) public Response richQueryForJSON(JSONObject queryDocument, @Context UriInfo ui) throws WebApplicationException, JSONException { MultivaluedMap<String, String> queryParams = ui.getQueryParameters(); Set<String> s = queryParams.keySet(); Map<String, Object> m = new HashMap<String, Object>(); for (Iterator<String> iterator = s.iterator(); iterator.hasNext();) { String key = (String) iterator.next(); m.put(key, queryParams.getFirst(key)); } JSONArray jArr = null; try { jArr = col.queryForJSON(queryDocument, m); } catch (Exception e) { Log.logException("Error in doing query for services in JSON format", e, logger); JSONArray err = new JSONArray(); err.put(ExceptionUtil.toJson(e)); throw new WebApplicationException(e,Response.status(Status.INTERNAL_SERVER_ERROR).entity(err).build()); } if (jArr.length() == 0) { return Response.ok(jArr).status(Status.NO_CONTENT).build(); } return Response.ok(jArr).build(); }
1743159_5
@POST @Produces(MediaType.APPLICATION_XML) @Consumes(MediaType.APPLICATION_JSON) public Response richQueryForXML(JSONObject queryDocument, @Context UriInfo ui) throws WebApplicationException { MultivaluedMap<String, String> queryParams = ui.getQueryParameters(); Set<String> s = queryParams.keySet(); Map<String, Object> m = new HashMap<String, Object>(); for (Iterator<String> iterator = s.iterator(); iterator.hasNext();) { String key = (String) iterator.next(); m.put(key, queryParams.getFirst(key)); } QueryResult jArr = null; try { jArr = col.queryForXML(queryDocument, m); } catch (Exception e) { Log.logException("Error in doing query for services in XML format", e, logger); throw new WebApplicationException(e,Response.status(Status.INTERNAL_SERVER_ERROR).entity("<error>"+e.getCause().toString()+"</error>").build()); } if (jArr == null) { return Response.ok().status(Status.NO_CONTENT).build(); } else if (jArr.getCount() == BigInteger.ZERO) { return Response.ok(jArr).status(Status.NO_CONTENT).build(); } return Response.ok(jArr).build(); }
1743159_6
public ChildrenManager() { childServices = new HashMap<String, Date>(); }
1743159_7
public synchronized List<String> getChildDSRs() { List<String> result = new ArrayList<String>(); Date currentTime = new Date(); Set<String> s=childServices.keySet(); Iterator<String> it=s.iterator(); while(it.hasNext()) { String key=it.next(); Date value=childServices.get(key); if ( value.getTime()+hour > currentTime.getTime()) { result.add(key); } else { // expired checkin entry childServices.remove(key); } } return result; }
1743159_8
public synchronized boolean addChildDSR(String identifier) throws EmptyIdentifierFailureException, NullPointerFailureException { if (identifier == null) throw new NullPointerFailureException(); if (identifier.isEmpty()) throw new EmptyIdentifierFailureException(); boolean retval = false; if (childServices.containsKey(identifier)) { Date currentTime = new Date(); Date value = childServices.get(identifier); if ( value.getTime()+hour <= currentTime.getTime()) { // expired checkin entry retval = true; } childServices.remove(identifier); } else { // First time put the identifier into the list retval = true; } childServices.put(identifier, new Date()); return retval; }
1743159_9
public InfrastructureManager() { parentsRoute = new ArrayList<String>(); try { Class.forName("org.h2.Driver"); } catch (ClassNotFoundException e) { Log.logException("", e); } try { String h2db = EMIRServer.getServerProperties().getValue( ServerProperties.PROP_H2_DBFILE_PATH); if (h2db == null || h2db.isEmpty()) { h2db = "/var/lib/emi/emir/data/Emiregistry"; } conn = DriverManager.getConnection("jdbc:h2:" + h2db, "sa", ""); stat = conn.createStatement(); stat.execute("create table " + dbname + "(id varchar(255) primary key, new int, del int)"); } catch (SQLException e) { if (e.toString().substring(30, 60) .equals("Database may be already in use")) { logger.error("DB locked! " + e); } else if (e.toString().substring(30, 64) .equals("Table \"EMIREGISTRY\" already exists")) { if (logger.isDebugEnabled()) { logger.debug("DB exist. " + e); } } else { logger.error("Other SQL exception: " + e); } } }
1743723_0
@SafeVarargs @SuppressWarnings("unchecked") public final static <T> T[] copyArrayExcept(T[] array, T... except) { final List<T> values = CollectionFactory.newList(); for (final T item : array) { if (Arrays.binarySearch(except, item, new Comparator<T>() { @Override public int compare(Object o1, Object o2) { return (o1 == o2 ? 1 : 0); } }) >= 0) { values.add(item); } } return (T[]) Arrays.copyOf(values.toArray(), values.size(), array.getClass()); }
1743723_1
@Override public synchronized List<ScriptContext> load(File scriptDescriptor) throws Exception { Preconditions.checkNotNull(scriptDescriptor, "scriptDescriptor"); final JAXBContext c = JAXBContext.newInstance(ScriptInfo.class, ScriptList.class); final Unmarshaller u = c.createUnmarshaller(); final ScriptList list = (ScriptList) u.unmarshal(scriptDescriptor); final List<ScriptContext> contexts = CollectionFactory.newList(); for (ScriptInfo si : list.getScriptInfos()) { final ScriptContext context = createContext(si, null); if (context != null) { this.contexts.add(context); context.init(); contexts.add(context); } } return contexts; }
1743723_2
@Override public synchronized List<ScriptContext> load(File scriptDescriptor) throws Exception { Preconditions.checkNotNull(scriptDescriptor, "scriptDescriptor"); final JAXBContext c = JAXBContext.newInstance(ScriptInfo.class, ScriptList.class); final Unmarshaller u = c.createUnmarshaller(); final ScriptList list = (ScriptList) u.unmarshal(scriptDescriptor); final List<ScriptContext> contexts = CollectionFactory.newList(); for (ScriptInfo si : list.getScriptInfos()) { final ScriptContext context = createContext(si, null); if (context != null) { this.contexts.add(context); context.init(); contexts.add(context); } } return contexts; }
1757703_0
public static PrestoContextField getContextField(Presto session, String path) { PrestoDataProvider dataProvider = session.getDataProvider(); PrestoSchemaProvider schemaProvider = session.getSchemaProvider(); String[] traverse = path.split(FIELD_PATH_SEPARATOR_REGEX); if (traverse.length % 3 != 0) { throw new RuntimeException("Invalid field path: " + path); } int steps = traverse.length / 3; // find root topic String startTopicId = PathParser.deskull(traverse[0]); String startViewId = traverse[1]; String startFieldId = traverse[2]; boolean isNewTopic = PrestoContext.isNewTopic(startTopicId); PrestoTopic currentTopic; String startTypeId; if (isNewTopic) { currentTopic = null; startTypeId = PrestoContext.getTypeId(startTopicId); } else { currentTopic = dataProvider.getTopicById(startTopicId); if (currentTopic == null) { return null; } startTypeId = currentTopic.getTypeId(); } PrestoType currentType = schemaProvider.getTypeById(startTypeId); PrestoView currentView = currentType.getViewById(startViewId); PrestoField currentField = currentType.getFieldById(startFieldId, currentView); PrestoContext currentContext; if (isNewTopic) { currentContext = PrestoContext.create(session.getResolver(), currentType, currentView); } else { currentContext = PrestoContext.create(session.getResolver(), currentTopic, currentType, currentView); } System.out.println("T1: " + startTopicId + " V: " + startViewId + " F: " + startFieldId); // traverse children for (int i=1; i < steps; i++) { String topicId = PathParser.deskull(traverse[i*3]); String viewId = traverse[i*3+1]; String fieldId = traverse[i*3+2]; if (PrestoContext.isNewTopic(topicId)) { currentTopic = null; currentType = PrestoContext.getTypeOfNewTopic(topicId, schemaProvider); currentView = currentType.getViewById(viewId); currentContext = PrestoContext.createSubContext(currentContext, currentField, topicId, viewId); } else { // find topic amongst parent field values currentTopic = findInParentField(currentContext, currentField, topicId); if (currentTopic == null) { return null; } String typeId = currentTopic.getTypeId(); currentType = schemaProvider.getTypeById(typeId); currentView = currentType.getViewById(viewId); currentContext = PrestoContext.createSubContext(currentContext, currentField, currentTopic, currentType, currentView); } currentField = currentType.getFieldById(fieldId, currentView); System.out.println("T0: " + topicId + " V: " + viewId + " F: " + fieldId); } return new PrestoContextField(currentContext, currentField); }
1757703_1
public static PrestoContext getTopicByPath(Presto session, String path, String topicId, String viewId) { if (path == null || path.equals("_")) { return PrestoContext.create(session.getResolver(), PathParser.deskull(topicId), viewId); } PrestoContextField contextField = getContextField(session, path); PrestoContext currentContext = contextField.getContext(); PrestoField currentField = contextField.getField(); if (PrestoContext.isNewTopic(topicId)) { return PrestoContext.createSubContext(currentContext, currentField, PathParser.deskull(topicId), viewId); } else { PrestoTopic resultTopic = findInParentField(currentContext, currentField, topicId); if (resultTopic == null) { return null; } else { String resultTypeId = resultTopic.getTypeId(); PrestoType resultType = session.getSchemaProvider().getTypeById(resultTypeId); PrestoView resultView = resultType.getViewById(viewId); return PrestoContext.createSubContext(currentContext, currentField, resultTopic, resultType, resultView); } } }
1757703_2
public static PrestoContext getTopicByPath(Presto session, String path, String topicId, String viewId) { if (path == null || path.equals("_")) { return PrestoContext.create(session.getResolver(), PathParser.deskull(topicId), viewId); } PrestoContextField contextField = getContextField(session, path); PrestoContext currentContext = contextField.getContext(); PrestoField currentField = contextField.getField(); if (PrestoContext.isNewTopic(topicId)) { return PrestoContext.createSubContext(currentContext, currentField, PathParser.deskull(topicId), viewId); } else { PrestoTopic resultTopic = findInParentField(currentContext, currentField, topicId); if (resultTopic == null) { return null; } else { String resultTypeId = resultTopic.getTypeId(); PrestoType resultType = session.getSchemaProvider().getTypeById(resultTypeId); PrestoView resultView = resultType.getViewById(viewId); return PrestoContext.createSubContext(currentContext, currentField, resultTopic, resultType, resultView); } } }
1757703_3
public static PrestoContext getTopicByPath(Presto session, String path, String topicId, String viewId) { if (path == null || path.equals("_")) { return PrestoContext.create(session.getResolver(), PathParser.deskull(topicId), viewId); } PrestoContextField contextField = getContextField(session, path); PrestoContext currentContext = contextField.getContext(); PrestoField currentField = contextField.getField(); if (PrestoContext.isNewTopic(topicId)) { return PrestoContext.createSubContext(currentContext, currentField, PathParser.deskull(topicId), viewId); } else { PrestoTopic resultTopic = findInParentField(currentContext, currentField, topicId); if (resultTopic == null) { return null; } else { String resultTypeId = resultTopic.getTypeId(); PrestoType resultType = session.getSchemaProvider().getTypeById(resultTypeId); PrestoView resultView = resultType.getViewById(viewId); return PrestoContext.createSubContext(currentContext, currentField, resultTopic, resultType, resultView); } } }
1757703_4
public static PrestoContext getTopicByPath(Presto session, String path, String topicId, String viewId) { if (path == null || path.equals("_")) { return PrestoContext.create(session.getResolver(), PathParser.deskull(topicId), viewId); } PrestoContextField contextField = getContextField(session, path); PrestoContext currentContext = contextField.getContext(); PrestoField currentField = contextField.getField(); if (PrestoContext.isNewTopic(topicId)) { return PrestoContext.createSubContext(currentContext, currentField, PathParser.deskull(topicId), viewId); } else { PrestoTopic resultTopic = findInParentField(currentContext, currentField, topicId); if (resultTopic == null) { return null; } else { String resultTypeId = resultTopic.getTypeId(); PrestoType resultType = session.getSchemaProvider().getTypeById(resultTypeId); PrestoView resultView = resultType.getViewById(viewId); return PrestoContext.createSubContext(currentContext, currentField, resultTopic, resultType, resultView); } } }
1757703_5
public static PrestoContext getTopicByPath(Presto session, String path, String topicId, String viewId) { if (path == null || path.equals("_")) { return PrestoContext.create(session.getResolver(), PathParser.deskull(topicId), viewId); } PrestoContextField contextField = getContextField(session, path); PrestoContext currentContext = contextField.getContext(); PrestoField currentField = contextField.getField(); if (PrestoContext.isNewTopic(topicId)) { return PrestoContext.createSubContext(currentContext, currentField, PathParser.deskull(topicId), viewId); } else { PrestoTopic resultTopic = findInParentField(currentContext, currentField, topicId); if (resultTopic == null) { return null; } else { String resultTypeId = resultTopic.getTypeId(); PrestoType resultType = session.getSchemaProvider().getTypeById(resultTypeId); PrestoView resultView = resultType.getViewById(viewId); return PrestoContext.createSubContext(currentContext, currentField, resultTopic, resultType, resultView); } } }
1757703_6
public static String getInlineTopicPath(PrestoContext context, PrestoField field) { if (context == null) { return "_"; } String topicId = context.getTopicId(); String viewId = context.getView().getId(); String fieldId = field.getId(); String localPath = PathParser.skull(topicId) + PathParser.FIELD_PATH_SEPARATOR + viewId + PathParser.FIELD_PATH_SEPARATOR + fieldId; PrestoContext parentContext = context.getParentContext(); if (parentContext != null) { PrestoField parentField = context.getParentField(); String parentPath = getInlineTopicPath(parentContext, parentField); return parentPath + PathParser.FIELD_PATH_SEPARATOR + localPath; } else { return localPath; } }
1757703_7
public static <T> List<T> moveValuesToIndex(List<? extends T> values, List<? extends T> moveValues, int index, boolean allowAdd) { int size = values.size(); if (index > size) { throw new ArrayIndexOutOfBoundsException("Index: " + index + ", Size: " + values.size()); } List<T> result = new ArrayList<T>(values); if (moveValues.isEmpty()) { return result; } int beforeCount=0; for (T moveValue : moveValues) { int ix = result.indexOf(moveValue); if (ix != -1) { if (ix < index) { beforeCount++; } @SuppressWarnings("unused") T removed = result.remove(ix); System.out.println("R: " + ix + " " + removed + " " + moveValue); } else if (!allowAdd) { throw new RuntimeException("Not allowed to add new values: " + moveValue); } } System.out.println("V: " + values + " " + moveValues + " " + result); System.out.println("IX: " + index + " AA: " + allowAdd); int moveSize = moveValues.size(); int offset = Math.max(0, index-beforeCount); System.out.println("MS: " + moveSize + " BC: " + beforeCount + " OF: " + offset); System.out.println("OF: " + offset + " = " + index + "-" + beforeCount); for (int i=0; i < moveSize; i++) { System.out.println("A: " + (offset+1) + " " + moveValues.get(i)); result.add(offset+i, moveValues.get(i)); } return result; }
1757703_8
public static <T> List<T> moveValuesToIndex(List<? extends T> values, List<? extends T> moveValues, int index, boolean allowAdd) { int size = values.size(); if (index > size) { throw new ArrayIndexOutOfBoundsException("Index: " + index + ", Size: " + values.size()); } List<T> result = new ArrayList<T>(values); if (moveValues.isEmpty()) { return result; } int beforeCount=0; for (T moveValue : moveValues) { int ix = result.indexOf(moveValue); if (ix != -1) { if (ix < index) { beforeCount++; } @SuppressWarnings("unused") T removed = result.remove(ix); System.out.println("R: " + ix + " " + removed + " " + moveValue); } else if (!allowAdd) { throw new RuntimeException("Not allowed to add new values: " + moveValue); } } System.out.println("V: " + values + " " + moveValues + " " + result); System.out.println("IX: " + index + " AA: " + allowAdd); int moveSize = moveValues.size(); int offset = Math.max(0, index-beforeCount); System.out.println("MS: " + moveSize + " BC: " + beforeCount + " OF: " + offset); System.out.println("OF: " + offset + " = " + index + "-" + beforeCount); for (int i=0; i < moveSize; i++) { System.out.println("A: " + (offset+1) + " " + moveValues.get(i)); result.add(offset+i, moveValues.get(i)); } return result; }
1757703_9
public static <T> List<T> moveValuesToIndex(List<? extends T> values, List<? extends T> moveValues, int index, boolean allowAdd) { int size = values.size(); if (index > size) { throw new ArrayIndexOutOfBoundsException("Index: " + index + ", Size: " + values.size()); } List<T> result = new ArrayList<T>(values); if (moveValues.isEmpty()) { return result; } int beforeCount=0; for (T moveValue : moveValues) { int ix = result.indexOf(moveValue); if (ix != -1) { if (ix < index) { beforeCount++; } @SuppressWarnings("unused") T removed = result.remove(ix); System.out.println("R: " + ix + " " + removed + " " + moveValue); } else if (!allowAdd) { throw new RuntimeException("Not allowed to add new values: " + moveValue); } } System.out.println("V: " + values + " " + moveValues + " " + result); System.out.println("IX: " + index + " AA: " + allowAdd); int moveSize = moveValues.size(); int offset = Math.max(0, index-beforeCount); System.out.println("MS: " + moveSize + " BC: " + beforeCount + " OF: " + offset); System.out.println("OF: " + offset + " = " + index + "-" + beforeCount); for (int i=0; i < moveSize; i++) { System.out.println("A: " + (offset+1) + " " + moveValues.get(i)); result.add(offset+i, moveValues.get(i)); } return result; }
1767164_0
@ExceptionHandler(value={ ObjectNotFoundException.class, EntityNotFoundException.class, EntityExistsException.class, DataIntegrityViolationException.class }) public ResponseEntity<Object> handleCustomException(Exception ex, WebRequest request) { HttpHeaders headers = new HttpHeaders(); HttpStatus status; if (ex instanceof ObjectNotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof EntityNotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof EntityExistsException) { status = HttpStatus.CONFLICT; } else if (ex instanceof DataIntegrityViolationException) { status = HttpStatus.CONFLICT; } else { logger.warn("Unknown exception type: " + ex.getClass().getName()); status = HttpStatus.INTERNAL_SERVER_ERROR; return handleExceptionInternal(ex, null, headers, status, request); } return handleExceptionInternal(ex, buildRestError(ex, status), headers, status, request); }
1767164_1
@ExceptionHandler(value={ ObjectNotFoundException.class, EntityNotFoundException.class, EntityExistsException.class, DataIntegrityViolationException.class }) public ResponseEntity<Object> handleCustomException(Exception ex, WebRequest request) { HttpHeaders headers = new HttpHeaders(); HttpStatus status; if (ex instanceof ObjectNotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof EntityNotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof EntityExistsException) { status = HttpStatus.CONFLICT; } else if (ex instanceof DataIntegrityViolationException) { status = HttpStatus.CONFLICT; } else { logger.warn("Unknown exception type: " + ex.getClass().getName()); status = HttpStatus.INTERNAL_SERVER_ERROR; return handleExceptionInternal(ex, null, headers, status, request); } return handleExceptionInternal(ex, buildRestError(ex, status), headers, status, request); }
1767164_2
@ExceptionHandler(value={ ObjectNotFoundException.class, EntityNotFoundException.class, EntityExistsException.class, DataIntegrityViolationException.class }) public ResponseEntity<Object> handleCustomException(Exception ex, WebRequest request) { HttpHeaders headers = new HttpHeaders(); HttpStatus status; if (ex instanceof ObjectNotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof EntityNotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof EntityExistsException) { status = HttpStatus.CONFLICT; } else if (ex instanceof DataIntegrityViolationException) { status = HttpStatus.CONFLICT; } else { logger.warn("Unknown exception type: " + ex.getClass().getName()); status = HttpStatus.INTERNAL_SERVER_ERROR; return handleExceptionInternal(ex, null, headers, status, request); } return handleExceptionInternal(ex, buildRestError(ex, status), headers, status, request); }
1767164_3
@ExceptionHandler(value={ ObjectNotFoundException.class, EntityNotFoundException.class, EntityExistsException.class, DataIntegrityViolationException.class }) public ResponseEntity<Object> handleCustomException(Exception ex, WebRequest request) { HttpHeaders headers = new HttpHeaders(); HttpStatus status; if (ex instanceof ObjectNotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof EntityNotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof EntityExistsException) { status = HttpStatus.CONFLICT; } else if (ex instanceof DataIntegrityViolationException) { status = HttpStatus.CONFLICT; } else { logger.warn("Unknown exception type: " + ex.getClass().getName()); status = HttpStatus.INTERNAL_SERVER_ERROR; return handleExceptionInternal(ex, null, headers, status, request); } return handleExceptionInternal(ex, buildRestError(ex, status), headers, status, request); }
1767164_4
@ExceptionHandler(value={ ObjectNotFoundException.class, EntityNotFoundException.class, EntityExistsException.class, DataIntegrityViolationException.class }) public ResponseEntity<Object> handleCustomException(Exception ex, WebRequest request) { HttpHeaders headers = new HttpHeaders(); HttpStatus status; if (ex instanceof ObjectNotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof EntityNotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof EntityExistsException) { status = HttpStatus.CONFLICT; } else if (ex instanceof DataIntegrityViolationException) { status = HttpStatus.CONFLICT; } else { logger.warn("Unknown exception type: " + ex.getClass().getName()); status = HttpStatus.INTERNAL_SERVER_ERROR; return handleExceptionInternal(ex, null, headers, status, request); } return handleExceptionInternal(ex, buildRestError(ex, status), headers, status, request); }
1767164_5
public static Class<?> getGenericType(Class<?> clazz) { return getGenericType(clazz, 0); }
1767164_6
public static Class<?> getGenericTypeFromBean(Object object) { Class<?> clazz = object.getClass(); if (AopUtils.isAopProxy(object)) { clazz = AopUtils.getTargetClass(object); } return getGenericType(clazz); }
1767164_7
@ExceptionHandler(value={ IllegalArgumentException.class, ValidationException.class, NotFoundException.class, NotImplementedException.class }) public ResponseEntity<Object> handleCustomException(Exception ex, WebRequest request) { HttpHeaders headers = new HttpHeaders(); HttpStatus status; if (ex instanceof IllegalArgumentException) { status = HttpStatus.BAD_REQUEST; } else if (ex instanceof ValidationException) { status = HttpStatus.BAD_REQUEST; } else if (ex instanceof NotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof NotImplementedException) { status = HttpStatus.NOT_IMPLEMENTED; } else { logger.warn("Unknown exception type: " + ex.getClass().getName()); status = HttpStatus.INTERNAL_SERVER_ERROR; return handleExceptionInternal(ex, null, headers, status, request); } return handleExceptionInternal(ex, buildRestError(ex, status), headers, status, request); }
1767164_8
@ExceptionHandler(value={ IllegalArgumentException.class, ValidationException.class, NotFoundException.class, NotImplementedException.class }) public ResponseEntity<Object> handleCustomException(Exception ex, WebRequest request) { HttpHeaders headers = new HttpHeaders(); HttpStatus status; if (ex instanceof IllegalArgumentException) { status = HttpStatus.BAD_REQUEST; } else if (ex instanceof ValidationException) { status = HttpStatus.BAD_REQUEST; } else if (ex instanceof NotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof NotImplementedException) { status = HttpStatus.NOT_IMPLEMENTED; } else { logger.warn("Unknown exception type: " + ex.getClass().getName()); status = HttpStatus.INTERNAL_SERVER_ERROR; return handleExceptionInternal(ex, null, headers, status, request); } return handleExceptionInternal(ex, buildRestError(ex, status), headers, status, request); }
1767164_9
@ExceptionHandler(value={ IllegalArgumentException.class, ValidationException.class, NotFoundException.class, NotImplementedException.class }) public ResponseEntity<Object> handleCustomException(Exception ex, WebRequest request) { HttpHeaders headers = new HttpHeaders(); HttpStatus status; if (ex instanceof IllegalArgumentException) { status = HttpStatus.BAD_REQUEST; } else if (ex instanceof ValidationException) { status = HttpStatus.BAD_REQUEST; } else if (ex instanceof NotFoundException) { status = HttpStatus.NOT_FOUND; } else if (ex instanceof NotImplementedException) { status = HttpStatus.NOT_IMPLEMENTED; } else { logger.warn("Unknown exception type: " + ex.getClass().getName()); status = HttpStatus.INTERNAL_SERVER_ERROR; return handleExceptionInternal(ex, null, headers, status, request); } return handleExceptionInternal(ex, buildRestError(ex, status), headers, status, request); }
1767458_0
public UserProfile fetchUserProfile(TripIt tripit) { TripItProfile profile = tripit.getUserProfile(); return new UserProfileBuilder().setName(profile.getPublicDisplayName()).setEmail(profile.getEmailAddress()).setUsername(profile.getScreenName()).build(); }
1767458_1
public UserProfile fetchUserProfile(TripIt tripit) { TripItProfile profile = tripit.getUserProfile(); return new UserProfileBuilder().setName(profile.getPublicDisplayName()).setEmail(profile.getEmailAddress()).setUsername(profile.getScreenName()).build(); }
1767458_2
public UserProfile fetchUserProfile(TripIt tripit) { TripItProfile profile = tripit.getUserProfile(); return new UserProfileBuilder().setName(profile.getPublicDisplayName()).setEmail(profile.getEmailAddress()).setUsername(profile.getScreenName()).build(); }
1767458_3
public UserProfile fetchUserProfile(TripIt tripit) { TripItProfile profile = tripit.getUserProfile(); return new UserProfileBuilder().setName(profile.getPublicDisplayName()).setEmail(profile.getEmailAddress()).setUsername(profile.getScreenName()).build(); }
1767458_4
public String getProfileId() { return getUserProfile().getId(); }
1767458_5
public String getProfileUrl() { return getUserProfile().getProfileUrl(); }
1767458_6
public List<Trip> getUpcomingTrips() { return getRestTemplate().getForObject("https://api.tripit.com/v1/list/trip/traveler/true/past/false?format=json", TripList.class).getList(); }
1767458_7
public List<Trip> getUpcomingTrips() { return getRestTemplate().getForObject("https://api.tripit.com/v1/list/trip/traveler/true/past/false?format=json", TripList.class).getList(); }
1767458_8
public List<Trip> getUpcomingTrips() { return getRestTemplate().getForObject("https://api.tripit.com/v1/list/trip/traveler/true/past/false?format=json", TripList.class).getList(); }
1767567_0
public static Object findFactory(String factoryId, String defaultImpl) throws PreProcessFailedException { CodeGenClassLoader classLoader = null; try { ClassLoader parent = Thread.currentThread().getContextClassLoader().getParent(); if(parent instanceof CodeGenClassLoader) { classLoader = (CodeGenClassLoader) parent; } } catch (Exception exception) { throw new PreProcessFailedException(exception.getMessage(), exception); } try { String systemProp = System.getProperty( factoryId ); if( systemProp!=null) { return newInstance(factoryId, systemProp, classLoader); } } catch (Exception exception) { // TODO throw exception or go with our impl } FileInputStream in = null; try { String javah=System.getProperty( "java.home" ); String configFile = javah + File.separator + "lib" + File.separator + "ebaysoa.properties"; File f=new File( configFile ); if( f.exists()) { Properties props=new Properties(); in = new FileInputStream(f); props.load(in); String factoryClassName = props.getProperty(factoryId); return newInstance(factoryId, factoryClassName, classLoader); } } catch(Exception exception) { //TODO throw exception or go with our impl } finally { CodeGenUtil.closeQuietly(in); } if (defaultImpl == null) { throw new PreProcessFailedException("Provider for " + factoryId + " cannot be found"); } return newInstance(factoryId, defaultImpl, classLoader); }
1767567_1
public static boolean isCollectionType(Class<?> typeClazz) { if (typeClazz == null || typeClazz.isPrimitive()) { return false; } boolean isCollectionType = false; for (Class<?> collectionClazz : s_collectionTypes) { if (collectionClazz.isAssignableFrom(typeClazz)) { isCollectionType = true; break; } } return isCollectionType; }
1767567_2
public static boolean isCollectionType(Class<?> typeClazz) { if (typeClazz == null || typeClazz.isPrimitive()) { return false; } boolean isCollectionType = false; for (Class<?> collectionClazz : s_collectionTypes) { if (collectionClazz.isAssignableFrom(typeClazz)) { isCollectionType = true; break; } } return isCollectionType; }
1767567_3
public static boolean isCollectionType(Class<?> typeClazz) { if (typeClazz == null || typeClazz.isPrimitive()) { return false; } boolean isCollectionType = false; for (Class<?> collectionClazz : s_collectionTypes) { if (collectionClazz.isAssignableFrom(typeClazz)) { isCollectionType = true; break; } } return isCollectionType; }
1767567_4
public static boolean isCollectionType(Class<?> typeClazz) { if (typeClazz == null || typeClazz.isPrimitive()) { return false; } boolean isCollectionType = false; for (Class<?> collectionClazz : s_collectionTypes) { if (collectionClazz.isAssignableFrom(typeClazz)) { isCollectionType = true; break; } } return isCollectionType; }
1767567_5
public static boolean isCollectionType(Class<?> typeClazz) { if (typeClazz == null || typeClazz.isPrimitive()) { return false; } boolean isCollectionType = false; for (Class<?> collectionClazz : s_collectionTypes) { if (collectionClazz.isAssignableFrom(typeClazz)) { isCollectionType = true; break; } } return isCollectionType; }
1767567_6
public static boolean hasCollectionType(Class<?>[] types) { if (types == null || types.length == 0) { return false; } boolean hasCollectionType = false; for (Class<?> typeClazz : types) { if (isCollectionType(typeClazz)) { hasCollectionType = true; break; } } return hasCollectionType; }
1767567_7
public static boolean hasCollectionType(Class<?>[] types) { if (types == null || types.length == 0) { return false; } boolean hasCollectionType = false; for (Class<?> typeClazz : types) { if (isCollectionType(typeClazz)) { hasCollectionType = true; break; } } return hasCollectionType; }
1767567_8
public static boolean hasCollectionType(Class<?>[] types) { if (types == null || types.length == 0) { return false; } boolean hasCollectionType = false; for (Class<?> typeClazz : types) { if (isCollectionType(typeClazz)) { hasCollectionType = true; break; } } return hasCollectionType; }
1767567_9
public static boolean hasAttachmentTypeRef(Class<?> type, Set<String> typeNameSet) { // If Type is already processed or being processed // then don't process it again, which might cause // infinite loop // ex: A class referring itself (Linked list node class) if (type == null || typeNameSet.contains(type.getName())) { return false; } typeNameSet.add(type.getName()); if (type == Void.TYPE || type.isPrimitive()) { return false; } else if (type.isArray()) { return hasAttachmentTypeRef(type.getComponentType(), typeNameSet); } else if (javax.activation.DataHandler.class.isAssignableFrom(type)) { return true; } else if (type.getPackage() != null && type.getPackage().getName().startsWith("java")) { return false; } else { boolean hasAttachmentType = false; Method[] allMethods = type.getMethods(); for (Method method : allMethods) { Type genReturnType = method.getGenericReturnType(); Type[] genParamTypes = method.getGenericParameterTypes(); Type[] methodInOutTypes = new Type[genParamTypes.length + 1]; methodInOutTypes[0] = genReturnType; System.arraycopy(genParamTypes, 0, methodInOutTypes, 1, genParamTypes.length); for (Type inOutType : methodInOutTypes) { if (!isParameterizedType(inOutType) && (inOutType instanceof Class)) { hasAttachmentType = hasAttachmentTypeRef((Class<?>) inOutType, typeNameSet); if (hasAttachmentType) { return true; } } else { List<Class<?>> actualTypes = new ArrayList<Class<?>>(2); actualTypes = getAllActualTypes(inOutType, actualTypes); for (Class<?> typeClass : actualTypes) { hasAttachmentType = hasAttachmentTypeRef(typeClass, typeNameSet); if (hasAttachmentType) { return true; } } } } } // None of the method's Param / Return type is of Attachment type // So, check whether any PUBLIC field is an Attachment type Field[] publicFields = type.getFields(); for (Field field : publicFields) { Type genType = field.getGenericType(); if (!isParameterizedType(genType)) { hasAttachmentType = hasAttachmentTypeRef((Class<?>) genType, typeNameSet); if (hasAttachmentType) { return true; } } else { List<Class<?>> allTypes = new ArrayList<Class<?>>(2); allTypes = getAllActualTypes(field.getGenericType(), allTypes); for (Class<?> typeClass : allTypes) { hasAttachmentType = hasAttachmentTypeRef(typeClass, typeNameSet); if (hasAttachmentType) { return true; } } } } return false; } }
1768217_0
public UserProfile fetchUserProfile(Twitter twitter) { TwitterProfile profile = twitter.userOperations().getUserProfile(); return new UserProfileBuilder().setName(profile.getName()).setUsername(profile.getScreenName()).build(); }
1768217_1
public UserProfile fetchUserProfile(Twitter twitter) { TwitterProfile profile = twitter.userOperations().getUserProfile(); return new UserProfileBuilder().setName(profile.getName()).setUsername(profile.getScreenName()).build(); }
1768217_2
public UserProfile fetchUserProfile(Twitter twitter) { TwitterProfile profile = twitter.userOperations().getUserProfile(); return new UserProfileBuilder().setName(profile.getName()).setUsername(profile.getScreenName()).build(); }
1768217_3
public UserProfile fetchUserProfile(Twitter twitter) { TwitterProfile profile = twitter.userOperations().getUserProfile(); return new UserProfileBuilder().setName(profile.getName()).setUsername(profile.getScreenName()).build(); }
1768217_4
public UserProfile fetchUserProfile(Twitter twitter) { TwitterProfile profile = twitter.userOperations().getUserProfile(); return new UserProfileBuilder().setName(profile.getName()).setUsername(profile.getScreenName()).build(); }
1768217_5
public SearchResults search(String query) { return this.search(new SearchParameters(query)); }
1768217_6
public SearchResults search(String query) { return this.search(new SearchParameters(query)); }
1768217_7
public SearchResults search(String query) { return this.search(new SearchParameters(query)); }
1768217_8
public SearchResults search(String query) { return this.search(new SearchParameters(query)); }
1768217_9
public SearchResults search(String query) { return this.search(new SearchParameters(query)); }
1768307_0
static Map<String, List<Integer>> updateParameterNamesToIndexes(Map<String, List<Integer>> parametersNameToIndex, List<ArrayParameter> arrayParametersSortedAsc) { for(Map.Entry<String, List<Integer>> parameterNameToIndexes : parametersNameToIndex.entrySet()) { List<Integer> newParameterIndex = new ArrayList<>(parameterNameToIndexes.getValue().size()); for(Integer parameterIndex : parameterNameToIndexes.getValue()) { newParameterIndex.add(computeNewIndex(parameterIndex, arrayParametersSortedAsc)); } parameterNameToIndexes.setValue(newParameterIndex); } return parametersNameToIndex; }
1768307_1
static int computeNewIndex(int index, List<ArrayParameter> arrayParametersSortedAsc) { int newIndex = index; for(ArrayParameter arrayParameter : arrayParametersSortedAsc) { if(index > arrayParameter.parameterIndex) { newIndex = newIndex + arrayParameter.parameterCount - 1; } else { return newIndex; } } return newIndex; }
1768307_2
static String updateQueryWithArrayParameters(String parsedQuery, List<ArrayParameter> arrayParametersSortedAsc) { if(arrayParametersSortedAsc.isEmpty()) { return parsedQuery; } StringBuilder sb = new StringBuilder(); Iterator<ArrayParameter> parameterToReplaceIt = arrayParametersSortedAsc.iterator(); ArrayParameter nextParameterToReplace = parameterToReplaceIt.next(); // PreparedStatement index starts at 1 int currentIndex = 1; for(char c : parsedQuery.toCharArray()) { if(nextParameterToReplace != null && c == '?') { if(currentIndex == nextParameterToReplace.parameterIndex) { sb.append("?"); for(int i = 1; i < nextParameterToReplace.parameterCount; i++) { sb.append(",?"); } if(parameterToReplaceIt.hasNext()) { nextParameterToReplace = parameterToReplaceIt.next(); } else { nextParameterToReplace = null; } } else { sb.append(c); } currentIndex++; } else { sb.append(c); } } return sb.toString(); }
1768307_3
@Deprecated public Query createQuery(String query, boolean returnGeneratedKeys) { return new Connection(this, true).createQuery(query, returnGeneratedKeys); }
1768307_4
@Deprecated public Query createQuery(String query, boolean returnGeneratedKeys) { return new Connection(this, true).createQuery(query, returnGeneratedKeys); }
1768307_5
public Connection open(ConnectionSource connectionSource) { return new Connection(this, connectionSource, false); }
1768307_6
@Deprecated public Query createQuery(String query, boolean returnGeneratedKeys) { return new Connection(this, true).createQuery(query, returnGeneratedKeys); }