Package org.neo4j.helpers

Examples of org.neo4j.helpers.Predicate


            keys = idNameOnly;
          }

          for (PropertyKey key : keys) {

            final Predicate predicate  = writer.getSecurityContext().getRange(key.jsonName());
            final Object value         = source.getProperty(key, predicate);
            final Class relatedType    = key.relatedType();
            final PropertyKey localKey = key;

            if (value != null) {
View Full Code Here


      }

      final List<GraphObject> entries = new LinkedList<>();
      final Query query               = getTimestampQuery();
      final Range<Long> range         = getRangeFromQuery(query);
      final Predicate datePredicate   = query.toPredicate();

      for (final Path path : files) {

        try (final BufferedReader reader = Files.newBufferedReader(path, Charset.forName("utf-8"))) {

          final String fileName = path.getFileName().toString();
          String pathSubjectId  = inverse ? fileName.substring(33, 64) : fileName.substring(0, 32);
          String pathObjectId   = inverse ? fileName.substring(0, 32: fileName.substring(33, 64);

          String line = reader.readLine();
          while (line != null) {

            try {

              final int pos0            = line.indexOf(",");
              final int pos1            = line.indexOf(",", pos0+1);

              final String part0        = line.substring(0, pos0);
              final String part1        = line.substring(pos0+1, pos1);
              final String part2        = line.substring(pos1+1);

              final long timestamp      = Long.valueOf(part0);
              final Date date           = new Date(timestamp);
              final String entryAction  = part1;
              final String entryMessage = part2;

              // determine first timestamp
              if (timestamp <= beginTimestamp) {
                beginTimestamp = timestamp;
              }

              // determine last timestamp
              if (timestamp >= endTimestamp) {
                endTimestamp = timestamp;
              }

              if (overview) {

                Integer actionCount = actions.get(entryAction);
                if (actionCount == null) {

                  actions.put(entryAction, 1);

                } else {

                  actions.put(entryAction, actionCount + 1);
                }

                entryCount++;

              } else {

                // action present or matching?
                if (action == null || action.equals(entryAction)) {

                  final GraphObjectMap map = new GraphObjectMap();
                  map.put(subjectProperty, pathSubjectId);
                  map.put(objectProperty, pathObjectId);
                  map.put(actionProperty, entryAction);
                  map.put(timestampProperty, date);
                  map.put(messageProperty, entryMessage);

                  // date predicate present?
                  if (date == null || datePredicate.accept(map)) {
                    entries.add(map);
                  }
                }
              }
View Full Code Here

TOP

Related Classes of org.neo4j.helpers.Predicate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.