org.securegraph.Visibility - java examples

Here are the examples of the java api org.securegraph.Visibility taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

101 Examples 7

19 View Complete Implementation : PtObjectMapper.java
Copyright Apache License 2.0
Author : lumifyio
public clreplaced PtObjectMapper extends PalantirMapperBase<LongWritable, PtObject> {

    private Visibility visibility;

    private VisibilityJson visibilityJson;

    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
        loadObjectTypes(context);
        visibility = new LumifyVisibility("").getVisibility();
        visibilityJson = new VisibilityJson();
    }

    @Override
    protected void safeMap(LongWritable key, PtObject ptObject, Context context) throws Exception {
        context.setStatus(key.toString());
        if (ptObject.getDeleted() != null && ptObject.getDeleted() != 0) {
            return;
        }
        String conceptTypeUri = getConceptTypeUri(ptObject);
        VertexBuilder m = prepareVertex(getObjectVertexId(ptObject), visibility);
        LumifyProperties.CONCEPT_TYPE.setProperty(m, conceptTypeUri, visibility);
        LumifyProperties.CREATED_BY.setProperty(m, PtUserMapper.getUserVertexId(ptObject.getCreatedBy()), visibility);
        LumifyProperties.CREATE_DATE.setProperty(m, new Date(ptObject.getTimeCreated()), visibility);
        LumifyProperties.MODIFIED_BY.setProperty(m, PtUserMapper.getUserVertexId(ptObject.getLastModifiedBy()), visibility);
        LumifyProperties.MODIFIED_DATE.setProperty(m, new Date(ptObject.getLastModified()), visibility);
        LumifyProperties.VISIBILITY_JSON.setProperty(m, visibilityJson, visibility);
        m.save(getAuthorizations());
    }

    private String getConceptTypeUri(PtObject ptObject) {
        PtObjectType ptObjectType = getObjectType(ptObject.getType());
        if (ptObjectType == null) {
            throw new LumifyException("Could not find object type: " + ptObject.getType());
        }
        return getConceptTypeUri(ptObjectType.getUri());
    }

    protected String getConceptTypeUri(String uri) {
        return getBaseIri() + uri;
    }

    public static String getObjectVertexId(PtObject ptObject) {
        return getObjectVertexId(ptObject.getObjectId());
    }

    public static String getObjectVertexId(long objectId) {
        return ID_PREFIX + "OBJECT_" + objectId;
    }
}

19 View Complete Implementation : ElementMaker.java
Copyright Apache License 2.0
Author : lumifyio
private boolean isHidden(String propertyKey, String propertyName, Visibility visibility) {
    for (HiddenProperty hiddenProperty : hiddenProperties) {
        if (hiddenProperty.matches(propertyKey, propertyName, visibility)) {
            return true;
        }
    }
    return false;
}

19 View Complete Implementation : AuditRelationship.java
Copyright Apache License 2.0
Author : lumifyio
public AuditRelationship setSourceType(Object sourceType, Visibility visibility) {
    set(SOURCE_TYPE, sourceType, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : PtGraphMapper.java
Copyright Apache License 2.0
Author : lumifyio
public clreplaced PtGraphMapper extends PalantirMapperBase<LongWritable, PtGraph> {

    private Visibility workspaceOnlyVisibility;

    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
        workspaceOnlyVisibility = new LumifyVisibility(WorkspaceRepository.VISIBILITY_STRING).getVisibility();
    }

    @Override
    protected void safeMap(LongWritable key, PtGraph ptGraph, Context context) throws Exception {
        context.setStatus(key.toString());
        byte[] awstateProto = TryInflaterInputStream.inflate(ptGraph.getAwstateProto());
        AWState.Wrapper1 awstate = AWState.Wrapper1.parseFrom(awstateProto);
        String workspaceVertexId = getWorkspaceVertexId(ptGraph);
        String userId = PtUserMapper.getUserVertexId(ptGraph.getCreatedBy());
        getAuthorizationRepository().addAuthorizationToGraph(workspaceVertexId);
        saveWorkspaceVertex(ptGraph, workspaceVertexId);
        saveWorkspaceToUserEdge(workspaceVertexId, userId);
        for (AWState.Vertex v : awstate.getWrapper2().getWrapper3().getVertexList()) {
            long objectId = v.getVertexInner().getObjectId();
            String objectVertexId = PtObjectMapper.getObjectVertexId(objectId);
            String edgeId = PtGraphObjectMapper.getWorkspaceToEnreplacedyEdgeId(workspaceVertexId, objectVertexId);
            EdgeBuilderByVertexId m = getGraph().prepareEdge(edgeId, workspaceVertexId, objectVertexId, WorkspaceRepository.WORKSPACE_TO_ENreplacedY_RELATIONSHIP_IRI, workspaceOnlyVisibility);
            WorkspaceLumifyProperties.WORKSPACE_TO_ENreplacedY_GRAPH_POSITION_X.setProperty(m, v.getVertexInner().getX(), workspaceOnlyVisibility);
            WorkspaceLumifyProperties.WORKSPACE_TO_ENreplacedY_GRAPH_POSITION_Y.setProperty(m, v.getVertexInner().getY(), workspaceOnlyVisibility);
            m.save(getAuthorizations());
        }
    }

    private void saveWorkspaceToUserEdge(String workspaceVertexId, String userId) {
        String edgeId = workspaceVertexId + WorkspaceRepository.WORKSPACE_TO_USER_RELATIONSHIP_IRI + userId;
        EdgeBuilderByVertexId edgeBuilder = getGraph().prepareEdge(edgeId, workspaceVertexId, userId, WorkspaceRepository.WORKSPACE_TO_USER_RELATIONSHIP_IRI, workspaceOnlyVisibility);
        WorkspaceLumifyProperties.WORKSPACE_TO_USER_IS_CREATOR.setProperty(edgeBuilder, true, workspaceOnlyVisibility);
        WorkspaceLumifyProperties.WORKSPACE_TO_USER_ACCESS.setProperty(edgeBuilder, WorkspaceAccess.WRITE.toString(), workspaceOnlyVisibility);
        edgeBuilder.save(getAuthorizations());
    }

    private void saveWorkspaceVertex(PtGraph ptGraph, String workspaceVertexId) {
        VertexBuilder m = prepareVertex(workspaceVertexId, workspaceOnlyVisibility);
        LumifyProperties.CONCEPT_TYPE.setProperty(m, WorkspaceRepository.WORKSPACE_CONCEPT_IRI, workspaceOnlyVisibility);
        WorkspaceLumifyProperties.replacedLE.setProperty(m, ptGraph.getreplacedle(), workspaceOnlyVisibility);
        m.save(getAuthorizations());
    }

    public static String getWorkspaceVertexId(PtGraph ptGraph) {
        return getWorkspaceVertexId(ptGraph.getId());
    }

    public static String getWorkspaceVertexId(long graphId) {
        return ID_PREFIX + "WORKSPACE_" + graphId;
    }
}

19 View Complete Implementation : AuditRelationship.java
Copyright Apache License 2.0
Author : lumifyio
public AuditRelationship setSourceId(Object sourceId, Visibility visibility) {
    set(SOURCE_ID, sourceId, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditProperty.java
Copyright Apache License 2.0
Author : lumifyio
public AuditProperty setPropertyName(Object propertyName, Visibility visibility) {
    set(PROPERTY_NAME, propertyName, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : ImportJsonMRMapper.java
Copyright Apache License 2.0
Author : lumifyio
public clreplaced ImportJsonMRMapper extends LumifyElementMapperBase<SequenceFileKey, Text> {

    public static final String MULTI_VALUE_KEY = ImportJsonMR.clreplaced.getName();

    public static final String SOURCE = "TheMovieDb.org";

    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");

    private static final SimpleDateFormat DATE_YEAR_FORMAT = new SimpleDateFormat("yyyy");

    private Visibility visibility;

    private AcreplaceduloAuthorizations authorizations;

    private Visibility defaultVisibility;

    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
        VisibilityTranslator visibilityTranslator = new DirectVisibilityTranslator();
        this.visibility = visibilityTranslator.getDefaultVisibility();
        this.defaultVisibility = visibilityTranslator.getDefaultVisibility();
        this.authorizations = new AcreplaceduloAuthorizations();
    }

    @Override
    protected void safeMap(SequenceFileKey key, Text line, Context context) throws IOException, InterruptedException, ParseException {
        String lineString = line.toString();
        JSONObject json = new JSONObject(lineString);
        int id = json.getInt("id");
        RecordType recordType = key.getRecordType();
        context.setStatus(recordType + ":" + id);
        switch(recordType) {
            case MOVIE:
                mapMovie(id, json, context);
                break;
            case PERSON:
                mapPerson(id, json, context);
                break;
            case PRODUCTION_COMPANY:
                mapProductionCompany(id, json, context);
                break;
        }
    }

    private void mapProductionCompany(int productionCompanyId, JSONObject json, Context context) {
        VertexBuilder productionCompanyMutation = prepareVertex(TheMovieDbOntology.getProductionCompanyVertexId(productionCompanyId), visibility);
        LumifyProperties.CONCEPT_TYPE.addPropertyValue(productionCompanyMutation, MULTI_VALUE_KEY, TheMovieDbOntology.CONCEPT_TYPE_PRODUCTION_COMPANY, visibility);
        LumifyProperties.SOURCE.addPropertyValue(productionCompanyMutation, MULTI_VALUE_KEY, SOURCE, visibility);
        String name = json.optString("name");
        if (name != null && name.length() > 0) {
            LumifyProperties.replacedLE.addPropertyValue(productionCompanyMutation, MULTI_VALUE_KEY, name, visibility);
        }
        productionCompanyMutation.save(authorizations);
        context.getCounter(TheMovieDbImportCounters.PRODUCTION_COMPANIES_PROCESSED).increment(1);
    }

    private void mapPerson(int personId, JSONObject personJson, Context context) throws ParseException {
        String name = personJson.getString("name");
        String vertexId = TheMovieDbOntology.getPersonVertexId(personId);
        VertexBuilder m = prepareVertex(vertexId, visibility);
        LumifyProperties.CONCEPT_TYPE.addPropertyValue(m, MULTI_VALUE_KEY, TheMovieDbOntology.CONCEPT_TYPE_PERSON, visibility);
        LumifyProperties.SOURCE.addPropertyValue(m, MULTI_VALUE_KEY, SOURCE, visibility);
        StreamingPropertyValue rawValue = new StreamingPropertyValue(new ByteArrayInputStream(personJson.toString().getBytes()), byte[].clreplaced);
        rawValue.store(true);
        rawValue.searchIndex(false);
        LumifyProperties.RAW.addPropertyValue(m, MULTI_VALUE_KEY, rawValue, visibility);
        LumifyProperties.replacedLE.addPropertyValue(m, MULTI_VALUE_KEY, name, visibility);
        String biography = personJson.optString("biography");
        if (biography != null) {
            Metadata metadata = new Metadata();
            LumifyProperties.META_DATA_TEXT_DESCRIPTION.setMetadata(metadata, "Biography", defaultVisibility);
            LumifyProperties.META_DATA_MIME_TYPE.setMetadata(metadata, "text/plain", defaultVisibility);
            StreamingPropertyValue value = new StreamingPropertyValue(new ByteArrayInputStream(biography.getBytes()), String.clreplaced);
            LumifyProperties.TEXT.addPropertyValue(m, MULTI_VALUE_KEY, value, metadata, visibility);
        }
        String birthDateString = personJson.optString("birthday");
        if (birthDateString != null && birthDateString.length() > 0) {
            Date birthDate = parseDate(birthDateString);
            TheMovieDbOntology.BIRTHDATE.addPropertyValue(m, MULTI_VALUE_KEY, birthDate, visibility);
        }
        String deathDateString = personJson.optString("deathday");
        if (deathDateString != null && deathDateString.length() > 0) {
            Date deathDate = parseDate(deathDateString);
            TheMovieDbOntology.DEATH_DATE.addPropertyValue(m, MULTI_VALUE_KEY, deathDate, visibility);
        }
        JSONArray akas = personJson.optJSONArray("also_known_as");
        if (akas != null) {
            for (int i = 0; i < akas.length(); i++) {
                String aka = akas.getString(i);
                TheMovieDbOntology.ALSO_KNOWN_AS.addPropertyValue(m, "aka" + i, aka, visibility);
            }
        }
        Vertex personVertex = m.save(authorizations);
        processPersonCredits(personId, personJson, personVertex);
        context.getCounter(TheMovieDbImportCounters.PERSONS_PROCESSED).increment(1);
    }

    private void processPersonCredits(int personId, JSONObject personJson, Vertex personVertex) {
        JSONObject combinedCredits = personJson.getJSONObject("combined_credits");
        JSONArray cast = combinedCredits.getJSONArray("cast");
        for (int i = 0; i < cast.length(); i++) {
            JSONObject movieJson = cast.getJSONObject(i);
            String mediaType = movieJson.getString("media_type");
            if (!mediaType.equals("movie")) {
                continue;
            }
            int movieId = movieJson.getInt("id");
            VertexBuilder movieMutation = prepareVertex(TheMovieDbOntology.getMovieVertexId(movieId), visibility);
            LumifyProperties.CONCEPT_TYPE.addPropertyValue(movieMutation, MULTI_VALUE_KEY, TheMovieDbOntology.CONCEPT_TYPE_MOVIE, visibility);
            LumifyProperties.SOURCE.addPropertyValue(movieMutation, MULTI_VALUE_KEY, SOURCE, visibility);
            String replacedle = movieJson.optString("replacedle");
            if (replacedle != null && replacedle.length() > 0) {
                LumifyProperties.replacedLE.addPropertyValue(movieMutation, MULTI_VALUE_KEY, replacedle, visibility);
            }
            Vertex movieVertex = movieMutation.save(authorizations);
            addEdge(TheMovieDbOntology.getStarredInEdgeId(personId, movieId), personVertex, movieVertex, TheMovieDbOntology.EDGE_LABEL_STARRED_IN, visibility, authorizations);
        }
    }

    private void mapMovie(int movieId, JSONObject movieJson, Context context) throws ParseException {
        String replacedle = movieJson.getString("replacedle");
        String vertexId = TheMovieDbOntology.getMovieVertexId(movieId);
        String sourceUrl = "http://www.themoviedb.org/movie/" + movieId;
        VertexBuilder m = prepareVertex(vertexId, visibility);
        LumifyProperties.CONCEPT_TYPE.addPropertyValue(m, MULTI_VALUE_KEY, TheMovieDbOntology.CONCEPT_TYPE_MOVIE, visibility);
        LumifyProperties.SOURCE.addPropertyValue(m, MULTI_VALUE_KEY, SOURCE, visibility);
        LumifyProperties.SOURCE_URL.addPropertyValue(m, MULTI_VALUE_KEY, sourceUrl, visibility);
        StreamingPropertyValue rawValue = new StreamingPropertyValue(new ByteArrayInputStream(movieJson.toString().getBytes()), byte[].clreplaced);
        rawValue.store(true);
        rawValue.searchIndex(false);
        LumifyProperties.RAW.addPropertyValue(m, MULTI_VALUE_KEY, rawValue, visibility);
        LumifyProperties.replacedLE.addPropertyValue(m, MULTI_VALUE_KEY, replacedle, visibility);
        String releaseDateString = movieJson.optString("release_date");
        if (releaseDateString != null && releaseDateString.length() > 0) {
            Date releaseDate = parseDate(releaseDateString);
            TheMovieDbOntology.RELEASE_DATE.addPropertyValue(m, MULTI_VALUE_KEY, releaseDate, visibility);
        }
        JSONArray genres = movieJson.optJSONArray("genres");
        if (genres != null) {
            for (int i = 0; i < genres.length(); i++) {
                JSONObject genre = genres.getJSONObject(i);
                String genreName = genre.getString("name");
                TheMovieDbOntology.GENRE.addPropertyValue(m, MULTI_VALUE_KEY + "_" + genreName, genreName, visibility);
            }
        }
        double runtime = movieJson.optDouble("runtime", -1);
        if (runtime > 0) {
            runtime = runtime * 60;
            TheMovieDbOntology.RUNTIME.addPropertyValue(m, MULTI_VALUE_KEY, runtime, visibility);
        }
        int revenue = movieJson.optInt("revenue", -1);
        if (revenue > 0) {
            TheMovieDbOntology.REVENUE.addPropertyValue(m, MULTI_VALUE_KEY, revenue, visibility);
        }
        int budget = movieJson.optInt("budget", -1);
        if (budget > 0) {
            TheMovieDbOntology.BUDGET.addPropertyValue(m, MULTI_VALUE_KEY, budget, visibility);
        }
        String overview = movieJson.optString("overview");
        if (overview != null && overview.length() > 0) {
            Metadata metadata = new Metadata();
            LumifyProperties.META_DATA_TEXT_DESCRIPTION.setMetadata(metadata, "Overview", defaultVisibility);
            LumifyProperties.META_DATA_MIME_TYPE.setMetadata(metadata, "text/plain", defaultVisibility);
            StreamingPropertyValue value = new StreamingPropertyValue(new ByteArrayInputStream(overview.getBytes()), String.clreplaced);
            LumifyProperties.TEXT.addPropertyValue(m, MULTI_VALUE_KEY, value, metadata, visibility);
        }
        String tagLine = movieJson.optString("tagline");
        if (tagLine != null && tagLine.length() > 0) {
            TheMovieDbOntology.TAG_LINE.addPropertyValue(m, MULTI_VALUE_KEY, tagLine, visibility);
        }
        Vertex movieVertex = m.save(authorizations);
        processMovieCredits(movieId, movieJson, movieVertex);
        processMovieProductionCompanies(movieId, movieJson, movieVertex);
        context.getCounter(TheMovieDbImportCounters.MOVIES_PROCESSED).increment(1);
    }

    private void processMovieProductionCompanies(int movieId, JSONObject movieJson, Vertex movieVertex) {
        JSONArray productionCompanies = movieJson.optJSONArray("production_companies");
        if (productionCompanies != null) {
            for (int i = 0; i < productionCompanies.length(); i++) {
                JSONObject productionCompany = productionCompanies.getJSONObject(i);
                int productionCompanyId = productionCompany.getInt("id");
                String sourceUrl = "http://www.themoviedb.org/company/" + productionCompanyId;
                VertexBuilder productionCompanyMutation = prepareVertex(TheMovieDbOntology.getProductionCompanyVertexId(productionCompanyId), visibility);
                LumifyProperties.CONCEPT_TYPE.addPropertyValue(productionCompanyMutation, MULTI_VALUE_KEY, TheMovieDbOntology.CONCEPT_TYPE_PRODUCTION_COMPANY, visibility);
                LumifyProperties.SOURCE.addPropertyValue(productionCompanyMutation, MULTI_VALUE_KEY, SOURCE, visibility);
                LumifyProperties.SOURCE_URL.addPropertyValue(productionCompanyMutation, MULTI_VALUE_KEY, sourceUrl, visibility);
                String name = productionCompany.optString("name");
                if (name != null && name.length() > 0) {
                    LumifyProperties.replacedLE.addPropertyValue(productionCompanyMutation, MULTI_VALUE_KEY, name, visibility);
                }
                Vertex productionCompanyVertex = productionCompanyMutation.save(authorizations);
                addEdge(TheMovieDbOntology.getProductionCompanyProducedEdgeId(productionCompanyId, movieId), productionCompanyVertex, movieVertex, TheMovieDbOntology.EDGE_LABEL_PRODUCED, visibility, authorizations);
            }
        }
    }

    private void processMovieCredits(int movieId, JSONObject movieJson, Vertex movieVertex) {
        JSONObject credits = movieJson.getJSONObject("credits");
        JSONArray cast = credits.getJSONArray("cast");
        for (int i = 0; i < cast.length(); i++) {
            JSONObject castJson = cast.getJSONObject(i);
            int personId = castJson.getInt("id");
            String sourceUrl = "http://www.themoviedb.org/person/" + personId;
            VertexBuilder personMutation = prepareVertex(TheMovieDbOntology.getPersonVertexId(personId), visibility);
            LumifyProperties.CONCEPT_TYPE.addPropertyValue(personMutation, MULTI_VALUE_KEY, TheMovieDbOntology.CONCEPT_TYPE_PERSON, visibility);
            LumifyProperties.SOURCE.addPropertyValue(personMutation, MULTI_VALUE_KEY, SOURCE, visibility);
            LumifyProperties.SOURCE_URL.addPropertyValue(personMutation, MULTI_VALUE_KEY, sourceUrl, visibility);
            String name = castJson.optString("name");
            if (name != null && name.length() > 0) {
                LumifyProperties.replacedLE.addPropertyValue(personMutation, MULTI_VALUE_KEY, name, visibility);
            }
            Vertex personVertex = personMutation.save(authorizations);
            addEdge(TheMovieDbOntology.getStarredInEdgeId(personId, movieId), personVertex, movieVertex, TheMovieDbOntology.EDGE_LABEL_STARRED_IN, visibility, authorizations);
            String character = castJson.optString("character");
            if (character != null && character.length() > 0) {
                String roleId = TheMovieDbOntology.getRoleId(personId, movieId);
                VertexBuilder roleMutation = prepareVertex(TheMovieDbOntology.getRoleVertexId(roleId), visibility);
                LumifyProperties.CONCEPT_TYPE.addPropertyValue(roleMutation, MULTI_VALUE_KEY, TheMovieDbOntology.CONCEPT_TYPE_ROLE, visibility);
                LumifyProperties.SOURCE.addPropertyValue(roleMutation, MULTI_VALUE_KEY, SOURCE, visibility);
                LumifyProperties.replacedLE.addPropertyValue(roleMutation, MULTI_VALUE_KEY, character, visibility);
                Vertex roleVertex = roleMutation.save(authorizations);
                addEdge(TheMovieDbOntology.getPlayedEdgeId(personId, roleId), personVertex, roleVertex, TheMovieDbOntology.EDGE_LABEL_PLAYED, visibility, authorizations);
                addEdge(TheMovieDbOntology.getHasRoleEdgeId(movieId, roleId), movieVertex, roleVertex, TheMovieDbOntology.EDGE_LABEL_HAS_ROLE, visibility, authorizations);
            }
        }
    }

    private Date parseDate(String str) throws ParseException {
        try {
            return DATE_FORMAT.parse(str);
        } catch (ParseException p) {
            return DATE_YEAR_FORMAT.parse(str);
        }
    }
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setUnixBuildTime(Long unixBuildTime, Visibility visibility) {
    set(UNIX_BUILD_TIME, unixBuildTime, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : ElementMaker.java
Copyright Apache License 2.0
Author : lumifyio
private void extractPropertyData(Map.Entry<Key, Value> column, ColumnVisibility columnVisibility) {
    Text columnQualifier = column.getKey().getColumnQualifier();
    Value value = column.getValue();
    Visibility visibility = AcreplaceduloGraph.acreplaceduloVisibilityToVisibility(columnVisibility);
    String propertyName = getPropertyNameFromColumnQualifier(columnQualifier.toString());
    String key = propertyColumnQualifierToKey(columnQualifier, visibility);
    long timestamp = column.getKey().getTimestamp();
    propertyColumnQualifier.put(key, columnQualifier.toString());
    propertyNames.put(key, propertyName);
    propertyValues.put(key, value.get());
    propertyVisibilities.put(key, visibility);
    propertyTimestamps.put(key, timestamp);
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setVersion(String version, Visibility visibility) {
    set(VERSION, version, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : LumifyVisibility.java
Copyright Apache License 2.0
Author : lumifyio
public clreplaced LumifyVisibility {

    public static final String SUPER_USER_VISIBILITY_STRING = "lumify";

    private final Visibility visibility;

    public LumifyVisibility() {
        this.visibility = new Visibility("");
    }

    public LumifyVisibility(String visibility) {
        if (visibility == null || visibility.length() == 0) {
            this.visibility = new Visibility("");
        } else {
            this.visibility = addSuperUser(visibility);
        }
    }

    public LumifyVisibility(Visibility visibility) {
        if (visibility == null || visibility.getVisibilityString().length() == 0 || visibility.getVisibilityString().contains(SUPER_USER_VISIBILITY_STRING)) {
            this.visibility = visibility;
        } else {
            this.visibility = addSuperUser(visibility.getVisibilityString());
        }
    }

    public Visibility getVisibility() {
        return visibility;
    }

    private Visibility addSuperUser(String visibility) {
        return new Visibility("(" + visibility + ")|" + SUPER_USER_VISIBILITY_STRING);
    }

    @Override
    public String toString() {
        return getVisibility().toString();
    }

    public static Visibility and(Visibility visibility, String additionalVisibility) {
        if (visibility.getVisibilityString().length() == 0) {
            return new Visibility(additionalVisibility);
        }
        return new Visibility("(" + visibility.getVisibilityString() + ")&(" + additionalVisibility + ")");
    }
}

19 View Complete Implementation : AuditRelationship.java
Copyright Apache License 2.0
Author : lumifyio
public AuditRelationship setDestId(Object destId, Visibility visibility) {
    set(DEST_ID, destId, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditEntity.java
Copyright Apache License 2.0
Author : lumifyio
public AuditEnreplacedy setreplacedyzedBy(Object replacedyzedBy, Visibility visibility) {
    set(replacedYZED_BY, replacedyzedBy, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : PtMediaAndValueMapper.java
Copyright Apache License 2.0
Author : lumifyio
public clreplaced PtMediaAndValueMapper extends PalantirMapperBase<LongWritable, PtMediaAndValue> {

    private Visibility visibility;

    private String hasMediaConceptTypeIri;

    private VisibilityJson visibilityJson;

    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
        visibility = new LumifyVisibility("").getVisibility();
        visibilityJson = new VisibilityJson();
        hasMediaConceptTypeIri = getOntologyRepository().getRequiredRelationshipIRIByIntent("hasMedia");
    }

    @Override
    protected void safeMap(LongWritable key, PtMediaAndValue ptMediaAndValue, Context context) throws Exception {
        context.setStatus(key.toString());
        if (ptMediaAndValue.isDeleted()) {
            return;
        }
        if (ptMediaAndValue.getContents() == null) {
            return;
        }
        String propertyKey = getPropertyKey(ptMediaAndValue);
        try (InputStream in = new TryInflaterInputStream(ptMediaAndValue.getContents())) {
            StreamingPropertyValue propertyValue = new StreamingPropertyValue(in, byte[].clreplaced);
            propertyValue.store(true);
            propertyValue.searchIndex(false);
            String replacedle = ptMediaAndValue.getreplacedle();
            if (replacedle == null) {
                replacedle = "";
            }
            VertexBuilder vertexBuilder = prepareVertex(getMediaId(ptMediaAndValue), visibility);
            LumifyProperties.RAW.addPropertyValue(vertexBuilder, propertyKey, propertyValue, visibility);
            LumifyProperties.replacedLE.setProperty(vertexBuilder, replacedle, visibility);
            LumifyProperties.CREATED_BY.setProperty(vertexBuilder, PtUserMapper.getUserVertexId(ptMediaAndValue.getCreatedBy()), visibility);
            LumifyProperties.CREATE_DATE.setProperty(vertexBuilder, new Date(ptMediaAndValue.getTimeCreated()), visibility);
            LumifyProperties.MODIFIED_BY.setProperty(vertexBuilder, PtUserMapper.getUserVertexId(ptMediaAndValue.getLastModifiedBy()), visibility);
            LumifyProperties.MODIFIED_DATE.setProperty(vertexBuilder, new Date(ptMediaAndValue.getLastModified()), visibility);
            LumifyProperties.VISIBILITY_JSON.setProperty(vertexBuilder, visibilityJson, visibility);
            Vertex mediaVertex = vertexBuilder.save(getAuthorizations());
            String sourceVertexId = PtObjectMapper.getObjectVertexId(ptMediaAndValue.getLinkObjectId());
            String edgeId = getEdgeId(ptMediaAndValue);
            String edgeLabel = getEdgeLabel(ptMediaAndValue);
            EdgeBuilderByVertexId edgeBuilder = prepareEdge(edgeId, sourceVertexId, mediaVertex.getId(), edgeLabel, visibility);
            LumifyProperties.CREATED_BY.setProperty(edgeBuilder, PtUserMapper.getUserVertexId(ptMediaAndValue.getCreatedBy()), visibility);
            LumifyProperties.CREATE_DATE.setProperty(edgeBuilder, new Date(ptMediaAndValue.getTimeCreated()), visibility);
            LumifyProperties.MODIFIED_BY.setProperty(edgeBuilder, PtUserMapper.getUserVertexId(ptMediaAndValue.getLastModifiedBy()), visibility);
            LumifyProperties.MODIFIED_DATE.setProperty(edgeBuilder, new Date(ptMediaAndValue.getLastModified()), visibility);
            LumifyProperties.VISIBILITY_JSON.setProperty(edgeBuilder, visibilityJson, visibility);
            edgeBuilder.save(getAuthorizations());
        }
    }

    private String getMediaId(PtMediaAndValue ptMediaAndValue) {
        return ID_PREFIX + "_media_" + ptMediaAndValue.getId();
    }

    private String getPropertyKey(PtMediaAndValue ptMediaAndValue) {
        return getBaseIri() + ptMediaAndValue.getId();
    }

    private String getEdgeId(PtMediaAndValue ptMediaAndValue) {
        return ID_PREFIX + "_media_" + ptMediaAndValue.getLinkObjectId() + "_to_" + ptMediaAndValue.getId();
    }

    private String getEdgeLabel(PtMediaAndValue row) {
        return hasMediaConceptTypeIri;
    }
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setType(String type, Visibility visibility) {
    set(TYPE, type, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : PtPropertyAndValueMapper.java
Copyright Apache License 2.0
Author : lumifyio
public clreplaced PtPropertyAndValueMapper extends PalantirMapperBase<LongWritable, PtPropertyAndValue> {

    private static final LumifyLogger LOGGER = LumifyLoggerFactory.getLogger(PtPropertyAndValueMapper.clreplaced);

    public static final Pattern DURATION_PATTERN = Pattern.compile("(\\d+):(\\d\\d)");

    private Visibility visibility;

    private VisibilityJson visibilityJson;

    private DoreplacedentBuilder dBuilder;

    private static Pattern VALUE_BODY_PATTERN = Pattern.compile("^<VALUE>(.*)</VALUE>$", Pattern.DOTALL);

    private static Pattern UNPARSED_VALUE_BODY_PATTERN = Pattern.compile("^<UNPARSED_VALUE>(.*)</UNPARSED_VALUE>$", Pattern.DOTALL);

    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
        loadPropertyTypes(context);
        visibility = new LumifyVisibility("").getVisibility();
        visibilityJson = new VisibilityJson();
        try {
            DoreplacedentBuilderFactory dbFactory = DoreplacedentBuilderFactory.newInstance();
            dBuilder = dbFactory.newDoreplacedentBuilder();
        } catch (ParserConfigurationException e) {
            throw new LumifyException("Could not create doreplacedent builder", e);
        }
    }

    @Override
    protected void safeMap(LongWritable key, PtPropertyAndValue ptPropertyAndValue, Context context) throws Exception {
        context.setStatus(key.toString());
        if (ptPropertyAndValue.isDeleted()) {
            return;
        }
        PtPropertyType propertyType = getPropertyType(ptPropertyAndValue.getType());
        if (propertyType == null) {
            throw new LumifyException("Could not find property type: " + ptPropertyAndValue.getType());
        }
        String objectVertexId = PtObjectMapper.getObjectVertexId(ptPropertyAndValue.getLinkObjectId());
        String propertyKey = getPropertyKey(ptPropertyAndValue);
        Metadata propertyMetadata = createMetadata(ptPropertyAndValue);
        Value value = cleanUpValueString(propertyType, ptPropertyAndValue.getValue());
        JGeometryWrapper gisData = ptPropertyAndValue.getGeometryGis();
        if (value == null && gisData == null) {
            return;
        }
        VertexBuilder v = prepareVertex(objectVertexId, visibility);
        if (value != null) {
            addValueToVertexBuilder(v, propertyType, propertyKey, propertyMetadata, value);
        }
        if (gisData != null) {
            addGisDataToVertexBuilder(v, propertyType, propertyKey, propertyMetadata, gisData);
        }
        v.save(getAuthorizations());
    }

    private Metadata createMetadata(PtPropertyAndValue ptPropertyAndValue) {
        Metadata propertyMetadata = new Metadata();
        LumifyProperties.CREATED_BY.setMetadata(propertyMetadata, PtUserMapper.getUserVertexId(ptPropertyAndValue.getCreatedBy()), visibility);
        LumifyProperties.CREATE_DATE.setMetadata(propertyMetadata, new Date(ptPropertyAndValue.getTimeCreated()), visibility);
        LumifyProperties.MODIFIED_BY.setMetadata(propertyMetadata, PtUserMapper.getUserVertexId(ptPropertyAndValue.getLastModifiedBy()), visibility);
        LumifyProperties.MODIFIED_DATE.setMetadata(propertyMetadata, new Date(ptPropertyAndValue.getLastModified()), visibility);
        LumifyProperties.VISIBILITY_JSON.setMetadata(propertyMetadata, visibilityJson, visibility);
        return propertyMetadata;
    }

    private void addValueToVertexBuilder(VertexBuilder v, PtPropertyType propertyType, String propertyKey, Metadata propertyMetadata, Value value) {
        if (value instanceof StringValue) {
            String innerKey = null;
            if (propertyType.isGisEnabled()) {
                innerKey = PtPropertyType.VALUE_SUFFIX;
            }
            String propertyName = getPropertyName(propertyType.getUri(), innerKey);
            String valueString = ((StringValue) value).getValue();
            Object valueObject;
            try {
                valueObject = toValue(propertyType, null, valueString);
            } catch (Exception ex) {
                LOGGER.error("Could not convert property value: %s (propertyType: %s)", value, propertyType.getConfigUri(), ex);
                valueObject = valueString;
                propertyName += PtPropertyType.ERROR_SUFFIX;
            }
            v.addPropertyValue(propertyKey, propertyName, valueObject, propertyMetadata, visibility);
        } else if (value instanceof MapValue) {
            MapValue values = (MapValue) value;
            for (Map.Entry<String, String> valueEntry : values.getValues().entrySet()) {
                String innerKey = valueEntry.getKey();
                String propertyName = getPropertyName(propertyType.getUri(), innerKey);
                String valueString = valueEntry.getValue();
                Object valueObject;
                try {
                    valueObject = toValue(propertyType, innerKey, valueString);
                } catch (Exception ex) {
                    LOGGER.error("Could not convert property value: %s (innerKey: %s, propertyType: %s): %s", value, innerKey, propertyType.getConfigUri(), ex.getMessage(), ex);
                    valueObject = valueString;
                    propertyName += PtPropertyType.ERROR_SUFFIX;
                }
                v.addPropertyValue(propertyKey, propertyName, valueObject, propertyMetadata, visibility);
            }
        } else {
            throw new RuntimeException("Unexpected value type: " + value.getClreplaced().getName());
        }
    }

    private void addGisDataToVertexBuilder(VertexBuilder v, PtPropertyType propertyType, String propertyKey, Metadata propertyMetadata, JGeometryWrapper gisData) {
        String propertyName = getBaseIri() + propertyType.getUri() + PtPropertyType.GIS_SUFFIX;
        GeoShape geoShape = toGeoShape(gisData);
        v.addPropertyValue(propertyKey, propertyName, geoShape, propertyMetadata, visibility);
    }

    private GeoShape toGeoShape(JGeometryWrapper gisData) {
        switch(gisData.getType()) {
            case POINT:
                Point2D pt = gisData.getJavaPoint();
                return new GeoPoint(pt.getY(), pt.getX());
            default:
                throw new RuntimeException("Unhandled Geo-shape: " + gisData.getType());
        }
    }

    private Object toValue(PtPropertyType ptPropertyType, String innerKey, String value) {
        String propertyType;
        if (innerKey == null) {
            propertyType = ptPropertyType.getConfigTypeBase();
        } else {
            propertyType = ptPropertyType.getConfigComponentType(innerKey);
        }
        if (propertyType == null) {
            throw new RuntimeException("Could not find property type");
        }
        if (propertyType.equals("com.palantir.type.String")) {
            return value;
        }
        if (propertyType.equals("com.palantir.type.Enumeration")) {
            return value;
        }
        if (propertyType.equals("com.palantir.type.Number")) {
            return parseNumber(value);
        }
        if (propertyType.equals("com.palantir.type.Date")) {
            return parseDate(value);
        }
        if (propertyType.equals("com.palantir.type.Composite")) {
            throw new RuntimeException("Found composite property type without innerKey");
        }
        throw new RuntimeException("Unhandled property type");
    }

    private Object parseDate(String value) {
        // July 2, 2013 09:51:48 -04:00
        try {
            return new SimpleDateFormat("MMMM d, yyyy HHmmss Z").parse(value.replaceAll(":", ""));
        } catch (ParseException ex1) {
            try {
                return new SimpleDateFormat("MMMM d, yyyy").parse(value);
            } catch (ParseException ex2) {
                throw new RuntimeException("Could not parse date", ex2);
            }
        }
    }

    private Object parseNumber(String value) {
        try {
            if (value.contains(":")) {
                Matcher m = DURATION_PATTERN.matcher(value);
                if (m.matches()) {
                    String minutePart = m.group(1);
                    String secondPart = m.group(2);
                    return ((Integer.parseInt(minutePart) * 60) + Integer.parseInt(secondPart));
                } else {
                    throw new RuntimeException("Number has a ':' but does not match duration pattern");
                }
            }
            if (value.contains(".")) {
                return Double.parseDouble(value);
            }
            return Long.parseLong(value);
        } catch (Exception ex) {
            throw new RuntimeException("Could not parse number", ex);
        }
    }

    private String getPropertyName(String uri, String innerKey) {
        return getBaseIri() + uri + (innerKey == null ? "" : ("/" + innerKey));
    }

    private Value cleanUpValueString(PtPropertyType propertyType, String value) throws IOException, SAXException {
        if (value == null) {
            return null;
        }
        value = value.trim();
        if (value.equals("<null></null>")) {
            return null;
        }
        Matcher m = VALUE_BODY_PATTERN.matcher(value);
        if (m.matches()) {
            value = m.group(1).trim();
        }
        m = VALUE_BODY_PATTERN.matcher(value);
        if (m.matches()) {
            return new StringValue(m.group(1).trim());
        }
        m = UNPARSED_VALUE_BODY_PATTERN.matcher(value);
        if (m.matches()) {
            return new StringValue(m.group(1).trim());
        }
        Doreplacedent d = dBuilder.parse(new ByteArrayInputStream(("<v>" + value + "</v>").getBytes()));
        Map<String, String> values = new HashMap<>();
        NodeList childNodes = d.getDoreplacedentElement().getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node childNode = childNodes.item(i);
            if (childNode instanceof Element) {
                Element e = (Element) childNode;
                String tagName = e.getTagName();
                values.put(tagName, e.getTextContent());
            }
        }
        return new MapValue(values);
    }

    private String getPropertyKey(PtPropertyAndValue ptPropertyAndValue) {
        return ID_PREFIX + ptPropertyAndValue.getPropertyValueId();
    }

    private static abstract clreplaced Value {
    }

    private static clreplaced StringValue extends Value {

        private final String value;

        public StringValue(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }

        @Override
        public String toString() {
            return "StringValue{" + "value='" + value + '\'' + '}';
        }
    }

    private static clreplaced MapValue extends Value {

        private final Map<String, String> values;

        public MapValue(Map<String, String> values) {
            this.values = values;
        }

        public Map<String, String> getValues() {
            return values;
        }

        @Override
        public String toString() {
            return "MapValue{" + "values=" + values + '}';
        }
    }
}

19 View Complete Implementation : AuditProperty.java
Copyright Apache License 2.0
Author : lumifyio
public AuditProperty setPreviousValue(Object previousValue, Visibility visibility) {
    set(PREVIOUS_VALUE, previousValue, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : EdgePropertySourceInfo.java
Copyright Apache License 2.0
Author : lumifyio
@Override
public void handle(HttpServletRequest request, HttpServletResponse response, HandlerChain chain) throws Exception {
    String edgeId = getRequiredParameter(request, "edgeId");
    String propertyName = getRequiredParameter(request, "propertyName");
    String visibilitySource = getRequiredParameter(request, "visibilitySource");
    String propertyKey = getOptionalParameter(request, "propertyKey");
    User user = getUser(request);
    Authorizations authorizations = getAuthorizations(request, user);
    Visibility visibility = new Visibility(visibilitySource);
    if (!graph.isVisibilityValid(visibility, authorizations)) {
        LOGGER.warn("%s is not a valid visibility for %s user", visibilitySource, user.getDisplayName());
        respondWithBadRequest(response, "visibilitySource", getString(request, "visibility.invalid"));
        chain.next(request, response);
        return;
    }
    Edge edge = this.graph.getEdge(edgeId, authorizations);
    if (edge == null) {
        throw new LumifyResourceNotFoundException("Could not find edge with id: " + edgeId, edgeId);
    }
    ClientApiObject sourceInfo = termMentionRepository.getSourceInfoForEdgeProperty(edge, propertyKey, propertyName, visibility, authorizations);
    if (sourceInfo == null) {
        throw new LumifyResourceNotFoundException("Could not find source info for edge with id: " + edgeId, edgeId);
    }
    respondWithClientApiObject(response, sourceInfo);
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setComment(String comment, Visibility visibility) {
    set(COMMENT, comment, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : ElementMaker.java
Copyright Apache License 2.0
Author : lumifyio
protected List<Property> getProperties(boolean includeHidden) {
    List<Property> results = new ArrayList<>(propertyValues.size());
    for (Map.Entry<String, byte[]> propertyValueEntry : propertyValues.entrySet()) {
        String key = propertyValueEntry.getKey();
        String propertyKey = getPropertyKeyFromColumnQualifier(propertyColumnQualifier.get(key));
        String propertyName = propertyNames.get(key);
        byte[] propertyValue = propertyValueEntry.getValue();
        Visibility propertyVisibility = propertyVisibilities.get(key);
        long propertyTimestamp = propertyTimestamps.get(key);
        Set<Visibility> propertyHiddenVisibilities = getPropertyHiddenVisibilities(propertyKey, propertyName, propertyVisibility);
        if (!includeHidden && isHidden(propertyKey, propertyName, propertyVisibility)) {
            continue;
        }
        LazyPropertyMetadata metadata = propertyMetadata.get(key);
        LazyMutableProperty property = new LazyMutableProperty(getGraph(), getGraph().getValueSerializer(), propertyKey, propertyName, propertyValue, metadata, propertyHiddenVisibilities, propertyVisibility, propertyTimestamp);
        results.add(property);
    }
    return results;
}

19 View Complete Implementation : AuditRelationship.java
Copyright Apache License 2.0
Author : lumifyio
public AuditRelationship setSourceSubtype(Object source, Visibility visibility) {
    set(SOURCE_SUBTYPE, source, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditRelationship.java
Copyright Apache License 2.0
Author : lumifyio
public AuditRelationship setSourcereplacedle(Object sourcereplacedle, Visibility visibility) {
    set(SOURCE_replacedLE, sourcereplacedle, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setUserId(String userId, Visibility visibility) {
    set(USER_ID, userId, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditRelationship.java
Copyright Apache License 2.0
Author : lumifyio
public AuditRelationship setDestreplacedle(Object destreplacedle, Visibility visibility) {
    set(DEST_replacedLE, destreplacedle, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditData.java
Copyright Apache License 2.0
Author : lumifyio
public AuditData setUser(User user, Visibility visibility) {
    setUserId(user.getUserId(), visibility);
    return this;
}

19 View Complete Implementation : LumifyVisibility.java
Copyright Apache License 2.0
Author : lumifyio
public static Visibility and(Visibility visibility, String additionalVisibility) {
    if (visibility.getVisibilityString().length() == 0) {
        return new Visibility(additionalVisibility);
    }
    return new Visibility("(" + visibility.getVisibilityString() + ")&(" + additionalVisibility + ")");
}

19 View Complete Implementation : AuditRelationship.java
Copyright Apache License 2.0
Author : lumifyio
public AuditRelationship setLabel(String label, Visibility visibility) {
    set(LABEL, label, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditData.java
Copyright Apache License 2.0
Author : lumifyio
public AuditData setMessage(String message, Visibility visibility) {
    set(MESSAGE, message, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : Replay.java
Copyright Apache License 2.0
Author : lumifyio
private void replayFile(File file) throws Exception {
    LOGGER.debug("Replaying file: " + file.getName());
    JSONObject json = readFile(file);
    Visibility visibility = new Visibility("");
    this.flightRepository.save(json, visibility, getAuthorizations());
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setPublished(String published, Visibility visibility) {
    set(PUBLISHED, published, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : PtGraphObjectMapper.java
Copyright Apache License 2.0
Author : lumifyio
public clreplaced PtGraphObjectMapper extends PalantirMapperBase<LongLongWritable, PtGraphObject> {

    private Visibility visibility;

    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
        visibility = new LumifyVisibility(WorkspaceRepository.VISIBILITY_STRING).getVisibility();
    }

    @Override
    protected void safeMap(LongLongWritable key, PtGraphObject ptGraphObject, Context context) throws Exception {
        context.setStatus(key.toString());
        String workspaceVertexId = PtGraphMapper.getWorkspaceVertexId(ptGraphObject.getGraphId());
        String objectVertexId = PtObjectMapper.getObjectVertexId(ptGraphObject.getObjectId());
        String edgeId = getWorkspaceToEnreplacedyEdgeId(workspaceVertexId, objectVertexId);
        EdgeBuilderByVertexId m = getGraph().prepareEdge(edgeId, workspaceVertexId, objectVertexId, WorkspaceRepository.WORKSPACE_TO_ENreplacedY_RELATIONSHIP_IRI, visibility);
        WorkspaceLumifyProperties.WORKSPACE_TO_ENreplacedY_VISIBLE.setProperty(m, true, visibility);
        m.save(getAuthorizations());
    }

    public static String getWorkspaceToEnreplacedyEdgeId(String workspaceVertexId, String objectVertexId) {
        return workspaceVertexId + WorkspaceRepository.WORKSPACE_TO_ENreplacedY_RELATIONSHIP_IRI + objectVertexId;
    }
}

19 View Complete Implementation : AuditProperty.java
Copyright Apache License 2.0
Author : lumifyio
public AuditProperty setPropertyMetadata(Object propertyMetadata, Visibility visibility) {
    set(PROPERTY_METADATA, propertyMetadata, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : PtNoteAndNoteValueMapper.java
Copyright Apache License 2.0
Author : lumifyio
public clreplaced PtNoteAndNoteValueMapper extends PalantirMapperBase<LongWritable, PtNoteAndNoteValue> {

    private Visibility visibility;

    private VisibilityJson visibilityJson;

    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
        visibility = new LumifyVisibility("").getVisibility();
        visibilityJson = new VisibilityJson();
    }

    @Override
    protected void safeMap(LongWritable key, PtNoteAndNoteValue ptNoteAndNoteValue, Context context) throws Exception {
        context.setStatus(key.toString());
        if (ptNoteAndNoteValue.isDeleted()) {
            return;
        }
        String objectVertexId = PtObjectMapper.getObjectVertexId(ptNoteAndNoteValue.getLinkObjectId());
        VertexBuilder v = prepareVertex(objectVertexId, visibility);
        String propertyKey = getPropertyKey(ptNoteAndNoteValue);
        String propertyValue = getPropertyValue(ptNoteAndNoteValue);
        Metadata propertyMetadata = new Metadata();
        LumifyProperties.CREATED_BY.setMetadata(propertyMetadata, PtUserMapper.getUserVertexId(ptNoteAndNoteValue.getCreatedBy()), visibility);
        LumifyProperties.CREATE_DATE.setMetadata(propertyMetadata, new Date(ptNoteAndNoteValue.getTimeCreated()), visibility);
        LumifyProperties.MODIFIED_BY.setMetadata(propertyMetadata, PtUserMapper.getUserVertexId(ptNoteAndNoteValue.getLastModifiedBy()), visibility);
        LumifyProperties.MODIFIED_DATE.setMetadata(propertyMetadata, new Date(ptNoteAndNoteValue.getLastModified()), visibility);
        LumifyProperties.VISIBILITY_JSON.setMetadata(propertyMetadata, visibilityJson, visibility);
        LumifyProperties.COMMENT.addPropertyValue(v, propertyKey, propertyValue, propertyMetadata, visibility);
        v.save(getAuthorizations());
    }

    private String getPropertyValue(PtNoteAndNoteValue ptNoteAndNoteValue) {
        StringBuilder result = new StringBuilder();
        if (ptNoteAndNoteValue.getreplacedle() != null) {
            result.append(ptNoteAndNoteValue.getreplacedle());
            result.append("\n");
        }
        if (ptNoteAndNoteValue.getContents() != null) {
            result.append(ptNoteAndNoteValue.getContents());
        }
        return result.toString().trim();
    }

    private String getPropertyKey(PtNoteAndNoteValue ptNoteAndNoteValue) {
        return Long.toString(ptNoteAndNoteValue.getId());
    }
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setActorType(UserType actorType, Visibility visibility) {
    set(ACTOR_TYPE, actorType.toString(), visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : PtObjectObjectMapper.java
Copyright Apache License 2.0
Author : lumifyio
public clreplaced PtObjectObjectMapper extends PalantirMapperBase<LongWritable, PtObjectObject> {

    private Visibility visibility;

    private VisibilityJson visibilityJson;

    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
        loadLinkTypes(context);
        visibility = new LumifyVisibility("").getVisibility();
        visibilityJson = new VisibilityJson();
    }

    @Override
    protected void safeMap(LongWritable key, PtObjectObject ptObjectObject, Context context) throws Exception {
        context.setStatus(key.toString());
        if (ptObjectObject.isDeleted()) {
            return;
        }
        String sourceVertexId = PtObjectMapper.getObjectVertexId(ptObjectObject.getParentObjectId());
        String destVertexId = PtObjectMapper.getObjectVertexId(ptObjectObject.getChildObjectId());
        PtLinkType ptLinkType = getLinkType(ptObjectObject.getType());
        if (ptLinkType == null) {
            throw new LumifyException("Could not find link type: " + ptObjectObject.getType());
        }
        String linkTypeUri = getLinkTypeUri(ptLinkType.getUri());
        String edgeId = sourceVertexId + linkTypeUri + destVertexId;
        EdgeBuilderByVertexId m = prepareEdge(edgeId, sourceVertexId, destVertexId, linkTypeUri, visibility);
        LumifyProperties.CREATED_BY.setProperty(m, PtUserMapper.getUserVertexId(ptObjectObject.getCreatedBy()), visibility);
        LumifyProperties.CREATE_DATE.setProperty(m, new Date(ptObjectObject.getTimeCreated()), visibility);
        LumifyProperties.MODIFIED_BY.setProperty(m, PtUserMapper.getUserVertexId(ptObjectObject.getLastModifiedBy()), visibility);
        LumifyProperties.MODIFIED_DATE.setProperty(m, new Date(ptObjectObject.getLastModified()), visibility);
        LumifyProperties.VISIBILITY_JSON.setProperty(m, visibilityJson, visibility);
        m.save(getAuthorizations());
    }

    protected String getLinkTypeUri(String uri) {
        return getBaseIri() + uri;
    }
}

19 View Complete Implementation : AuditProperty.java
Copyright Apache License 2.0
Author : lumifyio
public AuditProperty setPropertyKey(Object propertyKey, Visibility visibility) {
    set(PROPERTY_KEY, propertyKey, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : ImportImgMRMapper.java
Copyright Apache License 2.0
Author : lumifyio
public clreplaced ImportImgMRMapper extends LumifyElementMapperBase<SequenceFileKey, BytesWritable> {

    public static final String MULTI_VALUE_KEY = ImportJsonMR.clreplaced.getName();

    public static final String SOURCE = "TheMovieDb.org";

    private Visibility visibility;

    private AcreplaceduloAuthorizations authorizations;

    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
        this.visibility = new Visibility("");
        this.authorizations = new AcreplaceduloAuthorizations();
    }

    @Override
    protected void safeMap(SequenceFileKey key, BytesWritable value, Context context) throws Exception {
        String conceptType;
        String sourceVertexId;
        String edgeLabel;
        context.setStatus(key.getRecordType() + ":" + key.getId());
        switch(key.getRecordType()) {
            case PERSON:
                conceptType = TheMovieDbOntology.CONCEPT_TYPE_PROFILE_IMAGE;
                edgeLabel = TheMovieDbOntology.EDGE_LABEL_HAS_PROFILE_IMAGE;
                sourceVertexId = TheMovieDbOntology.getPersonVertexId(key.getId());
                break;
            case MOVIE:
                conceptType = TheMovieDbOntology.CONCEPT_TYPE_POSTER_IMAGE;
                edgeLabel = TheMovieDbOntology.EDGE_LABEL_HAS_POSTER_IMAGE;
                sourceVertexId = TheMovieDbOntology.getMovieVertexId(key.getId());
                break;
            case PRODUCTION_COMPANY:
                conceptType = TheMovieDbOntology.CONCEPT_TYPE_LOGO;
                edgeLabel = TheMovieDbOntology.EDGE_LABEL_HAS_LOGO;
                sourceVertexId = TheMovieDbOntology.getProductionCompanyVertexId(key.getId());
                break;
            default:
                throw new LumifyException("Invalid record type: " + key.getRecordType());
        }
        String edgeId = TheMovieDbOntology.getHasImageEdgeId(key.getId(), key.getImagePath());
        String replacedle = key.getreplacedle();
        String vertexId = TheMovieDbOntology.getImageVertexId(key.getImagePath());
        VertexBuilder m = prepareVertex(vertexId, visibility);
        LumifyProperties.CONCEPT_TYPE.addPropertyValue(m, MULTI_VALUE_KEY, conceptType, visibility);
        LumifyProperties.SOURCE.addPropertyValue(m, MULTI_VALUE_KEY, SOURCE, visibility);
        StreamingPropertyValue rawValue = new StreamingPropertyValue(new ByteArrayInputStream(value.getBytes()), byte[].clreplaced);
        rawValue.store(true);
        rawValue.searchIndex(false);
        LumifyProperties.RAW.addPropertyValue(m, MULTI_VALUE_KEY, rawValue, visibility);
        LumifyProperties.replacedLE.addPropertyValue(m, MULTI_VALUE_KEY, "Image of " + replacedle, visibility);
        Vertex profileImageVertex = m.save(authorizations);
        VertexBuilder sourceVertexMutation = prepareVertex(sourceVertexId, visibility);
        LumifyProperties.ENreplacedY_IMAGE_VERTEX_ID.addPropertyValue(sourceVertexMutation, MULTI_VALUE_KEY, profileImageVertex.getId(), visibility);
        Vertex sourceVertex = sourceVertexMutation.save(authorizations);
        addEdge(edgeId, sourceVertex, profileImageVertex, edgeLabel, visibility, authorizations);
        context.getCounter(TheMovieDbImportCounters.IMAGES_PROCESSED).increment(1);
    }
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setUser(User user, Visibility visibility) {
    setUserId(user.getUserId(), visibility);
    setUserName(user.getUsername(), visibility);
    setDisplayName(user.getDisplayName(), visibility);
    setActorType(user.getUserType(), visibility);
    return this;
}

19 View Complete Implementation : LoaderConstants.java
Copyright Apache License 2.0
Author : lumifyio
public final clreplaced LoaderConstants {

    public static final Visibility EMPTY_VISIBILITY = new Visibility("");

    public static final String MULTI_VALUE_KEY = TweetTransformer.clreplaced.getName();

    public static final String SOURCE_NAME = "twitter.com";

    private LoaderConstants() {
        throw new replacedertionError();
    }
}

19 View Complete Implementation : AuditProperty.java
Copyright Apache License 2.0
Author : lumifyio
public AuditProperty setNewValue(Object newValue, Visibility visibility) {
    set(NEW_VALUE, newValue, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AccumuloAuthorizations.java
Copyright Apache License 2.0
Author : lumifyio
@Override
public boolean canRead(Visibility visibility) {
    checkNotNull(visibility, "visibility is required");
    // this is just a shortcut so that we don't need to construct evaluators and visibility objects to check for an empty string.
    if (visibility.getVisibilityString().length() == 0) {
        return true;
    }
    VisibilityEvaluator visibilityEvaluator = new VisibilityEvaluator(new org.apache.acreplacedulo.core.security.Authorizations(this.getAuthorizations()));
    ColumnVisibility columnVisibility = new ColumnVisibility(visibility.getVisibilityString());
    try {
        return visibilityEvaluator.evaluate(columnVisibility);
    } catch (VisibilityParseException e) {
        throw new SecureGraphException("could not evaluate visibility " + visibility.getVisibilityString(), e);
    }
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setScmBuildNumber(String scmBuildNumber, Visibility visibility) {
    set(SCM_BUILD_NUMBER, scmBuildNumber, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : ElementMaker.java
Copyright Apache License 2.0
Author : lumifyio
private String propertyColumnQualifierToKey(Text columnQualifier, Visibility visibility) {
    return columnQualifier.toString() + ElementMutationBuilder.VALUE_SEPARATOR + visibility.toString();
}

19 View Complete Implementation : AuditRelationship.java
Copyright Apache License 2.0
Author : lumifyio
public AuditRelationship setDestSubtype(Object destSubtype, Visibility visibility) {
    set(DEST_SUBTYPE, destSubtype, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setDisplayName(String displayName, Visibility visibility) {
    set(DISPLAY_NAME, displayName, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setProcess(String process, Visibility visibility) {
    set(PROCESS, process, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setAction(AuditAction action, Visibility visibility) {
    set(ACTION, action.toString(), visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditCommon.java
Copyright Apache License 2.0
Author : lumifyio
public AuditCommon setUserName(String userName, Visibility visibility) {
    set(USER_NAME, userName, visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditData.java
Copyright Apache License 2.0
Author : lumifyio
public AuditData setUserId(Object userId, Visibility visibility) {
    set(USER_ID, userId.toString(), visibility.getVisibilityString());
    return this;
}

19 View Complete Implementation : AuditRelationship.java
Copyright Apache License 2.0
Author : lumifyio
public AuditRelationship setDestType(Object destType, Visibility visibility) {
    set(DEST_TYPE, destType, visibility.getVisibilityString());
    return this;
}