private String readString() throws IOException
    {
        final StringBuilder str = strBuf;
        final StringBuilder hex = hexBuf;
        str.setLength(0);
        int state = STRING_START;
        final FastPushbackReader in = input;

        while (true)
        {
            final int c = in.read();
            if (c == -1)
            {
                error("EOF reached while reading JSON string");
            }

            if (state == STRING_START)
            {
                if (c == '"')
                {
                    break;
                }
                else if (c == '\\')
                {
                    state = STRING_SLASH;
                }
                else
                {
                    str.appendCodePoint(c);
                }
            }
            else if (state == STRING_SLASH)
            {
                switch(c)
                {
                    case '\\':
                        str.appendCodePoint('\\');
                        break;
                    case '/':
                        str.appendCodePoint('/');
                        break;
                    case '"':
                        str.appendCodePoint('"');
                        break;
                    case '\'':
                        str.appendCodePoint('\'');
                        break;
                    case 'b':
                        str.appendCodePoint('\b');
                        break;
                    case 'f':
                        str.appendCodePoint('\f');
                        break;
                    case 'n':
                        str.appendCodePoint('\n');
                        break;
                    case 'r':
                        str.appendCodePoint('\r');
                        break;
                    case 't':
                        str.appendCodePoint('\t');
                        break;
                    case 'u':
                        hex.setLength(0);
                        state = HEX_DIGITS;
                        break;
                    default:
                        error("Invalid character escape sequence specified: " + c);
                }

                if (c != 'u')
                {
                    state = STRING_START;
                }
            }
            else
            {
                if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'))
                {
                    hex.appendCodePoint((char) c);
                    if (hex.length() == 4)
                    {
                        int value = Integer.parseInt(hex.toString(), 16);
                        str.appendCodePoint(value);
                        state = STRING_START;
                    }
                }
                else
                {
                    error("Expected hexadecimal digits");
                }
            }
        }

        final String s = str.toString();
        final String translate =  stringCache.get(s);
        return translate == null ? s : translate;
    }

Read a JSON string
This method assumes the initial quote has already been read.

@return String read from JSON input stream.
@throws IOException for stream errors or parsing errors.

Read a JSON string This method assumes the initial quote has already been read .


public static Field getField(Class c, String field)
    {
        return getDeepDeclaredFields(c).get(field);
    }

public static Field getField ( Class c , String field ) { return getDeepDeclaredFields ( c ) . get ( field ) ; }

Return an instance of of the Java Field class corresponding to the passed in field name.
@param c class containing the field / field name
@param field String name of a field on the class.
@return Field instance if the field with the corresponding name is found, null otherwise.

Return an instance of of the Java Field class corresponding to the passed in field name .


static String removeLeadingAndTrailingQuotes(String s)
    {
        Matcher m = extraQuotes.matcher(s);
        if (m.find())
        {
            s = m.group(2);
        }
        return s;
    }

static String removeLeadingAndTrailingQuotes ( String s ) { Matcher m = extraQuotes . matcher ( s ) ; if ( m . find ( ) ) { s = m . group ( 2 ) ; } return s ; }

Strip leading and trailing double quotes from the passed in String.

Strip leading and trailing double quotes from the passed in String .


public static String objectToJson(Object item, Map<String, Object> optionalArgs)
    {
        try
        {
            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            JsonWriter writer = new JsonWriter(stream, optionalArgs);
            writer.write(item);
            writer.close();
            return new String(stream.toByteArray(), "UTF-8");
        }
        catch (Exception e)
        {
            throw new JsonIoException("Unable to convert object to JSON", e);
        }
    }

public
static
String
objectToJson
(
Object
item
,
Map
<
String
,
Object
>
optionalArgs
)
{
try
{
ByteArrayOutputStream
stream
=
new
ByteArrayOutputStream
(
)
;
JsonWriter
writer
=
new
JsonWriter
(
stream
,
optionalArgs
)
;
writer
.
write
(
item
)
;
writer
.
close
(
)
;
return
new
String
(
stream
.
toByteArray
(
)
,
"UTF-8"
)
;
}
catch
(
Exception
e
)
{
throw
new
JsonIoException
(
"Unable to convert object to JSON"
,
e
)
;
}
}

Convert a Java Object to a JSON String.

@param item Object to convert to a JSON String.
@param optionalArgs (optional) Map of extra arguments indicating how dates are formatted,
what fields are written out (optional).  For Date parameters, use the public static
DATE_TIME key, and then use the ISO_DATE or ISO_DATE_TIME indicators.  Or you can specify
your own custom SimpleDateFormat String, or you can associate a SimpleDateFormat object,
in which case it will be used.  This setting is for both java.util.Date and java.sql.Date.
If the DATE_FORMAT key is not used, then dates will be formatted as longs.  This long can
be turned back into a date by using 'new Date(longValue)'.
@return String containing JSON representation of passed in object root.

Convert a Java Object to a JSON String .


public static String formatJson(String json, Map readingArgs, Map writingArgs)
    {
        Map args = new HashMap();
        if (readingArgs != null)
        {
            args.putAll(readingArgs);
        }
        args.put(JsonReader.USE_MAPS, true);
        Object obj = JsonReader.jsonToJava(json, args);
        args.clear();
        if (writingArgs != null)
        {
            args.putAll(writingArgs);
        }
        args.put(PRETTY_PRINT, true);
        return objectToJson(obj, args);
    }

public static String formatJson ( String json , Map readingArgs , Map writingArgs ) { Map args = new HashMap ( ) ; if ( readingArgs != null ) { args . putAll ( readingArgs ) ; } args . put ( JsonReader . USE_MAPS , true ) ; Object obj = JsonReader . jsonToJava ( json , args ) ; args . clear ( ) ; if ( writingArgs != null ) { args . putAll ( writingArgs ) ; } args . put ( PRETTY_PRINT , true ) ; return objectToJson ( obj , args ) ; }

Format the passed in JSON string in a nice, human readable format.
@param json String input JSON
@param readingArgs (optional) Map of extra arguments for parsing json.  Can be null.
@param writingArgs (optional) Map of extra arguments for writing out json.  Can be null.
@return String containing equivalent JSON, formatted nicely for human readability.

Format the passed in JSON string in a nice human readable format .


private void tab(Writer output, int delta) throws IOException
    {
        if (!isPrettyPrint)
        {
            return;
        }
        output.write(NEW_LINE);
        depth += delta;
        for (int i=0; i < depth; i++)
        {
            output.write("  ");
        }
    }

private
void
tab
(
Writer
output
,
int
delta
)
throws
IOException
{
if
(
!
isPrettyPrint
)
{
return
;
}
output
.
write
(
NEW_LINE
)
;
depth
+=
delta
;
for
(
int
i
=
0
;
i
<
depth
;
i
++
)
{
output
.
write
(
"  "
)
;
}
}

tab the JSON output by the given number of characters specified by delta.
@param output Writer being used for JSON outpt.
@param delta int number of characters to tab.
@throws IOException

tab the JSON output by the given number of characters specified by delta .


public boolean writeArrayElementIfMatching(Class arrayComponentClass, Object o, boolean showType, Writer output)
    {
        if (!o.getClass().isAssignableFrom(arrayComponentClass) || notCustom.contains(o.getClass()))
        {
            return false;
        }

        try
        {
            return writeCustom(arrayComponentClass, o, showType, output);
        }
        catch (IOException e)
        {
            throw new JsonIoException("Unable to write custom formatted object as array element:", e);
        }
    }

Write the passed in array element to the JSON output, if any only if, there is a customer writer
for the class of the instance 'o'.
@param arrayComponentClass Class type of the array
@param o Object instance to write
@param showType boolean indicating whether or not @type should be output.
@param output Writer to write the JSON to (if there is a custom writer for o's Class).
@return true if the array element was written, false otherwise.

Write the passed in array element to the JSON output if any only if there is a customer writer for the class of the instance o .


protected boolean writeCustom(Class arrayComponentClass, Object o, boolean showType, Writer output) throws IOException
    {
        if (neverShowType)
        {
            showType = false;
        }
		JsonClassWriterBase closestWriter = getCustomWriter(arrayComponentClass);

        if (closestWriter == null)
        {
            return false;
        }

        if (writeOptionalReference(o))
        {
            return true;
        }

        boolean referenced = objsReferenced.containsKey(o);

        if (closestWriter instanceof JsonClassWriter)
        {
            JsonClassWriter writer = (JsonClassWriter) closestWriter;
            if (writer.hasPrimitiveForm())
            {
                if ((!referenced && !showType) || closestWriter instanceof Writers.JsonStringWriter)
                {
                    if (writer instanceof Writers.DateWriter)
                    {
                        ((Writers.DateWriter)writer).writePrimitiveForm(o, output, args);
                    }
                    else
                    {
                        writer.writePrimitiveForm(o, output);
                    }
                    return true;
                }
            }
        }

        output.write('{');
        tabIn();
        if (referenced)
        {
            writeId(getId(o));
            if (showType)
            {
                output.write(',');
                newLine();
            }
        }

        if (showType)
        {
            writeType(o, output);
        }

        if (referenced || showType)
        {
            output.write(',');
            newLine();
        }

        if (closestWriter instanceof JsonClassWriterEx)
        {
            ((JsonClassWriterEx)closestWriter).write(o, showType || referenced, output, args);
        }
        else
        {
            ((JsonClassWriter)closestWriter).write(o, showType || referenced, output);
        }
        tabOut();
        output.write('}');
        return true;
    }

protected boolean writeCustom ( Class arrayComponentClass , Object o , boolean showType , Writer output ) throws IOException { if ( neverShowType ) { showType = false ; } JsonClassWriterBase closestWriter = getCustomWriter ( arrayComponentClass ) ; if ( closestWriter == null ) { return false ; } if ( writeOptionalReference ( o ) ) { return true ; } boolean referenced = objsReferenced . containsKey ( o ) ; if ( closestWriter instanceof JsonClassWriter ) { JsonClassWriter writer = ( JsonClassWriter ) closestWriter ; if ( writer . hasPrimitiveForm ( ) ) { if ( ( ! referenced && ! showType ) || closestWriter instanceof Writers . JsonStringWriter ) { if ( writer instanceof Writers . DateWriter ) { ( ( Writers . DateWriter ) writer ) . writePrimitiveForm ( o , output , args ) ; } else { writer . writePrimitiveForm ( o , output ) ; } return true ; } } } output . write ( ' ' ) ; tabIn ( ) ; if ( referenced ) { writeId ( getId ( o ) ) ; if ( showType ) { output . write ( ' ' ) ; newLine ( ) ; } } if ( showType ) { writeType ( o , output ) ; } if ( referenced || showType ) { output . write ( ' ' ) ; newLine ( ) ; } if ( closestWriter instanceof JsonClassWriterEx ) { ( ( JsonClassWriterEx ) closestWriter ) . write ( o , showType || referenced , output , args ) ; } else { ( ( JsonClassWriter ) closestWriter ) . write ( o , showType || referenced , output ) ; } tabOut ( ) ; output . write ( ' ' ) ; return true ; }

Perform the actual custom writing for an array element that has a custom writer.
@param arrayComponentClass Class type of the array
@param o Object instance to write
@param showType boolean indicating whether or not @type should be output.
@param output Writer to write the JSON to (if there is a custom writer for o's Class).
@return true if the array element was written, false otherwise.

Perform the actual custom writing for an array element that has a custom writer .


private JsonClassWriterBase forceGetCustomWriter(Class c)
    {
        JsonClassWriterBase closestWriter = nullWriter;
        int minDistance = Integer.MAX_VALUE;

        for (Map.Entry<Class, JsonClassWriterBase> entry : writers.entrySet())
        {
            Class clz = entry.getKey();
            if (clz == c)
            {
                return entry.getValue();
            }
            int distance = MetaUtils.getDistance(clz, c);
            if (distance < minDistance)
            {
                minDistance = distance;
                closestWriter = entry.getValue();
            }
        }
        return closestWriter;
    }

private JsonClassWriterBase forceGetCustomWriter ( Class c ) { JsonClassWriterBase closestWriter = nullWriter ; int minDistance = Integer . MAX_VALUE ; for ( Map . Entry < Class , JsonClassWriterBase > entry : writers . entrySet ( ) ) { Class clz = entry . getKey ( ) ; if ( clz == c ) { return entry . getValue ( ) ; } int distance = MetaUtils . getDistance ( clz , c ) ; if ( distance < minDistance ) { minDistance = distance ; closestWriter = entry . getValue ( ) ; } } return closestWriter ; }

Fetch the customer writer for the passed in Class.  This method always fetches the custom writer, doing
the complicated inheritance distance checking.  This method is only called when a cache miss has happened.
A sentinal 'nullWriter' is returned when no custom writer is found.  This prevents future cache misses
from re-attempting to find custom writers for classes that do not have a custom writer.
@param c Class of object for which fetch a custom writer
@return JsonClassWriter/JsonClassWriterEx for the custom class (if one exists), nullWriter otherwise.

Fetch the customer writer for the passed in Class . This method always fetches the custom writer doing the complicated inheritance distance checking . This method is only called when a cache miss has happened . A sentinal nullWriter is returned when no custom writer is found . This prevents future cache misses from re - attempting to find custom writers for classes that do not have a custom writer .


public void write(Object obj)
    {
        traceReferences(obj);
        objVisited.clear();
        try
        {
            writeImpl(obj, true);
        }
        catch (Exception e)
        {
            throw new JsonIoException("Error writing object to JSON:", e);
        }
        flush();
        objVisited.clear();
        objsReferenced.clear();
    }

public
void
write
(
Object
obj
)
{
traceReferences
(
obj
)
;
objVisited
.
clear
(
)
;
try
{
writeImpl
(
obj
,
true
)
;
}
catch
(
Exception
e
)
{
throw
new
JsonIoException
(
"Error writing object to JSON:"
,
e
)
;
}
flush
(
)
;
objVisited
.
clear
(
)
;
objsReferenced
.
clear
(
)
;
}

Write the passed in Java object in JSON format.
@param obj Object any Java Object or JsonObject.

Write the passed in Java object in JSON format .


protected void traceReferences(Object root)
    {
        if (root == null)
        {
            return;
        }
        Map<Class, List<Field>> fieldSpecifiers = (Map) args.get(FIELD_SPECIFIERS);
        final Deque<Object> stack = new ArrayDeque<Object>();
        stack.addFirst(root);
        final Map<Object, Long> visited = objVisited;
        final Map<Object, Long> referenced = objsReferenced;

        while (!stack.isEmpty())
        {
            final Object obj = stack.removeFirst();

            if (!MetaUtils.isLogicalPrimitive(obj.getClass()))
            {
                Long id = visited.get(obj);
                if (id != null)
                {   // Only write an object once.
                    if (id == ZERO)
                    {   // 2nd time this object has been seen, so give it a unique ID and mark it referenced
                        id = identity++;
                        visited.put(obj, id);
                        referenced.put(obj, id);
                    }
                    continue;
                }
                else
                {   // Initially, mark an object with 0 as the ID, in case it is never referenced,
                    // we don't waste the memory to store a Long instance that is never used.
                    visited.put(obj, ZERO);
                }
            }

            final Class clazz = obj.getClass();

            if (clazz.isArray())
            {
                if (!MetaUtils.isLogicalPrimitive(clazz.getComponentType()))
                {   // Speed up: do not traceReferences of primitives, they cannot reference anything
                    final int len = Array.getLength(obj);

                    for (int i = 0; i < len; i++)
                    {
                        final Object o = Array.get(obj, i);
                        if (o != null)
                        {   // Slight perf gain (null is legal)
                            stack.addFirst(o);
                        }
                    }
                }
            }
            else if (Map.class.isAssignableFrom(clazz))
            {   // Speed up - logically walk maps, as opposed to following their internal structure.
                Map map = (Map) obj;
                for (final Object item : map.entrySet())
                {
                    final Map.Entry entry = (Map.Entry) item;
                    if (entry.getValue() != null)
                    {
                        stack.addFirst(entry.getValue());
                    }
                    if (entry.getKey() != null)
                    {
                        stack.addFirst(entry.getKey());
                    }
                }
            }
            else if (Collection.class.isAssignableFrom(clazz))
            {
                for (final Object item : (Collection)obj)
                {
                    if (item != null)
                    {
                        stack.addFirst(item);
                    }
                }
            }
            else
            {   // Speed up: do not traceReferences of primitives, they cannot reference anything
				if (!MetaUtils.isLogicalPrimitive(obj.getClass()))
                {
					traceFields(stack, obj, fieldSpecifiers);
				}
            }
        }
    }

Walk object graph and visit each instance, following each field, each Collection, Map and so on.
Tracks visited to handle cycles and to determine if an item is referenced elsewhere.  If an
object is never referenced more than once, no @id field needs to be emitted for it.
@param root Object to be deeply traced.  The objVisited and objsReferenced Maps will be written to
during the trace.

Walk object graph and visit each instance following each field each Collection Map and so on . Tracks visited to handle cycles and to determine if an item is referenced elsewhere . If an object is never referenced more than once no


protected void traceFields(final Deque<Object> stack, final Object obj, final Map<Class, List<Field>> fieldSpecifiers)
    {
        // If caller has special Field specifier for a given class
        // then use it, otherwise use reflection.
        Collection<Field> fields = getFieldsUsingSpecifier(obj.getClass(), fieldSpecifiers);
        Collection<Field> fieldsBySpec = fields;
        if (fields == null)
        {   // Trace fields using reflection
            fields = MetaUtils.getDeepDeclaredFields(obj.getClass()).values();
        }
        for (final Field field : fields)
        {
            if ((field.getModifiers() & Modifier.TRANSIENT) != 0)
            {
                if (fieldsBySpec == null || !fieldsBySpec.contains(field))
                {   // Skip tracing transient fields EXCEPT when the field is listed explicitly by using the fieldSpecifiers Map.
                    // In that case, the field must be traced, even though it is transient.
                    continue;
                }
            }
            try
            {
                final Object o = field.get(obj);
                if (o != null && !MetaUtils.isLogicalPrimitive(o.getClass()))
                {   // Trace through objects that can reference other objects
                    stack.addFirst(o);
                }
            }
            catch (Exception ignored) { }
        }
    }

Reach-ability trace to visit all objects within the graph to be written.
This API will handle any object, using either reflection APIs or by
consulting a specified FIELD_SPECIFIERS map if provided.
@param stack Deque used to manage descent into graph (rather than using Java stack.) This allows for
much larger graph processing.
@param obj Object root of graph
@param fieldSpecifiers Map of optional field specifiers, which are used to override the field list returned by
the JDK reflection operations.  This allows a subset of the actual fields on an object to be serialized.

Reach - ability trace to visit all objects within the graph to be written . This API will handle any object using either reflection APIs or by consulting a specified FIELD_SPECIFIERS map if provided .


public static boolean ensureJsonPrimitiveKeys(Map map)
    {
        for (Object o : map.keySet())
        {
            if (!(o instanceof String))
            {
                return false;
            }
        }
        return true;
    }

public static boolean ensureJsonPrimitiveKeys ( Map map ) { for ( Object o : map . keySet ( ) ) { if ( ! ( o instanceof String ) ) { return false ; } } return true ; }

Ensure that all keys within the Map are String instances
@param map Map to inspect that all keys are primitive.  This allows the output JSON
to be optimized into {"key1":value1, "key2": value2} format if all the
keys of the Map are Strings.  If not, then a Map is written as two
arrays, an @keys array and an @items array.  This allows support for Maps
with non-String keys.


private void writeCollectionElement(Object o) throws IOException
    {
        if (o == null)
        {
            out.write("null");
        }
        else if (o instanceof Boolean || o instanceof Double)
        {
            writePrimitive(o, false);
        }
        else if (o instanceof Long)
        {
            writePrimitive(o, writeLongsAsStrings);
        }
        else if (o instanceof String)
        {   // Never do an @ref to a String (they are treated as logical primitives and intern'ed on read)
            writeJsonUtf8String((String) o, out);
        }
        else if (neverShowType && MetaUtils.isPrimitive(o.getClass()))
        {   // If neverShowType, then force primitives (and primitive wrappers)
            // to be output with toString() - prevents {"value":6} for example
            writePrimitive(o, false);
        }
        else
        {
            writeImpl(o, true);
        }
    }

Write an element that is contained in some type of Collection or Map.
@param o Collection element to output in JSON format.
@throws IOException if an error occurs writing to the output stream.

Write an element that is contained in some type of Collection or Map .


private static Map<String, String> createMapFromList(final List<String> all) {
		final Map<String, String> map = new ConcurrentHashMap<>();

		for (final String documentElement : all) {
			if (documentElement != null) {
				map.put(documentElement, documentElement);
			}
		}
		return map;
	}

private static Map < String , String > createMapFromList ( final List < String > all ) { final Map < String , String > map = new ConcurrentHashMap <> ( ) ; for ( final String documentElement : all ) { if ( documentElement != null ) { map . put ( documentElement , documentElement ) ; } } return map ; }

Creates the map from list.

@param all
the all
@return the map


@Embedded
    @AttributeOverrides({
        @AttributeOverride(name = "value", column = @Column(name = "SOURCE_VALUE")),
        @AttributeOverride(name = "id", column = @Column(name = "SOURCE_ID"))
    })
    public Source getSource() {
        return source;
    }

@ Embedded @ AttributeOverrides ( { @ AttributeOverride ( name = "value" , column = @ Column ( name = "SOURCE_VALUE" ) ) , @ AttributeOverride ( name = "id" , column = @ Column ( name = "SOURCE_ID" ) ) } ) public Source getSource ( ) { return source ; }


@ManyToOne(targetEntity = Topics.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "TOPICS_INDICATOR_ELEMENT_HJID")
    public Topics getTopics() {
        return topics;
    }

@ ManyToOne ( targetEntity = Topics . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "TOPICS_INDICATOR_ELEMENT_HJID" ) public Topics getTopics ( ) { return topics ; }


@Id
    @Column(name = "HJID")
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getHjid() {
        return hjid;
    }

@ Id @ Column ( name = "HJID" ) @ GeneratedValue ( strategy = GenerationType . AUTO ) public Long getHjid ( ) { return hjid ; }


@OneToMany(targetEntity = DocumentDetailData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "DOCUMENT_DETAIL_LIST_DOCUMEN_0")
    public List<DocumentDetailData> getDocumentDetailList() {
        return this.documentDetailList;
    }

@ OneToMany ( targetEntity = DocumentDetailData . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "DOCUMENT_DETAIL_LIST_DOCUMEN_0" ) public List < DocumentDetailData > getDocumentDetailList ( ) { return this . documentDetailList ; }

Gets the document detail list.

@return the document detail list


private static Axes createAxesXYDateFloat() {
		return new Axes()
				.addAxis(new XYaxis().setRenderer(AxisRenderers.DATE)
						.setTickOptions(new AxisTickRenderer().setFormatString(YEAR_MONTH_DAY_FORMAT).setFontFamily(FONT_FAMILY).setTextColor(TEXT_COLOR).setFontSize(FONT_SIZE))
						.setNumberTicks(NUMBER_TICKS_DATE))
				.addAxis(new XYaxis(XYaxes.Y).setRenderer(AxisRenderers.LINEAR).setTickOptions(new AxisTickRenderer().setFormatString(FLOAT_FORMAT).setFontFamily(FONT_FAMILY).setTextColor(TEXT_COLOR).setFontSize(FONT_SIZE)).setNumberTicks(NUMBER_TICKS));
	}

private static Axes createAxesXYDateFloat ( ) { return new Axes ( ) . addAxis ( new XYaxis ( ) . setRenderer ( AxisRenderers . DATE ) . setTickOptions ( new AxisTickRenderer ( ) . setFormatString ( YEAR_MONTH_DAY_FORMAT ) . setFontFamily ( FONT_FAMILY ) . setTextColor ( TEXT_COLOR ) . setFontSize ( FONT_SIZE ) ) . setNumberTicks ( NUMBER_TICKS_DATE ) ) . addAxis ( new XYaxis ( XYaxes . Y ) . setRenderer ( AxisRenderers . LINEAR ) . setTickOptions ( new AxisTickRenderer ( ) . setFormatString ( FLOAT_FORMAT ) . setFontFamily ( FONT_FAMILY ) . setTextColor ( TEXT_COLOR ) . setFontSize ( FONT_SIZE ) ) . setNumberTicks ( NUMBER_TICKS ) ) ; }

Creates the axes XY date float.

@return the axes


private static Grid createDefaultGrid() {
		final Grid grid = new Grid();
		grid.setBackground(BACKGROUND_COLOR);
		grid.setGridLineColor(GRIDLINE_COLOR);
		grid.setBorderColor(BORDER_COLOR);
		return grid;
	}

private static Grid createDefaultGrid ( ) { final Grid grid = new Grid ( ) ; grid . setBackground ( BACKGROUND_COLOR ) ; grid . setGridLineColor ( GRIDLINE_COLOR ) ; grid . setBorderColor ( BORDER_COLOR ) ; return grid ; }

Creates the default grid.

@return the grid


private static Legend createdLegendEnhancedInsideNorthWest() {
		return setLegendStyling(new Legend().setShow(true)
				.setRendererOptions(
						new EnhancedLegendRenderer().setSeriesToggle(SeriesToggles.NORMAL).setSeriesToggleReplot(true).setNumberColumns(LEGEND_COLUMNS).setNumberRows(LEGEND_ROWS))
				.setPlacement(LegendPlacements.INSIDE_GRID).setLocation(LegendLocations.NORTH_WEST));
	}

private static Legend createdLegendEnhancedInsideNorthWest ( ) { return setLegendStyling ( new Legend ( ) . setShow ( true ) . setRendererOptions ( new EnhancedLegendRenderer ( ) . setSeriesToggle ( SeriesToggles . NORMAL ) . setSeriesToggleReplot ( true ) . setNumberColumns ( LEGEND_COLUMNS ) . setNumberRows ( LEGEND_ROWS ) ) . setPlacement ( LegendPlacements . INSIDE_GRID ) . setLocation ( LegendLocations . NORTH_WEST ) ) ; }

Created legend enhanced inside north west.

@return the legend

Created legend enhanced inside north west .


private static Legend createdLegendEnhancedInsideWest() {
		return setLegendStyling(
				new Legend().setShow(true).setPlacement(LegendPlacements.INSIDE_GRID).setLocation(LegendLocations.WEST)
						.setRenderer(LegendRenderers.ENHANCED).setRendererOptions(new EnhancedLegendRenderer()
								.setSeriesToggle(SeriesToggles.NORMAL).setSeriesToggleReplot(true).setNumberColumns(LEGEND_COLUMNS).setNumberRows(LEGEND_ROWS)));
	}

private static Legend createdLegendEnhancedInsideWest ( ) { return setLegendStyling ( new Legend ( ) . setShow ( true ) . setPlacement ( LegendPlacements . INSIDE_GRID ) . setLocation ( LegendLocations . WEST ) . setRenderer ( LegendRenderers . ENHANCED ) . setRendererOptions ( new EnhancedLegendRenderer ( ) . setSeriesToggle ( SeriesToggles . NORMAL ) . setSeriesToggleReplot ( true ) . setNumberColumns ( LEGEND_COLUMNS ) . setNumberRows ( LEGEND_ROWS ) ) ) ; }

Created legend enhanced inside west.

@return the legend


private static Legend createLegendOutsideOneColumn() {
		return setLegendStyling(new Legend().setShow(true)
				.setRendererOptions(
						new EnhancedLegendRenderer().setSeriesToggle(SeriesToggles.NORMAL).setSeriesToggleReplot(true).setNumberColumns(ONE_COLUMN_NUMBER_OF_COLUMNS).setNumberRows(ONE_COLUMN_NUMBER_OF_ROWS))
				.setPlacement(LegendPlacements.OUTSIDE_GRID));
	}

private static Legend createLegendOutsideOneColumn ( ) { return setLegendStyling ( new Legend ( ) . setShow ( true ) . setRendererOptions ( new EnhancedLegendRenderer ( ) . setSeriesToggle ( SeriesToggles . NORMAL ) . setSeriesToggleReplot ( true ) . setNumberColumns ( ONE_COLUMN_NUMBER_OF_COLUMNS ) . setNumberRows ( ONE_COLUMN_NUMBER_OF_ROWS ) ) . setPlacement ( LegendPlacements . OUTSIDE_GRID ) ) ; }

Creates the legend outside one column.

@return the legend


private static Legend setLegendStyling(final Legend legend) {
		legend.setBackground(BACKGROUND_COLOR).setFontFamily(FONT_FAMILY).setTextColor(TEXT_COLOR).setFontSize(LEGEND_FONT_SIZE);
		return legend;
	}

private static Legend setLegendStyling ( final Legend legend ) { legend . setBackground ( BACKGROUND_COLOR ) . setFontFamily ( FONT_FAMILY ) . setTextColor ( TEXT_COLOR ) . setFontSize ( LEGEND_FONT_SIZE ) ; return legend ; }

Sets the legend styling.

@param legend
the legend
@return the legend


private static Highlighter createHighLighter() {
		return new Highlighter().setShow(true).setShowTooltip(true).setTooltipAlwaysVisible(true)
				.setKeepTooltipInsideChart(true);
	}

private static Highlighter createHighLighter ( ) { return new Highlighter ( ) . setShow ( true ) . setShowTooltip ( true ) . setTooltipAlwaysVisible ( true ) . setKeepTooltipInsideChart ( true ) ; }

Creates the high lighter.

@return the highlighter


private static Highlighter createHighLighterNorth() {
		return new Highlighter().setShow(true).setShowTooltip(true).setTooltipAlwaysVisible(true)
				.setKeepTooltipInsideChart(true).setTooltipLocation(TooltipLocations.NORTH)
				.setTooltipAxes(TooltipAxes.XY_BAR).setShowMarker(true).setBringSeriesToFront(true);
	}

private static Highlighter createHighLighterNorth ( ) { return new Highlighter ( ) . setShow ( true ) . setShowTooltip ( true ) . setTooltipAlwaysVisible ( true ) . setKeepTooltipInsideChart ( true ) . setTooltipLocation ( TooltipLocations . NORTH ) . setTooltipAxes ( TooltipAxes . XY_BAR ) . setShowMarker ( true ) . setBringSeriesToFront ( true ) ; }

Creates the high lighter north.

@return the highlighter


private static SeriesDefaults createSeriesDefaultPieChart() {
		return new SeriesDefaults().setRenderer(SeriesRenderers.PIE)
				.setRendererOptions(new PieRenderer().setShowDataLabels(true)).setShadow(true);
	}

private static SeriesDefaults createSeriesDefaultPieChart ( ) { return new SeriesDefaults ( ) . setRenderer ( SeriesRenderers . PIE ) . setRendererOptions ( new PieRenderer ( ) . setShowDataLabels ( true ) ) . setShadow ( true ) ; }

Creates the series default pie chart.

@return the series defaults


private static SeriesDefaults createDonoutSeriesDefault() {
		return new SeriesDefaults().setRenderer(SeriesRenderers.DONUT)
				.setRendererOptions(new DonutRenderer().setSliceMargin(SLICE_MARGIN).setStartAngle(START_ANGLE).setShowDataLabels(true)
						.setDataLabels(DataLabels.VALUE));
	}

private static SeriesDefaults createDonoutSeriesDefault ( ) { return new SeriesDefaults ( ) . setRenderer ( SeriesRenderers . DONUT ) . setRendererOptions ( new DonutRenderer ( ) . setSliceMargin ( SLICE_MARGIN ) . setStartAngle ( START_ANGLE ) . setShowDataLabels ( true ) . setDataLabels ( DataLabels . VALUE ) ) ; }

Creates the donout series default.

@return the series defaults


@OneToMany(targetEntity = DocumentAttachment.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "DOCUMENT_ATTACHMENT_LIST_DOC_0")
    public List<DocumentAttachment> getDocumentAttachmentList() {
        return this.documentAttachmentList;
    }

@ OneToMany ( targetEntity = DocumentAttachment . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "DOCUMENT_ATTACHMENT_LIST_DOC_0" ) public List < DocumentAttachment > getDocumentAttachmentList ( ) { return this . documentAttachmentList ; }

Gets the document attachment list.

@return the document attachment list


@Override
	public void createCommitteeeRankingMenuBar(final MenuBar menuBar) {
		initApplicationMenuBar(menuBar);

		applicationMenuItemFactory.addRankingMenu(menuBar);

		createCommitteeRankingTopics(menuBar.addItem(COMMITTEE_RANKING_TEXT, null, null));
	}

@ Override public void createCommitteeeRankingMenuBar ( final MenuBar menuBar ) { initApplicationMenuBar ( menuBar ) ; applicationMenuItemFactory . addRankingMenu ( menuBar ) ; createCommitteeRankingTopics ( menuBar . addItem ( COMMITTEE_RANKING_TEXT , null , null ) ) ; }

Creates the committeee ranking menu bar.

@param menuBar
the menu bar

Creates the committeee ranking menu bar .


@Override
	public void createCommitteeRankingTopics(final MenuItem committeeMenuItem) {
		committeeMenuItem.addItem(OVERVIEW_TEXT, VaadinIcons.GROUP, COMMAND_OVERVIEW);

		final MenuItem listByTopic = committeeMenuItem.addItem(RANKING_LIST_BY_TOPIC_TEXT, VaadinIcons.GROUP, null);

		final MenuItem listItem = listByTopic.addItem(POLITICAL_WORK_SUMMARY_TEXT,VaadinIcons.GROUP, COMMAND_DATAGRID);
		listItem.setDescription(CURRENT_AND_PAST_MEMBER_AND_SUMMARY_OF_POLTICIAL_DAYS);

		final MenuItem chartByTopic = committeeMenuItem.addItem(CHART_BY_TOPIC_TEXT, VaadinIcons.GROUP, null);

		chartByTopic.addItem(CURRENT_COMMITTEES_CURRENT_MEMBERS_TEXT,VaadinIcons.GROUP, COMMAND_CURRENT_COMMITTEES_BY_HEADCOUNT);
		chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_CURRENT_ASSIGNMENTS,VaadinIcons.GROUP, COMMAND_COMMITTEES_BY_PARTY);
		chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_TOTAL_DAYS_SERVED_IN_COMMITTEES,VaadinIcons.GROUP, COMMAND_CURRENT_COMMITTEES_BY_PARTY_DAYS_SERVED);

		chartByTopic.addItem(ALL_COMMITTEES_TOTAL_MEMBERS,VaadinIcons.GROUP, COMMAND_ALL_COMMITTEES_BY_HEADCOUNT);

		committeeMenuItem.addItem(PAGE_VISIT_HISTORY_TEXT, VaadinIcons.GROUP, COMMAND_PAGEVISIT_HISTORY);

	}

Creates the committee ranking topics.

@param committeeMenuItem
the committee menu item


@Override
	public void createOverviewPage(final VerticalLayout panelContent) {
		final ResponsiveRow grid = RowUtil.createGridLayout(panelContent);

		createButtonLink(grid,POLITICAL_WORK_SUMMARY_TEXT,VaadinIcons.GROUP, COMMAND_DATAGRID, "Scoreboard over current member size, political days served and total assignments");
		createButtonLink(grid,CURRENT_COMMITTEES_CURRENT_MEMBERS_TEXT,VaadinIcons.GROUP, COMMAND_CURRENT_COMMITTEES_BY_HEADCOUNT, "Chart over current committees and member size");

		createButtonLink(grid,CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_CURRENT_ASSIGNMENTS,VaadinIcons.GROUP, COMMAND_COMMITTEES_BY_PARTY, "Chart over current parties active in committees and member size");
		createButtonLink(grid,CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_TOTAL_DAYS_SERVED_IN_COMMITTEES,VaadinIcons.GROUP, COMMAND_CURRENT_COMMITTEES_BY_PARTY_DAYS_SERVED, "Chart over current parties active in committees days served");
		createButtonLink(grid,ALL_COMMITTEES_TOTAL_MEMBERS,VaadinIcons.GROUP, COMMAND_ALL_COMMITTEES_BY_HEADCOUNT, "Chart over all committees and member size");

		createButtonLink(grid,PAGE_VISIT_HISTORY_TEXT, VaadinIcons.GROUP, COMMAND_PAGEVISIT_HISTORY, "View history of page visit for this page.");

	}

Creates the overview page.

@param panelContent
the panel content


private void createOverviewContent(final VerticalLayout panelContent, final PersonData personData,
			final ViewRiksdagenPolitician viewRiksdagenPolitician, final String pageId) {
		LabelFactory.createHeader2Label(panelContent, OVERVIEW);

		final Link createPoliticianPageLink = getPageLinkFactory().createPoliticianPageLink(personData);
		panelContent.addComponent(createPoliticianPageLink);

		final Image image = new Image("",
				new ExternalResource(personData.getImageUrl192().replace("http://", "https://")));

		final HorizontalLayout horizontalLayout = new HorizontalLayout();
		horizontalLayout.setSizeFull();

		panelContent.addComponent(horizontalLayout);

		horizontalLayout.addComponent(image);

		getFormFactory().addFormPanelTextFields(horizontalLayout, viewRiksdagenPolitician,
				ViewRiksdagenPolitician.class, AS_LIST);

		final VerticalLayout overviewLayout = new VerticalLayout();
		overviewLayout.setSizeFull();

		panelContent.addComponent(overviewLayout);
		panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);

		getPoliticianMenuItemFactory().createOverviewPage(overviewLayout, pageId);

		panelContent.setExpandRatio(createPoliticianPageLink, ContentRatio.SMALL);
		panelContent.setExpandRatio(horizontalLayout, ContentRatio.GRID);

	}

private void createOverviewContent ( final VerticalLayout panelContent , final PersonData personData , final ViewRiksdagenPolitician viewRiksdagenPolitician , final String pageId ) { LabelFactory . createHeader2Label ( panelContent , OVERVIEW ) ; final Link createPoliticianPageLink = getPageLinkFactory ( ) . createPoliticianPageLink ( personData ) ; panelContent . addComponent ( createPoliticianPageLink ) ; final Image image = new Image ( "" , new ExternalResource ( personData . getImageUrl192 ( ) . replace ( "http://" , "https://" ) ) ) ; final HorizontalLayout horizontalLayout = new HorizontalLayout ( ) ; horizontalLayout . setSizeFull ( ) ; panelContent . addComponent ( horizontalLayout ) ; horizontalLayout . addComponent ( image ) ; getFormFactory ( ) . addFormPanelTextFields ( horizontalLayout , viewRiksdagenPolitician , ViewRiksdagenPolitician . class , AS_LIST ) ; final VerticalLayout overviewLayout = new VerticalLayout ( ) ; overviewLayout . setSizeFull ( ) ; panelContent . addComponent ( overviewLayout ) ; panelContent . setExpandRatio ( overviewLayout , ContentRatio . LARGE_FORM ) ; getPoliticianMenuItemFactory ( ) . createOverviewPage ( overviewLayout , pageId ) ; panelContent . setExpandRatio ( createPoliticianPageLink , ContentRatio . SMALL ) ; panelContent . setExpandRatio ( horizontalLayout , ContentRatio . GRID ) ; }

Creates the overview content.

@param panelContent the panel content
@param personData the person data
@param viewRiksdagenPolitician the view riksdagen politician
@param pageId the page id


@OneToMany(targetEntity = SwedenMunicipalityElectionRegionData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "KOMMUNVALKRETS_SWEDEN_MUNICI_0")
    public List<SwedenMunicipalityElectionRegionData> getKommunvalkrets() {
        return this.kommunvalkrets;
    }

@ OneToMany ( targetEntity = SwedenMunicipalityElectionRegionData . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "KOMMUNVALKRETS_SWEDEN_MUNICI_0" ) public List < SwedenMunicipalityElectionRegionData > getKommunvalkrets ( ) { return this . kommunvalkrets ; }

Gets the kommunvalkrets.

@return the kommunvalkrets


private static void configureAuthentication(final String role) {
		final Collection<GrantedAuthority> authorities = AuthorityUtils.createAuthorityList(role);
		final Authentication authentication = new UsernamePasswordAuthenticationToken("service.impl.BootstrapDefaultConfig", "n/a", authorities);
		SecurityContextHolder.getContext().setAuthentication(authentication);
	}

private static void configureAuthentication ( final String role ) { final Collection < GrantedAuthority > authorities = AuthorityUtils . createAuthorityList ( role ) ; final Authentication authentication = new UsernamePasswordAuthenticationToken ( "service.impl.BootstrapDefaultConfig" , "n/a" , authorities ) ; SecurityContextHolder . getContext ( ) . setAuthentication ( authentication ) ; }

Configure authentication.

@param role
the role


public void setList(final List<ComplianceCheck> list) {
		this.list = Collections.unmodifiableList(ListUtils.emptyIfNull(list));
	}

public void setList ( final List < ComplianceCheck > list ) { this . list = Collections . unmodifiableList ( ListUtils . emptyIfNull ( list ) ) ; }

Sets the list.

@param list
the new list


public void setStatusMap(final Map<Status, List<RuleViolation>> statusMap) {
		this.statusMap = Collections.unmodifiableMap(MapUtils.emptyIfNull(statusMap));
	}

public void setStatusMap ( final Map < Status , List < RuleViolation > > statusMap ) { this . statusMap = Collections . unmodifiableMap ( MapUtils . emptyIfNull ( statusMap ) ) ; }

Sets the status map.

@param statusMap
the new status map


public void setResourceTypeMap(final Map<ResourceType, List<RuleViolation>> resourceTypeMap) {
		this.resourceTypeMap = Collections.unmodifiableMap(MapUtils.emptyIfNull(resourceTypeMap));
	}

public void setResourceTypeMap ( final Map < ResourceType , List < RuleViolation > > resourceTypeMap ) { this . resourceTypeMap = Collections . unmodifiableMap ( MapUtils . emptyIfNull ( resourceTypeMap ) ) ; }

Sets the resource type map.

@param resourceTypeMap
the new resource type map


@OneToMany(targetEntity = SwedenMunicipalityData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "KOMMUN_SWEDEN_COUNTY_DATA_HJ_0")
    public List<SwedenMunicipalityData> getKommun() {
        return this.kommun;
    }

@ OneToMany ( targetEntity = SwedenMunicipalityData . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "KOMMUN_SWEDEN_COUNTY_DATA_HJ_0" ) public List < SwedenMunicipalityData > getKommun ( ) { return this . kommun ; }


@OneToMany(targetEntity = AssignmentElement.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "UPPDRAG_PERSON_ASSIGNMENT_EL_0")
    public List<AssignmentElement> getUppdrag() {
        return this.uppdrag;
    }

@ OneToMany ( targetEntity = AssignmentElement . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "UPPDRAG_PERSON_ASSIGNMENT_EL_0" ) public List < AssignmentElement > getUppdrag ( ) { return this . uppdrag ; }


@ManyToOne(targetEntity = DocumentProposalData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "PROPOSAL_DOCUMENT_PROPOSAL_C_0")
    public DocumentProposalData getProposal() {
        return proposal;
    }

@ ManyToOne ( targetEntity = DocumentProposalData . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "PROPOSAL_DOCUMENT_PROPOSAL_C_0" ) public DocumentProposalData getProposal ( ) { return proposal ; }

Gets the proposal.

@return the proposal


public String getPagePath() {
		if (pageReference != null && !pageReference.isEmpty()) {
			return page + PAGE_SEPARATOR + pageReference;
		} else {
			return page;
		}
	}

public String getPagePath ( ) { if ( pageReference != null && ! pageReference . isEmpty ( ) ) { return page + PAGE_SEPARATOR + pageReference ; } else { return page ; } }

Gets the page path.

@return the page path


private void updateBallot(final String ballotId) {
		try {
			configureAuthentication();
			updateService.updateVoteDataData(riksdagenApi.getBallot(ballotId));
		} catch (final DataFailureException e) {
			LOGGER.warn("Eror loading riksdagen voteData:" + ballotId + " errorMessage:", e);
		} finally {
			clearAuthentication();
		}
	}

private
void
updateBallot
(
final
String
ballotId
)
{
try
{
configureAuthentication
(
)
;
updateService
.
updateVoteDataData
(
riksdagenApi
.
getBallot
(
ballotId
)
)
;
}
catch
(
final
DataFailureException
e
)
{
LOGGER
.
warn
(
"Eror loading riksdagen voteData:"
+
ballotId
+
" errorMessage:"
,
e
)
;
}
finally
{
clearAuthentication
(
)
;
}
}

Update ballot.

@param ballotId
the ballot id


private List<ViewRiksdagenVoteDataBallotPartySummaryDaily> getMaxSizeViewRiksdagenVoteDataBallotPartySummaryDaily() {
		initPartyMap();

		final Optional<Entry<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>>> first = partyMap.entrySet()
				.stream().sorted((e1, e2) -> Integer.compare(e2.getValue().size(), e1.getValue().size())

		).findFirst();

		if (first.isPresent()) {
			return first.get().getValue();
		} else {
			return new ArrayList<>();
		}
	}

Gets the max size view riksdagen vote data ballot party summary daily.

@return the max size view riksdagen vote data ballot party summary daily

Gets the max size view riksdagen vote data ballot party summary daily .


private synchronized void initPartyMap() {
		if (partyMap == null) {
			final DataContainer<ViewRiksdagenVoteDataBallotPartySummaryDaily, RiksdagenVoteDataBallotPartyPeriodSummaryEmbeddedId> partyBallotSummaryDailyDataContainer = getApplicationManager()
					.getDataContainer(ViewRiksdagenVoteDataBallotPartySummaryDaily.class);

			partyMap = partyBallotSummaryDailyDataContainer.getAll().parallelStream().filter(Objects::nonNull)
					.collect(Collectors.groupingBy(t -> t.getEmbeddedId().getParty()));
		}
	}


private static void addPartyData(final DataSeries dataSeries, final SimpleDateFormat simpleDateFormat,
			final List<ViewRiksdagenVoteDataBallotPartySummaryDaily> list, final Function<ViewRiksdagenVoteDataBallotPartySummaryDaily, Object> t) {
		dataSeries.newSeries();
		for (final ViewRiksdagenVoteDataBallotPartySummaryDaily viewRiksdagenVoteDataBallotPartySummaryDaily : list) {
			if (viewRiksdagenVoteDataBallotPartySummaryDaily != null) {
				dataSeries.add(
						simpleDateFormat
								.format(viewRiksdagenVoteDataBallotPartySummaryDaily.getEmbeddedId().getVoteDate()),
						t.apply(viewRiksdagenVoteDataBallotPartySummaryDaily));
			}
		}
	}

Adds the party data.

@param dataSeries       the data series
@param simpleDateFormat the simple date format
@param list             the list
@param t                the t


private void createPartyBallotChart(final AbstractOrderedLayout content,final DataValueCalculator dataValueCalculator) {
		final Map<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>> map = getPartyMap();

		final DataSeries dataSeries = new DataSeries();

		final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH);

		final Series series = new Series();

		for (final Entry<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>> entry : map.entrySet()) {

			if (!"-".equals(entry.getKey())) {
				addBallotData(dataValueCalculator, dataSeries, simpleDateFormat, series, entry);
			}
		}

		addChart(content,"Party ballot chart", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true);
	}

Creates the party ballot chart.

@param dataValueCalculator
the data value calculator
@return the d charts


private void addBallotData(final DataValueCalculator dataValueCalculator, final DataSeries dataSeries,
			final SimpleDateFormat simpleDateFormat, final Series series,
			final Entry<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>> entry) {
		series.addSeries(new XYseries().setLabel(getPartyName(entry.getKey())));

		dataSeries.newSeries();
		final List<ViewRiksdagenVoteDataBallotPartySummaryDaily> list = entry.getValue();
		for (final ViewRiksdagenVoteDataBallotPartySummaryDaily viewRiksdagenVoteDataBallotPartySummaryDaily : list) {
			if (viewRiksdagenVoteDataBallotPartySummaryDaily != null) {
				dataSeries.add(
						simpleDateFormat
								.format(viewRiksdagenVoteDataBallotPartySummaryDaily.getEmbeddedId().getVoteDate()),
								dataValueCalculator.getDataValue(viewRiksdagenVoteDataBallotPartySummaryDaily));
			}
		}
	}

Adds the ballot data.

@param dataValueCalculator the data value calculator
@param dataSeries          the data series
@param simpleDateFormat    the simple date format
@param series              the series
@param entry               the entry


private static Map<Integer, Map<String, String>> createOrgMinistryMap(
			final Map<Integer, List<GovernmentBodyAnnualSummary>> data) {
		final Map<Integer, Map<String,String>> orgMinistryMap = new HashMap<>();

		final Set<Entry<Integer, List<GovernmentBodyAnnualSummary>>> entrySet = data.entrySet();

		for (final Entry<Integer, List<GovernmentBodyAnnualSummary>> entry : entrySet) {
			orgMinistryMap.put(entry.getKey(), entry.getValue().stream().collect(Collectors.groupingBy(t -> t.getOrgNumber().replaceAll("-","") ,Collectors.collectingAndThen(
                    Collectors.toList(),
                    values -> values.get(0).getMinistry()))));
		}

		return orgMinistryMap;
	}

private static Map < Integer , Map < String , String > > createOrgMinistryMap ( final Map < Integer , List < GovernmentBodyAnnualSummary > > data ) { final Map < Integer , Map < String , String > > orgMinistryMap = new HashMap <> ( ) ; final Set < Entry < Integer , List < GovernmentBodyAnnualSummary > > > entrySet = data . entrySet ( ) ; for ( final Entry < Integer , List < GovernmentBodyAnnualSummary > > entry : entrySet ) { orgMinistryMap . put ( entry . getKey ( ) , entry . getValue ( ) . stream ( ) . collect ( Collectors . groupingBy ( t -> t . getOrgNumber ( ) . replaceAll ( "-" , "" ) , Collectors . collectingAndThen ( Collectors . toList ( ) , values -> values . get ( 0 ) . getMinistry ( ) ) ) ) ) ; } return orgMinistryMap ; }

Creates the org ministry map.

@param data the data
@return the map


private static void addResultForMonth(final GovernmentBodyAnnualOutcomeSummary governmentBodyAnnualOutcomeSummary, final int month,
			final String value) {
		if (value != null && value.length() >0 ) {
			governmentBodyAnnualOutcomeSummary.addData(month,Double.valueOf(value.replaceAll(",", ".")));
		}
	}

private static void addResultForMonth ( final GovernmentBodyAnnualOutcomeSummary governmentBodyAnnualOutcomeSummary , final int month , final String value ) { if ( value != null && value . length ( ) > 0 ) { governmentBodyAnnualOutcomeSummary . addData ( month , Double . valueOf ( value . replaceAll ( "," , "." ) ) ) ; } }

Adds the result for month.

@param governmentBodyAnnualOutcomeSummary
the government body annual outcome summary
@param month
the month
@param value
the value


private static AbstractField<?> createField(final String property) {
		if (StringUtils.containsIgnoreCase(property,HIDDEN_FIELD_NAME)) {
			return new PasswordField();
		} else {
			return new TextField();
		}
	}

private static AbstractField < ? > createField ( final String property ) { if ( StringUtils . containsIgnoreCase ( property , HIDDEN_FIELD_NAME ) ) { return new PasswordField ( ) ; } else { return new TextField ( ) ; } }

Creates the field.

@param property the property
@return the abstract field


private static <T extends Serializable> void createDisplayPropertyConverters(final List<String> displayProperties,
			final ComponentContainer formContent, final Binder<T> binder, final PropertyDescriptor[] propertyDescriptors) {
		for (final String property : displayProperties) {
			final Class<?> typeOfProperty = getTypeOfProperty(propertyDescriptors, property);

			if (typeOfProperty != null) {
				final AbstractField<?> field = new TextField();
				field.setReadOnly(true);
				field.setCaption(property);
				field.setWidth(ContentSize.FULL_SIZE);
				formContent.addComponent(field);
				final Converter converter = getConverterForType(typeOfProperty);

				if (converter != null) {
					binder.forField(field).withConverter(converter).bind(property);
				} else {
					binder.forField(field).bind(property);
				}
			}
		}
	}

private static < T extends Serializable > void createDisplayPropertyConverters ( final List < String > displayProperties , final ComponentContainer formContent , final Binder < T > binder , final PropertyDescriptor [ ] propertyDescriptors ) { for ( final String property : displayProperties ) { final Class < ? > typeOfProperty = getTypeOfProperty ( propertyDescriptors , property ) ; if ( typeOfProperty != null ) { final AbstractField < ? > field = new TextField ( ) ; field . setReadOnly ( true ) ; field . setCaption ( property ) ; field . setWidth ( ContentSize . FULL_SIZE ) ; formContent . addComponent ( field ) ; final Converter converter = getConverterForType ( typeOfProperty ) ; if ( converter != null ) { binder . forField ( field ) . withConverter ( converter ) . bind ( property ) ; } else { binder . forField ( field ) . bind ( property ) ; } } } }

Creates the display property converters.

@param                     <T> the generic type
@param displayProperties   the display properties
@param formContent         the form content
@param binder              the binder
@param propertyDescriptors the property descriptors

Creates the display property converters .


private static Converter getConverterForType(final Class<?> typeOfProperty) {
		Converter converter;

		if (Date.class.equals(typeOfProperty)) {
			converter = new StringToDateConverter();
		} else if (Integer.class.equals(typeOfProperty) || "int".equalsIgnoreCase(typeOfProperty.getName())) {
			converter = new StringToIntegerConverter("Input value should be an integer");
		} else if (Long.class.equals(typeOfProperty) || "long".equalsIgnoreCase(typeOfProperty.getName())) {
			converter = new StringToLongConverter("Input value should be an long");
		} else if (BigInteger.class.equals(typeOfProperty)) {
			converter = new StringToBigIntegerConverter("Input value should be an biginteger");
		} else if (BigDecimal.class.equals(typeOfProperty)) {
			converter = new StringToBigDecimalConverter("Input value should be an bigdecimal");
		} else if (Boolean.class.equals(typeOfProperty) || "boolean".equalsIgnoreCase(typeOfProperty.getName())) {
			converter = new StringToBooleanConverter("Input value should be an boolean");
		} else if (typeOfProperty.isEnum()) {
			converter = new StringToEnumConverter();
		} else {
			converter = null;
		}

		return converter;
	}

private
static
Converter
getConverterForType
(
final
Class
<
>
typeOfProperty
)
{
Converter
converter
;
if
(
Date
.
class
.
equals
(
typeOfProperty
)
)
{
converter
=
new
StringToDateConverter
(
)
;
}
else
if
(
Integer
.
class
.
equals
(
typeOfProperty
)
||
"int"
.
equalsIgnoreCase
(
typeOfProperty
.
getName
(
)
)
)
{
converter
=
new
StringToIntegerConverter
(
"Input value should be an integer"
)
;
}
else
if
(
Long
.
class
.
equals
(
typeOfProperty
)
||
"long"
.
equalsIgnoreCase
(
typeOfProperty
.
getName
(
)
)
)
{
converter
=
new
StringToLongConverter
(
"Input value should be an long"
)
;
}
else
if
(
BigInteger
.
class
.
equals
(
typeOfProperty
)
)
{
converter
=
new
StringToBigIntegerConverter
(
"Input value should be an biginteger"
)
;
}
else
if
(
BigDecimal
.
class
.
equals
(
typeOfProperty
)
)
{
converter
=
new
StringToBigDecimalConverter
(
"Input value should be an bigdecimal"
)
;
}
else
if
(
Boolean
.
class
.
equals
(
typeOfProperty
)
||
"boolean"
.
equalsIgnoreCase
(
typeOfProperty
.
getName
(
)
)
)
{
converter
=
new
StringToBooleanConverter
(
"Input value should be an boolean"
)
;
}
else
if
(
typeOfProperty
.
isEnum
(
)
)
{
converter
=
new
StringToEnumConverter
(
)
;
}
else
{
converter
=
;
}
return
converter
;
}

Gets the converter for type.

@param typeOfProperty
the type of property
@return the converter for type


private static Class<?> getTypeOfProperty(final PropertyDescriptor[] propertyDescriptors, final String property) {

		for (final PropertyDescriptor propertyDescriptor : propertyDescriptors) {
			if (propertyDescriptor.getName().equalsIgnoreCase(property)) {
				return propertyDescriptor.getPropertyType();
			}
		}
		return null;
	}

private static Class < ? > getTypeOfProperty ( final PropertyDescriptor [ ] propertyDescriptors , final String property ) { for ( final PropertyDescriptor propertyDescriptor : propertyDescriptors ) { if ( propertyDescriptor . getName ( ) . equalsIgnoreCase ( property ) ) { return propertyDescriptor . getPropertyType ( ) ; } } return null ; }

Gets the type of property.

@param propertyDescriptors
the property descriptors
@param property
the property
@return the type of property


@OneToMany(targetEntity = DocumentActivityData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "DOCUMENT_ACTIVITIES_DOCUMENT_0")
    public List<DocumentActivityData> getDocumentActivities() {
        return this.documentActivities;
    }

@ OneToMany ( targetEntity = DocumentActivityData . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "DOCUMENT_ACTIVITIES_DOCUMENT_0" ) public List < DocumentActivityData > getDocumentActivities ( ) { return this . documentActivities ; }

Gets the document activities.

@return the document activities


protected final UserAccount getUserAccountFromSecurityContext() {
		final SecurityContext context = SecurityContextHolder.getContext();
		if (context != null) {
			final Authentication authentication = context.getAuthentication();
			if (authentication != null) {
				return userDAO.findFirstByProperty(UserAccount_.userId, authentication.getPrincipal().toString());
			}
		}

		return null;
	}

protected final UserAccount getUserAccountFromSecurityContext ( ) { final SecurityContext context = SecurityContextHolder . getContext ( ) ; if ( context != null ) { final Authentication authentication = context . getAuthentication ( ) ; if ( authentication != null ) { return userDAO . findFirstByProperty ( UserAccount_ . userId , authentication . getPrincipal ( ) . toString ( ) ) ; } } return null ; }

Gets the user account from security context.

@return the user account from security context

Gets the user account from security context .


@OneToMany(targetEntity = SwedenCountyData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "COUNTY_REGIONS_SWEDEN_COUNTY_0")
    public List<SwedenCountyData> getCountyRegions() {
        return this.countyRegions;
    }

@ OneToMany ( targetEntity = SwedenCountyData . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "COUNTY_REGIONS_SWEDEN_COUNTY_0" ) public List < SwedenCountyData > getCountyRegions ( ) { return this . countyRegions ; }

Gets the county regions.

@return the county regions


@ManyToOne(targetEntity = AgainstProposalContainer.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "AGAINST_PROPOSAL_CONTAINER_C_0")
    public AgainstProposalContainer getAgainstProposalContainer() {
        return againstProposalContainer;
    }

@ ManyToOne ( targetEntity = AgainstProposalContainer . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "AGAINST_PROPOSAL_CONTAINER_C_0" ) public AgainstProposalContainer getAgainstProposalContainer ( ) { return againstProposalContainer ; }

Gets the against proposal container.

@return the against proposal container


@ManyToOne(targetEntity = CommitteeProposalContainer.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "COMMITTEE_PROPOSAL_CONTAINER_0")
    public CommitteeProposalContainer getCommitteeProposalContainer() {
        return committeeProposalContainer;
    }

@ ManyToOne ( targetEntity = CommitteeProposalContainer . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "COMMITTEE_PROPOSAL_CONTAINER_0" ) public CommitteeProposalContainer getCommitteeProposalContainer ( ) { return committeeProposalContainer ; }

Gets the committee proposal container.

@return the committee proposal container


@OneToMany(targetEntity = ApplicationActionEvent.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "EVENTS_APPLICATION_SESSION_H_0")
    public List<ApplicationActionEvent> getEvents() {
        if (events == null) {
            events = new ArrayList<>();
        }
        return this.events;
    }

@ OneToMany ( targetEntity = ApplicationActionEvent . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "EVENTS_APPLICATION_SESSION_H_0" ) public List < ApplicationActionEvent > getEvents ( ) { if ( events == null ) { events = new ArrayList <> ( ) ; } return this . events ; }

Gets the value of the events property.

This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a set method for the events property.

For example, to add a new item, do as follows:

getEvents().add(newItem);

Objects of the following type(s) are allowed in the list
{@link ApplicationActionEvent }


protected final String getPageId(final String parameters) {
		if (parameters != null) {
			String cleanedString = parameters;
			if (parameters.contains("[")) {
				cleanedString = cleanedString.replace(cleanedString.substring(cleanedString.indexOf('[') , cleanedString.lastIndexOf(']')+1), "");
			}

			return cleanedString.substring(cleanedString.lastIndexOf('/') + "/".length(), cleanedString.length());
		} else {
			return "";
		}
	}

protected final String getPageId ( final String parameters ) { if ( parameters != null ) { String cleanedString = parameters ; if ( parameters . contains ( "[" ) ) { cleanedString = cleanedString . replace ( cleanedString . substring ( cleanedString . indexOf ( ' ' ) , cleanedString . lastIndexOf ( ' ' ) + 1 ) , "" ) ; } return cleanedString . substring ( cleanedString . lastIndexOf ( ' ' ) + "/" . length ( ) , cleanedString . length ( ) ) ; } else { return "" ; } }

Gets the page id.

@param parameters
the parameters
@return the page id


protected final int getPageNr(final String parameters) {
		final String cleanedString = parameters;
		String pageNrValue;
		if (cleanedString != null && cleanedString.contains("[") && cleanedString.contains("]")) {
			pageNrValue = cleanedString.substring(cleanedString.indexOf('[') + 1, cleanedString.lastIndexOf(']'));
		} else {
			pageNrValue = "";
		}

		int pageNr = 1;

		if (pageNrValue.length() > 0 && !pageNrValue.contains("/")) {
			pageNr = Integer.parseInt(pageNrValue);
		}
		return pageNr;
	}

protected final int getPageNr ( final String parameters ) { final String cleanedString = parameters ; String pageNrValue ; if ( cleanedString != null && cleanedString . contains ( "[" ) && cleanedString . contains ( "]" ) ) { pageNrValue = cleanedString . substring ( cleanedString . indexOf ( ' ' ) + 1 , cleanedString . lastIndexOf ( ' ' ) ) ; } else { pageNrValue = "" ; } int pageNr = 1 ; if ( pageNrValue . length ( ) > 0 && ! pageNrValue . contains ( "/" ) ) { pageNr = Integer . parseInt ( pageNrValue ) ; } return pageNr ; }

Gets the page nr.

@param parameters the parameters
@return the page nr


protected final VerticalLayout createPanelContent() {
		final VerticalLayout panelContent = new VerticalLayout();
		panelContent.setMargin(true);
		panelContent.setWidth(100, Unit.PERCENTAGE);
		panelContent.setHeight(100, Unit.PERCENTAGE);
		panelContent.setStyleName("Header");
		return panelContent;
	}

protected final VerticalLayout createPanelContent ( ) { final VerticalLayout panelContent = new VerticalLayout ( ) ; panelContent . setMargin ( true ) ; panelContent . setWidth ( 100 , Unit . PERCENTAGE ) ; panelContent . setHeight ( 100 , Unit . PERCENTAGE ) ; panelContent . setStyleName ( "Header" ) ; return panelContent ; }

Creates the panel content.

@return the vertical layout


protected final void createPageVisitHistory(final String pageName, final String pageId,
			final VerticalLayout panelContent) {

		final TabSheet tabsheet = new TabSheet();
		tabsheet.setWidth(100, Unit.PERCENTAGE);
		tabsheet.setHeight(100, Unit.PERCENTAGE);

		panelContent.addComponent(tabsheet);
		panelContent.setExpandRatio(tabsheet, ContentRatio.LARGE);

		final HorizontalLayout tabContentPageItemRankHistory = new HorizontalLayout();
		tabContentPageItemRankHistory.setWidth(100, Unit.PERCENTAGE);
		tabContentPageItemRankHistory.setHeight(100, Unit.PERCENTAGE);
		final Tab tabPageItemRankHistory = tabsheet.addTab(tabContentPageItemRankHistory);

		tabPageItemRankHistory.setCaption(CURRENT_PAGE_VISIT_HISTORY);
		adminChartDataManager.createApplicationActionEventPageElementDailySummaryChart(tabContentPageItemRankHistory,
				pageName, pageId);

		final HorizontalLayout tabContentPageModeSummary = new HorizontalLayout();
		tabContentPageModeSummary.setWidth(100, Unit.PERCENTAGE);
		tabContentPageModeSummary.setHeight(100, Unit.PERCENTAGE);
		final Tab tabPageModeSummary = tabsheet.addTab(tabContentPageModeSummary);
		tabPageModeSummary.setCaption(GENERAL_PAGE_MODE_PAGE_VISIT);

		adminChartDataManager.createApplicationActionEventPageModeDailySummaryChart(tabContentPageModeSummary,
				pageName);

	}

Creates the page visit history.

@param pageName
the page name
@param pageId
the page id
@param panelContent
the panel content


private static void addPoliticianIndicatorData(final List<ViewRiksdagenVoteDataBallotPoliticianSummaryDaily> list,
			final DataSeries dataSeries, final SimpleDateFormat simpleDateFormat) {
		addPoliticanData(list, dataSeries, simpleDateFormat, ViewRiksdagenVoteDataBallotPoliticianSummaryDaily::getWonPercentage);
		addPoliticanData(list, dataSeries, simpleDateFormat, ViewRiksdagenVoteDataBallotPoliticianSummaryDaily::getRebelPercentage);
		addPoliticanData(list, dataSeries, simpleDateFormat, ViewRiksdagenVoteDataBallotPoliticianSummaryDaily::getPoliticianPercentageAbsent);
		addPoliticanData(list, dataSeries, simpleDateFormat, ViewRiksdagenVoteDataBallotPoliticianSummaryDaily::getNumberBallots);
	}

Adds the politician indicator data.

@param list
the list
@param dataSeries
the data series
@param simpleDateFormat
the simple date format


private static void addPoliticanData(final List<ViewRiksdagenVoteDataBallotPoliticianSummaryDaily> list,
			final DataSeries dataSeries, final SimpleDateFormat simpleDateFormat, final Function<ViewRiksdagenVoteDataBallotPoliticianSummaryDaily, Object> t) {
		dataSeries.newSeries();
		for (final ViewRiksdagenVoteDataBallotPoliticianSummaryDaily viewRiksdagenVoteDataBallotPoliticianSummaryDaily : list) {
			if (viewRiksdagenVoteDataBallotPoliticianSummaryDaily != null) {
				dataSeries.add(
						simpleDateFormat.format(
								viewRiksdagenVoteDataBallotPoliticianSummaryDaily.getEmbeddedId().getVoteDate()),
						t.apply(viewRiksdagenVoteDataBallotPoliticianSummaryDaily));
			}
		}
	}

Adds the politican data.

@param list             the list
@param dataSeries       the data series
@param simpleDateFormat the simple date format
@param t                the t


public void setGoogleAuthScratchCodes(final List<Integer> googleAuthScratchCodes) {
		if (googleAuthScratchCodes != null) {
			this.googleAuthScratchCodes = googleAuthScratchCodes.stream().collect(Collectors.toList());
		}
	}

public void setGoogleAuthScratchCodes ( final List < Integer > googleAuthScratchCodes ) { if ( googleAuthScratchCodes != null ) { this . googleAuthScratchCodes = googleAuthScratchCodes . stream ( ) . collect ( Collectors . toList ( ) ) ; } }

Sets the google auth scratch codes.

@param googleAuthScratchCodes
the new google auth scratch codes


public final void createRoleGhant(final AbstractOrderedLayout roleSummaryLayoutTabsheet, final Collection<T> assignmentList) {

		final Comparator<T> compare = getComparator();

		final List<T> list = assignmentList.stream().filter(
				(final T x) -> new DateTime(getStepMapping().getFromDate(x).getTime()).getYear() > FILTER_DATA_BEFORE_YEAR)
				.collect(Collectors.toList());

		Collections.sort(list, compare);

		final Gantt createGantt = createGenericGantt(list, getRoleMapping(), getStepMapping());
		roleSummaryLayoutTabsheet.addComponent(createGantt);
		roleSummaryLayoutTabsheet.setExpandRatio(createGantt, ContentRatio.GRID);

	}

public final void createRoleGhant ( final AbstractOrderedLayout roleSummaryLayoutTabsheet , final Collection < T > assignmentList ) { final Comparator < T > compare = getComparator ( ) ; final List < T > list = assignmentList . stream ( ) . filter ( ( final T x ) -> new DateTime ( getStepMapping ( ) . getFromDate ( x ) . getTime ( ) ) . getYear ( ) > FILTER_DATA_BEFORE_YEAR ) . collect ( Collectors . toList ( ) ) ; Collections . sort ( list , compare ) ; final Gantt createGantt = createGenericGantt ( list , getRoleMapping ( ) , getStepMapping ( ) ) ; roleSummaryLayoutTabsheet . addComponent ( createGantt ) ; roleSummaryLayoutTabsheet . setExpandRatio ( createGantt , ContentRatio . GRID ) ; }

Creates the role ghant.

@param roleSummaryLayoutTabsheet the role summary layout tabsheet
@param assignmentList            the assignment list


private Gantt createGenericGantt(final List<T> assignmentList, final Function<T, String> roleMapping,
			final StepMapping<T> stepMapping) {

		final Map<String, List<T>> assignmentListMap = assignmentList.stream()
				.collect(Collectors.groupingBy(roleMapping, TreeMap::new, Collectors.toList()));

		final Gantt gantt = createGantt();

		if (!assignmentList.isEmpty()) {

			gantt.setStartDate(stepMapping.getFromDate(assignmentList.get(0)));
			gantt.setEndDate(
					stripDatesAfterCurrentDate(stepMapping.getToDate(assignmentList.get(assignmentList.size() - 1))));

			for (final Entry<String, List<T>> entry : entriesSortedByValues(assignmentListMap, stepMapping)) {

				final String stepName = entry.getKey();

				final Step step = new Step(stepName,CaptionMode.HTML);
				step.setDescription(stepName);

				final List<T> assignments = entry.getValue();

				Collections.sort(assignments, getComparator());

				addViewGenericRoleMemberToStep(stepName, step, assignments, stepMapping);

				gantt.addStep(step);
			}
		}

		return gantt;
	}

private Gantt createGenericGantt ( final List < T > assignmentList , final Function < T , String > roleMapping , final StepMapping < T > stepMapping ) { final Map < String , List < T > > assignmentListMap = assignmentList . stream ( ) . collect ( Collectors . groupingBy ( roleMapping , TreeMap :: new , Collectors . toList ( ) ) ) ; final Gantt gantt = createGantt ( ) ; if ( ! assignmentList . isEmpty ( ) ) { gantt . setStartDate ( stepMapping . getFromDate ( assignmentList . get ( 0 ) ) ) ; gantt . setEndDate ( stripDatesAfterCurrentDate ( stepMapping . getToDate ( assignmentList . get ( assignmentList . size ( ) - 1 ) ) ) ) ; for ( final Entry < String , List < T > > entry : entriesSortedByValues ( assignmentListMap , stepMapping ) ) { final String stepName = entry . getKey ( ) ; final Step step = new Step ( stepName , CaptionMode . HTML ) ; step . setDescription ( stepName ) ; final List < T > assignments = entry . getValue ( ) ; Collections . sort ( assignments , getComparator ( ) ) ; addViewGenericRoleMemberToStep ( stepName , step , assignments , stepMapping ) ; gantt . addStep ( step ) ; } } return gantt ; }

Creates the generic gantt.

@param assignmentList
the assignment list
@param roleMapping
the role mapping
@param stepMapping
the step mapping
@return the gantt


private SortedSet<Map.Entry<String, List<T>>> entriesSortedByValues(final Map<String, List<T>> map,
			final StepMapping<T> stepMapping) {
		final Comparator<? super Entry<String, List<T>>> compare = (o1, o2) -> {

			final Comparator<T> compare1 = (o11, o21) -> {
				final int compareDate = stepMapping.getFromDate(o11).compareTo(stepMapping.getFromDate(o21));
				if (compareDate == 0) {
					final int compareType = stepMapping.getRoleCode(o11).compareTo(stepMapping.getRoleCode(o21));
					if (compareType == 0) {
						return stepMapping.getOrg(o11).compareTo(stepMapping.getOrg(o21));
					} else {
						return compareType;
					}
				}

				return compareDate;
			};

			Collections.sort(o1.getValue(), compare1);
			Collections.sort(o2.getValue(), compare1);

			return compare1.compare(o1.getValue().get(0), o2.getValue().get(0));
		};

		final SortedSet<Map.Entry<String, List<T>>> sortedEntries = new TreeSet<>(compare);
		sortedEntries.addAll(map.entrySet());
		return sortedEntries;
	}

private SortedSet < Map . Entry < String , List < T > > > entriesSortedByValues ( final Map < String , List < T > > map , final StepMapping < T > stepMapping ) { final Comparator < ? super Entry < String , List < T > > > compare = ( o1 , o2 ) -> { final Comparator < T > compare1 = ( o11 , o21 ) -> { final int compareDate = stepMapping . getFromDate ( o11 ) . compareTo ( stepMapping . getFromDate ( o21 ) ) ; if ( compareDate == 0 ) { final int compareType = stepMapping . getRoleCode ( o11 ) . compareTo ( stepMapping . getRoleCode ( o21 ) ) ; if ( compareType == 0 ) { return stepMapping . getOrg ( o11 ) . compareTo ( stepMapping . getOrg ( o21 ) ) ; } else { return compareType ; } } return compareDate ; } ; Collections . sort ( o1 . getValue ( ) , compare1 ) ; Collections . sort ( o2 . getValue ( ) , compare1 ) ; return compare1 . compare ( o1 . getValue ( ) . get ( 0 ) , o2 . getValue ( ) . get ( 0 ) ) ; } ; final SortedSet < Map . Entry < String , List < T > > > sortedEntries = new TreeSet <> ( compare ) ; sortedEntries . addAll ( map . entrySet ( ) ) ; return sortedEntries ; }

Entries sorted by values.

@param map
the map
@param stepMapping
the step mapping
@return the sorted set


private void addViewGenericRoleMemberToStep(final String stepName, final Step step, final List<T> assignments,
			final StepMapping<T> stepMapping) {

		for (final T assignmentData : assignments) {

			String subStepName = "";

			if (stepMapping.getRoleCode(assignmentData) != null) {
				subStepName = new StringBuilder().append(stepMapping.getFirstName(assignmentData))
						.append(CONTENT_SEPARATOR).append(stepMapping.getLastName(assignmentData))
						.append(PARTY_START_TAG).append(stepMapping.getParty(assignmentData)).append(PARTY_END_TAG)
						.toString();
			}

			final SubStep sameRoleSubStep = new SubStep(stepName + '.' + subStepName,CaptionMode.HTML);
			sameRoleSubStep.setDescription(stepName + '.' + subStepName);
			sameRoleSubStep.setBackgroundColor(stepMapping.getBackgroundColor(assignmentData));

			sameRoleSubStep.setStartDate(stepMapping.getFromDate(assignmentData).getTime());
			sameRoleSubStep.setEndDate(stripDatesAfterCurrentDate(stepMapping.getToDate(assignmentData)).getTime());

			step.addSubStep(sameRoleSubStep);
		}
	}

private void addViewGenericRoleMemberToStep ( final String stepName , final Step step , final List < T > assignments , final StepMapping < T > stepMapping ) { for ( final T assignmentData : assignments ) { String subStepName = "" ; if ( stepMapping . getRoleCode ( assignmentData ) != null ) { subStepName = new StringBuilder ( ) . append ( stepMapping . getFirstName ( assignmentData ) ) . append ( CONTENT_SEPARATOR ) . append ( stepMapping . getLastName ( assignmentData ) ) . append ( PARTY_START_TAG ) . append ( stepMapping . getParty ( assignmentData ) ) . append ( PARTY_END_TAG ) . toString ( ) ; } final SubStep sameRoleSubStep = new SubStep ( stepName + ' ' + subStepName , CaptionMode . HTML ) ; sameRoleSubStep . setDescription ( stepName + ' ' + subStepName ) ; sameRoleSubStep . setBackgroundColor ( stepMapping . getBackgroundColor ( assignmentData ) ) ; sameRoleSubStep . setStartDate ( stepMapping . getFromDate ( assignmentData ) . getTime ( ) ) ; sameRoleSubStep . setEndDate ( stripDatesAfterCurrentDate ( stepMapping . getToDate ( assignmentData ) ) . getTime ( ) ) ; step . addSubStep ( sameRoleSubStep ) ; } }

Adds the view generic role member to step.

@param stepName
the step name
@param step
the step
@param assignments
the assignments
@param stepMapping
the step mapping

Adds the view generic role member to step .


private static final Date stripDatesAfterCurrentDate(final Date toDate) {
		final DateTime currentTime = new DateTime();

		if (currentTime.isBefore(toDate.getTime())) {
			return currentTime.plusDays(1).toDate();
		} else {
			return toDate;
		}
	}

private static final Date stripDatesAfterCurrentDate ( final Date toDate ) { final DateTime currentTime = new DateTime ( ) ; if ( currentTime . isBefore ( toDate . getTime ( ) ) ) { return currentTime . plusDays ( 1 ) . toDate ( ) ; } else { return toDate ; } }

Strip dates after current date.

@param toDate
the to date
@return the date


private static final Gantt createGantt() {
		final Gantt gantt = new Gantt();
		gantt.setSizeFull();
		gantt.setWidth(100, Unit.PERCENTAGE);
		gantt.setHeight(100, Unit.PERCENTAGE);
		gantt.setResizableSteps(false);
		gantt.setMovableSteps(false);
		gantt.setResolution(Resolution.Week);
		return gantt;
	}

private static final Gantt createGantt ( ) { final Gantt gantt = new Gantt ( ) ; gantt . setSizeFull ( ) ; gantt . setWidth ( 100 , Unit . PERCENTAGE ) ; gantt . setHeight ( 100 , Unit . PERCENTAGE ) ; gantt . setResizableSteps ( false ) ; gantt . setMovableSteps ( false ) ; gantt . setResolution ( Resolution . Week ) ; return gantt ; }


protected final String convertToYearsString(final long totalDays) {
		final long years = totalDays / DAYS_PER_STANDARD_YEAR;
		final long days = totalDays - years * DAYS_PER_STANDARD_YEAR;

		return years + " Years " + days + " days";
	}

protected
final
String
convertToYearsString
(
final
long
totalDays
)
{
final
long
years
=
totalDays
/
DAYS_PER_STANDARD_YEAR
;
final
long
days
=
totalDays
years
*
DAYS_PER_STANDARD_YEAR
;
return
years
+
" Years "
+
days
+
" days"
;
}

Convert to years string.

@param totalDays
the total days
@return the string


private Object loadSecretXADataSource(final Reference ref) {
		return loadBaseDataSource(new SecretPGXADataSource(((SecretReference)ref).getSecretCredentialsManager()), ref);
	}

private Object loadSecretXADataSource ( final Reference ref ) { return loadBaseDataSource ( new SecretPGXADataSource ( ( ( SecretReference ) ref ) . getSecretCredentialsManager ( ) ) , ref ) ; }

Load secret XA data source.

@param ref the ref
@return the object


private void sendMessage(final DataAgentWorkOrder workOrder) {

		switch (workOrder.getTarget()) {
		case MODEL_EXTERNAL_RIKSDAGEN:
			for (final RiksdagenDataSources datasource :RiksdagenDataSources.values()) {
				jmsSender.send(riksdagenApiDestination, datasource);
			}
			break;
		case MODEL_EXTERNAL_WORLDBANK:
			for (final WorldBankDataSources datasource :WorldBankDataSources.values()) {
				jmsSender.send(worldBankApiDestination, datasource);
			}
			break;
		default:
			break;
		}
	}

private void sendMessage ( final DataAgentWorkOrder workOrder ) { switch ( workOrder . getTarget ( ) ) { case MODEL_EXTERNAL_RIKSDAGEN : for ( final RiksdagenDataSources datasource : RiksdagenDataSources . values ( ) ) { jmsSender . send ( riksdagenApiDestination , datasource ) ; } break ; case MODEL_EXTERNAL_WORLDBANK : for ( final WorldBankDataSources datasource : WorldBankDataSources . values ( ) ) { jmsSender . send ( worldBankApiDestination , datasource ) ; } break ; default : break ; } }

Send message.

@param workOrder
the work order


@OneToMany(targetEntity = DocumentPersonReferenceData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "DOCUMENT_PERSON_REFERENCE_LI_1")
    public List<DocumentPersonReferenceData> getDocumentPersonReferenceList() {
        return this.documentPersonReferenceList;
    }

@ OneToMany ( targetEntity = DocumentPersonReferenceData . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "DOCUMENT_PERSON_REFERENCE_LI_1" ) public List < DocumentPersonReferenceData > getDocumentPersonReferenceList ( ) { return this . documentPersonReferenceList ; }

Gets the document person reference list.

@return the document person reference list

Gets the document person reference list .


private static String cleanupDecision(final String chamber) {
		return chamber.toUpperCase(Locale.ENGLISH).replace("(UTSKOTTET)", "").replace("UTKOTTET", "UTSKOTTET").replace("UTBSKOTTET", "UTSKOTTET").replace("UBTSKOTTET", "UTSKOTTET").replace("(", "").replace(")","");
	}

private static String cleanupDecision ( final String chamber ) { return chamber . toUpperCase ( Locale . ENGLISH ) . replace ( "(UTSKOTTET)" , "" ) . replace ( "UTKOTTET" , "UTSKOTTET" ) . replace ( "UTBSKOTTET" , "UTSKOTTET" ) . replace ( "UBTSKOTTET" , "UTSKOTTET" ) . replace ( "(" , "" ) . replace ( ")" , "" ) ; }

Cleanup decision.

@param chamber
the chamber
@return the string


private static String getDocumentName(final DocumentStatusContainer document) {
		if ("prop".equalsIgnoreCase(document.getDocument().getDocumentType())) {
			return "Proposition";
		} else if (document.getDocument().getSubType() != null && document.getDocument().getSubType().length() > "motion".length()) {
			return document.getDocument().getSubType();
		} else {
			return "Motion";
		}

	}

private static String getDocumentName ( final DocumentStatusContainer document ) { if ( "prop" . equalsIgnoreCase ( document . getDocument ( ) . getDocumentType ( ) ) ) { return "Proposition" ; } else if ( document . getDocument ( ) . getSubType ( ) != null && document . getDocument ( ) . getSubType ( ) . length ( ) > "motion" . length ( ) ) { return document . getDocument ( ) . getSubType ( ) ; } else { return "Motion" ; } }

Gets the document name.

@param document
the document
@return the document name


private static String getCommittteeShortName(final DocumentProposalData proposal) {
		final String upperCase = proposal.getProcessedIn().replaceAll("\\d","").replace("/:","").toUpperCase(Locale.ENGLISH);

		if (upperCase.contains(",")) {
			return upperCase.substring(0, upperCase.indexOf(','));
		} else {
			return upperCase;
		}
	}

private static String getCommittteeShortName ( final DocumentProposalData proposal ) { final String upperCase = proposal . getProcessedIn ( ) . replaceAll ( "\\d" , "" ) . replace ( "/:" , "" ) . toUpperCase ( Locale . ENGLISH ) ; if ( upperCase . contains ( "," ) ) { return upperCase . substring ( 0 , upperCase . indexOf ( ' ' ) ) ; } else { return upperCase ; } }

Gets the committtee short name.

@param proposal
the proposal
@return the committtee short name


private void blockByUserFailedLoginAttempts(final String email, final LoginBlockResultImpl loginBlockResultImpl) {
		final UserAccount userExist = userDAO.findFirstByProperty(UserAccount_.email, email);

		if (userExist != null) {

			final ApplicationConfiguration maxLoginAttemptsByUser = applicationConfigurationService.checkValueOrLoadDefault(MAX_FAILED_LOGIN_ATTEMPTS_RECENT_HOUR_PER_USER, BLOCKS_ANY_LOGIN_ATTEMPTS_AFTER_THIS_NUMBER_IS_REACHED, ConfigurationGroup.AUTHENTICATION, LoginBlockedAccessImpl.class.getSimpleName(), LOGIN_BLOCKER, BLOCKS_LOGIN_ATTEMPTS, APPLICATION_AUTHENTICATION_ALLOW_MAX_RECENT_FAILED_LOGINS_BY_USER, DEFAULT_MAX_LOGIN_ATTEMPTS);

			final List<ApplicationActionEvent> failedLoginsByThisUser = applicationActionEventDAO.findListByProperty(
					new Object[] { email, ApplicationOperationType.AUTHENTICATION, ServiceResult.FAILURE.toString() },
					ApplicationActionEvent_.elementId, ApplicationActionEvent_.applicationOperation,
					ApplicationActionEvent_.applicationMessage);

			final Date oneHourAgo = new Date(System.currentTimeMillis() - ONE_HOUR);
			final Map<Boolean, List<ApplicationActionEvent>> recentOldLoginAttemptsMap = failedLoginsByThisUser.stream()
					.collect(Collectors.groupingBy((final ApplicationActionEvent x ) -> x.getCreatedDate().after(oneHourAgo)));
			final List<ApplicationActionEvent> recentFailedLogins = recentOldLoginAttemptsMap.get(Boolean.TRUE);
			if (recentFailedLogins != null && recentFailedLogins.size() > NumberUtils.toInt(maxLoginAttemptsByUser.getPropertyValue(),DEFAULT_MAX_LOGINS)) {
				loginBlockResultImpl.setBlocked(true);
				loginBlockResultImpl.addMessages(BLOCKED_BY_MORE_THAN_5_RECENT_LOGIN_ATTEMPTS_BY_THIS_USER);
			}
		}
	}

Block by user failed login attempts.

@param email
the email
@param loginBlockResultImpl
the login block result impl


private void blockBySessionOrIpFailedLoginAttempts(final String sessionId, final LoginBlockResultImpl loginBlockResultImpl) {
		final ApplicationSession applicationSession = applicationSessionDAO
				.findFirstByProperty(ApplicationSession_.sessionId, sessionId);

		if (applicationSession != null) {

			final ApplicationConfiguration maxLoginAttemptsBySession = applicationConfigurationService.checkValueOrLoadDefault(MAX_FAILED_LOGIN_ATTEMPTS_RECENT_HOUR_PER_SESSION, BLOCKS_ANY_LOGIN_ATTEMPTS_AFTER_THIS_NUMBER_IS_REACHED, ConfigurationGroup.AUTHENTICATION, LoginBlockedAccessImpl.class.getSimpleName(), LOGIN_BLOCKER, BLOCKS_LOGIN_ATTEMPTS, APPLICATION_AUTHENTICATION_ALLOW_MAX_RECENT_FAILED_LOGINS_BY_SESSION,DEFAULT_MAX_LOGIN_ATTEMPTS);
			final List<ApplicationActionEvent> failedLoginsByThisSession = applicationActionEventDAO.findListByProperty(
					new Object[] { sessionId, ApplicationOperationType.AUTHENTICATION,
							ServiceResult.FAILURE.toString() },
					ApplicationActionEvent_.sessionId, ApplicationActionEvent_.applicationOperation,
					ApplicationActionEvent_.applicationMessage);
			if (failedLoginsByThisSession.size() > NumberUtils.toInt(maxLoginAttemptsBySession.getPropertyValue(),DEFAULT_MAX_LOGINS)) {
				loginBlockResultImpl.setBlocked(true);
				loginBlockResultImpl.addMessages(BLOCKED_BY_MORE_THAN_5_LOGIN_ATTEMPTS_BY_THIS_SESSION);
			}

			if (!("0:0:0:0:0:0:0:1".equals(applicationSession.getIpInformation()) || "127.0.0.1".equals(applicationSession.getIpInformation()))) {

				final List<ApplicationSession> applicationSessionsByIp = applicationSessionDAO
						.findListByProperty(ApplicationSession_.ipInformation, applicationSession.getIpInformation());

				final List<String> sessionIdsWithIp = applicationSessionsByIp.stream().map(ApplicationSession::getSessionId)
						.collect(Collectors.toList());

				final List<ApplicationActionEvent> applicationEventsWithIp = applicationActionEventDAO
						.findListByPropertyInList(ApplicationActionEvent_.sessionId,
								sessionIdsWithIp.toArray(new Object[sessionIdsWithIp.size()]));

				final Date oneHourAgo = new Date(System.currentTimeMillis() - ONE_HOUR);
				final Map<Boolean, List<ApplicationActionEvent>> recentOldLoginAttemptsMap = applicationEventsWithIp
						.stream()
						.filter((final ApplicationActionEvent x) -> x.getApplicationOperation() == ApplicationOperationType.AUTHENTICATION
								&& x.getApplicationMessage().equals(ServiceResult.FAILURE.toString()))
						.collect(Collectors.groupingBy((final ApplicationActionEvent x) -> x.getCreatedDate().after(oneHourAgo)));
				final List<ApplicationActionEvent> recentFailedLogins = recentOldLoginAttemptsMap
						.get(Boolean.TRUE);

				final ApplicationConfiguration maxLoginAttemptsByIp = applicationConfigurationService.checkValueOrLoadDefault(MAX_FAILED_LOGIN_ATTEMPTS_RECENT_HOUR_PER_IP, BLOCKS_ANY_LOGIN_ATTEMPTS_AFTER_THIS_NUMBER_IS_REACHED, ConfigurationGroup.AUTHENTICATION, LoginBlockedAccessImpl.class.getSimpleName(), LOGIN_BLOCKER, BLOCKS_LOGIN_ATTEMPTS, APPLICATION_AUTHENTICATION_ALLOW_MAX_RECENT_FAILED_LOGINS_BY_IP, DEFAULT_MAX_LOGIN_ATTEMPTS);
				if (recentFailedLogins != null && recentFailedLogins.size() > NumberUtils.toInt(maxLoginAttemptsByIp.getPropertyValue(),DEFAULT_MAX_LOGINS_BY_IP)) {
					loginBlockResultImpl.setBlocked(true);
					loginBlockResultImpl.addMessages(BLOCKED_BY_MORE_THAN_5_RECENT_LOGIN_ATTEMPTS_BY_THIS_IP);
				}
			}
		}
	}

Block by session or ip failed login attempts.

@param sessionId
the session id
@param loginBlockResultImpl
the login block result impl

Block by session or ip failed login attempts .


private static void navigateToPage(final RuleViolation violation) {
		if (violation.getResourceType() == ResourceType.PARTY) {
			UI.getCurrent().getNavigator().navigateTo(UserViews.PARTY_VIEW_NAME + PAGE_SEPARATOR + violation.getId());
		} else {
			UI.getCurrent().getNavigator().navigateTo(UserViews.POLITICIAN_VIEW_NAME + PAGE_SEPARATOR + violation.getId());
		}
	}

private static void navigateToPage ( final RuleViolation violation ) { if ( violation . getResourceType ( ) == ResourceType . PARTY ) { UI . getCurrent ( ) . getNavigator ( ) . navigateTo ( UserViews . PARTY_VIEW_NAME + PAGE_SEPARATOR + violation . getId ( ) ) ; } else { UI . getCurrent ( ) . getNavigator ( ) . navigateTo ( UserViews . POLITICIAN_VIEW_NAME + PAGE_SEPARATOR + violation . getId ( ) ) ; } }

Navigate to page.

@param violation
the violation


protected ApplicationManager getApplicationManager() {
		return WebApplicationContextUtils
				.getWebApplicationContext(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
						.getRequest().getSession(true).getServletContext())
				.getBean(ApplicationManager.class);
	}

protected ApplicationManager getApplicationManager ( ) { return WebApplicationContextUtils . getWebApplicationContext ( ( ( ServletRequestAttributes ) RequestContextHolder . currentRequestAttributes ( ) ) . getRequest ( ) . getSession ( true ) . getServletContext ( ) ) . getBean ( ApplicationManager . class ) ; }

Gets the application manager.

@return the application manager


protected void showNotification(final String caption, final String description, final Type type) {
		Notification.show(caption, description, type);
	}

protected void showNotification ( final String caption , final String description , final Type type ) { Notification . show ( caption , description , type ) ; }

Show notification.

@param caption     the caption
@param description the description
@param type        the type


@OneToMany(targetEntity = Topic.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "TOPIC_TOPICS_HJID")
    public List<Topic> getTopic() {
        return this.topic;
    }

@ OneToMany ( targetEntity = Topic . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "TOPIC_TOPICS_HJID" ) public List < Topic > getTopic ( ) { return this . topic ; }


private static void addSourcesAndIndicatorsToMenu(final MenuItem countryIndicators,
			final Map<String, List<ViewWorldbankIndicatorDataCountrySummary>> sourceIndicatorMap) {

		final Map<String, List<ViewWorldbankIndicatorDataCountrySummary>> sortedIndicatorMap = sourceIndicatorMap
				.entrySet().stream().sorted((e1, e2) -> e1.getKey().compareTo(e2.getKey()))
				.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));

		for (final Entry<String, List<ViewWorldbankIndicatorDataCountrySummary>> entry : sortedIndicatorMap
				.entrySet()) {

			final MenuItem sourceItems = countryIndicators.addItem(entry.getKey(), null, null);

			final List<ViewWorldbankIndicatorDataCountrySummary> sortedEntries = entry.getValue().stream()
					.sorted((e1, e2) -> e1.getIndicatorName().compareTo(e2.getIndicatorName()))
					.collect(Collectors.toList());

			for (final ViewWorldbankIndicatorDataCountrySummary indciatorSummary : sortedEntries) {
				final MenuItem addItem = sourceItems.addItem(indciatorSummary.getIndicatorName(),
						new PageModeMenuCommand(UserViews.COUNTRY_RANKING_VIEW_NAME, PageMode.INDICATORS,
								indciatorSummary.getEmbeddedId().getIndicatorId()));
				addItem.setStyleName("RestrictedHeader");
			}
		}

	}

Adds the sources and indicators to menu.

@param countryIndicators
the country indicators
@param sourceIndicatorMap
the source indicator map

Adds the sources and indicators to menu .


private Map<String, List<ViewWorldbankIndicatorDataCountrySummary>> getTopicIndicatorMap() {
		final DataContainer<ViewWorldbankIndicatorDataCountrySummary, WorldbankIndicatorDataCountrySummaryEmbeddedId> indicatorDataCountrSummaryDailyDataContainer = applicationManager
				.getDataContainer(ViewWorldbankIndicatorDataCountrySummary.class);

		return indicatorDataCountrSummaryDailyDataContainer
				.findListByEmbeddedProperty(ViewWorldbankIndicatorDataCountrySummary.class,ViewWorldbankIndicatorDataCountrySummary_.embeddedId,WorldbankIndicatorDataCountrySummaryEmbeddedId.class,WorldbankIndicatorDataCountrySummaryEmbeddedId_.countryId,"SE").parallelStream()
				.filter(t -> t != null && t.getSourceValue() != null && t.getEndYear() > DATA_POINTS_FOR_YEAR_ABOVE && t.getDataPoint() > MINIMUM_NUMBER_DATA_POINTS)
				.flatMap(t -> Arrays.asList(t.getTopics().split(";")).stream()
						.map(topic -> new AbstractMap.SimpleEntry<>(topic, t)))

				.collect(Collectors.groupingBy(SimpleEntry::getKey,
						Collectors.mapping(SimpleEntry::getValue, Collectors.toList())));
	}

Gets the topic indicator map.

@return the topic indicator map


@ElementCollection
    @OrderColumn(name = "HJINDEX")
    @Column(name = "HJVALUE")
    @CollectionTable(name = "USER_ACCOUNT_ADDRESS", joinColumns = {
        @JoinColumn(name = "HJID")
    })
    public List<String> getAddress() {
        if (address == null) {
            address = new ArrayList<>();
        }
        return this.address;
    }

@ ElementCollection @ OrderColumn ( name = "HJINDEX" ) @ Column ( name = "HJVALUE" ) @ CollectionTable ( name = "USER_ACCOUNT_ADDRESS" , joinColumns = { @ JoinColumn ( name = "HJID" ) } ) public List < String > getAddress ( ) { if ( address == null ) { address = new ArrayList <> ( ) ; } return this . address ; }

Gets the value of the address property.

This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a set method for the address property.

For example, to add a new item, do as follows:

getAddress().add(newItem);

Objects of the following type(s) are allowed in the list
{@link String }

Gets the value of the address property .


protected final void addCacheHints(final TypedQuery<?> typedQuery, final String comment) {
		typedQuery.setHint("org.hibernate.cacheMode", CacheMode.NORMAL);
		typedQuery.setHint("org.hibernate.cacheable", Boolean.TRUE);
		typedQuery.setHint("org.hibernate.comment", comment);
	}

protected final void addCacheHints ( final TypedQuery < ? > typedQuery , final String comment ) { typedQuery . setHint ( "org.hibernate.cacheMode" , CacheMode . NORMAL ) ; typedQuery . setHint ( "org.hibernate.cacheable" , Boolean . TRUE ) ; typedQuery . setHint ( "org.hibernate.comment" , comment ) ; }

Adds the cache hints.

@param typedQuery
the typed query
@param comment
the comment


protected final List<String> getStringIdList(final SingularAttribute<T, String> property) {
		final CriteriaQuery<String> criteria = getCriteriaBuilder().createQuery(String.class);
		final Root<T> root = criteria.from(persistentClass);
		criteria.select(getCriteriaBuilder().construct(String.class,root.get(property)));
		return getEntityManager().createQuery(criteria).getResultList();
	}

protected final List < String > getStringIdList ( final SingularAttribute < T , String > property ) { final CriteriaQuery < String > criteria = getCriteriaBuilder ( ) . createQuery ( String . class ) ; final Root < T > root = criteria . from ( persistentClass ) ; criteria . select ( getCriteriaBuilder ( ) . construct ( String . class , root . get ( property ) ) ) ; return getEntityManager ( ) . createQuery ( criteria ) . getResultList ( ) ; }

Gets the string id list.

@param property
the property
@return the string id list


private static List<String> readUsingZipInputStream(final InputStream inputStream) throws IOException {
		final BufferedInputStream bis = new BufferedInputStream(inputStream);
		final ZipInputStream is = new ZipInputStream(bis);

		final List<String> list = new ArrayList<>();
		try {
			ZipEntry entry;

			while ((entry = is.getNextEntry()) != null) {
				if (entry.getName().startsWith("API_SWE_")) {
					list.addAll(readCsvContent(is));
				}
			}
		} finally {
			is.close();
		}
		return list;
	}

private static List < String > readUsingZipInputStream ( final InputStream inputStream ) throws IOException { final BufferedInputStream bis = new BufferedInputStream ( inputStream ) ; final ZipInputStream is = new ZipInputStream ( bis ) ; final List < String > list = new ArrayList <> ( ) ; try { ZipEntry entry ; while ( ( entry = is . getNextEntry ( ) ) != null ) { if ( entry . getName ( ) . startsWith ( "API_SWE_" ) ) { list . addAll ( readCsvContent ( is ) ) ; } } } finally { is . close ( ) ; } return list ; }

Read using zip input stream.

@param inputStream
the input stream
@param specificFields
the specific fields
@return the list
@throws IOException
Signals that an I/O exception has occurred.