method2testcases
stringlengths
118
6.63k
### Question: GraphSONUtility { static Map<String, Object> readProperties(final JsonNode node) { final Map<String, Object> map = new HashMap<>(); final Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); while (iterator.hasNext()) { final Map.Entry<String, JsonNode> entry = iterator.next(); if (!isReservedK...
### Question: GraphSONUtility { public Map<String, Object> vertexFromJson(Graph g, final JsonNode json) { final Map<String, Object> props = readProperties(json); if (props.containsKey(Constants.TYPENAME_PROPERTY_KEY)) { return null; } Map<String, Object> schemaUpdate = null; VertexFeatures vertexFeatures = g.features()...
### Question: FixedBufferList { public List<T> toList() { return this.buffer.subList(0, this.length); } FixedBufferList(Class<T> clazz); FixedBufferList(Class<T> clazz, int incrementCapacityBy); T next(); List<T> toList(); void reset(); }### Answer: @Test public void createdBasedOnInitialSize() { Spying.resetCounters...
### Question: NotificationEntityChangeListener implements EntityChangeListener { @VisibleForTesting public static List<Struct> getAllTraits(Referenceable entityDefinition, AtlasTypeRegistry typeRegistry) throws AtlasException { List<Struct> ret = new ArrayList<>(); for (String traitName : entityDefinition.getTraitNames...
### Question: ActiveInstanceElectorService implements Service, LeaderLatchListener { @Override public void start() throws AtlasException { metricsUtil.onServerStart(); if (!HAConfiguration.isHAEnabled(configuration)) { metricsUtil.onServerActivation(); LOG.info("HA is not enabled, no need to start leader election servi...
### Question: AtlasClassificationType extends AtlasStructType { @Override public AtlasClassification createDefaultValue() { AtlasClassification ret = new AtlasClassification(classificationDef.getName()); populateDefaultValues(ret); return ret; } AtlasClassificationType(AtlasClassificationDef classificationDef); AtlasC...
### Question: ActiveInstanceElectorService implements Service, LeaderLatchListener { @Override public void stop() { if (!HAConfiguration.isHAEnabled(configuration)) { LOG.info("HA is not enabled, no need to stop leader election service"); return; } try { leaderLatch.close(); curatorFactory.close(); } catch (IOException...
### Question: ActiveInstanceElectorService implements Service, LeaderLatchListener { @Override public void isLeader() { LOG.warn("Server instance with server id {} is elected as leader", serverId); serviceState.becomingActive(); try { for (ActiveStateChangeHandler handler : activeStateChangeHandlers) { handler.instance...
### Question: ActiveInstanceElectorService implements Service, LeaderLatchListener { @Override public void notLeader() { LOG.warn("Server instance with server id {} is removed as leader", serverId); serviceState.becomingPassive(); for (int idx = activeStateChangeHandlers.size() - 1; idx >= 0; idx--) { try { activeState...
### Question: ServiceState { public ServiceStateValue getState() { return state; } ServiceState(); ServiceState(Configuration configuration); ServiceStateValue getState(); void becomingActive(); void setActive(); void becomingPassive(); void setPassive(); boolean isInstanceInTransition(); void setMigration(); boolean ...
### Question: ServiceState { public void becomingPassive() { LOG.warn("Instance becoming passive from {}", state); setState(ServiceStateValue.BECOMING_PASSIVE); } ServiceState(); ServiceState(Configuration configuration); ServiceStateValue getState(); void becomingActive(); void setActive(); void becomingPassive(); vo...
### Question: AtlasClassificationType extends AtlasStructType { @Override public boolean isValidValue(Object obj) { if (obj != null) { for (AtlasClassificationType superType : superTypes) { if (!superType.isValidValue(obj)) { return false; } } if (!validateTimeBoundaries(obj, null)) { return false; } return super.isVal...
### Question: AtlasClassificationType extends AtlasStructType { @Override public Object getNormalizedValue(Object obj) { Object ret = null; if (obj != null) { if (isValidValue(obj)) { if (obj instanceof AtlasClassification) { normalizeAttributeValues((AtlasClassification) obj); ret = obj; } else if (obj instanceof Map)...
### Question: AuditFilter implements Filter { boolean isOperationExcludedFromAudit(String requestHttpMethod, String requestOperation, Configuration config) { try { return AtlasRepositoryConfiguration.isExcludedFromAudit(config, requestHttpMethod, requestOperation); } catch (AtlasException e) { return false; } } @Overr...
### Question: AuditFilter implements Filter { public static void audit(AuditLog auditLog) { if (AUDIT_LOG.isInfoEnabled() && auditLog != null) { AUDIT_LOG.info(auditLog.toString()); } } @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain...
### Question: AuditFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { final long startTime = System.currentTimeMillis(); final Date requestTime = new Date(); final HttpServletRequest httpRequest = (H...
### Question: AtlasClassificationType extends AtlasStructType { @Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { for (AtlasClassificationType superType : superTypes) { ret = superType.validateValue(obj, objName, messages) && ret; } ret = ...
### Question: AtlasClassificationType extends AtlasStructType { public static boolean isValidTimeZone(final String timeZone) { final String DEFAULT_GMT_TIMEZONE = "GMT"; if (timeZone.equals(DEFAULT_GMT_TIMEZONE)) { return true; } else { String id = TimeZone.getTimeZone(timeZone).getID(); if (!id.equals(DEFAULT_GMT_TIME...
### Question: AtlasMapType extends AtlasType { @Override public Map<Object, Object> createDefaultValue() { Map<Object, Object> ret = new HashMap<>(); Object key = keyType.createDefaultValue(); if ( key != null) { ret.put(key, valueType.createDefaultValue()); } return ret; } AtlasMapType(AtlasType keyType, AtlasType val...
### Question: ReactiveBus implements Bus { public static ReactiveBus create() { return new ReactiveBus(); } static ReactiveBus create(); @Override void send(final Event object); @Override @SuppressWarnings("unchecked") Flowable<Event> receive(); }### Answer: @Test public void shouldCreateBus() { Bus bus = ReactiveBus...
### Question: Event { public static Event create() { return Event.builder().build(); } protected Event(String id, String name, Serializable data); protected Event(String id, String name); protected Event(Builder builder); protected Event(); static Event create(); static Builder id(final String id); String id(); sta...
### Question: DataSourceController { @RequestMapping(method = RequestMethod.PUT) @ResponseBody public GetDatasourceResponse put(@PathVariable("tenant") String tenantId, @PathVariable("datasource") String dataSourceId, @RequestParam(value = "validate", required = false) Boolean validate, @Valid @RequestBody RestDataSour...
### Question: ImmutableEdge implements Edge<V> { @Override public String toString() { return "ImmutableEdge [source=" + source + ", dest=" + dest + ", id=" + id + "]"; } ImmutableEdge(final V source, final V dest, final int id); static ImmutableEdge<V> construct(final V source, final V dest, final int id); @Overr...
### Question: MersenneTwister extends java.util.Random implements Serializable, Cloneable { public double nextDouble() { return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); } MersenneTwister(); MersenneTwister(long seed); MersenneTwister(int[] array); @Override Object clone(); synchronized boolean stat...
### Question: OntologyTerms { public static <O extends Ontology<?, ?>> void visitChildrenOf(TermId termId, O ontology, TermVisitor<O> termVisitor) { BreadthFirstSearch<TermId, ImmutableEdge<TermId>> bfs = new BreadthFirstSearch<>(); @SuppressWarnings("unchecked") DirectedGraph<TermId, ImmutableEdge<TermId>> graph = (Di...
### Question: OntologyTerms { public static <O extends Ontology<?, ?>> Set<TermId> childrenOf(TermId termId, O ontology) { Set<TermId> result = new HashSet<>(); visitChildrenOf(termId, ontology, new TermVisitor<O>() { @Override public boolean visit(O ontology, TermId termId) { result.add(termId); return true; } }); ret...
### Question: OntologyTerms { public static <O extends Ontology<?, ?>> void visitParentsOf(TermId termId, O ontology, TermVisitor<O> termVisitor) { BreadthFirstSearch<TermId, ImmutableEdge<TermId>> bfs = new BreadthFirstSearch<>(); @SuppressWarnings("unchecked") DirectedGraph<TermId, ImmutableEdge<TermId>> graph = (Dir...
### Question: OntologyTerms { public static <O extends Ontology<?, ?>> Set<TermId> parentsOf(TermId termId, O ontology) { Set<TermId> result = new HashSet<>(); visitParentsOf(termId, ontology, new TermVisitor<O>() { @Override public boolean visit(O ontology, TermId termId) { result.add(termId); return true; } }); retur...
### Question: InformationContentComputation { public <LabelT> Map<TermId, Double> computeInformationContent(Map<TermId, ? extends Collection<LabelT>> termLabels) { LOGGER.info("Computing IC of {} terms using {} labels...", new Object[] {ontology.countAllTerms(), termLabels.values().stream().mapToInt(l -> l.size()).sum(...
### Question: SimilarityScoreSampling { public Map<Integer, ScoreDistribution> performSampling( Map<Integer, ? extends Collection<TermId>> labels) { Map<Integer, ScoreDistribution> result = new HashMap<>(); for (int numTerms = options.getMinNumTerms(); numTerms <= options .getMaxNumTerms(); ++numTerms) { result.put(num...
### Question: ObjectScoreDistribution implements Serializable { public double estimatePValue(double score) { Entry<Double, Double> previous = null; for (Entry<Double, Double> entry : cumulativeFrequencies.entrySet()) { if (previous == null && score < entry.getKey()) { return 1.0; } if (previous != null && previous.getK...
### Question: ScoreDistributions { public static ScoreDistribution merge(Collection<ScoreDistribution> distributions) { if (distributions.isEmpty()) { throw new CannotMergeScoreDistributions("Cannot merge zero ScoreDistributions objects."); } if (distributions.stream().map(d -> d.getNumTerms()).collect(Collectors.toSet...
### Question: ScoreSamplingOptions implements Serializable, Cloneable { @Override public String toString() { return "ScoreSamplingOptions [numThreads=" + numThreads + ", minObjectId=" + minObjectId + ", maxObjectId=" + maxObjectId + ", minNumTerms=" + minNumTerms + ", maxNumTerms=" + maxNumTerms + ", numIterations=" + ...
### Question: ImmutableEdge implements Edge<V> { @Override public final Object clone() { return new ImmutableEdge<V>(source, dest, id); } ImmutableEdge(final V source, final V dest, final int id); static ImmutableEdge<V> construct(final V source, final V dest, final int id); @Override final V getSource(); @Overri...
### Question: TermIds { public static Set<TermId> augmentWithAncestors(ImmutableOntology<?, ?> ontology, Set<TermId> termIds, boolean includeRoot) { termIds.addAll(ontology.getAllAncestorTermIds(termIds, includeRoot)); return termIds; } static Set<TermId> augmentWithAncestors(ImmutableOntology<?, ?> ontology, Se...
### Question: TermAnnotations { public static Map<TermId, Collection<String>> constructTermAnnotationToLabelsMap( Ontology<?, ?> ontology, Collection<? extends TermAnnotation> annotations) { final Map<TermId, Collection<String>> result = new HashMap<>(); for (TermAnnotation anno : annotations) { for (TermId termId : on...
### Question: TermAnnotations { public static Map<String, Collection<TermId>> constructTermLabelToAnnotationsMap( Ontology<?, ?> ontology, Collection<? extends TermAnnotation> annotations) { final Map<String, Collection<TermId>> result = new HashMap<>(); for (TermAnnotation anno : annotations) { for (TermId termId : on...
### Question: ImmutableTermId implements TermId { @Override public int compareTo(TermId that) { return ComparisonChain.start().compare(this.getPrefix(), that.getPrefix()) .compare(this.getId(), that.getId()).result(); } ImmutableTermId(TermPrefix prefix, String id); static ImmutableTermId constructWithPrefix(String ter...
### Question: ImmutableTermId implements TermId { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj instanceof TermId) { final TermId that = (TermId) obj; return this.prefix.equals(that.getPrefix()) && (this.id.equals(that.getId())); } else { return false; } } ImmutableTermId(...
### Question: ImmutableTermId implements TermId { @Override public String toString() { return "ImmutableTermId [prefix=" + prefix + ", id=" + id + "]"; } ImmutableTermId(TermPrefix prefix, String id); static ImmutableTermId constructWithPrefix(String termIdString); @Override int compareTo(TermId that); @Override TermPr...
### Question: ImmutableTermPrefix implements TermPrefix { @Override public int compareTo(TermPrefix o) { if (this == o) { return 0; } else { return value.compareTo(o.getValue()); } } ImmutableTermPrefix(String value); @Override int compareTo(TermPrefix o); @Override String getValue(); @Override String toString(); @Over...
### Question: ImmutableTermPrefix implements TermPrefix { @Override public String getValue() { return value; } ImmutableTermPrefix(String value); @Override int compareTo(TermPrefix o); @Override String getValue(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }### Answer:...
### Question: ImmutableTermPrefix implements TermPrefix { @Override public String toString() { return "ImmutableTermPrefix [value=" + value + "]"; } ImmutableTermPrefix(String value); @Override int compareTo(TermPrefix o); @Override String getValue(); @Override String toString(); @Override int hashCode(); @Override boo...
### Question: ImmutableEdge implements Edge<V> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } @SuppressWarnings("unchecked") ImmutableEdge<V> other = (ImmutableEdge<V>) obj; if (dest == null) { if (...
### Question: SimpleFeatureVectorSimilarity implements Similarity { @Override public double computeScore(Collection<TermId> query, Collection<TermId> target) { return Sets.intersection(Sets.newHashSet(query), Sets.newHashSet(target)).size(); } @Override String getName(); @Override String getParameters(); @Override boo...
### Question: JaccardSimilarity implements Similarity { @Override public double computeScore(Collection<TermId> query, Collection<TermId> target) { final Set<TermId> termIdsQuery = ontology.getAllAncestorTermIds(query, false); final Set<TermId> termIdsTarget = ontology.getAllAncestorTermIds(target, false); double...
### Question: CosineSimilarity implements Similarity { @Override public double computeScore(Collection<TermId> query, Collection<TermId> target) { final Set<TermId> termIdsQuery = ontology.getAllAncestorTermIds(query, false); final Set<TermId> termIdsTarget = ontology.getAllAncestorTermIds(target, false); return Sets.i...
### Question: PrecomputingPairwiseResnikSimilarity implements PairwiseSimilarity, Serializable { @Override public double computeScore(TermId query, TermId target) { return precomputedScores.get(query, target); } PrecomputingPairwiseResnikSimilarity(Ontology<T, R> ontology, Map<TermId, Double> termToIc, ...
### Question: TermOverlapSimilarity implements Similarity { @Override public double computeScore(Collection<TermId> query, Collection<TermId> target) { final Set<TermId> termIdsQuery = ontology.getAllAncestorTermIds(query, false); final Set<TermId> termIdsTarget = ontology.getAllAncestorTermIds(target, false); do...
### Question: PairwiseResnikSimilarity implements PairwiseSimilarity { @Override public double computeScore(TermId query, TermId target) { return computeScoreImpl(query, target); } protected PairwiseResnikSimilarity(); PairwiseResnikSimilarity(Ontology<T, R> ontology, Map<TermId, Double> termToIc); double compu...
### Question: ResnikSimilarity extends AbstractCommonAncestorSimilarity<T, R> { @Override public String getName() { return "Resnik similarity"; } ResnikSimilarity(Ontology<T, R> ontology, Map<TermId, Double> termToIc, boolean symmetric); ResnikSimilarity(PairwiseSimilarity pairwiseSimilarity, boolean symmetric);...
### Question: ImmutableDirectedGraph implements DirectedGraph<V, E> { public static <V extends Comparable<V>, E extends ImmutableEdge<V>> Builder<V, E> builder(final Edge.Factory<V, E> edgeFactory) { return new Builder<V, E>(edgeFactory); } private ImmutableDirectedGraph(final Collection<V> vertices, final Colle...
### Question: OboParser { public OboFile parseString(String oboString) { final HelperListener helper = new HelperListener(); parseString(oboString, helper); return new OboFile(helper.getHeader(), helper.getStanzas()); } OboParser(); OboParser(boolean debug); OboFile parseFile(File file); void parseFile(File file, OboP...
### Question: ImmutableDirectedGraph implements DirectedGraph<V, E> { @Override public String toString() { return "ImmutableDirectedGraph [edgeLists=" + ImmutableSortedMap.copyOf(edgeLists) + ", edgeCount=" + edgeCount + "]"; } private ImmutableDirectedGraph(final Collection<V> vertices, final Collection<E> edge...
### Question: ImmutableDirectedGraph implements DirectedGraph<V, E> { @Override public Iterator<E> outEdgeIterator(V v) { return edgeLists.get(v).getOutEdges().iterator(); } private ImmutableDirectedGraph(final Collection<V> vertices, final Collection<E> edges); static Builder<V, E> builder(final Edge.Factory<V,...
### Question: ImmutableDirectedGraph implements DirectedGraph<V, E> { @Override public Iterator<E> inEdgeIterator(V v) { return edgeLists.get(v).getInEdges().iterator(); } private ImmutableDirectedGraph(final Collection<V> vertices, final Collection<E> edges); static Builder<V, E> builder(final Edge.Factory<V, E...
### Question: ImmutableDirectedGraph implements DirectedGraph<V, E> { @Override public Iterator<V> viaOutEdgeIterator(V v) { final Iterator<? extends Edge<V>> iter = outEdgeIterator(v); return new Iterator<V>() { @Override public boolean hasNext() { return iter.hasNext(); } @Override public V next() { return iter...
### Question: ImmutableDirectedGraph implements DirectedGraph<V, E> { @Override public Iterator<V> viaInEdgeIterator(V v) { final Iterator<? extends Edge<V>> iter = inEdgeIterator(v); return new Iterator<V>() { @Override public boolean hasNext() { return iter.hasNext(); } @Override public V next() { return iter.n...
### Question: ImmutableDirectedGraph implements DirectedGraph<V, E> { @SuppressWarnings("unchecked") @Override public DirectedGraph<V, E> subGraph(Collection<V> vertices) { Set<V> argVertexSet = ImmutableSet.copyOf(vertices); Set<V> vertexSubset = new HashSet<V>(); Iterator<V> vertexIt = vertexIterator(); while (...
### Question: BronWatchList { public boolean isWatched(Entiteit entity) { return list.containsKey(Hibernate.getClass(entity)); } boolean isWatched(Entiteit entity); boolean isWatched(Entiteit entiteit, String property); static boolean isSleutelWaarde(Entiteit entiteit, String expression); static boolean isSleutelWaard...
### Question: StringUtil { public static String emptyOrStringValue(Object value) { if (value == null) return ""; return String.valueOf(value); } private StringUtil(); static boolean checkMatchesRegExp(String parameter, String value, String regexp); @Deprecated() static String stripHighAscii(String tekst); static Integ...
### Question: StringUtil { public static String nullOrStringValue(Object value) { if (value == null) return null; return String.valueOf(value); } private StringUtil(); static boolean checkMatchesRegExp(String parameter, String value, String regexp); @Deprecated() static String stripHighAscii(String tekst); static Inte...
### Question: ResourceUtil { public static void flush(Object objectToFlush) { if (objectToFlush instanceof Flushable) { Flushable flushable = (Flushable) objectToFlush; try { flushable.flush(); } catch (IOException e) { log.error(e.toString(), e); throw new RuntimeException(e); } } } private ResourceUtil(); static voi...
### Question: Utf8BufferedWriter extends BufferedWriter { public void writeByteOrderMark() throws IOException { write(new String(BOM, "UTF-8")); } Utf8BufferedWriter(File file); Utf8BufferedWriter(File file, int size); void writeByteOrderMark(); static byte[] BOM; }### Answer: @Test public void testWriteByteOrderMark(...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public void afterTransactionBegin(Transaction tx) { for (Interceptor interceptor : interceptors) { interceptor.afterTransactionBegin(tx); } } CompoundHibernateInterceptor(); CompoundHibernateInterceptor(Int...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public void afterTransactionCompletion(Transaction tx) { for (Interceptor interceptor : interceptors) { interceptor.afterTransactionCompletion(tx); } } CompoundHibernateInterceptor(); CompoundHibernateInter...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public void beforeTransactionCompletion(Transaction tx) { for (Interceptor interceptor : interceptors) { interceptor.beforeTransactionCompletion(tx); } } CompoundHibernateInterceptor(); CompoundHibernateInt...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public Object getEntity(String entityName, Serializable id) throws CallbackException { for (Interceptor interceptor : interceptors) { Object tmp = interceptor.getEntity(entityName, id); if (tmp != null) { re...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public String getEntityName(Object object) throws CallbackException { for (Interceptor interceptor : interceptors) { String name = interceptor.getEntityName(object); if (name != null) { return name; } } retu...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException { for (Interceptor interceptor : interceptors) { Object entity = interceptor.instantiate(entityNa...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException { for (Interceptor interceptor : interceptors) { interceptor.onCollectionRecreate(collection, key); } } Compound...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public void onCollectionRemove(Object collection, Serializable key) throws CallbackException { for (Interceptor interceptor : interceptors) { interceptor.onCollectionRemove(collection, key); } } CompoundHibe...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException { for (Interceptor interceptor : interceptors) { interceptor.onCollectionUpdate(collection, key); } } CompoundHibe...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { for (Interceptor interceptor : interceptors) { interceptor.onDelete(entit...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public String onPrepareStatement(String sql) { String result = sql; for (Interceptor interceptor : interceptors) { result = interceptor.onPrepareStatement(result); } return result; } CompoundHibernateInterce...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @Override public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { boolean entityModified = false; for (Interceptor interceptor : intercept...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @SuppressWarnings("unchecked") @Override public void postFlush(Iterator entities) throws CallbackException { for (Interceptor interceptor : interceptors) { interceptor.postFlush(entities); } } CompoundHibernateInterce...
### Question: CompoundHibernateInterceptor extends EmptyInterceptor implements Iterable<Interceptor> { @SuppressWarnings("unchecked") @Override public void preFlush(Iterator entities) throws CallbackException { for (Interceptor interceptor : interceptors) { interceptor.preFlush(entities); } } CompoundHibernateIntercept...
### Question: InterceptingSessionFactory implements SessionFactory, InterceptorFactoryAware, HibernateSessionFactoryAware { public Session openSession() throws HibernateException { if (!interceptorFactories.isEmpty()) { return interceptedSession(null); } return sessionFactory.openSession(); } InterceptingSessionFacto...
### Question: BronStateChange implements Serializable { @Override public String toString() { return entity.getClass().getSimpleName() + "." + propertyName + ": " + toString(previousValue) + " -> " + toString(currentValue); } BronStateChange(IdObject entity, String propertyName, Object previousValue, Object currentVa...
### Question: IntakeWizardModel implements IModel<IntakeWizardModel> { public Date getRegistratieDatum() { return registratieDatum; } IntakeWizardModel(); IntakeWizardModel(Medewerker medewerker); IntakeWizardModel(Deelnemer deelnemer, Medewerker medewerker); Intakegesprek createDefaultIntakegesprek(Verbintenis verbi...
### Question: IntakeWizardModel implements IModel<IntakeWizardModel> { public Deelnemer getDeelnemer() { return deelnemerModel.getObject(); } IntakeWizardModel(); IntakeWizardModel(Medewerker medewerker); IntakeWizardModel(Deelnemer deelnemer, Medewerker medewerker); Intakegesprek createDefaultIntakegesprek(Verbinten...
### Question: BeginEinddatumUtil { public static <T extends IBeginEinddatumEntiteit> List<T> getElementenOpPeildatum( List<T> lijst, Date peildatum) { List<T> resultaat = new ArrayList<T>(); for (T element : lijst) { if (element.isActief(peildatum)) { resultaat.add(element); } } return resultaat; } static boolean isAc...
### Question: Token extends InstellingEntiteit { public String getSerienummer() { return serienummer; } Token(String serienummer, String applicatie, String blob); protected Token(); boolean verifieerPassword(String password); @SuppressWarnings("hiding") void geefUit(Account gebruiker); void neemIn(); void meldDefect()...
### Question: Token extends InstellingEntiteit { public TokenStatus getStatus() { return status; } Token(String serienummer, String applicatie, String blob); protected Token(); boolean verifieerPassword(String password); @SuppressWarnings("hiding") void geefUit(Account gebruiker); void neemIn(); void meldDefect(); voi...
### Question: Adres extends LandelijkOfInstellingEntiteit { public static String[] parseHuisnummerToevoeging(String text) { Pattern pattern = Pattern.compile("([0-9]+)(.*)"); Matcher matcher = pattern.matcher(text); if (!matcher.find()) { return StringUtils.stripAll(new String[] {text, ""}); } else { return StringUtils...
### Question: BronWatchList { public static boolean isSleutelWaarde(Entiteit entiteit, String expression) { Class< ? > key = Hibernate.getClass(entiteit); HashMap<String, Property> properties = list.get(key); if (properties != null && properties.containsKey(expression)) { Property property = properties.get(expression);...
### Question: Brin extends ExterneOrganisatie { public Brin() { } Brin(); Brin(String brincode); @Exportable String getCode(); void setCode(String brincode); static boolean testBrincode(String brincode); @Override String toString(); void setOnderwijssector(Onderwijssector onderwijssector); Onderwijssector getOnderwijs...
### Question: Brin extends ExterneOrganisatie { @Exportable public Integer getVestigingsVolgnummer() { String brincode = getCode(); if (brincode != null) { Matcher matcher = BRIN_REGEXP.matcher(brincode); if (!matcher.matches()) { Asserts.fail(brincode + " is geen geldige BRIN code"); } String volgnummer = matcher.grou...
### Question: Schooljaar implements IBeginEinddatumEntiteit, Comparable<Schooljaar>, Serializable { public static Schooljaar valueOf(Date datum) { int startJaar = bepaalStartJaarVanSchooljaarActiefOpDatum(datum); return valueOf(startJaar); } private Schooljaar(int jaar); private Schooljaar(Date datum); int getStart...
### Question: Schooljaar implements IBeginEinddatumEntiteit, Comparable<Schooljaar>, Serializable { public boolean isAfgelopen() { Date current = TimeUtil.getInstance().currentDate(); return current.after(getEinddatum()); } private Schooljaar(int jaar); private Schooljaar(Date datum); int getStartJaar(); int getEin...
### Question: Schooljaar implements IBeginEinddatumEntiteit, Comparable<Schooljaar>, Serializable { public static Schooljaar parse(String value) { Pattern[] patterns = new Pattern[] {officieel, kort}; for (Pattern pattern : patterns) { Matcher matcher = pattern.matcher(value); if (!matcher.matches()) { continue; } St...
### Question: NaturalOrderComparator implements Comparator<Object>, Serializable { @Override public int compare(Object o1, Object o2) { String a = o1.toString(); String b = o2.toString(); int ia = 0, ib = 0; int nza = 0, nzb = 0; char ca, cb; int result; while (true) { nza = nzb = 0; ca = charAt(a, ia); cb = charAt(b, ...
### Question: ExceptionUtil { public static void printStackTrace(PrintWriter pw, Throwable t) { printStackTrace(pw, t, new StackTraceElement[] {}); } static String getDescription(Exception exception); static boolean isCausedBy(Throwable exception, Class< ? extends Throwable> cause); static void printStackTrace(PrintWr...
### Question: DecimalUtil { public static final boolean nonZero(BigDecimal decimal) { return decimal != null && decimal.compareTo(BigDecimal.ZERO) != 0; } static final boolean nonZero(BigDecimal decimal); static final boolean isZero(BigDecimal decimal); static final boolean greaterThan(BigDecimal is, BigDecimal than);...
### Question: DecimalUtil { public static final boolean isZero(BigDecimal decimal) { return decimal.compareTo(BigDecimal.ZERO) == 0; } static final boolean nonZero(BigDecimal decimal); static final boolean isZero(BigDecimal decimal); static final boolean greaterThan(BigDecimal is, BigDecimal than); static final boolea...
### Question: DecimalUtil { public static final boolean greaterThan(BigDecimal is, BigDecimal than) { return is.compareTo(than) > 0; } static final boolean nonZero(BigDecimal decimal); static final boolean isZero(BigDecimal decimal); static final boolean greaterThan(BigDecimal is, BigDecimal than); static final boolea...
### Question: DecimalUtil { public static final boolean greaterThanOrEqual(BigDecimal is, int than) { return is.compareTo(BigDecimal.valueOf(than)) >= 0; } static final boolean nonZero(BigDecimal decimal); static final boolean isZero(BigDecimal decimal); static final boolean greaterThan(BigDecimal is, BigDecimal than)...
### Question: DecimalUtil { public static final int compare(BigDecimal one, BigDecimal other) { if (one == null && other == null) return 0; if (one == null) return -1; else if (other == null) return 1; return one.compareTo(other); } static final boolean nonZero(BigDecimal decimal); static final boolean isZero(BigDecim...
### Question: DecimalUtil { public static final BigDecimal max(BigDecimal one, BigDecimal other) { return (one.compareTo(other) > 0 ? one : other); } static final boolean nonZero(BigDecimal decimal); static final boolean isZero(BigDecimal decimal); static final boolean greaterThan(BigDecimal is, BigDecimal than); stat...