Search in sources :

Example 36 with JsonIgnore

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore in project Gaffer by gchq.

the class NamedOperationDetail method getOperationChainWithDefaultParams.

/**
 * Gets the OperationChain after adding in default values for any parameters. If a parameter
 * does not have a default, null is inserted.
 *
 * @return The {@link OperationChain}
 * @throws IllegalArgumentException if substituting the parameters fails
 */
@JsonIgnore
public OperationChain getOperationChainWithDefaultParams() {
    String opStringWithDefaults = operations;
    if (null != parameters) {
        for (final Map.Entry<String, ParameterDetail> parameterDetailPair : parameters.entrySet()) {
            String paramKey = parameterDetailPair.getKey();
            try {
                opStringWithDefaults = opStringWithDefaults.replace(buildParamNameString(paramKey), new String(JSONSerialiser.serialise(parameterDetailPair.getValue().getDefaultValue(), CHARSET_NAME), CHARSET_NAME));
            } catch (final SerialisationException | UnsupportedEncodingException e) {
                throw new IllegalArgumentException(e.getMessage());
            }
        }
    }
    OperationChain opChain;
    try {
        opChain = JSONSerialiser.deserialise(opStringWithDefaults.getBytes(CHARSET_NAME), OperationChainDAO.class);
    } catch (final Exception e) {
        throw new IllegalArgumentException(e.getMessage());
    }
    return opChain;
}
Also used : OperationChainDAO(uk.gov.gchq.gaffer.operation.OperationChainDAO) SerialisationException(uk.gov.gchq.gaffer.exception.SerialisationException) OperationChain(uk.gov.gchq.gaffer.operation.OperationChain) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Map(java.util.Map) SerialisationException(uk.gov.gchq.gaffer.exception.SerialisationException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 37 with JsonIgnore

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore in project Gaffer by gchq.

the class NamedOperation method getOperations.

@Override
@JsonIgnore
public List<Operation> getOperations() {
    final List<Operation> operations = new ArrayList<>();
    if (null != parameters) {
        for (final Map.Entry<String, Object> parameterDetailPair : parameters.entrySet()) {
            Object paramValue = parameterDetailPair.getValue();
            if (paramValue instanceof Operation) {
                Operation operation = (Operation) paramValue;
                operations.add(operation);
            }
        }
    }
    return operations;
}
Also used : ArrayList(java.util.ArrayList) Operation(uk.gov.gchq.gaffer.operation.Operation) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 38 with JsonIgnore

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore in project Gaffer by gchq.

the class StoreProperties method getOperationDeclarations.

/**
 * Returns the operation definitions from the file specified in the
 * properties.
 * This is an optional feature, so if the property does not exist then this
 * function
 * will return an empty object.
 *
 * @return The Operation Definitions to load dynamically
 */
@JsonIgnore
public OperationDeclarations getOperationDeclarations() {
    OperationDeclarations declarations = null;
    final String declarationsPaths = get(StoreProperties.OPERATION_DECLARATIONS);
    if (null != declarationsPaths) {
        declarations = OperationDeclarations.fromPaths(declarationsPaths);
    }
    if (null == declarations) {
        declarations = new OperationDeclarations.Builder().build();
    }
    return declarations;
}
Also used : ToStringBuilder(uk.gov.gchq.gaffer.commonutil.ToStringBuilder) HashCodeBuilder(org.apache.commons.lang3.builder.HashCodeBuilder) EqualsBuilder(org.apache.commons.lang3.builder.EqualsBuilder) OperationDeclarations(uk.gov.gchq.gaffer.store.operation.declaration.OperationDeclarations) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 39 with JsonIgnore

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore in project Gaffer by gchq.

the class SchemaElementDefinition method createFullAggregator.

@JsonIgnore
private synchronized void createFullAggregator() {
    if (null == fullAggregatorCache) {
        // NB Need to check if fullAggregatorCache is null again as there may be two calls to createFullAggregator
        // in sequence and we don't want to repeat the work of creating the aggregator
        fullAggregatorCache = new ElementAggregator();
        if (aggregate) {
            if (null != aggregator) {
                fullAggregatorCache.getComponents().addAll(aggregator.getComponents());
            }
            final Set<String> aggregatorProperties = getAggregatorProperties();
            for (final Entry<String, String> entry : getPropertyMap().entrySet()) {
                if (!aggregatorProperties.contains(entry.getKey())) {
                    addTypeAggregateFunction(fullAggregatorCache, entry.getKey(), entry.getValue());
                }
            }
        }
        fullAggregatorCache.lock();
    }
}
Also used : ElementAggregator(uk.gov.gchq.gaffer.data.element.function.ElementAggregator) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 40 with JsonIgnore

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore in project Gaffer by gchq.

the class SchemaElementDefinition method createIngestAggregator.

@JsonIgnore
private synchronized void createIngestAggregator() {
    if (null == ingestAggregatorCache) {
        // NB Need to check if ingestAggregatorCache is null again as there may be two calls to createIngestAggregator
        // in sequence and we don't want to repeat the work of creating the aggregator
        ingestAggregatorCache = new ElementAggregator();
        if (aggregate) {
            final Set<String> aggregatorProperties = getAggregatorProperties();
            if (null != aggregator) {
                for (final TupleAdaptedBinaryOperator<String, ?> component : aggregator.getComponents()) {
                    final String[] selection = component.getSelection();
                    if (selection.length == 1 && !groupBy.contains(selection[0]) && !selection[0].equals(schemaReference.getVisibilityProperty())) {
                        ingestAggregatorCache.getComponents().add(component);
                    } else if (!CollectionUtil.containsAny(groupBy, selection)) {
                        ingestAggregatorCache.getComponents().add(component);
                    }
                }
            }
            for (final Entry<String, String> entry : getPropertyMap().entrySet()) {
                if (!aggregatorProperties.contains(entry.getKey())) {
                    if (!groupBy.contains(entry.getKey()) && !entry.getKey().equals(schemaReference.getVisibilityProperty())) {
                        addTypeAggregateFunction(ingestAggregatorCache, entry.getKey(), entry.getValue());
                    }
                }
            }
        }
        ingestAggregatorCache.lock();
    }
}
Also used : ElementAggregator(uk.gov.gchq.gaffer.data.element.function.ElementAggregator) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Aggregations

JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)111 lombok.val (lombok.val)14 ArrayList (java.util.ArrayList)11 HashMap (java.util.HashMap)8 Map (java.util.Map)8 HashSet (java.util.HashSet)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 Date (java.util.Date)5 Field (com.hortonworks.registries.common.Schema.Field)4 Set (java.util.Set)4 Schema (com.hortonworks.registries.common.Schema)3 PrimaryKey (com.hortonworks.registries.storage.PrimaryKey)3 EntitlementException (com.sun.identity.entitlement.EntitlementException)3 PolicyException (com.sun.identity.policy.PolicyException)3 JsonArray (io.vertx.core.json.JsonArray)3 List (java.util.List)3 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)2 TrustAndKeyProvider (com.codingchili.core.security.TrustAndKeyProvider)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2