_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q168600
LoggingOutputStream.checkLine
validation
private void checkLine() { String endStr = new String(buf, count - LINE_SEPERATOR.length(), LINE_SEPERATOR.length(), charset); if (LINE_SEPERATOR.equals(endStr)) { flush(); } }
java
{ "resource": "" }
q168601
EventPoller.initialize
validation
public void initialize(Map<String, List<EventHandler>> eventHandlers, URI uri) { this.eventHandlers = eventHandlers; EventListener listener = new EventListener(uri); executorService.submit(listener); logger.fine("Started event listener"); }
java
{ "resource": "" }
q168602
AbstractJMXStatisticsSender.getMBeanServerConnection
validation
protected MBeanServerConnection getMBeanServerConnection(String childName) { MBeanConnectionInfo connInfo = connections.get(childName); if (connInfo == null) { connInfo = new MBeanConnectionInfo(); connections.put(childName, connInfo); } long childPid = main.getFirstJavaChildPid(childName); if (childPid > 0 && childPid != connInfo.childPid && connInfo.connector != null) { try { connInfo.connector.close(); } catch (IOException e) { logger.log(Level.FINE, "Failed to close JMXConnector", e); } connInfo.connector = null; connInfo.server = null; } if (childPid > 0) { try { if (connInfo.connector == null) { connInfo.connector = DeployerControl.getJMXConnector(childPid); } if (connInfo.connector != null && connInfo.server == null) { connInfo.server = connInfo.connector.getMBeanServerConnection(); connInfo.childPid = childPid; } } catch (IOException e) { logger.log(Level.FINE, "Failed to get JMX connection", e); try { connInfo.connector.close(); } catch (Exception e2) { logger.log(Level.FINE, "Failed to close JMXConnector", e2); } connInfo.connector = null; connInfo.server = null; } } return connInfo.server; }
java
{ "resource": "" }
q168603
AbstractJMXStatisticsSender.closeMBeanServerConnection
validation
protected void closeMBeanServerConnection(String childName) { MBeanConnectionInfo connInfo = connections.get(childName); if (connInfo != null && connInfo.connector != null) { try { connInfo.connector.close(); } catch (IOException e) { logger.log(Level.FINE, "Failed to close JMXConnector", e); } connInfo.connector = null; } }
java
{ "resource": "" }
q168604
FakeSearchView.init
validation
protected void init(Context context) { LayoutInflater.from(context).inflate(R.layout.fake_search_view, this, true); wrappedEditText = (EditText) findViewById(R.id.wrapped_search); wrappedEditText.addTextChangedListener(this); wrappedEditText.setOnEditorActionListener(this); }
java
{ "resource": "" }
q168605
UniversalRunner.main
validation
public static void main(String[] args) throws Throwable { try { Class<?> initialClass; // make it independent - get class name & method from props/manifest initialClass = Thread.currentThread().getContextClassLoader().loadClass("kg.apc.cmdtools.PluginsCMD"); Object instance = initialClass.newInstance(); Method startup = initialClass.getMethod("processParams", (new String[0]).getClass()); Object res = startup.invoke(instance, new Object[]{args}); int rc = (Integer) res; if (rc != 0) { System.exit(rc); } } catch (Throwable e) { if (e.getCause() != null) { System.err.println("ERROR: " + e.getCause().toString()); System.err.println("*** Problem's technical details go below ***"); System.err.println("Home directory was detected as: " + jarDirectory); throw e.getCause(); } else { System.err.println("Home directory was detected as: " + jarDirectory); throw e; } } }
java
{ "resource": "" }
q168606
JacksonSchema.getValidator
validation
private com.github.fge.jsonschema.main.JsonSchema getValidator() throws ProcessingException { if (validator == null) { synchronized (this) { if (validator == null) { ValidationConfigurationBuilder cfgBuilder = ValidationConfiguration.newBuilder(); cfgBuilder.addLibrary("http://brutusin.org/json/json-schema-spec", DraftV3Library.get()); validator = JsonSchemaFactory.newBuilder().setValidationConfiguration(cfgBuilder.freeze()).freeze().getJsonSchema(getNode()); } } } return validator; }
java
{ "resource": "" }
q168607
Table.getFindColumnList
validation
public List<Column> getFindColumnList() { List<Column> findColumnList = new ArrayList<Column>(); List<Column> tempColumnList = new ArrayList<Column>(); for (int i = 1; i <= this.cardinality; i++) { if (this.columns.get(i).referenceTable != null) { tempColumnList = this.columns.get(i).referenceTable.getFindColumnList(); for (int j = 0; j < tempColumnList.size(); j++) { Column column = new Column(); column.name = columns.get(i).name.replace("_ID", "_").replace("_id", "_") + tempColumnList.get(j).name; column.dataType = tempColumnList.get(j).dataType; column.nullable = this.columns.get(i).nullable; findColumnList.add(column); } } else { Column column = new Column(); column.name = columns.get(i).name; column.dataType = columns.get(i).dataType; column.nullable = this.columns.get(i).nullable; findColumnList.add(column); } } return findColumnList; }
java
{ "resource": "" }
q168608
Table.getInsertColumnList
validation
public List<Column> getInsertColumnList() { List<Column> result = new ArrayList<>(); List<Column> tempColumnList = new ArrayList<>(); for (Column currentColumn:this.columns) { if (currentColumn.referenceTable != null) { tempColumnList = currentColumn.referenceTable.getFindColumnList(); for (Column tempColumn : tempColumnList) { Column column = new Column(); column.name = currentColumn.name.replace("_ID", "_").replace("_id", "_") + tempColumn.name; column.dataType = tempColumn.dataType; column.nullable = currentColumn.nullable; result.add(column); } } else { Column column = new Column(); column.name = currentColumn.name; column.dataType = currentColumn.dataType; column.nullable = currentColumn.nullable; result.add(column); } } return result; }
java
{ "resource": "" }
q168609
ProjectMetaData.getAllPackages
validation
@XmlTransient public List<PackageMetaData> getAllPackages() { List<PackageMetaData> result = new ArrayList<>(); if (packages != null) { for (PackageMetaData pack : packages) { result.addAll(getPackages(pack)); } } return result; }
java
{ "resource": "" }
q168610
SingleFileWriteCommand.getNotOverridableContent
validation
private final String getNotOverridableContent() throws IOException { if (Files.exists(filePath)) { List<String> lines = Files.readAllLines(filePath, fileType.getEncoding()); boolean isNotOverridable = false; StringWriter notOverridableContentWriter = new StringWriter(); for (String line : lines) { if (line.contains(fileType.getSpecificCodeStartMark())) { isNotOverridable = true; } else if (line.contains(fileType.getSpecificCodeEndMark())) { isNotOverridable = false; } else { if (isNotOverridable) { notOverridableContentWriter.append(line + SKIP_LINE); } } } return notOverridableContentWriter.toString(); } return ""; }
java
{ "resource": "" }
q168611
SingleFileWriteCommand.writeNotOverridableContent
validation
protected final void writeNotOverridableContent() throws IOException { String content = getNotOverridableContent(); writeLine(fileType.getSpecificCodeStartMark()); write(content); writeLine(fileType.getSpecificCodeEndMark()); }
java
{ "resource": "" }
q168612
Model.findTable
validation
public Table findTable(String tableName) { if (tableName == null) { return null; } if (tableName.isEmpty()) { return null; } for (Package myPackage : this.packages) { for (Table table : myPackage.tables) { if (table.originalName.equals(tableName)) { return table; } } } throw new TableNotFoundException("Invalid table reference : " + tableName); }
java
{ "resource": "" }
q168613
Model.findBean
validation
public Bean findBean(String tableOriginalName) { for (Package myPackage : this.packages) { for (Bean bean : myPackage.beans) { if (bean.table.originalName.equals(tableOriginalName)) { return bean; } } } throw new BeanNotFoundException("invalid table reference : " + tableOriginalName); }
java
{ "resource": "" }
q168614
JavaViewPropertiesFactory.getReferenceProperties
validation
public List<ViewProperty> getReferenceProperties(Bean bean) { List<ViewProperty> result = new ArrayList<>(); for (int i = 0; i < bean.cardinality; i++) { Property property = bean.properties.get(i); result.addAll(property.viewProperties); } return result; }
java
{ "resource": "" }
q168615
JavaViewPropertiesFactory.getVisibleProperties
validation
private List<ViewProperty> getVisibleProperties(OneToMany oneToMany) { return getViewPropertiesExcludingField(oneToMany.referenceBean, oneToMany.referenceProperty.name); }
java
{ "resource": "" }
q168616
Versionable.update
validation
public void update(Versionable target, Versionable source) { target.setDirty(source.getDirty()); target.setMajorVersion(source.getMajorVersion()); target.setMidVersion(source.getMidVersion()); target.setMinorVersion(source.getMinorVersion()); target.setModifierId(source.getModifierId()); target.setReason(source.getReason()); target.setModificationTime(source.getModificationTime()); target.setHistoryList(source.getHistoryList()); try { target.updateHistory(); } catch (Exception ex) { LOG.log(Level.SEVERE, ex.getLocalizedMessage(), ex); } }
java
{ "resource": "" }
q168617
Versionable.addHistory
validation
public void addHistory(History history) { if (getHistoryList() == null) { setHistoryList(new ArrayList<>()); } getHistoryList().add(history); }
java
{ "resource": "" }
q168618
JPAEclipseLinkSessionCustomizer.customize
validation
@Override public void customize(Session session) throws Exception { JNDIConnector connector; // Initialize session customizer DataSource dataSource; try { Context context = new InitialContext(); if (null == context) { throw new VMException("Context is null"); } connector = (JNDIConnector) session.getLogin().getConnector(); // possible CCE // Lookup this new dataSource dataSource = (DataSource) context.lookup(JNDI_DATASOURCE_NAME); connector.setDataSource(dataSource); // Change from COMPOSITE_NAME_LOOKUP to STRING_LOOKUP // Note: if both jta and non-jta elements exist this will only change the first one - and may still result in the COMPOSITE_NAME_LOOKUP being set // Make sure only jta-data-source is in persistence.xml with no non-jta-data-source property set connector.setLookupType(JNDIConnector.STRING_LOOKUP); // if you are specifying both JTA and non-JTA in your persistence.xml then set both connectors to be safe JNDIConnector writeConnector = (JNDIConnector) session.getLogin().getConnector(); writeConnector.setLookupType(JNDIConnector.STRING_LOOKUP); JNDIConnector readConnector = (JNDIConnector) ((DatabaseLogin) ((ServerSession) session) .getReadConnectionPool().getLogin()).getConnector(); readConnector.setLookupType(JNDIConnector.STRING_LOOKUP); // Set the new connection on the session session.getLogin().setConnector(connector); } catch (Exception e) { LOG.log(Level.SEVERE, JNDI_DATASOURCE_NAME, e); } }
java
{ "resource": "" }
q168619
RequirementSpecServer.addSpecNode
validation
public RequirementSpecNodeServer addSpecNode(String name, String description, String scope) throws Exception { RequirementSpecNodeServer sns = new RequirementSpecNodeServer( new RequirementSpecJpaController( getEntityManagerFactory()) .findRequirementSpec(getRequirementSpecPK()), name, description, scope); sns.write2DB(); getRequirementSpecNodeList().add( new RequirementSpecNodeJpaController( getEntityManagerFactory()) .findRequirementSpecNode(sns.getRequirementSpecNodePK())); write2DB(); return sns; }
java
{ "resource": "" }
q168620
VMIdServer.write2DB
validation
@Override public int write2DB() throws VMException { try { VmIdJpaController controller = new VmIdJpaController( getEntityManagerFactory()); VmId vmId; if (getId() == null) { vmId = new VmId(); update(vmId, this); controller.create(vmId); setId(vmId.getId()); } else { vmId = getEntity(); update(vmId, this); controller.edit(vmId); } update(); return getId(); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); throw new VMException(ex); } }
java
{ "resource": "" }
q168621
IssueTypeServer.getType
validation
public static IssueType getType(String typename) { IssueType result = null; for (IssueType type : new IssueTypeJpaController(DataBaseManager .getEntityManagerFactory()).findIssueTypeEntities()) { if (type.getTypeName().equals(typename)) { result = type; break; } } return result; }
java
{ "resource": "" }
q168622
VMSettingServer.getSetting
validation
@SuppressWarnings("unchecked") public static VmSetting getSetting(String s) { PARAMETERS.clear(); PARAMETERS.put("setting", s); result = namedQuery("VmSetting.findBySetting", PARAMETERS); if (result.isEmpty()) { return null; } else { return (VmSetting) result.get(0); } }
java
{ "resource": "" }
q168623
DataEntryServer.getStringField
validation
public static DataEntry getStringField(String name, String expected, boolean matchCase) { DataEntry de = new DataEntry(); DataEntryType det = DataEntryTypeServer.getType("type.string.name"); de.setEntryName(name); de.setDataEntryPropertyList(getDefaultProperties(det)); de.setDataEntryType(det); if (expected != null) { getProperty(de, "property.expected.result") .setPropertyValue(expected); getProperty(de, "property.match.case") .setPropertyValue(matchCase ? "true" : "false"); } return de; }
java
{ "resource": "" }
q168624
DataEntryServer.getBooleanField
validation
public static DataEntry getBooleanField(String name) { DataEntry de = new DataEntry(); de.setEntryName(name); DataEntryType det = DataEntryTypeServer.getType("type.boolean.name"); de.setDataEntryPropertyList(getDefaultProperties(det)); de.setDataEntryType(det); return de; }
java
{ "resource": "" }
q168625
DataEntryServer.getNumericField
validation
public static DataEntry getNumericField(String name, Float min, Float max) { DataEntry de = new DataEntry(); de.setEntryName(name); DataEntryType det = DataEntryTypeServer.getType("type.numeric.name"); de.setDataEntryPropertyList(getDefaultProperties(det)); de.setDataEntryType(det); for (DataEntryProperty dep : de.getDataEntryPropertyList()) { if (dep.getPropertyName().equals("property.min") && min != null) { //Set minimum dep.setPropertyValue(min.toString()); } if (dep.getPropertyName().equals("property.max") && max != null) { //Set minimum dep.setPropertyValue(max.toString()); } } return de; }
java
{ "resource": "" }
q168626
WorkflowViewer.displayWorkflow
validation
private void displayWorkflow(Workflow w) { Graph graph = new Graph(w.getWorkflowName(), Graph.DIGRAPH); nodes.clear(); //Create the nodes w.getWorkflowStepList().forEach(step -> { addStep(step, graph); //Now add the links step.getSourceTransitions().forEach(t -> { addStep(t.getWorkflowStepSource(), graph); addStep(t.getWorkflowStepTarget(), graph); Subgraph.Edge edge = graph.addEdge(nodes.get(t.getWorkflowStepSource() .getWorkflowStepPK().getId()), nodes.get(t.getWorkflowStepTarget() .getWorkflowStepPK().getId())); edge.setParam("label", TRANSLATOR.translate(t.getTransitionName())); //Workaround https://github.com/pontusbostrom/VaadinGraphvizComponent/issues/9 edge.setDest(nodes.get(t.getWorkflowStepTarget() .getWorkflowStepPK().getId())); edges.put(TRANSLATOR.translate(t.getTransitionName()), new AbstractMap.SimpleEntry<>( nodes.get(t.getWorkflowStepSource() .getWorkflowStepPK().getId()), edge)); }); }); diagram.drawGraph(graph); }
java
{ "resource": "" }
q168627
WorkflowViewer.refreshWorkflow
validation
private void refreshWorkflow() { Graph graph = new Graph(((Workflow) workflows.getValue()) .getWorkflowName(), Graph.DIGRAPH); nodes.values().forEach(node -> { graph.addNode(node); }); edges.values().forEach(edge -> { graph.addEdge(edge.getKey(), edge.getValue().getDest()); }); diagram.drawGraph(graph); selected = null; updateControls(); }
java
{ "resource": "" }
q168628
VaadinUtils.walkComponentTree
validation
private static void walkComponentTree(Component c, Consumer<Component> visitor) { visitor.accept(c); if (c instanceof HasComponents) { for (Component child : ((HasComponents) c)) { walkComponentTree(child, visitor); } } }
java
{ "resource": "" }
q168629
FileUploader.receiveUpload
validation
@Override public OutputStream receiveUpload(String filename, String MIMEType) { FileOutputStream fos; // Output stream to write to try { file = File.createTempFile("upload", filename.substring(filename.lastIndexOf('.'))); // Open the file for writing. fos = new FileOutputStream(getFile()); } catch (FileNotFoundException ex) { // Error while opening the file. Not reported here. LOG.log(Level.SEVERE, null, ex); return null; } catch (IOException ex) { // Error while opening the file. Not reported here. LOG.log(Level.SEVERE, null, ex); return null; } return fos; // Return the output stream to write to }
java
{ "resource": "" }
q168630
PersonDetails.getAddressRisk
validation
@Nullable public ResultStrength getAddressRisk() { if (addressRisk == null) { return null; } return ResultStrength.toEnum(addressRisk.toLowerCase()); }
java
{ "resource": "" }
q168631
AbstractFileResolver.toFileDescriptor
validation
@Deprecated protected <D extends FileDescriptor> D toFileDescriptor(Descriptor descriptor, Class<D> type, String path, ScannerContext context) { if (descriptor == null) { D result = context.getStore().create(type); result.setFileName(path); return result; } return migrateOrCast(descriptor, type, context); }
java
{ "resource": "" }
q168632
BlockscoreError.getBlockscoreError
validation
@Nullable public static BlockscoreError getBlockscoreError(@NotNull final RetrofitError cause) { Object rawError = cause.getBodyAs(BlockscoreError.class); if (rawError instanceof BlockscoreError) { return (BlockscoreError) rawError; } else { return null; } }
java
{ "resource": "" }
q168633
QuestionSet.score
validation
@NotNull public void score(@NotNull final AnswerSet answers) { QuestionSet scoredSet = restAdapter.scoreQuestionSet(getId(), answers); expired = scoredSet.isExpired(); score = scoredSet.getScore(); }
java
{ "resource": "" }
q168634
MD5DigestDelegate.digest
validation
public <D extends MD5Descriptor> D digest(InputStream stream, DigestOperation<D> digestOperation) throws IOException { DigestInputStream digestInputStream = new DigestInputStream(stream, md5Digest); D md5Descriptor = digestOperation.execute(digestInputStream); String md5 = DatatypeConverter.printHexBinary(md5Digest.digest()); md5Descriptor.setMd5(md5); return md5Descriptor; }
java
{ "resource": "" }
q168635
FilePatternMatcher.accepts
validation
public boolean accepts(String path) { boolean result; if (includeFilePatterns != null) { result = matches(path, includeFilePatterns); } else { result = true; } if (excludeFilePatterns != null) { result = result && !matches(path, excludeFilePatterns); } return result; }
java
{ "resource": "" }
q168636
AnswerSet.addAnswer
validation
public void addAnswer(int questionId, int answerId) { QuestionAnswerPair answerPair = new QuestionAnswerPair(questionId, answerId); answers.add(answerPair); }
java
{ "resource": "" }
q168637
WatchlistHit.getMatchingInfo
validation
@NotNull public String[] getMatchingInfo() { if (matchingInfo == null) { return new String[0]; } return Arrays.copyOf(matchingInfo, matchingInfo.length); }
java
{ "resource": "" }
q168638
WatchlistHit.getAddress
validation
@Nullable public Address getAddress() { return new Address(addressStreet1, addressStreet2, addressCity, addressState, addressPostalCode, addressCountryCode); }
java
{ "resource": "" }
q168639
Person.createQuestionSet
validation
public QuestionSet createQuestionSet(long timeLimit) { Map<String, String> queryOptions = new HashMap<String, String>(); queryOptions.put("person_id", getId()); queryOptions.put("time_limit", String.valueOf(timeLimit)); QuestionSet questionSet = restAdapter.createQuestionSet(queryOptions); questionSet.setAdapter(restAdapter); return questionSet; }
java
{ "resource": "" }
q168640
Person.retrieveQuestionSet
validation
public QuestionSet retrieveQuestionSet(@NotNull final String questionSetId) { QuestionSet questionSet = restAdapter.retrieveQuestionSet(questionSetId); questionSet.setAdapter(restAdapter); return questionSet; }
java
{ "resource": "" }
q168641
Person.getDateOfBirth
validation
@NotNull public Date getDateOfBirth() { GregorianCalendar calendar = new GregorianCalendar(birthYear, birthMonth, birthDay); return calendar.getTime(); }
java
{ "resource": "" }
q168642
Person.getAddress
validation
@NotNull public Address getAddress() { Address addressObject = new Address(addressStreet1, addressStreet2, addressCity, addressSubdivision, addressPostalCode, addressCountryCode); return addressObject; }
java
{ "resource": "" }
q168643
Company.getIncorporationDate
validation
@Nullable public Date getIncorporationDate() { if (incorporationDay == null || incorporationMonth == null || incorporationYear == null) { return null; } GregorianCalendar calendarDay = new GregorianCalendar(incorporationYear, incorporationMonth, incorporationDay); return calendarDay.getTime(); }
java
{ "resource": "" }
q168644
Candidate.getRevisionHistory
validation
public List<Candidate> getRevisionHistory() { List<Candidate> candidates = restAdapter.getCandidateHistory(getId()); for (Candidate candidate : candidates) { candidate.setAdapter(restAdapter); } return Collections.unmodifiableList(candidates); }
java
{ "resource": "" }
q168645
Candidate.searchWatchlists
validation
public PaginatedResult<WatchlistHit> searchWatchlists(EntityType entityType, Double similarityThreshold) { Map<String, String> queryOptions = new HashMap<String, String>(); queryOptions.put("candidate_id", getId()); if (entityType != null) { queryOptions.put("match_type", String.valueOf(entityType)); } if (similarityThreshold != null) { queryOptions.put("similarity_threshold", String.valueOf(similarityThreshold)); } WatchlistSearchResults results = restAdapter.searchWatchlists(queryOptions); //wrap the result's data with PaginatedResult to make v5.0 transition simpler return new PaginatedResult<WatchlistHit>(results.getMatches(), results.getCount(), false); }
java
{ "resource": "" }
q168646
Candidate.setDateOfBirth
validation
@NotNull public Candidate setDateOfBirth(@Nullable final Date dateOfBirth) { if (dateOfBirth == null) { this.dateOfBirth = null; return this; } this.dateOfBirth = new Date(dateOfBirth.getTime()); return this; }
java
{ "resource": "" }
q168647
Candidate.setAddress
validation
public Candidate setAddress(@NotNull final Address address) { this.addressStreet1 = address.getStreet1(); this.addressStreet2 = address.getStreet2(); this.addressCity = address.getCity(); this.addressSubdivision = address.getSubdivision(); this.addressPostalCode = address.getPostalCode(); this.addressCountryCode = address.getCountryCode(); return this; }
java
{ "resource": "" }
q168648
BlockscoreApiClient.retrievePerson
validation
@NotNull public Person retrievePerson(@NotNull final String id) { Person person = restAdapter.retrievePerson(id); person.setAdapter(restAdapter); return person; }
java
{ "resource": "" }
q168649
BlockscoreApiClient.retrieveCandidate
validation
@NotNull public Candidate retrieveCandidate(@NotNull final String id) { Candidate candidate = restAdapter.retrieveCandidate(id); candidate.setAdapter(restAdapter); return candidate; }
java
{ "resource": "" }
q168650
BlockscoreApiClient.getEncodedAuthorization
validation
@NotNull private String getEncodedAuthorization() { try { return "Basic " + DatatypeConverter.printBase64Binary(apiKey.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
java
{ "resource": "" }
q168651
BirthRange.getDateOfBirthEnd
validation
@Nullable public Date getDateOfBirthEnd() { if (birthDayEnd == null || birthMonthEnd == null || birthYearEnd == null) { return null; } GregorianCalendar calendar = new GregorianCalendar(birthYearEnd, birthMonthEnd, birthDayEnd); return calendar.getTime(); }
java
{ "resource": "" }
q168652
AbstractScannerPlugin.getTypeParameter
validation
protected <T> Class<T> getTypeParameter(Class<?> expectedSuperClass, int genericTypeParameterIndex) { Class<? extends AbstractScannerPlugin> thisClass = this.getClass(); if (!thisClass.getSuperclass().equals(expectedSuperClass)) { throw new IllegalStateException("Cannot determine type argument of " + thisClass.getName()); } Type genericSuperclass = thisClass.getGenericSuperclass(); Type typeParameter = ((ParameterizedType) genericSuperclass).getActualTypeArguments()[genericTypeParameterIndex]; if (typeParameter instanceof ParameterizedType) { return (Class<T>) ((ParameterizedType) typeParameter).getRawType(); } return (Class<T>) typeParameter; }
java
{ "resource": "" }
q168653
AbstractScannerPlugin.getStringProperty
validation
protected String getStringProperty(String name, String defaultValue) { Object value = properties.get(name); return value != null ? value.toString() : defaultValue; }
java
{ "resource": "" }
q168654
AbstractScannerPlugin.getBooleanProperty
validation
protected Boolean getBooleanProperty(String name, Boolean defaultValue) { Object value = properties.get(name); return value != null ? Boolean.valueOf(value.toString()) : defaultValue; }
java
{ "resource": "" }
q168655
AbstractScannerPlugin.getDirectoryPath
validation
protected String getDirectoryPath(File directory, File entry) { String relativePath; if (entry.equals(directory)) { relativePath = "/"; } else { String filePath = entry.getAbsolutePath(); String directoryPath = directory.getAbsolutePath(); relativePath = filePath.substring(directoryPath.length()).replace(File.separator, "/"); } return relativePath; }
java
{ "resource": "" }
q168656
RequestError.getErrorType
validation
@NotNull public BlockscoreErrorType getErrorType() { if (type == null) { return BlockscoreErrorType.UNKNOWN; } else { return BlockscoreErrorType.toEnum(type); } }
java
{ "resource": "" }
q168657
RequestError.getValidationErrorCode
validation
@NotNull public ValidationErrorType getValidationErrorCode() { if (code == null) { return ValidationErrorType.UNKNOWN; } else { return ValidationErrorType.toEnum(code); } }
java
{ "resource": "" }
q168658
ContainerFileResolver.flush
validation
public void flush() { createHierarchy(); sync(fileContainerDescriptor.getRequires(), requiredFiles); sync(fileContainerDescriptor.getContains(), containedFiles); }
java
{ "resource": "" }
q168659
ContainerFileResolver.sync
validation
private void sync(Collection<FileDescriptor> target, Map<String, FileDescriptor> after) { Map<String, FileDescriptor> before = getCache(target); Map<String, FileDescriptor> all = new HashMap<>(); all.putAll(before); all.putAll(after); for (Map.Entry<String, FileDescriptor> entry : all.entrySet()) { String key = entry.getKey(); FileDescriptor fileDescriptor = entry.getValue(); boolean hasBefore = before.containsKey(key); boolean hasAfter = after.containsKey(key); if (hasBefore && !hasAfter) { target.remove(fileDescriptor); } else if (!hasBefore && hasAfter) { target.add(fileDescriptor); } } }
java
{ "resource": "" }
q168660
ContainerFileResolver.getCache
validation
private Map<String, FileDescriptor> getCache(Iterable<FileDescriptor> fileDescriptors) { Map<String, FileDescriptor> cache = new HashMap<>(); for (FileDescriptor fileDescriptor : fileDescriptors) { cache.put(fileDescriptor.getFileName(), fileDescriptor); } return cache; }
java
{ "resource": "" }
q168661
ContainerFileResolver.createHierarchy
validation
private void createHierarchy() { for (Map.Entry<String, FileDescriptor> entry : containedFiles.entrySet()) { String relativePath = entry.getKey(); FileDescriptor fileDescriptor = entry.getValue(); int separatorIndex = relativePath.lastIndexOf('/'); if (separatorIndex != -1) { String parentName = relativePath.substring(0, separatorIndex); FileDescriptor parentDescriptor = containedFiles.get(parentName); if (parentDescriptor instanceof FileContainerDescriptor) { ((FileContainerDescriptor) parentDescriptor).getContains().add(fileDescriptor); } } } }
java
{ "resource": "" }
q168662
NetworkUtil.findUnusedPort
validation
public static int findUnusedPort() throws IOException { int port; try (ServerSocket socket = new ServerSocket()) { socket.bind(new InetSocketAddress(0)); port = socket.getLocalPort(); } return port; }
java
{ "resource": "" }
q168663
EFapsRequestParametersAdapter.getParameterValue
validation
@Override public StringValue getParameterValue(final String _name) { final List<StringValue> values = this.parameters.get(_name); return (values != null && !values.isEmpty()) ? values.get(0) : StringValue.valueOf((String) null); }
java
{ "resource": "" }
q168664
EFapsRequestParametersAdapter.setParameterValues
validation
@Override public void setParameterValues(final String _name, final List<StringValue> _value) { this.parameters.put(_name, _value); try { Context.getThreadContext().getParameters().put(_name, ParameterUtil.stringValues2Array(_value)); } catch (final EFapsException e) { EFapsRequestParametersAdapter.LOG.error("Could not set parameter '{}' in Context.", _name); } }
java
{ "resource": "" }
q168665
EFapsRequestParametersAdapter.setParameterValue
validation
public void setParameterValue(final String _key, final String _value) { final List<StringValue> list = new ArrayList<StringValue>(1); list.add(StringValue.valueOf(_value)); setParameterValues(_key, list); }
java
{ "resource": "" }
q168666
EFapsRequestParametersAdapter.addParameterValue
validation
public void addParameterValue(final String _key, final String _value) { List<StringValue> list = this.parameters.get(_key); if (list == null) { list = new ArrayList<StringValue>(1); this.parameters.put(_key, list); } list.add(StringValue.valueOf(_value)); try { Context.getThreadContext().getParameters().put(_key, ParameterUtil.stringValues2Array(list)); } catch (final EFapsException e) { EFapsRequestParametersAdapter.LOG.error("Could not add parameter '{}' in Context.", _key); } }
java
{ "resource": "" }
q168667
AbstractUIPageObject.getTargetCmd
validation
public AbstractCommand getTargetCmd() throws CacheReloadException { AbstractCommand cmd = Command.get(this.targetCmdUUID); if (cmd == null) { cmd = Menu.get(this.targetCmdUUID); } return cmd; }
java
{ "resource": "" }
q168668
AbstractUIPageObject.getValue4Wizard
validation
protected Object getValue4Wizard(final String _key) { Object ret = null; final Map<String, String[]> para = this.wizard.getParameters((IWizardElement) this); if (para != null && para.containsKey(_key)) { final String[] value = para.get(_key); ret = value[0]; } return ret; }
java
{ "resource": "" }
q168669
AbstractUIPageObject.registerOID
validation
public String registerOID(final String _oid) { final String ret = RandomUtil.randomAlphanumeric(8); getUiID2Oid().put(ret, _oid); return ret; }
java
{ "resource": "" }
q168670
StructurBrowserTreeTable.newNodeComponent
validation
@Override public Component newNodeComponent(final String _wicketId, final IModel<UIStructurBrowser> _model) { return new Node<UIStructurBrowser>(_wicketId, this, _model) { private static final long serialVersionUID = 1L; @Override protected Component createContent(final String _wicketId, final IModel<UIStructurBrowser> _model) { return newContentComponent(_wicketId, _model); } @Override protected MarkupContainer createJunctionComponent(final String _id) { final UIStructurBrowser strucBrws = (UIStructurBrowser) getDefaultModelObject(); final MarkupContainer ret; if (strucBrws.hasChildren() && strucBrws.isForceExpanded()) { ret = new WebMarkupContainer(_id); } else { ret = super.createJunctionComponent(_id); } if (strucBrws.getLevel() > 0) { ret.add(AttributeModifier.append("style", "margin-left:" + 15 * (strucBrws.getLevel() - 1) + "px")); } return ret; } }; }
java
{ "resource": "" }
q168671
StructurBrowserTreeTable.newSubtree
validation
@Override public Component newSubtree(final String _wicketId, final IModel<UIStructurBrowser> _model) { return new SubElement(_wicketId, this, _model); }
java
{ "resource": "" }
q168672
IndexFlavor.complementOf
validation
public static Set<IndexFlavor> complementOf(final Set<IndexFlavor> indexFlavors) { final Set<IndexFlavor> set = allOf(); set.removeAll(indexFlavors); return set; }
java
{ "resource": "" }
q168673
IndexFlavor.of
validation
public static Set<IndexFlavor> of(final IndexFlavor first, final IndexFlavor... rest) { final Set<IndexFlavor> set = new HashSet<>(); set.add(first); set.addAll(Arrays.asList(rest)); return set; }
java
{ "resource": "" }
q168674
MultiMap.put
validation
@Override public V put(final K key, final V value) { entries.add(new Entry(key, value)); return value; }
java
{ "resource": "" }
q168675
MultiMap.remove
validation
@Override public V remove(final Object key) { final Iterator<Map.Entry<K, V>> iterator = entries.iterator(); V lastValue = null; while (iterator.hasNext()) { final Map.Entry<K, V> entry = iterator.next(); lastValue = entry.getValue(); if (key.equals(entry.getKey())) { iterator.remove(); } } return lastValue; }
java
{ "resource": "" }
q168676
AbstractUI.getRandom4ID
validation
public String getRandom4ID(final Long _id) { final String rid = RandomUtil.randomAlphanumeric(8); this.random2id.put(rid, _id); return rid; }
java
{ "resource": "" }
q168677
AbstractUIHeaderObject.getUserWidths
validation
protected List<Integer> getUserWidths() { List<Integer> ret = null; try { if (Context.getThreadContext().containsUserAttribute( getCacheKey(UITable.UserCacheKey.COLUMNWIDTH))) { setUserWidth(true); final String widths = Context.getThreadContext().getUserAttribute( getCacheKey(UITable.UserCacheKey.COLUMNWIDTH)); final StringTokenizer tokens = new StringTokenizer(widths, ";"); ret = new ArrayList<>(); while (tokens.hasMoreTokens()) { final String token = tokens.nextToken(); for (int i = 0; i < token.length(); i++) { if (!Character.isDigit(token.charAt(i))) { final int width = Integer.parseInt(token.substring(0, i)); ret.add(width); break; } } } } } catch (final NumberFormatException e) { // we don't throw an error because this are only Usersettings AbstractUIHeaderObject.LOG.error("error during the retrieve of UserAttributes in getUserWidths()", e); } catch (final EFapsException e) { // we don't throw an error because this are only Usersettings AbstractUIHeaderObject.LOG.error("error during the retrieve of UserAttributes in getUserWidths()", e); } return ret; }
java
{ "resource": "" }
q168678
AbstractUIHeaderObject.setSortDirection
validation
public void setSortDirection(final SortDirection _sortdirection) { this.sortDirection = _sortdirection; try { Context.getThreadContext().setUserAttribute(getCacheKey(UserCacheKey.SORTDIRECTION), _sortdirection.getValue()); } catch (final EFapsException e) { // we don't throw an error because this are only Usersettings AbstractUIHeaderObject.LOG.error("error during the retrieve of UserAttributes", e); } }
java
{ "resource": "" }
q168679
AbstractUIHeaderObject.setColumnOrder
validation
public void setColumnOrder(final String _markupsIds) { final StringTokenizer tokens = new StringTokenizer(_markupsIds, ";"); final StringBuilder columnOrder = new StringBuilder(); while (tokens.hasMoreTokens()) { final String markupId = tokens.nextToken(); for (final UITableHeader header : getHeaders()) { if (markupId.equals(header.getMarkupId())) { columnOrder.append(header.getFieldName()).append(";"); break; } } } try { Context.getThreadContext().setUserAttribute(getCacheKey(UITable.UserCacheKey.COLUMNORDER), columnOrder.toString()); } catch (final EFapsException e) { // we don't throw an error because this are only Usersettings AbstractUIHeaderObject.LOG.error("error during the setting of UserAttributes", e); } }
java
{ "resource": "" }
q168680
AbstractUIHeaderObject.getUserSortedColumns
validation
protected List<Field> getUserSortedColumns() { List<Field> ret = new ArrayList<>(); try { final List<Field> fields = getTable().getFields(); if (Context.getThreadContext().containsUserAttribute( getCacheKey(UITable.UserCacheKey.COLUMNORDER))) { final String columnOrder = Context.getThreadContext().getUserAttribute( getCacheKey(UITable.UserCacheKey.COLUMNORDER)); final StringTokenizer tokens = new StringTokenizer(columnOrder, ";"); while (tokens.hasMoreTokens()) { final String fieldname = tokens.nextToken(); for (int i = 0; i < fields.size(); i++) { if (fieldname.equals(fields.get(i).getName())) { ret.add(fields.get(i)); fields.remove(i); } } } if (!fields.isEmpty()) { for (final Field field : fields) { ret.add(field); } } } else { ret = fields; } } catch (final EFapsException e) { AbstractUIHeaderObject.LOG.debug("Error on sorting columns"); } return ret; }
java
{ "resource": "" }
q168681
SortHeaderColumnLink.onComponentTag
validation
@Override protected void onComponentTag(final ComponentTag _tag) { super.onComponentTag(_tag); final UIStructurBrowser structurBrowser = (UIStructurBrowser) getDefaultModelObject(); if (structurBrowser.getSortDirection().equals(SortDirection.ASCENDING)) { _tag.put("class", "sortLabelAsc"); } else { _tag.put("class", "sortLabelDsc"); } }
java
{ "resource": "" }
q168682
SortHeaderColumnLink.onComponentTagBody
validation
@Override public void onComponentTagBody(final MarkupStream _markupStream, final ComponentTag _openTag) { replaceComponentTagBody(_markupStream, _openTag, this.header); }
java
{ "resource": "" }
q168683
SortHeaderColumnLink.onClick
validation
@Override public void onClick() { final UIStructurBrowser structurBrowser = (UIStructurBrowser) getDefaultModelObject(); // toggle sort direction if (structurBrowser.getSortDirection() == SortDirection.NONE || structurBrowser.getSortDirection() == SortDirection.DESCENDING) { structurBrowser.setSortDirection(SortDirection.ASCENDING); } else { structurBrowser.setSortDirection(SortDirection.DESCENDING); } structurBrowser.sort(); try { final Page page; if (structurBrowser instanceof UIFieldStructurBrowser) { page = new FormPage(Model.of((UIForm) getPage().getDefaultModelObject())); } else { page = new StructurBrowserPage(Model.of(structurBrowser)); } getRequestCycle().setResponsePage(page); } catch (final EFapsException e) { getRequestCycle().setResponsePage(new ErrorPage(e)); } }
java
{ "resource": "" }
q168684
ConfigFactory.getConfig
validation
public static Config getConfig(String name, IConfigFactory factory) { if (configs == null) { init(); } if (name == null) { name = DEFAULT_CONFIG_NAME; } Config got = configs.get(name); if (got == null) { log(true, "No Config instance named " + name + "... requesting a new one", null); // recheck in synchronized block to avoid double instantiation // will block concurrent calls to this Config until // the initialization is complete synchronized (name.intern()) { got = configs.get(name); if (got == null) { got = factory == null ? load(name) : factory.createConfig(name); if (got == null) { log(false, "Factory " + factory + " returned a null Config", null); throw new InvalidConfigException( "Invalid Config returned by " + factory + " factory: null"); } configs.put(name, got); } } } return got; }
java
{ "resource": "" }
q168685
EFapsResourceAggregator.renderEFapsHeaderItems
validation
private void renderEFapsHeaderItems() { Collections.sort(this.eFapsHeaderItems, (_item0, _item1) -> _item0.getSortWeight().compareTo(_item1.getSortWeight())); final List<String> css = new ArrayList<>(); final List<String> js = new ArrayList<>(); for (final AbstractEFapsHeaderItem item : this.eFapsHeaderItems) { if (item instanceof EFapsJavaScriptHeaderItem) { js.add(item.getReference().getName()); } else { css.add(item.getReference().getName()); } } try { if (!css.isEmpty()) { final String key = BundleMaker.getBundleKey(css, TempFileBundle.class); final TempFileBundle bundle = (TempFileBundle) BundleMaker.getBundle(key); bundle.setContentType("text/css"); super.render(CssHeaderItem.forUrl(EFapsApplication.get().getServletContext() .getContextPath() + "/servlet/static/" + key)); } if (!js.isEmpty()) { final String key = BundleMaker.getBundleKey(js, TempFileBundle.class); final TempFileBundle bundle = (TempFileBundle) BundleMaker.getBundle(key); bundle.setContentType("text/javascript"); super.render(JavaScriptHeaderItem.forUrl(EFapsApplication.get().getServletContext() .getContextPath() + "/servlet/static/" + key)); } } catch (final EFapsException e) { EFapsResourceAggregator.LOG.error("Error on rendering eFaps Header items: ", e); } }
java
{ "resource": "" }
q168686
EFapsResourceAggregator.renderCombinedRequireScripts
validation
private void renderCombinedRequireScripts() { final Set<DojoClass> dojoClasses = this.requireHeaderItems.stream().flatMap(o -> o.getDojoClasses().stream()) .collect(Collectors.toSet()); if (CollectionUtils.isNotEmpty(dojoClasses)) { super.render(new HeaderItem() { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public Iterable<?> getRenderTokens() { return dojoClasses; } @Override public void render(final Response _response) { JavaScriptUtils.writeJavaScript(_response, DojoWrapper.require(null, dojoClasses.toArray(new DojoClass[dojoClasses.size()])), RequireHeaderItem.class.getName()); } }); } }
java
{ "resource": "" }
q168687
ClassificationFilter.getCreateTreeNodeScript
validation
protected CharSequence getCreateTreeNodeScript() { final StringBuilder js = new StringBuilder(); js.append("function(args) {\n") .append("var tn = new dijit._TreeNode(args);\n") .append("tn.labelNode.innerHTML = args.label;\n") .append("var cb = new CheckBox({\n") .append("name: '").append(INPUTNAME).append("',\n") .append("value: args.item.id,\n") .append("checked: args.item.selected,\n") .append("onChange: function(b){\n") .append("this.focusNode.checked=this.checked;\n") .append("\n") .append("}\n") .append("});\n") .append("cb.placeAt(tn.labelNode, 'first');\n") .append("tn.cb = cb;\n") .append("return tn;\n") .append("}\n"); return js; }
java
{ "resource": "" }
q168688
ClassificationFilter.getDataLine
validation
protected CharSequence getDataLine(final Classification _clazz, final IClassificationFilter _filter) throws EFapsException { final StringBuilder js = new StringBuilder(); if (_clazz.hasAccess(null, AccessTypeEnums.SHOW.getAccessType())) { js.append(",\n{id:'").append(_clazz.getUUID()).append("', name:'") .append(StringEscapeUtils.escapeEcmaScript(_clazz.getLabel())).append("', parent:'") .append(_clazz.isRoot() ? "root" : _clazz.getParentClassification().getUUID()).append("', selected:") .append(_filter.contains(_clazz.getUUID())).append("}"); for (final Classification childClazz: _clazz.getChildClassifications()) { js.append(getDataLine(childClazz, _filter)); } } return js; }
java
{ "resource": "" }
q168689
UIClassification.execute
validation
public void execute(final Instance _instance) throws EFapsException { UIClassification clazz = this; while (!clazz.isRoot()) { clazz = clazz.getParent(); } clazz.initialized = true; for (final UIClassification child : clazz.getChildren()) { final Classification type = (Classification) Type.get(child.getClassificationUUID()); if (clazz.selectedUUID.contains(child.getClassificationUUID())) { child.setSelected(true); } child.addChildren(child, type.getChildClassifications(), clazz.selectedUUID, _instance); clazz.expand(); } }
java
{ "resource": "" }
q168690
UIClassification.expand
validation
@SuppressWarnings("unchecked") private void expand() { try { final String key = getCacheKey(); if (Context.getThreadContext().containsSessionAttribute(key)) { final Set<UUID> sessMap = (Set<UUID>) Context .getThreadContext().getSessionAttribute(key); setExpandedInternal(sessMap.contains(this.classificationUUID)); for (final UIClassification uiClazz : getDescendants()) { if (sessMap.contains(uiClazz.classificationUUID)) { uiClazz.setExpandedInternal(true); } } } } catch (final EFapsException e) { UIClassification.LOG.error("Error reading Session info for UICLassificagtion called by Filed with ID: {}", this.fieldId, e); } }
java
{ "resource": "" }
q168691
UIClassification.addChildren
validation
private void addChildren(final UIClassification _parent, final Set<Classification> _children, final Set<UUID> _selectedUUID, final Instance _instance) throws EFapsException { for (final Classification child : _children) { boolean access; if (!child.isAbstract()) { final Instance inst = AbstractInstanceObject.getInstance4Create(child); access = child.hasAccess(inst, getMode() == TargetMode.CREATE || getMode() == TargetMode.EDIT ? AccessTypeEnums.CREATE.getAccessType() : AccessTypeEnums.SHOW.getAccessType()); } else { access = true; } if (access) { final UIClassification childUI = new UIClassification(child.getUUID(), _parent.mode, false); if (_selectedUUID.contains(child.getUUID())) { childUI.selected = true; } childUI.addChildren(childUI, child.getChildClassifications(), _selectedUUID, _instance); _parent.children.add(childUI); childUI.setParent(_parent); } } Collections.sort(_parent.children, new Comparator<UIClassification>() { @Override public int compare(final UIClassification _class0, final UIClassification _class2) { return _class0.getLabel().compareTo(_class2.getLabel()); } }); }
java
{ "resource": "" }
q168692
UIClassification.getClassInstanceKeys
validation
public Map<UUID, String> getClassInstanceKeys(final Instance _instance) throws EFapsException { final Map<UUID, String> ret = new HashMap<UUID, String>(); UIClassification clazz = this; while (!clazz.isRoot()) { clazz = clazz.getParent(); } Type reltype = null; for (final UIClassification child : clazz.getChildren()) { final Classification classType = (Classification) Type.get(child.getClassificationUUID()); if (!classType.getClassifyRelationType().equals(reltype)) { final QueryBuilder queryBldr = new QueryBuilder(classType.getClassifyRelationType()); queryBldr.addWhereAttrEqValue(classType.getRelLinkAttributeName(), _instance.getId()); final MultiPrintQuery multi = queryBldr.getPrint(); multi.addAttribute(classType.getRelTypeAttributeName()); multi.execute(); while (multi.next()) { final Long typeid = multi.<Long>getAttribute(classType.getRelTypeAttributeName()); final Classification subClassType = (Classification) Type.get(typeid); final QueryBuilder subQueryBldr = new QueryBuilder(subClassType); subQueryBldr.addWhereAttrEqValue(subClassType.getLinkAttributeName(), _instance.getId()); subQueryBldr.addOrderByAttributeAsc("ID"); final InstanceQuery query = subQueryBldr.getQuery(); query.execute(); if (query.next()) { // TODO must return an instanceKey!!! not necessary the // oid final String instanceKey = query.getCurrentValue().getOid(); ret.put(query.getCurrentValue().getType().getUUID(), instanceKey); this.selectedUUID.add(query.getCurrentValue().getType().getUUID()); } } } reltype = classType.getClassifyRelationType(); } return ret; }
java
{ "resource": "" }
q168693
UIClassification.getCacheKey
validation
public String getCacheKey() { String ret = "noKey"; UIClassification clazz = this; while (!clazz.isRoot()) { clazz = clazz.getParent(); } final Field field = Field.get(clazz.getFieldId()); if (field != null) { try { ret = field.getCollection().getUUID().toString() + "-" + field.getName() + "-" + UIClassification.USERSESSIONKEY; } catch (final CacheReloadException e) { UIClassification.LOG.error("Cannot generate CacheKey", e); } } return ret; }
java
{ "resource": "" }
q168694
ViewDocumentRequestBuilder.addHighlightExpressions
validation
public ViewDocumentRequestBuilder addHighlightExpressions(final String highlightExpression, final String... highlightExpressions) { this.highlightExpressions.add(highlightExpression); this.highlightExpressions.addAll(Arrays.asList(highlightExpressions)); return this; }
java
{ "resource": "" }
q168695
ViewDocumentRequestBuilder.addStartTags
validation
public ViewDocumentRequestBuilder addStartTags(final String startTag, final String... startTags) { this.startTags.add(startTag); this.startTags.addAll(Arrays.asList(startTags)); return this; }
java
{ "resource": "" }
q168696
ViewDocumentRequestBuilder.addEndTags
validation
public ViewDocumentRequestBuilder addEndTags(final String endTag, final String... endTags) { this.endTags.add(endTag); this.endTags.addAll(Arrays.asList(endTags)); return this; }
java
{ "resource": "" }
q168697
DashboardPanel.getLazyLoadComponent
validation
public Component getLazyLoadComponent(final String _markupId, final String _html) { return new WebMarkupContainer(_markupId) { /** */ private static final long serialVersionUID = 1L; @Override public void onComponentTagBody(final MarkupStream _markupStream, final ComponentTag _openTag) { replaceComponentTagBody(_markupStream, _openTag, _html); } }; }
java
{ "resource": "" }
q168698
DashboardPanel.getLoadingComponent
validation
public Component getLoadingComponent(final String _markupId) { final IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR); return new Label(_markupId, "<img alt=\"Loading...\" src=\"" + RequestCycle.get().urlFor(handler) + "\"/>") .setEscapeModelStrings(false); }
java
{ "resource": "" }
q168699
UpdateParentCallback.onClose
validation
@Override public void onClose(final AjaxRequestTarget _target) { if (this.modalwindow.isUpdateParent()) { final Object object = this.pageReference.getPage().getDefaultModelObject(); try { if (object instanceof AbstractUIObject) { final AbstractUIObject uiObject = (AbstractUIObject) object; if (this.clearmodel) { uiObject.resetModel(); } AbstractContentPage page = null; if (uiObject instanceof UITable) { page = new TablePage(Model.of((UITable) uiObject), ((AbstractContentPage) this.pageReference .getPage()).getModalWindow(), ((AbstractContentPage) this.pageReference .getPage()).getCalledByPageReference()); } else if (uiObject instanceof UIForm) { page = new FormPage(Model.of((UIForm) uiObject), ((AbstractContentPage) this.pageReference .getPage()).getModalWindow(), ((AbstractContentPage) this.pageReference .getPage()).getCalledByPageReference()); } else if (uiObject instanceof UIStructurBrowser) { page = new StructurBrowserPage(Model.of((UIStructurBrowser) uiObject), ((AbstractContentPage) this.pageReference.getPage()).getModalWindow(), ((AbstractContentPage) this.pageReference.getPage()) .getCalledByPageReference()); } RequestCycle.get().setResponsePage(page); } else if (object instanceof UIGrid) { final UIGrid uiGrid = (UIGrid) object; uiGrid.reload(); RequestCycle.get().setResponsePage(new GridPage(Model.of(uiGrid))); } } catch (final EFapsException e) { RequestCycle.get().setResponsePage(new ErrorPage(e)); } } }
java
{ "resource": "" }