Compare commits
8 commits
78e6fda4cc
...
f98a53362e
Author | SHA1 | Date | |
---|---|---|---|
f98a53362e | |||
f0f915ddc1 | |||
e44bda8db2 | |||
93c06e728a | |||
6bf7610328 | |||
b5cfdaef21 | |||
be08c8c7e4 | |||
9227238b25 |
277 changed files with 1276 additions and 25267 deletions
10
.classpath
10
.classpath
|
@ -2,7 +2,7 @@
|
|||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
|
@ -18,10 +18,8 @@
|
|||
<classpathentry kind="lib" path="lib/commons-text-1.9.jar" sourcepath="lib/commons-text-1.9-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/tika-core-1.24.1.jar" sourcepath="lib/tika-core-1.24.1-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/catgenerator-core-0.1.7.jar" sourcepath="lib/catgenerator-core-0.1.7-sources.zip"/>
|
||||
<classpathentry kind="lib" path="lib/xidyn-1.11.2.jar" sourcepath="lib/xidyn-1.11.2-sources.zip"/>
|
||||
<classpathentry kind="lib" path="lib/jOpenDocument-1.3.jar" sourcepath="lib/jOpenDocument-src-1.3.zip"/>
|
||||
<classpathentry kind="lib" path="lib/threeten-extra-1.5.0.jar" sourcepath="lib/threeten-extra-1.5.0-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/devinsy-strings-0.11.4.jar" sourcepath="lib/devinsy-strings-0.11.4-sources.zip"/>
|
||||
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.32.jar" sourcepath="lib/Logs/slf4j-api-1.7.32-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Logs/log4j-api-2.17.1.jar" sourcepath="lib/Logs/log4j-api-2.17.1-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Logs/log4j-core-2.17.1.jar" sourcepath="lib/Logs/log4j-core-2.17.1-sources.jar"/>
|
||||
|
@ -32,5 +30,11 @@
|
|||
<classpathentry kind="lib" path="lib/postgresql-42.3.3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/sqlite-jdbc-3.36.0.3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/mysql-jdbc-5.0.8.jar"/>
|
||||
<classpathentry kind="lib" path="lib/devinsy-strings-0.17.0.jar" sourcepath="lib/devinsy-strings-0.17.0-sources.zip"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/apache-tomcat-10.1.12">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="jst.utility"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -11,9 +11,9 @@ org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
|
|||
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
|
@ -22,19 +22,28 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
|||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
org.eclipse.jdt.core.compiler.source=17
|
||||
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
|
||||
org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line=false
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.align_with_spaces=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant=49
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field=49
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=49
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method=49
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package=49
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type=49
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_assertion_message=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
||||
|
@ -44,6 +53,8 @@ org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0
|
|||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
|
||||
|
@ -52,6 +63,7 @@ org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
|
|||
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_record_components=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
|
||||
|
@ -62,8 +74,10 @@ org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
|||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_type_annotations=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
|
||||
|
@ -112,6 +126,7 @@ org.eclipse.jdt.core.formatter.comment.indent_tag_description=false
|
|||
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
|
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert
|
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags=false
|
||||
org.eclipse.jdt.core.formatter.comment.line_length=80
|
||||
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
|
||||
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
|
||||
|
@ -191,6 +206,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arg
|
|||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert
|
||||
|
@ -282,6 +298,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_ar
|
|||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert
|
||||
|
@ -365,6 +382,8 @@ org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false
|
|||
org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line=one_line_never
|
||||
org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line=one_line_never
|
||||
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never
|
||||
org.eclipse.jdt.core.formatter.lineSplit=200
|
||||
|
@ -395,6 +414,7 @@ org.eclipse.jdt.core.formatter.text_block_indentation=0
|
|||
org.eclipse.jdt.core.formatter.use_on_off_tags=false
|
||||
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||
org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
|
||||
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
|
||||
|
@ -404,5 +424,6 @@ org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
|
|||
org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator=false
|
||||
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
||||
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
cleanup.add_all=false
|
||||
cleanup.add_default_serial_version_id=false
|
||||
cleanup.add_generated_serial_version_id=true
|
||||
cleanup.add_missing_annotations=true
|
||||
|
@ -7,34 +8,78 @@ cleanup.add_missing_nls_tags=false
|
|||
cleanup.add_missing_override_annotations=true
|
||||
cleanup.add_missing_override_annotations_interface_methods=true
|
||||
cleanup.add_serial_version_id=true
|
||||
cleanup.also_simplify_lambda=true
|
||||
cleanup.always_use_blocks=true
|
||||
cleanup.always_use_parentheses_in_expressions=false
|
||||
cleanup.always_use_this_for_non_static_field_access=true
|
||||
cleanup.always_use_this_for_non_static_method_access=false
|
||||
cleanup.array_with_curly=false
|
||||
cleanup.arrays_fill=false
|
||||
cleanup.bitwise_conditional_expression=false
|
||||
cleanup.boolean_literal=false
|
||||
cleanup.boolean_value_rather_than_comparison=true
|
||||
cleanup.break_loop=false
|
||||
cleanup.collection_cloning=false
|
||||
cleanup.comparing_on_criteria=false
|
||||
cleanup.comparison_statement=false
|
||||
cleanup.controlflow_merge=false
|
||||
cleanup.convert_functional_interfaces=false
|
||||
cleanup.convert_to_enhanced_for_loop=false
|
||||
cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
|
||||
cleanup.convert_to_switch_expressions=false
|
||||
cleanup.correct_indentation=true
|
||||
cleanup.do_while_rather_than_while=true
|
||||
cleanup.double_negation=false
|
||||
cleanup.else_if=false
|
||||
cleanup.embedded_if=false
|
||||
cleanup.evaluate_nullable=false
|
||||
cleanup.extract_increment=false
|
||||
cleanup.format_source_code=true
|
||||
cleanup.format_source_code_changes_only=false
|
||||
cleanup.hash=false
|
||||
cleanup.if_condition=false
|
||||
cleanup.insert_inferred_type_arguments=false
|
||||
cleanup.instanceof=false
|
||||
cleanup.instanceof_keyword=false
|
||||
cleanup.invert_equals=false
|
||||
cleanup.join=false
|
||||
cleanup.lazy_logical_operator=false
|
||||
cleanup.make_local_variable_final=false
|
||||
cleanup.make_parameters_final=true
|
||||
cleanup.make_private_fields_final=false
|
||||
cleanup.make_type_abstract_if_missing_method=false
|
||||
cleanup.make_variable_declarations_final=true
|
||||
cleanup.map_cloning=false
|
||||
cleanup.merge_conditional_blocks=false
|
||||
cleanup.multi_catch=false
|
||||
cleanup.never_use_blocks=false
|
||||
cleanup.never_use_parentheses_in_expressions=true
|
||||
cleanup.no_string_creation=false
|
||||
cleanup.no_super=false
|
||||
cleanup.number_suffix=false
|
||||
cleanup.objects_equals=false
|
||||
cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=true
|
||||
cleanup.operand_factorization=false
|
||||
cleanup.organize_imports=false
|
||||
cleanup.overridden_assignment=false
|
||||
cleanup.overridden_assignment_move_decl=true
|
||||
cleanup.plain_replacement=false
|
||||
cleanup.precompile_regex=false
|
||||
cleanup.primitive_comparison=false
|
||||
cleanup.primitive_parsing=false
|
||||
cleanup.primitive_rather_than_wrapper=true
|
||||
cleanup.primitive_serialization=false
|
||||
cleanup.pull_out_if_from_if_else=false
|
||||
cleanup.pull_up_assignment=false
|
||||
cleanup.push_down_negation=false
|
||||
cleanup.qualify_static_field_accesses_with_declaring_class=false
|
||||
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
|
||||
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
|
||||
cleanup.qualify_static_member_accesses_with_declaring_class=true
|
||||
cleanup.qualify_static_method_accesses_with_declaring_class=false
|
||||
cleanup.reduce_indentation=false
|
||||
cleanup.redundant_comparator=false
|
||||
cleanup.redundant_falling_through_block_end=false
|
||||
cleanup.remove_private_constructors=true
|
||||
cleanup.remove_redundant_modifiers=false
|
||||
cleanup.remove_redundant_semicolons=false
|
||||
|
@ -47,13 +92,36 @@ cleanup.remove_unnecessary_casts=true
|
|||
cleanup.remove_unnecessary_nls_tags=true
|
||||
cleanup.remove_unused_imports=true
|
||||
cleanup.remove_unused_local_variables=false
|
||||
cleanup.remove_unused_method_parameters=false
|
||||
cleanup.remove_unused_private_fields=true
|
||||
cleanup.remove_unused_private_members=false
|
||||
cleanup.remove_unused_private_methods=true
|
||||
cleanup.remove_unused_private_types=true
|
||||
cleanup.return_expression=false
|
||||
cleanup.simplify_lambda_expression_and_method_ref=false
|
||||
cleanup.single_used_field=false
|
||||
cleanup.sort_members=true
|
||||
cleanup.sort_members_all=false
|
||||
cleanup.standard_comparison=false
|
||||
cleanup.static_inner_class=false
|
||||
cleanup.strictly_equal_or_different=false
|
||||
cleanup.stringbuffer_to_stringbuilder=false
|
||||
cleanup.stringbuilder=false
|
||||
cleanup.stringbuilder_for_local_vars=true
|
||||
cleanup.stringconcat_stringbuffer_stringbuilder=false
|
||||
cleanup.stringconcat_to_textblock=false
|
||||
cleanup.substring=false
|
||||
cleanup.switch=false
|
||||
cleanup.system_property=false
|
||||
cleanup.system_property_boolean=false
|
||||
cleanup.system_property_file_encoding=false
|
||||
cleanup.system_property_file_separator=false
|
||||
cleanup.system_property_line_separator=false
|
||||
cleanup.system_property_path_separator=false
|
||||
cleanup.ternary_operator=false
|
||||
cleanup.try_with_resource=false
|
||||
cleanup.unlooped_while=false
|
||||
cleanup.unreachable_block=false
|
||||
cleanup.use_anonymous_class_creation=false
|
||||
cleanup.use_autoboxing=false
|
||||
cleanup.use_blocks=true
|
||||
|
@ -61,18 +129,22 @@ cleanup.use_blocks_only_for_return_and_throw=false
|
|||
cleanup.use_directly_map_method=false
|
||||
cleanup.use_lambda=true
|
||||
cleanup.use_parentheses_in_expressions=false
|
||||
cleanup.use_string_is_blank=false
|
||||
cleanup.use_this_for_non_static_field_access=true
|
||||
cleanup.use_this_for_non_static_field_access_only_if_necessary=false
|
||||
cleanup.use_this_for_non_static_method_access=false
|
||||
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
|
||||
cleanup.use_unboxing=false
|
||||
cleanup.use_var=false
|
||||
cleanup_profile=_StatoolInfos
|
||||
cleanup.useless_continue=false
|
||||
cleanup.useless_return=false
|
||||
cleanup.valueof_rather_than_instantiation=false
|
||||
cleanup_profile=_StaoolInfos
|
||||
cleanup_settings_version=2
|
||||
eclipse.preferences.version=1
|
||||
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
|
||||
formatter_profile=_StatoolInfos
|
||||
formatter_settings_version=19
|
||||
formatter_settings_version=23
|
||||
jautodoc.cleanup.add_header=false
|
||||
jautodoc.cleanup.javadoc=false
|
||||
jautodoc.cleanup.replace_header=false
|
||||
|
@ -80,6 +152,7 @@ org.eclipse.jdt.ui.exception.name=exception
|
|||
org.eclipse.jdt.ui.gettersetter.use.is=true
|
||||
org.eclipse.jdt.ui.keywordthis=false
|
||||
org.eclipse.jdt.ui.overrideannotation=true
|
||||
sp_cleanup.add_all=false
|
||||
sp_cleanup.add_default_serial_version_id=true
|
||||
sp_cleanup.add_generated_serial_version_id=false
|
||||
sp_cleanup.add_missing_annotations=true
|
||||
|
@ -89,35 +162,79 @@ sp_cleanup.add_missing_nls_tags=false
|
|||
sp_cleanup.add_missing_override_annotations=true
|
||||
sp_cleanup.add_missing_override_annotations_interface_methods=true
|
||||
sp_cleanup.add_serial_version_id=false
|
||||
sp_cleanup.also_simplify_lambda=false
|
||||
sp_cleanup.always_use_blocks=true
|
||||
sp_cleanup.always_use_parentheses_in_expressions=false
|
||||
sp_cleanup.always_use_this_for_non_static_field_access=true
|
||||
sp_cleanup.always_use_this_for_non_static_method_access=false
|
||||
sp_cleanup.array_with_curly=false
|
||||
sp_cleanup.arrays_fill=false
|
||||
sp_cleanup.bitwise_conditional_expression=false
|
||||
sp_cleanup.boolean_literal=false
|
||||
sp_cleanup.boolean_value_rather_than_comparison=false
|
||||
sp_cleanup.break_loop=false
|
||||
sp_cleanup.collection_cloning=false
|
||||
sp_cleanup.comparing_on_criteria=false
|
||||
sp_cleanup.comparison_statement=false
|
||||
sp_cleanup.controlflow_merge=false
|
||||
sp_cleanup.convert_functional_interfaces=false
|
||||
sp_cleanup.convert_to_enhanced_for_loop=false
|
||||
sp_cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
|
||||
sp_cleanup.convert_to_switch_expressions=false
|
||||
sp_cleanup.correct_indentation=true
|
||||
sp_cleanup.do_while_rather_than_while=false
|
||||
sp_cleanup.double_negation=false
|
||||
sp_cleanup.else_if=false
|
||||
sp_cleanup.embedded_if=false
|
||||
sp_cleanup.evaluate_nullable=false
|
||||
sp_cleanup.extract_increment=false
|
||||
sp_cleanup.format_source_code=true
|
||||
sp_cleanup.format_source_code_changes_only=false
|
||||
sp_cleanup.hash=false
|
||||
sp_cleanup.if_condition=false
|
||||
sp_cleanup.insert_inferred_type_arguments=false
|
||||
sp_cleanup.instanceof=false
|
||||
sp_cleanup.instanceof_keyword=false
|
||||
sp_cleanup.invert_equals=false
|
||||
sp_cleanup.join=false
|
||||
sp_cleanup.lazy_logical_operator=false
|
||||
sp_cleanup.make_local_variable_final=false
|
||||
sp_cleanup.make_parameters_final=true
|
||||
sp_cleanup.make_private_fields_final=false
|
||||
sp_cleanup.make_type_abstract_if_missing_method=false
|
||||
sp_cleanup.make_variable_declarations_final=true
|
||||
sp_cleanup.map_cloning=false
|
||||
sp_cleanup.merge_conditional_blocks=false
|
||||
sp_cleanup.multi_catch=false
|
||||
sp_cleanup.never_use_blocks=false
|
||||
sp_cleanup.never_use_parentheses_in_expressions=true
|
||||
sp_cleanup.no_string_creation=false
|
||||
sp_cleanup.no_super=false
|
||||
sp_cleanup.number_suffix=false
|
||||
sp_cleanup.objects_equals=false
|
||||
sp_cleanup.on_save_use_additional_actions=true
|
||||
sp_cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=false
|
||||
sp_cleanup.operand_factorization=false
|
||||
sp_cleanup.organize_imports=true
|
||||
sp_cleanup.overridden_assignment=false
|
||||
sp_cleanup.overridden_assignment_move_decl=false
|
||||
sp_cleanup.plain_replacement=false
|
||||
sp_cleanup.precompile_regex=false
|
||||
sp_cleanup.primitive_comparison=false
|
||||
sp_cleanup.primitive_parsing=false
|
||||
sp_cleanup.primitive_rather_than_wrapper=false
|
||||
sp_cleanup.primitive_serialization=false
|
||||
sp_cleanup.pull_out_if_from_if_else=false
|
||||
sp_cleanup.pull_up_assignment=false
|
||||
sp_cleanup.push_down_negation=false
|
||||
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
|
||||
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
|
||||
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
|
||||
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
|
||||
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
|
||||
sp_cleanup.reduce_indentation=false
|
||||
sp_cleanup.redundant_comparator=false
|
||||
sp_cleanup.redundant_falling_through_block_end=false
|
||||
sp_cleanup.remove_private_constructors=true
|
||||
sp_cleanup.remove_redundant_modifiers=false
|
||||
sp_cleanup.remove_redundant_semicolons=false
|
||||
|
@ -130,13 +247,36 @@ sp_cleanup.remove_unnecessary_casts=true
|
|||
sp_cleanup.remove_unnecessary_nls_tags=true
|
||||
sp_cleanup.remove_unused_imports=true
|
||||
sp_cleanup.remove_unused_local_variables=false
|
||||
sp_cleanup.remove_unused_method_parameters=false
|
||||
sp_cleanup.remove_unused_private_fields=true
|
||||
sp_cleanup.remove_unused_private_members=false
|
||||
sp_cleanup.remove_unused_private_methods=true
|
||||
sp_cleanup.remove_unused_private_types=true
|
||||
sp_cleanup.return_expression=false
|
||||
sp_cleanup.simplify_lambda_expression_and_method_ref=false
|
||||
sp_cleanup.single_used_field=false
|
||||
sp_cleanup.sort_members=true
|
||||
sp_cleanup.sort_members_all=false
|
||||
sp_cleanup.standard_comparison=false
|
||||
sp_cleanup.static_inner_class=false
|
||||
sp_cleanup.strictly_equal_or_different=false
|
||||
sp_cleanup.stringbuffer_to_stringbuilder=false
|
||||
sp_cleanup.stringbuilder=false
|
||||
sp_cleanup.stringbuilder_for_local_vars=false
|
||||
sp_cleanup.stringconcat_stringbuffer_stringbuilder=false
|
||||
sp_cleanup.stringconcat_to_textblock=false
|
||||
sp_cleanup.substring=false
|
||||
sp_cleanup.switch=false
|
||||
sp_cleanup.system_property=false
|
||||
sp_cleanup.system_property_boolean=false
|
||||
sp_cleanup.system_property_file_encoding=false
|
||||
sp_cleanup.system_property_file_separator=false
|
||||
sp_cleanup.system_property_line_separator=false
|
||||
sp_cleanup.system_property_path_separator=false
|
||||
sp_cleanup.ternary_operator=false
|
||||
sp_cleanup.try_with_resource=false
|
||||
sp_cleanup.unlooped_while=false
|
||||
sp_cleanup.unreachable_block=false
|
||||
sp_cleanup.use_anonymous_class_creation=false
|
||||
sp_cleanup.use_autoboxing=false
|
||||
sp_cleanup.use_blocks=true
|
||||
|
@ -144,12 +284,16 @@ sp_cleanup.use_blocks_only_for_return_and_throw=false
|
|||
sp_cleanup.use_directly_map_method=false
|
||||
sp_cleanup.use_lambda=false
|
||||
sp_cleanup.use_parentheses_in_expressions=false
|
||||
sp_cleanup.use_string_is_blank=false
|
||||
sp_cleanup.use_this_for_non_static_field_access=true
|
||||
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
|
||||
sp_cleanup.use_this_for_non_static_method_access=false
|
||||
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
|
||||
sp_cleanup.use_unboxing=false
|
||||
sp_cleanup.use_var=false
|
||||
sp_cleanup.useless_continue=false
|
||||
sp_cleanup.useless_return=false
|
||||
sp_cleanup.valueof_rather_than_instantiation=false
|
||||
sp_jautodoc.cleanup.add_header=false
|
||||
sp_jautodoc.cleanup.javadoc=false
|
||||
sp_jautodoc.cleanup.replace_header=false
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<runtime name="apache-tomcat-10.1.12"/>
|
||||
<fixed facet="java"/>
|
||||
<fixed facet="jst.utility"/>
|
||||
<installed facet="jst.utility" version="1.0"/>
|
||||
<installed facet="java" version="11"/>
|
||||
<installed facet="java" version="17"/>
|
||||
</faceted-project>
|
||||
|
|
16
README.md
16
README.md
|
@ -50,15 +50,15 @@ Read CONCEPT.md and ONTOLOGY.md files.
|
|||
|
||||
## Requirements
|
||||
|
||||
- Java 11
|
||||
- Eclipse 4.16 (202006).
|
||||
- Java 17
|
||||
- Eclipse 4.29 (2023-09).
|
||||
|
||||
## INSTALL
|
||||
|
||||
Install Java :
|
||||
|
||||
```
|
||||
apt-get install openjdk-11-jre-headless
|
||||
apt-get install openjdk-17-jre-headless
|
||||
```
|
||||
|
||||
Download the last release: https://forge.devinsy.fr/devinsy/statoolinfos/releases
|
||||
|
@ -83,7 +83,7 @@ Usage:
|
|||
statoolinfos clear <configurationfile> remove property files from conf
|
||||
statoolinfos crawl <configurationfile> crawl all file from conf and input
|
||||
statoolinfos format <fileordirectory> format property files in tiny way
|
||||
statoolinfos htmlize <configurationfile> generate web pages from conf
|
||||
s̶t̶a̶t̶o̶o̶l̶i̶n̶f̶o̶s̶ ̶h̶t̶m̶l̶i̶z̶e̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶<̶c̶o̶n̶f̶i̶g̶u̶r̶a̶t̶i̶o̶n̶f̶i̶l̶e̶>̶ ̶ ̶ ̶ ̶ ̶g̶e̶n̶e̶r̶a̶t̶e̶ ̶w̶e̶b̶ ̶p̶a̶g̶e̶s̶ ̶f̶r̶o̶m̶ ̶c̶o̶n̶f̶ REMOVED since splitweb
|
||||
statoolinfos probe OPTION [<directory>|<configurationfile>] generate metrics files from conf
|
||||
OPTION = [-full|-today|-previousday|-NN] with NN a day count
|
||||
statoolinfos tagdate <fileordirectory> update the file.datetime file
|
||||
|
@ -101,6 +101,14 @@ Usage:
|
|||
statoolinfos list errlog <logfilesorconfigfile> display http error log lines
|
||||
```
|
||||
|
||||
### htmlize removed
|
||||
The htmlize command is removed since 2024-07.
|
||||
|
||||
As a reminder, the htmlize command generated absolutely all the pages needed for a static site.
|
||||
|
||||
As the number of pages generated became too large (> 10000 with 100 organizations), the decision was made to separate the html valuation into a separate project, StatoolInfosWeb.
|
||||
|
||||
A dynamic web site allows to generate page only when it is necessary.
|
||||
|
||||
## Generate metrics files
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
Description of used libraries:
|
||||
|
||||
- Logs/
|
||||
- log4j log API
|
||||
- log4j-api log API
|
||||
- log4j-core
|
||||
- log4j-slf4j-impl adaptation layer between slf4j and log4j
|
||||
- slf4j-api facade log API
|
||||
- slf4j-log4j12 adaptation layer between slf4j and log4j
|
||||
|
||||
- UnitTesting/
|
||||
- hamcrest-core required by junit
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -16,7 +16,7 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.core;
|
||||
package fr.devinsy.statoolinfos.app;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -28,10 +28,14 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.build.Builder;
|
||||
import fr.devinsy.statoolinfos.core.BotFilter;
|
||||
import fr.devinsy.statoolinfos.core.Configuration;
|
||||
import fr.devinsy.statoolinfos.core.Factory;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosContext;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.Crawler;
|
||||
import fr.devinsy.statoolinfos.htmlize.Htmlizer;
|
||||
import fr.devinsy.statoolinfos.metrics.Prober;
|
||||
import fr.devinsy.statoolinfos.metrics.httpaccess.HttpAccessLog;
|
||||
import fr.devinsy.statoolinfos.metrics.httpaccess.HttpAccessLogs;
|
||||
|
@ -54,11 +58,11 @@ import fr.devinsy.strings.StringList;
|
|||
import fr.devinsy.strings.StringsUtils;
|
||||
|
||||
/**
|
||||
* The Class StatoolInfos.
|
||||
* The Class StatoolInfosApp.
|
||||
*/
|
||||
public class StatoolInfos
|
||||
public class StatoolInfosApp
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(StatoolInfos.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(StatoolInfosApp.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
|
@ -92,7 +96,6 @@ public class StatoolInfos
|
|||
|
||||
Builder.clear(configuration);
|
||||
new Crawler(configuration.getCrawlCacheDirectory()).clear();
|
||||
Htmlizer.clear(configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,21 +153,6 @@ public class StatoolInfos
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param configurationFile
|
||||
* the input
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void htmlize(final File configurationFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
Htmlizer.htmlize(configurationFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* List files.
|
||||
*
|
||||
|
@ -199,10 +187,6 @@ public class StatoolInfos
|
|||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -259,10 +243,6 @@ public class StatoolInfos
|
|||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1173,11 +1153,11 @@ public class StatoolInfos
|
|||
*/
|
||||
public static void uptime(final File configurationFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
HtmlizerContext.instance().configure(configurationFile);
|
||||
StatoolInfosContext context = new StatoolInfosContext(configurationFile);
|
||||
|
||||
UptimeJournal journal = HtmlizerContext.instance().getUptimeJournal();
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
UptimeJournal journal = context.getUptimeJournal();
|
||||
Federation federation = context.getFederation();
|
||||
UptimeSurveyor.survey(journal, federation.getURLActiveAll());
|
||||
HtmlizerContext.instance().getCache().storeUptimeJournal(journal);
|
||||
context.getCache().storeUptimeJournal(journal);
|
||||
}
|
||||
}
|
|
@ -293,12 +293,12 @@ public class PropertyChecker
|
|||
check = new PropertyCheck(lineIndex, "", Status.OK);
|
||||
check.setComment("OK");
|
||||
}
|
||||
else if ((StringUtils.isEmpty(line)) || (line.matches(COMMENT)))
|
||||
else if ((StringUtils.isEmpty(line)) || (isComment(line)))
|
||||
{
|
||||
check = new PropertyCheck(lineIndex, line, Status.OK);
|
||||
check.setComment("OK");
|
||||
}
|
||||
else if (!line.matches("^[^#].*[^\\s].*=.*$"))
|
||||
else if (!isProperty(line))
|
||||
{
|
||||
check = new PropertyCheck(lineIndex, line, Status.ERROR);
|
||||
check.setComment("Ligne malformée");
|
||||
|
@ -458,4 +458,83 @@ public class PropertyChecker
|
|||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is comment.
|
||||
*
|
||||
* @param line
|
||||
* the line
|
||||
* @return true, if is comment
|
||||
*/
|
||||
public static boolean isComment(final String line)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
// Method 1
|
||||
// public static final Pattern COMMENT_PATTERN =
|
||||
// Pattern.compile(COMMENT);
|
||||
// result = COMMENT_PATTERN.matcher(line).matches();
|
||||
|
||||
// Method 2
|
||||
// result = StringUtils.startsWith(line, "#");
|
||||
|
||||
// Method 3
|
||||
if ((line != null) && (line.length() > 0) && (line.charAt(0) == '#'))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is property.
|
||||
*
|
||||
* @param line
|
||||
* the line
|
||||
* @return true, if is property
|
||||
*/
|
||||
public static boolean isProperty(final String line)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
// Method 1, take so much time, > 1000 ms for each property file.
|
||||
// public static final Pattern PROPERTY_PATTERN =
|
||||
// Pattern.compile("^[^#].*[^\\s].*=.*$");
|
||||
// result = PROPERTY_PATTERN.matcher(line).matches();
|
||||
|
||||
// Method 2, well optimized, < 1 ms for each property file.
|
||||
if ((line == null) || (line.length() == 0))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int splitter = line.indexOf('=');
|
||||
if (splitter == -1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
String path = line.substring(0, splitter);
|
||||
if ((path.length() == 0) || (path.charAt(0) == '#') || (StringUtils.isBlank(path)))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -26,8 +26,8 @@ import org.apache.commons.lang3.math.NumberUtils;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.app.StatoolInfosApp;
|
||||
import fr.devinsy.statoolinfos.core.BotFilter;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfos;
|
||||
import fr.devinsy.statoolinfos.util.BuildInformation;
|
||||
import fr.devinsy.statoolinfos.util.Chrono;
|
||||
import fr.devinsy.statoolinfos.util.Files;
|
||||
|
@ -110,7 +110,7 @@ public final class StatoolInfosCLI
|
|||
message.appendln(" statoolinfos clear <configurationfile> remove property files from conf");
|
||||
message.appendln(" statoolinfos crawl <configurationfile> crawl all file from conf and input");
|
||||
message.appendln(" statoolinfos format <fileordirectory> format property files in tiny way");
|
||||
message.appendln(" statoolinfos htmlize <configurationfile> generate web pages from conf");
|
||||
message.appendln(" s̶t̶a̶t̶o̶o̶l̶i̶n̶f̶o̶s̶ ̶h̶t̶m̶l̶i̶z̶e̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶<̶c̶o̶n̶f̶i̶g̶u̶r̶a̶t̶i̶o̶n̶f̶i̶l̶e̶> REMOVED since splitweb");
|
||||
message.appendln(" statoolinfos probe OPTION [<directory>|<configurationfile>] generate metrics files from conf");
|
||||
message.appendln(" OPTION = [-full|-today|-previousday|-NN] with NN a day count");
|
||||
message.appendln(" statoolinfos tagdate <fileordirectory> update the file.datetime file");
|
||||
|
@ -249,7 +249,7 @@ public final class StatoolInfosCLI
|
|||
File configurationFile = new File(StringUtils.trim(args[1]));
|
||||
try
|
||||
{
|
||||
StatoolInfos.build(configurationFile);
|
||||
StatoolInfosApp.build(configurationFile);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -261,7 +261,7 @@ public final class StatoolInfosCLI
|
|||
File configurationFile = new File(StringUtils.trim(args[1]));
|
||||
try
|
||||
{
|
||||
StatoolInfos.clear(configurationFile);
|
||||
StatoolInfosApp.clear(configurationFile);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ public final class StatoolInfosCLI
|
|||
File configurationFile = new File(StringUtils.trim(args[1]));
|
||||
try
|
||||
{
|
||||
StatoolInfos.crawl(configurationFile);
|
||||
StatoolInfosApp.crawl(configurationFile);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -291,7 +291,7 @@ public final class StatoolInfosCLI
|
|||
{
|
||||
try
|
||||
{
|
||||
StatoolInfos.format(input);
|
||||
StatoolInfosApp.format(input);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -300,33 +300,18 @@ public final class StatoolInfosCLI
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "htmlize", ".+\\.conf"))
|
||||
{
|
||||
Chrono chrono = new Chrono().start();
|
||||
File configurationFile = new File(StringUtils.trim(args[1]));
|
||||
try
|
||||
{
|
||||
StatoolInfos.htmlize(configurationFile);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.error("Error with [{}]: {}", configurationFile.getAbsoluteFile(), exception.getMessage());
|
||||
exception.printStackTrace();
|
||||
}
|
||||
System.out.println(chrono.format());
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "ip", "(-all|-bot|-nobot)", ".+\\.conf*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.listIps(configurationFile, filter);
|
||||
StatoolInfosApp.listIps(configurationFile, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "ip", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.listIps(configurationFile, BotFilter.ALL);
|
||||
StatoolInfosApp.listIps(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "ip", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
|
@ -337,7 +322,7 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listIps(source, filter);
|
||||
StatoolInfosApp.listIps(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "ip", ".+"))
|
||||
{
|
||||
|
@ -347,13 +332,13 @@ public final class StatoolInfosCLI
|
|||
files.add(new File(args[source]));
|
||||
}
|
||||
|
||||
StatoolInfos.listIps(files, BotFilter.ALL);
|
||||
StatoolInfosApp.listIps(files, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(file|files)", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.listAccessFiles(configurationFile);
|
||||
StatoolInfosApp.listAccessFiles(configurationFile);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(file|files)", ".+"))
|
||||
{
|
||||
|
@ -363,13 +348,13 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listAccessFiles(source);
|
||||
StatoolInfosApp.listAccessFiles(source);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(errfile|errfiles)", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.listErrorFiles(configurationFile);
|
||||
StatoolInfosApp.listErrorFiles(configurationFile);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(errfile|errfiles)", ".+"))
|
||||
{
|
||||
|
@ -379,20 +364,20 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listErrorFiles(source);
|
||||
StatoolInfosApp.listErrorFiles(source);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(log|logs)", "(-all|-bot|-nobot)", ".+\\.conf*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.listLogs(configurationFile, filter);
|
||||
StatoolInfosApp.listLogs(configurationFile, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(log|logs)", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.listLogs(configurationFile, BotFilter.ALL);
|
||||
StatoolInfosApp.listLogs(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(log|logs)", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
|
@ -403,7 +388,7 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listLogs(source, filter);
|
||||
StatoolInfosApp.listLogs(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(log|logs)", ".+"))
|
||||
{
|
||||
|
@ -413,13 +398,13 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listLogs(source, BotFilter.ALL);
|
||||
StatoolInfosApp.listLogs(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(errlog|errlogs)", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.listErrorLogs(configurationFile);
|
||||
StatoolInfosApp.listErrorLogs(configurationFile);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(errlog|errlogs)", ".+"))
|
||||
{
|
||||
|
@ -429,20 +414,20 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listErrorLogs(source);
|
||||
StatoolInfosApp.listErrorLogs(source);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(useragent|ua)", "(-all|-bot|-nobot)", ".+\\.conf*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.listUserAgents(configurationFile, filter);
|
||||
StatoolInfosApp.listUserAgents(configurationFile, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(useragent|ua)", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.listUserAgents(configurationFile, BotFilter.ALL);
|
||||
StatoolInfosApp.listUserAgents(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(useragent|ua)", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
|
@ -453,7 +438,7 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listUserAgents(source, filter);
|
||||
StatoolInfosApp.listUserAgents(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(useragent|ua)", ".+"))
|
||||
{
|
||||
|
@ -463,20 +448,20 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listUserAgents(source, BotFilter.ALL);
|
||||
StatoolInfosApp.listUserAgents(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(visitor|visitors)", "(-all|-bot|-nobot)", ".+\\.conf*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.listVisitors(configurationFile, filter);
|
||||
StatoolInfosApp.listVisitors(configurationFile, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(visitor|visitors)", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.listVisitors(configurationFile, BotFilter.ALL);
|
||||
StatoolInfosApp.listVisitors(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(visitor|visitors)", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
|
@ -487,7 +472,7 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listVisitors(source, filter);
|
||||
StatoolInfosApp.listVisitors(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(visitor|visitors)", ".+"))
|
||||
{
|
||||
|
@ -497,7 +482,7 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listVisitors(source, BotFilter.ALL);
|
||||
StatoolInfosApp.listVisitors(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "probe", "(-full|-today|-previousday|-\\d+)", ".+"))
|
||||
{
|
||||
|
@ -536,7 +521,7 @@ public final class StatoolInfosCLI
|
|||
try
|
||||
{
|
||||
System.out.println("Probing [" + input + "] with day count filter " + dayCountFilter);
|
||||
StatoolInfos.probe(input, dayCountFilter);
|
||||
StatoolInfosApp.probe(input, dayCountFilter);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -557,13 +542,13 @@ public final class StatoolInfosCLI
|
|||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.statIps(configurationFile, filter);
|
||||
StatoolInfosApp.statIps(configurationFile, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "stat", "ip", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.statIps(configurationFile, BotFilter.ALL);
|
||||
StatoolInfosApp.statIps(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "ip", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
|
@ -574,7 +559,7 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statIps(source, filter);
|
||||
StatoolInfosApp.statIps(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "ip", ".+"))
|
||||
{
|
||||
|
@ -584,20 +569,20 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statIps(source, BotFilter.ALL);
|
||||
StatoolInfosApp.statIps(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "stat", "(useragent|ua)", "(-all|-bot|-nobot)", ".+\\.conf*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.statUserAgents(configurationFile, filter);
|
||||
StatoolInfosApp.statUserAgents(configurationFile, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "stat", "(useragent|ua)", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.statUserAgents(configurationFile, BotFilter.ALL);
|
||||
StatoolInfosApp.statUserAgents(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(useragent|ua)", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
|
@ -608,7 +593,7 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statUserAgents(source, filter);
|
||||
StatoolInfosApp.statUserAgents(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(useragent|ua)", ".+"))
|
||||
{
|
||||
|
@ -618,20 +603,20 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statUserAgents(source, BotFilter.ALL);
|
||||
StatoolInfosApp.statUserAgents(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "stat", "(visitor|visitors)", "(-all|-bot|-nobot)", ".+\\.conf*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.statVisitors(configurationFile, filter);
|
||||
StatoolInfosApp.statVisitors(configurationFile, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "stat", "(visitor|visitors)", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.statVisitors(configurationFile, BotFilter.ALL);
|
||||
StatoolInfosApp.statVisitors(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(visitor|visitors)", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
|
@ -642,7 +627,7 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statVisitors(source, filter);
|
||||
StatoolInfosApp.statVisitors(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(visitor|visitors)", ".+"))
|
||||
{
|
||||
|
@ -652,7 +637,7 @@ public final class StatoolInfosCLI
|
|||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statVisitors(source, BotFilter.ALL);
|
||||
StatoolInfosApp.statVisitors(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "tagdate", ".+"))
|
||||
{
|
||||
|
@ -661,7 +646,7 @@ public final class StatoolInfosCLI
|
|||
{
|
||||
try
|
||||
{
|
||||
StatoolInfos.tagDate(input);
|
||||
StatoolInfosApp.tagDate(input);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -677,7 +662,7 @@ public final class StatoolInfosCLI
|
|||
File configurationFile = new File(StringUtils.trim(args[1]));
|
||||
try
|
||||
{
|
||||
StatoolInfos.uptime(configurationFile);
|
||||
StatoolInfosApp.uptime(configurationFile);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-022 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -22,6 +22,8 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import fr.devinsy.strings.StringList;
|
||||
|
||||
/**
|
||||
|
@ -64,6 +66,43 @@ public class Categories extends ArrayList<Category>
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the by technical name.
|
||||
*
|
||||
* @param technicalName
|
||||
* the technical name
|
||||
* @return the by technical name
|
||||
*/
|
||||
public Category getByTechnicalName(final String technicalName)
|
||||
{
|
||||
Category result;
|
||||
|
||||
Iterator<Category> iterator = this.iterator();
|
||||
boolean ended = false;
|
||||
result = null;
|
||||
while (!ended)
|
||||
{
|
||||
if (iterator.hasNext())
|
||||
{
|
||||
Category category = iterator.next();
|
||||
|
||||
if (StringUtils.equals(category.getTechnicalName(), technicalName))
|
||||
{
|
||||
ended = true;
|
||||
result = category;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = null;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -32,6 +32,7 @@ public class Category
|
|||
public static final String DEFAULT_LOGO_PATH = "categories/default.svg";
|
||||
|
||||
private String name;
|
||||
private String technicalName;
|
||||
private String description;
|
||||
private StringList softwares;
|
||||
private String logoPath;
|
||||
|
@ -41,10 +42,7 @@ public class Category
|
|||
*/
|
||||
public Category(final String name, final String description)
|
||||
{
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.softwares = new StringList();
|
||||
this.logoPath = DEFAULT_LOGO_PATH;
|
||||
this(name, description, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,6 +58,7 @@ public class Category
|
|||
public Category(final String name, final String description, final StringList softwares)
|
||||
{
|
||||
this.name = name;
|
||||
this.technicalName = StatoolInfosUtils.toTechnicalName(getName());
|
||||
this.description = description;
|
||||
this.softwares = new StringList(softwares);
|
||||
this.logoPath = DEFAULT_LOGO_PATH;
|
||||
|
@ -111,7 +110,7 @@ public class Category
|
|||
{
|
||||
String result;
|
||||
|
||||
result = StatoolInfosUtils.toTechnicalName(getName());
|
||||
result = this.technicalName;
|
||||
|
||||
//
|
||||
return result;
|
||||
|
|
|
@ -167,10 +167,10 @@ public class Configuration extends PathPropertyList
|
|||
{
|
||||
File result;
|
||||
|
||||
String path = get("conf.htmlize.categories");
|
||||
String path = get("conf.categories");
|
||||
if (StringUtils.isBlank(path))
|
||||
{
|
||||
throw new StatoolInfosException("Entry conf.htmlize.categories is missing in configuration file.");
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -317,44 +317,6 @@ public class Configuration extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the htmlize directory.
|
||||
*
|
||||
* @return the htmlize directory
|
||||
*/
|
||||
public File getHtmlizeDirectory()
|
||||
{
|
||||
File result;
|
||||
|
||||
String path = getHtmlizeDirectoryPath();
|
||||
if (StringUtils.isBlank(path))
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = new File(path);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the htmlize directory path.
|
||||
*
|
||||
* @return the htmlize directory path
|
||||
*/
|
||||
public String getHtmlizeDirectoryPath()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = get("conf.htmlize.directory");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the htmlize input URL.
|
||||
*
|
||||
|
@ -583,6 +545,28 @@ public class Configuration extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is category file defined.
|
||||
*
|
||||
* @return true, if is category file defined
|
||||
*/
|
||||
public boolean isCategoryFileDefined()
|
||||
{
|
||||
boolean result;
|
||||
|
||||
if (StringUtils.isBlank(get("conf.categories")))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is federation.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -35,7 +35,6 @@ import fr.devinsy.statoolinfos.properties.PathProperty;
|
|||
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyUtils;
|
||||
import fr.devinsy.statoolinfos.properties.PropertyClassType;
|
||||
import fr.devinsy.statoolinfos.util.Chrono;
|
||||
import fr.devinsy.strings.StringList;
|
||||
import fr.devinsy.strings.StringSet;
|
||||
|
||||
|
@ -66,33 +65,9 @@ public class Factory
|
|||
{
|
||||
Categories result;
|
||||
|
||||
result = new Categories();
|
||||
|
||||
PathProperties properties = PathPropertyUtils.load(source);
|
||||
|
||||
StringSet prefixes = properties.getSubPrefixes();
|
||||
for (String prefix : prefixes)
|
||||
{
|
||||
String name = properties.get(prefix + ".name");
|
||||
String description = properties.get(prefix + ".description");
|
||||
String softwares = properties.get(prefix + ".softwares");
|
||||
String logoPath = properties.get(prefix + ".logo");
|
||||
|
||||
StringList softwareList = new StringList();
|
||||
if (StringUtils.isNotBlank(softwares))
|
||||
{
|
||||
for (String string : softwares.split("[;,]"))
|
||||
{
|
||||
softwareList.add(string.trim());
|
||||
}
|
||||
}
|
||||
|
||||
Category category = new Category(name, description, softwareList);
|
||||
category.setLogoPath(logoPath);
|
||||
result.add(category);
|
||||
}
|
||||
|
||||
result.sortByName();
|
||||
result = loadCategories(properties);
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -130,6 +105,102 @@ public class Factory
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load categories.
|
||||
*
|
||||
* @param properties
|
||||
* the properties
|
||||
* @return the categories
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static Categories loadCategories(final PathProperties properties) throws IOException
|
||||
{
|
||||
Categories result;
|
||||
|
||||
result = new Categories();
|
||||
|
||||
StringSet prefixes = properties.getSubPrefixes();
|
||||
for (String prefix : prefixes)
|
||||
{
|
||||
String name = properties.get(prefix + ".name");
|
||||
String description = properties.get(prefix + ".description");
|
||||
String softwares = properties.get(prefix + ".softwares");
|
||||
String logoPath = properties.get(prefix + ".logo");
|
||||
|
||||
StringList softwareList = new StringList();
|
||||
if (StringUtils.isNotBlank(softwares))
|
||||
{
|
||||
for (String string : softwares.split("[;,]"))
|
||||
{
|
||||
softwareList.add(string.trim());
|
||||
}
|
||||
}
|
||||
|
||||
Category category = new Category(name, description, softwareList);
|
||||
category.setLogoPath(logoPath);
|
||||
result.add(category);
|
||||
}
|
||||
|
||||
result.sortByName();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load categories.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @return the categories
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static Categories loadCategories(final URL source) throws IOException
|
||||
{
|
||||
Categories result;
|
||||
|
||||
PathProperties properties = PathPropertyUtils.load(source);
|
||||
|
||||
result = loadCategories(properties);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load categories.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @param federation
|
||||
* the federation
|
||||
* @return the categories
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static Categories loadCategories(final URL source, final Federation federation) throws IOException
|
||||
{
|
||||
Categories result;
|
||||
|
||||
result = loadCategories(source);
|
||||
|
||||
Category other = new Category("Autres", "Qui ne rentre pas dans une catégorie existante.");
|
||||
result.add(other);
|
||||
|
||||
for (Software software : federation.getSoftwares().values())
|
||||
{
|
||||
if (!result.matches(software.getName()))
|
||||
{
|
||||
other.getSoftwares().add(software.getName());
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load configuration.
|
||||
*
|
||||
|
@ -141,12 +212,19 @@ public class Factory
|
|||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static Configuration loadConfiguration(final File configurationFile) throws StatoolInfosException, IOException
|
||||
public static Configuration loadConfiguration(final File configurationFile) throws StatoolInfosException
|
||||
{
|
||||
Configuration result;
|
||||
|
||||
try
|
||||
{
|
||||
PathProperties properties = PathPropertyUtils.load(configurationFile);
|
||||
result = new Configuration(properties);
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error reading configuration file: " + configurationFile, exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -170,7 +248,6 @@ public class Factory
|
|||
Federation result;
|
||||
|
||||
System.out.println("Loading federation " + inputURL);
|
||||
Chrono chrono = new Chrono().start();
|
||||
|
||||
if (inputURL == null)
|
||||
{
|
||||
|
@ -201,7 +278,7 @@ public class Factory
|
|||
result = new Federation(properties);
|
||||
result.setInputURL(inputURL);
|
||||
result.setInputFile(federationFile);
|
||||
result.setLogoFileName(result.getTechnicalName() + "-logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
result.setLogoFileName("logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
|
||||
PropertyChecker checker = new PropertyChecker();
|
||||
PropertyChecks checks = checker.checkFederation(result.getInputFile());
|
||||
|
@ -227,7 +304,6 @@ public class Factory
|
|||
result.getCrawlJournal().addAll(cache.restoreCrawlJournal());
|
||||
}
|
||||
}
|
||||
System.out.println("Federation loaded in " + chrono.format());
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -253,7 +329,6 @@ public class Factory
|
|||
System.out.println("Loading metrics " + inputURL);
|
||||
|
||||
File inputFile = cache.restoreFile(inputURL);
|
||||
|
||||
if (inputFile == null)
|
||||
{
|
||||
logger.warn("WARNING: metrics not found in cache [{}]", inputURL);
|
||||
|
@ -310,7 +385,7 @@ public class Factory
|
|||
{
|
||||
result.setInputFile(inputFile);
|
||||
result.setInputURL(inputURL);
|
||||
result.setLogoFileName(result.getTechnicalName() + "-logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
result.setLogoFileName("logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
|
||||
//
|
||||
PropertyChecker checker = new PropertyChecker();
|
||||
|
@ -386,7 +461,7 @@ public class Factory
|
|||
result.setOrganization(organization);
|
||||
result.setInputFile(inputFile);
|
||||
result.setInputURL(inputURL);
|
||||
result.setLogoFileName(organization.getTechnicalName() + "-" + result.getTechnicalName() + "-logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
result.setLogoFileName("logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
|
||||
//
|
||||
PathProperties subs = result.getByPrefix("subs");
|
||||
|
|
|
@ -29,11 +29,11 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.WeekValues;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.YearValues;
|
||||
import fr.devinsy.statoolinfos.properties.MonthValues;
|
||||
import fr.devinsy.statoolinfos.properties.PathProperties;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||
import fr.devinsy.statoolinfos.properties.WeekValues;
|
||||
import fr.devinsy.statoolinfos.properties.YearValues;
|
||||
import fr.devinsy.statoolinfos.uptime.URLSet;
|
||||
import fr.devinsy.statoolinfos.util.URLUtils;
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.WeekValues;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.YearValues;
|
||||
import fr.devinsy.statoolinfos.properties.MonthValues;
|
||||
import fr.devinsy.statoolinfos.properties.PathProperties;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||
import fr.devinsy.statoolinfos.properties.WeekValues;
|
||||
import fr.devinsy.statoolinfos.properties.YearValues;
|
||||
import fr.devinsy.statoolinfos.uptime.URLSet;
|
||||
import fr.devinsy.statoolinfos.util.URLUtils;
|
||||
|
||||
|
@ -42,8 +42,6 @@ import fr.devinsy.statoolinfos.util.URLUtils;
|
|||
*/
|
||||
public class Organization extends PathPropertyList
|
||||
{
|
||||
private static final long serialVersionUID = -2709210934548224213L;
|
||||
|
||||
public enum Status
|
||||
{
|
||||
ACTIVE,
|
||||
|
@ -62,6 +60,8 @@ public class Organization extends PathPropertyList
|
|||
OTHER
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -2709210934548224213L;
|
||||
|
||||
private Federation federation;
|
||||
private Services services;
|
||||
private File inputFile;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -21,6 +21,9 @@ package fr.devinsy.statoolinfos.core;
|
|||
import java.time.Year;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* The Class Organizations.
|
||||
|
@ -37,6 +40,22 @@ public class Organizations extends ArrayList<Organization>
|
|||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new organizations.
|
||||
*
|
||||
* @param organization
|
||||
* the organization
|
||||
*/
|
||||
public Organizations(final Organization organization)
|
||||
{
|
||||
super();
|
||||
|
||||
if (organization != null)
|
||||
{
|
||||
add(organization);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter active.
|
||||
*
|
||||
|
@ -227,6 +246,43 @@ public class Organizations extends ArrayList<Organization>
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the by technical name.
|
||||
*
|
||||
* @param technicalName
|
||||
* the technical name
|
||||
* @return the by technical name
|
||||
*/
|
||||
public Organization getByTechnicalName(final String technicalName)
|
||||
{
|
||||
Organization result;
|
||||
|
||||
Iterator<Organization> iterator = this.iterator();
|
||||
boolean ended = false;
|
||||
result = null;
|
||||
while (!ended)
|
||||
{
|
||||
if (iterator.hasNext())
|
||||
{
|
||||
Organization organization = iterator.next();
|
||||
|
||||
if (StringUtils.equals(organization.getTechnicalName(), technicalName))
|
||||
{
|
||||
ended = true;
|
||||
result = organization;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = null;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the idles.
|
||||
*
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
|
||||
import fr.devinsy.statoolinfos.properties.MonthValues;
|
||||
import fr.devinsy.statoolinfos.properties.PathProperties;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||
import fr.devinsy.statoolinfos.uptime.URLSet;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -22,6 +22,7 @@ import java.time.LocalDate;
|
|||
import java.time.Year;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
|
@ -42,6 +43,22 @@ public class Services extends ArrayList<Service>
|
|||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new services.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
*/
|
||||
public Services(final Service service)
|
||||
{
|
||||
super();
|
||||
|
||||
if (service != null)
|
||||
{
|
||||
add(service);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Count by year.
|
||||
*
|
||||
|
@ -190,6 +207,43 @@ public class Services extends ArrayList<Service>
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the by technical name.
|
||||
*
|
||||
* @param technicalName
|
||||
* the technical name
|
||||
* @return the by technical name
|
||||
*/
|
||||
public Service getByTechnicalName(final String technicalName)
|
||||
{
|
||||
Service result;
|
||||
|
||||
Iterator<Service> iterator = this.iterator();
|
||||
boolean ended = false;
|
||||
result = null;
|
||||
while (!ended)
|
||||
{
|
||||
if (iterator.hasNext())
|
||||
{
|
||||
Service service = iterator.next();
|
||||
|
||||
if (StringUtils.equals(service.getTechnicalName(), technicalName))
|
||||
{
|
||||
ended = true;
|
||||
result = service;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = null;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the older.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -77,6 +77,8 @@ public class Softwares extends HashMap<String, Software>
|
|||
*/
|
||||
public void put(final Software software)
|
||||
{
|
||||
put(buildKey(software.getName()), software);
|
||||
|
||||
for (String alias : software.getAliases())
|
||||
{
|
||||
put(buildKey(alias), software);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -16,30 +16,21 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos;
|
||||
package fr.devinsy.statoolinfos.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Categories;
|
||||
import fr.devinsy.statoolinfos.core.Configuration;
|
||||
import fr.devinsy.statoolinfos.core.Factory;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.statoolinfos.uptime.UptimeJournal;
|
||||
|
||||
/**
|
||||
* The Class Manager.
|
||||
* The Class StatoolInfosContext.
|
||||
*/
|
||||
public class HtmlizerContext
|
||||
public class StatoolInfosContext
|
||||
{
|
||||
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HtmlizerContext.class);
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
private static final HtmlizerContext instance = new HtmlizerContext();
|
||||
}
|
||||
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StatoolInfosContext.class);
|
||||
|
||||
private Configuration configuration;
|
||||
private Federation federation;
|
||||
|
@ -49,9 +40,13 @@ public class HtmlizerContext
|
|||
|
||||
/**
|
||||
* Instantiates a new manager.
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws StatoolInfosException
|
||||
*/
|
||||
private HtmlizerContext()
|
||||
public StatoolInfosContext(final File configurationFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
configure(configurationFile);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,37 +63,31 @@ public class HtmlizerContext
|
|||
|
||||
logger.info("Cache setting: {}", this.configuration.getCrawlCachePath());
|
||||
logger.info("Htmlize input setting: {}", this.configuration.getHtmlizeInputURL());
|
||||
logger.info("Htmlize directory setting: {}", this.configuration.getHtmlizeDirectoryPath());
|
||||
|
||||
this.cache = new CrawlCache(this.configuration.getCrawlCacheDirectory());
|
||||
|
||||
File htmlizeDirectory = this.configuration.getHtmlizeDirectory();
|
||||
if (htmlizeDirectory == null)
|
||||
if (this.configuration.isFederation())
|
||||
{
|
||||
throw new IllegalArgumentException("Htmlize directory undefined.");
|
||||
}
|
||||
else if (!htmlizeDirectory.exists())
|
||||
long startTime = System.currentTimeMillis();
|
||||
System.out.println("Loading configuration file.");
|
||||
this.federation = Factory.loadFederation(this.configuration.getHtmlizeInputURL(), this.cache);
|
||||
if (this.configuration.isCategoryFileDefined())
|
||||
{
|
||||
throw new IllegalArgumentException("Htmlize directory is missing.");
|
||||
}
|
||||
else if (!htmlizeDirectory.isDirectory())
|
||||
{
|
||||
throw new IllegalArgumentException("Htmlize directory is not a directory.");
|
||||
this.categories = Factory.loadCategories(this.configuration.getCategoryFile(), this.federation);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.configuration.isFederation())
|
||||
{
|
||||
this.federation = Factory.loadFederation(this.configuration.getHtmlizeInputURL(), this.cache);
|
||||
this.categories = Factory.loadCategories(this.configuration.getCategoryFile(), this.federation);
|
||||
URL categoriesURL = StatoolInfosContext.class.getResource("/fr/devinsy/statoolinfos/core/categories.properties");
|
||||
this.categories = Factory.loadCategories(categoriesURL, this.federation);
|
||||
}
|
||||
this.uptimeJournal = this.cache.restoreUptimeJournal();
|
||||
System.out.println("Loaded configuration context in " + (System.currentTimeMillis() - startTime) + " ms.");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("Not a federation configuration.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cache.
|
||||
|
@ -161,32 +150,12 @@ public class HtmlizerContext
|
|||
}
|
||||
|
||||
/**
|
||||
* Htmlize directory.
|
||||
* Gets the uptime journal.
|
||||
*
|
||||
* @return the file
|
||||
* @return the uptime journal
|
||||
*/
|
||||
public File getHtmlizeDirectory()
|
||||
{
|
||||
File result;
|
||||
|
||||
result = this.configuration.getHtmlizeDirectory();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public UptimeJournal getUptimeJournal()
|
||||
{
|
||||
return this.uptimeJournal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instance.
|
||||
*
|
||||
* @return the manager
|
||||
*/
|
||||
public static HtmlizerContext instance()
|
||||
{
|
||||
return SingletonHolder.instance;
|
||||
}
|
||||
}
|
438
src/fr/devinsy/statoolinfos/core/categories.properties
Normal file
438
src/fr/devinsy/statoolinfos/core/categories.properties
Normal file
|
@ -0,0 +1,438 @@
|
|||
# Warning: UTF-8 file.
|
||||
# History:
|
||||
# 2021-2023 CHATONS stats workgroup with Angie from Framasoft, MrFlo and Cpm.
|
||||
# 2024 Cpm.
|
||||
|
||||
# [Categories]
|
||||
|
||||
# Outils de communication
|
||||
|
||||
## Courrier électronique / mail (alternative à Gmail, Hotmail, YahooMail, etc.)
|
||||
categories.mail.name=Courrier électronique
|
||||
categories.mail.description=
|
||||
categories.mail.logo=mail.svg
|
||||
categories.mail.softwares=BlueMind, Rainloop, Roundcube, SOgo, Mailman, Dovecot, Postfix, Snappymail
|
||||
|
||||
## Carnet d'adresse (alternative à Google Contacts)
|
||||
categories.adressbook.name=Carnet d'adresses
|
||||
categories.adressbook.description=
|
||||
categories.adressbook.logo=adressbook.svg
|
||||
categories.adressbook.softwares=Radicale, SOgo, Nextcloud Contact, Nextcloud, Davical, InfCloud
|
||||
|
||||
## Liste de diffusion (alternative à Google Groupes)
|
||||
categories.mailinglist.name=Liste de diffusion
|
||||
categories.mailinglist.description=
|
||||
categories.mailinglist.logo=mailinglist.svg
|
||||
categories.mailinglist.softwares=Sympa
|
||||
|
||||
## Lettres d'information (alternative à MailChimp)
|
||||
categories.newsletter.name=Lettres d'informations
|
||||
categories.newsletter.description=Générateur de lettres d'information
|
||||
categories.newsletter.logo=newsletter.svg
|
||||
categories.newsletter.softwares=PHPList, wassup
|
||||
|
||||
## Audioconférence (alternative à Discord)
|
||||
categories.audioconf.name=Audio-conférence
|
||||
categories.audioconf.description=
|
||||
categories.audioconf.logo=audioconf.svg
|
||||
categories.audioconf.softwares=Mumble, MumbleWeb, Mumble Web, Wire
|
||||
|
||||
## Visioconférence (alternative à Skype, Hangouts, etc.)
|
||||
categories.videoconf.name=Visio-conférence
|
||||
categories.videoconf.description=Pour faire des visio-conférences.
|
||||
categories.videoconf.logo=videoconf.svg
|
||||
categories.videoconf.softwares=Jitsi, Jitsi Meet, BigBlueButton, OpenMeetings, Jami, Nextcloud Talk, Galène
|
||||
|
||||
## Messagerie instantanée (alternative à Slack)
|
||||
categories.im.name=Messagerie instantanée
|
||||
categories.im.description=
|
||||
categories.im.logo=im.svg
|
||||
categories.im.softwares=Mattermost, RocketChat, MongooseIM, Tracim, Twake, BitlBee
|
||||
|
||||
## Chat IRC ou Jabber (alternative à MSN)
|
||||
categories.chat.name=Chat
|
||||
categories.chat.description=
|
||||
categories.chat.logo=chat.svg
|
||||
categories.chat.softwares=IRC, Jabber, ejabberd, Synapse, Metronome, Matrix, Element, Element Web, Riot, Prosody, MyCryptoChat, Converse, Glowing bear, BitlBee
|
||||
|
||||
## Forum (alternative à Discord)
|
||||
categories.forum.name=Forum
|
||||
categories.forum.description=
|
||||
categories.forum.logo=forum.svg
|
||||
categories.forum.softwares=Discourse, Flarum
|
||||
|
||||
## Réseau social (alternative à Facebook)
|
||||
categories.socialnetwork.name=Réseau social
|
||||
categories.socialnetwork.description=
|
||||
categories.socialnetwork.logo=socialnetwork.svg
|
||||
categories.socialnetwork.softwares=Diaspora*, Movim
|
||||
|
||||
## Microblogging (alternative à Twitter)
|
||||
categories.microblogging.name=Microblogging
|
||||
categories.microblogging.description=
|
||||
categories.microblogging.logo=microblogging.svg
|
||||
categories.microblogging.softwares=Mastodon, Pleroma
|
||||
|
||||
## Organisation d'évènements (alternative aux évènements Facebook, MeetUp, EventBrite)
|
||||
categories.events.name=Organisation d'évènements
|
||||
categories.events.description=
|
||||
categories.events.logo=events.svg
|
||||
categories.events.softwares=Mobilizon
|
||||
|
||||
## Gestion de groupes (alternative aux groupes Facebook)
|
||||
categories.groups.name=Gestion de groupes
|
||||
categories.groups.description=
|
||||
categories.groups.logo=groups.svg
|
||||
categories.groups.softwares=Mobilizon, Agorakit
|
||||
|
||||
## Gestionnaire de notifications
|
||||
categories.notifications.name=Gestionnaire de notifications
|
||||
categories.notifications.description=
|
||||
categories.notifications.logo=notifications.svg
|
||||
categories.notifications.softwares=ntfy
|
||||
|
||||
# Outils Internet
|
||||
|
||||
## Moteur de recherche (alternative à Google Search)
|
||||
categories.search.name=Moteur de recherche
|
||||
categories.search.description=
|
||||
categories.search.logo=search.svg
|
||||
categories.search.softwares=SearX
|
||||
|
||||
## Serveurs de jeux vidéo
|
||||
categories.videogames.name=Serveurs de jeux vidéo
|
||||
categories.videogames.description=
|
||||
categories.videogames.logo=videogames.svg
|
||||
categories.videogames.softwares=Minetest, Trivabble, Codenames Green, Terraforming Mars
|
||||
|
||||
## Cartographie (alternative à Google Maps, Mappy, etc.)
|
||||
categories.maps.name=Cartographie
|
||||
categories.maps.description=
|
||||
categories.maps.logo=maps.svg
|
||||
categories.maps.softwares=OpenStreetMap, GoGoCarto, uMap
|
||||
|
||||
## Outils de sondage (alternative à SurveyMonkey)
|
||||
categories.survey.name=Sondage
|
||||
categories.survey.description=
|
||||
categories.survey.logo=survey.svg
|
||||
categories.survey.softwares=LimeSurvey
|
||||
|
||||
## Outils de traduction
|
||||
categories.translator.name=Outils de traduction
|
||||
categories.translator.description=
|
||||
categories.translator.logo=translator.svg
|
||||
categories.translator.softwares=LibreTranslate, Weblate, Zanata
|
||||
|
||||
## Générateur de code-barres
|
||||
categories.barcode.name=Générateur de code-barres
|
||||
categories.barcode.description=
|
||||
categories.barcode.logo=qrcode.svg
|
||||
categories.barcode.softwares=LibreQR
|
||||
|
||||
## Raccourcisseur d'URL (alternative à Bit.ly, tinyurl, etc.)
|
||||
categories.urlshrinker.name=Raccourcisseur d'URL
|
||||
categories.urlshrinker.description=Pour partager des URL raccourcies.
|
||||
categories.urlshrinker.logo=urlshrinker.svg
|
||||
categories.urlshrinker.softwares=Yourls, LSTU, Rs-Short, Polr
|
||||
|
||||
## Transfert de messages ou de bouts de textes (alternative à PasteBin)
|
||||
categories.bin.name=Transfert de messages ou de bouts de texte
|
||||
categories.bin.description=
|
||||
categories.bin.logo=bin.svg
|
||||
categories.bin.softwares=PrivateBin, 0bin.net, Paste
|
||||
|
||||
## Gestionnaire de marques-pages / favoris (alternative à Del.icio.us, Diigo, Pearltrees, etc.)
|
||||
categories.bookmarks.name=Gestionnaire de marques-pages
|
||||
categories.bookmarks.description=
|
||||
categories.bookmarks.logo=bookmarks.svg
|
||||
categories.bookmarks.softwares=Shaarli
|
||||
|
||||
## Générateur de flux RSS
|
||||
categories.rssgen.name=Générateur de flux RSS
|
||||
categories.rssgen.description=
|
||||
categories.rssgen.logo=rssgen.svg
|
||||
categories.rssgen.softwares=RSS Bridge
|
||||
|
||||
## Agrégateur de flux RSS (alternative à Netvibes, Feedly, InoReader, etc.)
|
||||
categories.rss.name=Agrégateur de flux RSS
|
||||
categories.rss.description=
|
||||
categories.rss.logo=rss.svg
|
||||
categories.rss.softwares=Cyca, FreshRSS, Tiny Tiny RSS
|
||||
|
||||
## Sauvegarde de contenus web (alternative à Pocket, Instapaper, etc.)
|
||||
categories.saveforlater.name=Sauvegarde de contenus web
|
||||
categories.saveforlater.description=
|
||||
categories.saveforlater.logo=saveforlater.svg
|
||||
categories.saveforlater.softwares=Wallabag
|
||||
|
||||
## Gestionnaire de mots de passe (alternative à LastPass, Dashlane, etc.)
|
||||
categories.password.name=Gestionnaire de mots de passe
|
||||
categories.password.description=
|
||||
categories.password.logo=password.svg
|
||||
categories.password.softwares=Bitwarden, Vaultwarden, Nextcloud Passman
|
||||
|
||||
## Forge logicielle (alternative à Github)
|
||||
categories.git.name=Forge logicielle
|
||||
categories.git.description=Pour partager des dépôts versionnés
|
||||
categories.git.logo=git.svg
|
||||
categories.git.softwares=GitLab, GitLab CE,GitLabCE,Gogs,Gitea,Gitolite, Forgejo
|
||||
|
||||
## Mesure de statistiques (alternative à Google Analytics)
|
||||
categories.metrics.name=Mesure de statistiques
|
||||
categories.metrics.description=
|
||||
categories.metrics.logo=metrics.svg
|
||||
categories.metrics.softwares=Matomo, Open Web Analytics, Dolomon
|
||||
|
||||
## Proxy - Intermédiaire de relais et/ou d'anonymisation
|
||||
categories.proxy.name=Proxy
|
||||
categories.proxy.description=
|
||||
categories.proxy.logo=proxy.svg
|
||||
categories.proxy.softwares=Squid, Nitter,Invidious, Bibliogram, PeerJS Server, PeerServer, Coturn
|
||||
|
||||
## VPN - Réseau privé virtuel
|
||||
categories.vpn.name=VPN
|
||||
categories.vpn.description=
|
||||
categories.vpn.logo=vpn.svg
|
||||
categories.vpn.softwares=OpenVPN, tinc
|
||||
|
||||
# Outils de travail
|
||||
|
||||
## Agenda partagé (alternative à Google Agenda)
|
||||
categories.calendar.name=Agenda
|
||||
categories.calendar.description=
|
||||
categories.calendar.logo=calendar.svg
|
||||
categories.calendar.softwares=Radicale, SOgo, Nextcloud Calendar, Nextcloud, Tracim, Baïkal, Davical, InfCloud
|
||||
|
||||
## Rédaction collaborative (alternative à Google Docs)
|
||||
categories.pad.name=Traitement de texte collaboratif
|
||||
categories.pad.description=
|
||||
categories.pad.logo=pad.svg
|
||||
categories.pad.softwares=Etherpad, Etherpad-lite, CodiMD, Cryptpad, HedgeDoc, MyPads, Nextcloud OnlyOffice, Nextcloud Collabora Online, OnlyOffice, Collabora Online, Tracim Collabora Online, Libreto
|
||||
|
||||
## Tableur collaboratif (alternative à Google Sheets)
|
||||
categories.calc.name=Tableur collaboratif
|
||||
categories.calc.description=
|
||||
categories.calc.logo=calc.svg
|
||||
categories.calc.softwares=Ethercalc, Cryptpad, Nextcloud OnlyOffice, Nextcloud Collabora Online, OnlyOffice, Collabora Online
|
||||
|
||||
## Tableau blanc collaboratif (alternative à Stoodle)
|
||||
categories.board.name=Tableau blanc collaboratif
|
||||
categories.board.description=
|
||||
categories.board.logo=board.svg
|
||||
categories.board.softwares=Scrumblr, Whiteboard
|
||||
|
||||
## Présentation collaborative (alternative à Google Drive)
|
||||
categories.slide.name=Présentation en ligne
|
||||
categories.slide.description=
|
||||
categories.slide.logo=slide.svg
|
||||
categories.slide.softwares=Strut, Nextcloud OnlyOffice, Nextcloud Collabora Online, OnlyOffice, Collabora Online
|
||||
|
||||
## Questionnaire en ligne (alternative à Google Forms)
|
||||
categories.form.name=Questionnaire en ligne
|
||||
categories.form.description=
|
||||
categories.form.logo=form.svg
|
||||
categories.form.softwares=Yakforms
|
||||
|
||||
## Aide à la prise de rendez-vous (alternative à Doodle)
|
||||
categories.date.name=Aide à la prise de rendez-vous
|
||||
categories.date.description=
|
||||
categories.date.logo=date.svg
|
||||
categories.date.softwares=Framadate, OpenSondage
|
||||
|
||||
## Création de schémas et diagrammes (alternative à Visio)
|
||||
categories.diagram.name=Création de schémas et diagrammes
|
||||
categories.diagram.description=
|
||||
categories.diagram.logo=diagram.svg
|
||||
categories.diagram.softwares=Drawio
|
||||
|
||||
## Carte heuristique / mentale (alternative à Mindmeister)
|
||||
categories.mindmap.name=Carte heuristique
|
||||
categories.mindmap.description=
|
||||
categories.mindmap.logo=mindmap.svg
|
||||
categories.mindmap.softwares=WiseMapping, MyMind, My Mind
|
||||
|
||||
## Gestionnaire de tâches (alternative à Google Tasks)
|
||||
categories.tasks.name=Gestionnaire de tâches
|
||||
categories.tasks.description=
|
||||
categories.tasks.logo=tasks.svg
|
||||
categories.tasks.softwares= Taskwarrior
|
||||
|
||||
## Prise de note (alternative à Evernote, OneNote, etc.)
|
||||
categories.notes.name=Prise de note
|
||||
categories.notes.description=
|
||||
categories.notes.logo=notes.svg
|
||||
categories.notes.softwares=Turtl, Tracim
|
||||
|
||||
## Tableau Kanban (alternative à Trello, Asana, etc.)
|
||||
categories.kanbanboard.name=Tableau Kanban
|
||||
categories.kanbanboard.description=
|
||||
categories.kanbanboard.logo=kanban.svg
|
||||
categories.kanbanboard.softwares=Kanboard, Wekan, Nullboard
|
||||
|
||||
## Outils de prise de décision (alternative à Klaxoon)
|
||||
categories.decision.name=Outils de prise de décision
|
||||
categories.decision.description=
|
||||
categories.decision.logo=decision.svg
|
||||
categories.decision.softwares=Loomio, VotAR
|
||||
|
||||
## Gestionnaire de signature électronique
|
||||
categories.electronicsignature.name=Gestionnaire de signature électronique
|
||||
categories.electronicsignature.description=
|
||||
categories.electronicsignature.logo=esignature.svg
|
||||
categories.electronicsignature.softwares=Signature PDF
|
||||
|
||||
## Plateforme de formation / LMS
|
||||
categories.lms.name=Plateforme de formation / LMS (Learning Management System)
|
||||
categories.lms.description=
|
||||
categories.lms.logo=lms.svg
|
||||
categories.lms.softwares=Moodle, Scenarii, YesWiki, Open edX
|
||||
|
||||
# Services de partage de fichiers
|
||||
|
||||
## Stockage / partage de documents (alternative à Dropbox, Google Drive, OneDrive, etc.)
|
||||
categories.cloud.name=Stockage/ partage de documents
|
||||
categories.cloud.description=
|
||||
categories.cloud.logo=cloud.svg
|
||||
categories.cloud.softwares=Nextcloud, Owncloud, Seafile, Tracim, Minio, ProFTPD
|
||||
|
||||
## Partage temporaire de fichiers (alternative à WeTransfer, DropSend)
|
||||
categories.temporaryfilesharing.name=Partage temporaire de fichiers
|
||||
categories.temporaryfilesharing.description=Pour partager des fichiers de façon temporaire.
|
||||
categories.temporaryfilesharing.logo=temporaryfilesharing.svg
|
||||
categories.temporaryfilesharing.softwares=Firefox Send,FirefoxSend, Lufi, FileToLink, File2Link, Plik
|
||||
|
||||
## Stockage/partage d'images (alternative à Img.ur)
|
||||
categories.pic.name= Stockage et partage d'images
|
||||
categories.pic.description=
|
||||
categories.pic.logo=pic.svg
|
||||
categories.pic.softwares=Lutim, Pixelfed
|
||||
|
||||
## Stockage/partage d'albums de photos (alternative à Google Photos, Flickr, etc.)
|
||||
categories.gallery.name= Stockage et partage d'albums photos
|
||||
categories.gallery.description=
|
||||
categories.gallery.logo=gallery.svg
|
||||
categories.gallery.softwares=Piwigo, Mediagoblin
|
||||
|
||||
## Diffusion de fichiers vidéos (alternative à YouTube, DailyMotion, Viméo, etc.)
|
||||
categories.tube.name= Diffusion de fichiers vidéo
|
||||
categories.tube.description=
|
||||
categories.tube.logo=tube.svg
|
||||
categories.tube.softwares=PeerTube, Mediagoblin
|
||||
|
||||
## Diffusion de fichiers audio (alternative à Soundcloud)
|
||||
categories.podcast.name= Diffusion de fichiers audio
|
||||
categories.podcast.description=
|
||||
categories.podcast.logo=podcast.svg
|
||||
categories.podcast.softwares=Funkwhale, Mediagoblin
|
||||
|
||||
## Diffusion en direct de flux audio et vidéo
|
||||
categories.streaming.name= Diffusion en direct de flux audio et vidéo
|
||||
categories.streaming.description=
|
||||
categories.streaming.logo=streaming.svg
|
||||
categories.streaming.softwares=PeerTube, Icecast
|
||||
|
||||
## Hébergement de sites web / blogs / capsules
|
||||
categories.website.name= Hébergement de sites web / blogs / capsules
|
||||
categories.website.description=
|
||||
categories.website.logo=website.svg
|
||||
categories.website.softwares=Wordpress, Joomla!, Plume, SPIP, Grav, PrettyNoemie CMS, Write Freely, Vger, ISPconfig, Garage, Apache Httpd, Nginx, Twins
|
||||
|
||||
## Hébergement d'une plateforme de commentaires (alternative à Disqus)
|
||||
categories.commenting.name=Hébergement d'une plateforme de commentaires
|
||||
categories.commenting.description=
|
||||
categories.commenting.logo=commenting.svg
|
||||
categories.commenting.softwares=Commento
|
||||
|
||||
## Hébergement de wikis
|
||||
categories.wiki.name=Wiki
|
||||
categories.wiki.description=Modification collaborative de texte
|
||||
categories.wiki.logo=wiki.svg
|
||||
categories.wiki.softwares=Dokuwiki, Mediawiki
|
||||
|
||||
## Hébergement d'une ferme de wikis
|
||||
categories.wikifarm.name= Hébergement d'une ferme de wikis
|
||||
categories.wikifarm.description=
|
||||
categories.wikifarm.logo=wikifarm.svg
|
||||
categories.wikifarm.softwares=YesWiki, Bookstack
|
||||
|
||||
# Services de gestion
|
||||
|
||||
## Gestionnaire de finances personnelles
|
||||
categories.finance.name=Gestionnaire de finances personnelles
|
||||
categories.finance.description=
|
||||
categories.finance.logo=finance.svg
|
||||
categories.finance.softwares=Kresus, IHateMoney
|
||||
|
||||
## Gestionnaire de facturation / paiement
|
||||
categories.billing.name=Gestionnaire de facturation / paiement
|
||||
categories.billing.description=
|
||||
categories.billing.logo=billing.svg
|
||||
categories.billing.softwares=
|
||||
|
||||
## Progiciel de Gestion Intégré (PGI, ERP en anglais)
|
||||
categories.erp.name=Progiciel de Gestion Intégré
|
||||
categories.erp.description=
|
||||
categories.erp.logo=erp.svg
|
||||
categories.erp.softwares=Dolibarr, Odoo, Diacamma
|
||||
|
||||
## Progiciel de Gestion associative
|
||||
categories.asso.name=Progiciel de Gestion associative
|
||||
categories.asso.description=
|
||||
categories.asso.logo=association.svg
|
||||
categories.asso.softwares=Bénévalibre, Galette, Structura, Garradin, Paheko
|
||||
|
||||
## Gestionnaire de tickets pour le support technique
|
||||
categories.ticketing.name=Gestionnaire de tickets pour le support technique
|
||||
categories.ticketing.description=
|
||||
categories.ticketing.logo=ticketing.svg
|
||||
categories.ticketing.softwares=Mantis, MantisBT, Redmine, Gitlab, Gitea, RT, Request Tracker, OSTicket, Freescout
|
||||
|
||||
# Outils d'administration système
|
||||
|
||||
## Outils de monitoring
|
||||
categories.monitoring.name=Outils de monitoring
|
||||
categories.monitoring.description=
|
||||
categories.monitoring.logo=monitoring.svg
|
||||
categories.monitoring.softwares=Healthchecks, Monitorix, Gotify, naemon
|
||||
|
||||
## Outils d'automatisation
|
||||
categories.automated.name=Outils d'automatisation
|
||||
categories.automated.description=
|
||||
categories.automated.logo=automated.svg
|
||||
categories.automated.softwares=CyberChef, Buildbot
|
||||
|
||||
## Administration de machines virtuelles
|
||||
categories.vps.name=Administration de machines virtuelles
|
||||
categories.vps.description=
|
||||
categories.vps.logo=vps.svg
|
||||
categories.vps.softwares=Ganeti
|
||||
|
||||
## Fournisseur de machines physiques ou virtuelles
|
||||
categories.server.name= Fournisseur de comptes Shell, machines physiques ou virtuelles
|
||||
categories.server.description=
|
||||
categories.server.logo=server.svg
|
||||
categories.server.softwares=OpenSSH, Docker, KVM, QEMU, libvirt, VirtualBox, Proxmox
|
||||
|
||||
## Fournisseur de stockage (accès à un support de stockage, sans faire tourner des applications)
|
||||
categories.storage.name= Fournisseur de stockage
|
||||
categories.storage.description=
|
||||
categories.storage.logo=storage.svg
|
||||
categories.storage.softwares=MinIO, BorgBackup, borgmatic, Garage, ProFTPD, rsync
|
||||
|
||||
## Fournisseur de bases de données
|
||||
categories.database.name= Fournisseur de bases de données
|
||||
categories.database.description=
|
||||
categories.database.logo=database.svg
|
||||
categories.database.softwares=MariaDB, PostgreSQL, MongoDB, SQLite, Redis, CouchDb, Cassandra
|
||||
|
||||
## Résilience - Outils de réplication et de back up
|
||||
categories.resilience.name=Outils de réplication et de back up
|
||||
categories.resilience.description=
|
||||
categories.resilience.logo=resilience.svg
|
||||
categories.resilience.softwares=MariaDB, PostgreSQL, rsync
|
||||
|
||||
## Outils de DNS
|
||||
categories.dns.name=Outils de DNS
|
||||
categories.dns.description=
|
||||
categories.dns.logo=dns.svg
|
||||
categories.dns.softwares=bind9
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -46,14 +46,14 @@ import fr.devinsy.statoolinfos.util.URLUtils;
|
|||
*/
|
||||
public class CrawlCache
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(CrawlCache.class);
|
||||
|
||||
public static enum DefaultLogoGenerator
|
||||
{
|
||||
CAT,
|
||||
BIRD
|
||||
}
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(CrawlCache.class);
|
||||
|
||||
private File directory;
|
||||
|
||||
/**
|
||||
|
@ -234,7 +234,7 @@ public class CrawlCache
|
|||
}
|
||||
else
|
||||
{
|
||||
logger.info("CatGeneratoring from {}", url);
|
||||
logger.info("Restoring logo from {}", url);
|
||||
File logoFile = restoreFile(url);
|
||||
if (logoFile == null)
|
||||
{
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class AboutPage.
|
||||
*/
|
||||
public class AboutPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(AboutPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build() throws StatoolInfosException, IOException
|
||||
{
|
||||
logger.info("Htmlize about page.");
|
||||
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
CrawlCache cache = HtmlizerContext.instance().getCache();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
String page = htmlize();
|
||||
FileUtils.write(new File(htmlizeDirectory, "about.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize() throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building about page {}.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/about.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("À propos", "about.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building about page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
/**
|
||||
* The Class Breadcrumb.
|
||||
*/
|
||||
public class Breadcrumb
|
||||
{
|
||||
private String label;
|
||||
private String link;
|
||||
|
||||
/**
|
||||
* Instantiates a new breadcrumb.
|
||||
*/
|
||||
public Breadcrumb()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new breadcrumb.
|
||||
*
|
||||
* @param label
|
||||
* the label
|
||||
* @param link
|
||||
* the link
|
||||
*/
|
||||
public Breadcrumb(final String label, final String link)
|
||||
{
|
||||
this.label = label;
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the label.
|
||||
*
|
||||
* @return the label
|
||||
*/
|
||||
public String getLabel()
|
||||
{
|
||||
return this.label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the link.
|
||||
*
|
||||
* @return the link
|
||||
*/
|
||||
public String getLink()
|
||||
{
|
||||
return this.link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the label.
|
||||
*
|
||||
* @param label
|
||||
* the new label
|
||||
*/
|
||||
public void setLabel(final String label)
|
||||
{
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the link.
|
||||
*
|
||||
* @param link
|
||||
* the new link
|
||||
*/
|
||||
public void setLink(final String link)
|
||||
{
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import fr.devinsy.strings.StringList;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class BreadcrumbTrail.
|
||||
*/
|
||||
public class BreadcrumbTrail extends ArrayList<Breadcrumb>
|
||||
{
|
||||
private static final long serialVersionUID = -2688444486042912675L;
|
||||
|
||||
/**
|
||||
* Instantiates a new breadcrumb trail.
|
||||
*/
|
||||
public BreadcrumbTrail()
|
||||
{
|
||||
this("🏡", "index.xhtml");
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new breadcrumb trail.
|
||||
*
|
||||
* @param label
|
||||
* the label
|
||||
* @param link
|
||||
* the link
|
||||
*/
|
||||
public BreadcrumbTrail(final String label, final String link)
|
||||
{
|
||||
super();
|
||||
add(label, link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param label
|
||||
* the label
|
||||
* @return the breadcrumb trail
|
||||
*/
|
||||
public BreadcrumbTrail add(final String label)
|
||||
{
|
||||
BreadcrumbTrail result;
|
||||
|
||||
Breadcrumb crumb = new Breadcrumb(label, null);
|
||||
|
||||
add(crumb);
|
||||
|
||||
result = this;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param label
|
||||
* the label
|
||||
* @param link
|
||||
* the link
|
||||
* @return the breadcrumb trail
|
||||
*/
|
||||
public BreadcrumbTrail add(final String label, final String link)
|
||||
{
|
||||
BreadcrumbTrail result;
|
||||
|
||||
Breadcrumb crumb = new Breadcrumb(label, link);
|
||||
|
||||
add(crumb);
|
||||
|
||||
result = this;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
String result;
|
||||
|
||||
StringList buffer = new StringList();
|
||||
|
||||
for (Breadcrumb crumb : this)
|
||||
{
|
||||
if (crumb.getLink() == null)
|
||||
{
|
||||
buffer.append(XidynUtils.escapeXmlBlank(crumb.getLabel()));
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.append(String.format("<a href=\"%s\" style=\"text-decoration: none; padding: 5px;\">%s</a>", crumb.getLink(), XidynUtils.escapeXmlBlank(crumb.getLabel())));
|
||||
}
|
||||
buffer.append(" > ");
|
||||
}
|
||||
if (buffer.size() > 2)
|
||||
{
|
||||
buffer.removeLast();
|
||||
}
|
||||
|
||||
result = buffer.toString();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Categories;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
|
||||
import fr.devinsy.statoolinfos.stats.StatAgent;
|
||||
import fr.devinsy.statoolinfos.stats.categories.CategoryStat;
|
||||
import fr.devinsy.statoolinfos.stats.categories.CategoryStats;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class CategoriesPage.
|
||||
*/
|
||||
public class CategoriesPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(CategoriesPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
Categories categories = HtmlizerContext.instance().getCategories();
|
||||
|
||||
logger.info("Htmlize categories page.");
|
||||
CategoryStats stats = StatAgent.statAllCategories(federation, categories);
|
||||
String page = CategoriesPage.htmlize(stats);
|
||||
FileUtils.write(new File(htmlizeDirectory, "categories.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param stats
|
||||
* the stats
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final CategoryStats stats) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building categories page.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("categoryCount", stats.size());
|
||||
|
||||
int index = 0;
|
||||
for (CategoryStat stat : stats)
|
||||
{
|
||||
data.setEscapedContent("categoryListLine", index, "categoryListLineNameValue", stat.getCategory().getName());
|
||||
data.setAttribute("categoryListLine", index, "categoryListLineNameLink", "href", "category-" + stat.getCategory().getTechnicalName() + ".xhtml");
|
||||
data.setAttribute("categoryListLine", index, "categoryListLineNameLink", "title", stat.getCategory().getDescription());
|
||||
data.setAttribute("categoryListLine", index, "categoryListLineNameLogo", "src", stat.getCategory().getLogoPath());
|
||||
|
||||
data.setEscapedContent("categoryListLine", index, "categoryListLineSoftwares", stat.getCategory().getSoftwares().sort().toStringWithFrenchCommas());
|
||||
data.setContent("categoryListLine", index, "categoryListLineOrganizationCount", stat.getOrganizationCount());
|
||||
data.setContent("categoryListLine", index, "categoryListLineServiceCount", StatoolInfosUtils.defaultIfZero(stat.getServiceCount(), "😿"));
|
||||
data.setContent("categoryListLine", index, "categoryListLineUserCount", StatoolInfosUtils.defaultIfZero(stat.getUserCount(), "😢"));
|
||||
data.setContent("categoryListLine", index, "categoryListLineVisitCount", StatoolInfosUtils.defaultIfZero(stat.getVisitCount(), "😞"));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/categories.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Catégories", "categories.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building categories page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Categories;
|
||||
import fr.devinsy.statoolinfos.core.Category;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class CategoriesView.
|
||||
*/
|
||||
public class CategoriesView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(CategoriesView.class);
|
||||
|
||||
public enum Mode
|
||||
{
|
||||
ALL,
|
||||
ICONS_ONLY,
|
||||
LABELS_ONLY
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param categories
|
||||
* the categories
|
||||
* @param mode
|
||||
* the mode
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String build(final Categories categories, final Mode mode) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building categories view.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
int index = 0;
|
||||
for (Category category : categories)
|
||||
{
|
||||
data.setAttribute("category", index, "categoryLink", "href", "category-" + category.getTechnicalName() + ".xhtml");
|
||||
|
||||
if (mode == Mode.ALL)
|
||||
{
|
||||
data.setAttribute("category", index, "categoryLink", "title", category.getDescription());
|
||||
data.setAttribute("category", index, "categoryLogo", "src", category.getLogoPath());
|
||||
data.setEscapedContent("category", index, "categoryName", category.getName());
|
||||
}
|
||||
else if (mode == Mode.ICONS_ONLY)
|
||||
{
|
||||
data.setAttribute("category", index, "categoryLink", "title", category.getName());
|
||||
data.setAttribute("category", index, "categoryLogo", "src", category.getLogoPath());
|
||||
data.setAttribute("category", index, "categoryName", "class", "xid:nodisplay");
|
||||
}
|
||||
else if (mode == Mode.LABELS_ONLY)
|
||||
{
|
||||
data.setAttribute("category", index, "categoryLink", "title", category.getDescription());
|
||||
data.setAttribute("category", index, "categoryLogo", "class", "xid:nodisplay");
|
||||
data.setEscapedContent("category", index, "categoryName", category.getName());
|
||||
}
|
||||
|
||||
index += 1;
|
||||
}
|
||||
|
||||
String page = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/categoriesView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(page.replaceAll("id=\"[^\"]*\"", ""));
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building categories view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Categories;
|
||||
import fr.devinsy.statoolinfos.core.Category;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServicesPage.
|
||||
*/
|
||||
public class CategoryPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(CategoryPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void buildAll() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
CrawlCache cache = HtmlizerContext.instance().getCache();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
Categories categories = HtmlizerContext.instance().getCategories();
|
||||
|
||||
logger.info("Htmlize category pages.");
|
||||
for (Category category : categories)
|
||||
{
|
||||
Services services = federation.getServices().getBy(category);
|
||||
String page = CategoryPage.htmlize(category, services);
|
||||
FileUtils.write(new File(htmlizeDirectory, "category-" + category.getTechnicalName() + ".xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param category
|
||||
* the category
|
||||
* @param services
|
||||
* the services
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Category category, final Services services) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building category page.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setAttribute("categoryLogo", "src", category.getLogoPath());
|
||||
data.setEscapedContent("categoryName", category.getName());
|
||||
data.setEscapedContent("categoryDescription", category.getDescription());
|
||||
data.setEscapedContent("categorySoftwares", category.getSoftwares().sort().toStringWithFrenchCommas());
|
||||
data.setContent("serviceCount", services.size());
|
||||
data.setContent("serviceListView", ServiceListView.htmlize(services.sortByName()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/category.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Catégories", "categories.xhtml");
|
||||
trail.add(category.getName(), "category-" + category.getTechnicalName() + ".xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building category page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlLog;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class CrawlJournalPage.
|
||||
*/
|
||||
public class CrawlJournalView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(CrawlJournalView.class);
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param journal
|
||||
* the journal
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final CrawlJournal journal) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setEscapedContent("title", "Journal des téléchargements");
|
||||
data.setContent("date", journal.getDatetime().format(DateTimeFormatter.ofPattern("dd/MM/YYYY HH:mm")));
|
||||
data.setContent("totalCount", journal.size());
|
||||
data.setContent("errorCount", journal.getErrors().size());
|
||||
|
||||
int index = 0;
|
||||
for (CrawlLog log : journal)
|
||||
{
|
||||
data.setEscapedContent("crawlLogLine", index, "crawlLogLineParentUrlLink", StringUtils.abbreviate(log.getParentUrlValue(), 35));
|
||||
data.setEscapedAttribute("crawlLogLine", index, "crawlLogLineParentUrlLink", "href", StringUtils.defaultString(log.getParentUrlValue(), "#"));
|
||||
data.setEscapedAttribute("crawlLogLine", index, "crawlLogLineParentUrlLink", "title", StringUtils.defaultString(log.getParentUrlValue(), "#"));
|
||||
|
||||
data.setEscapedContent("crawlLogLine", index, "crawlLogLineUrlLink", log.getUrl().toString());
|
||||
data.setEscapedAttribute("crawlLogLine", index, "crawlLogLineUrlLink", "href", log.getUrl().toString());
|
||||
|
||||
data.setContent("crawlLogLine", index, "crawlLogLineStatus", log.getStatus().toString());
|
||||
|
||||
if (log.getStatus().isError())
|
||||
{
|
||||
data.setAttribute("crawlLogLine", index, "crawlLogLineStatus", "style", "background-color: red;");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("crawlLogLine", index, "crawlLogLineStatus", "style", "background-color: lime;");
|
||||
}
|
||||
|
||||
index += 1;
|
||||
}
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/crawlJournalView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building crawl journal page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Configuration;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class EditoPage.
|
||||
*/
|
||||
public class EditoPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(EditoPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build() throws StatoolInfosException, IOException
|
||||
{
|
||||
logger.info("Htmlize edito page.");
|
||||
|
||||
Configuration configuration = HtmlizerContext.instance().getConfiguration();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
String edito;
|
||||
File editoDirectory = configuration.getEditoDirectory();
|
||||
if ((editoDirectory != null) && (editoDirectory.exists()))
|
||||
{
|
||||
File editoFile = new File(editoDirectory, "edito.xhtml");
|
||||
|
||||
if (editoFile.exists())
|
||||
{
|
||||
logger.info("EDITO: found data.");
|
||||
// Copy files.
|
||||
FileUtils.copyDirectory(editoDirectory, htmlizeDirectory);
|
||||
|
||||
// Load body edito xhtml file.
|
||||
edito = FileUtils.readFileToString(editoFile, StandardCharsets.UTF_8);
|
||||
edito = XidynUtils.extractBodyContent(edito);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.info("EDITO: not found data.");
|
||||
edito = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.info("EDITO: not found configuration.");
|
||||
edito = null;
|
||||
}
|
||||
|
||||
String page = htmlize(edito);
|
||||
FileUtils.write(new File(htmlizeDirectory, "edito.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final String edito) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building edito page {}.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
if (edito != null)
|
||||
{
|
||||
data.setContent("edito", edito);
|
||||
}
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/edito.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Édito", "edito.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building edito page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,145 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.io.CSVFile;
|
||||
import fr.devinsy.statoolinfos.io.JSONFile;
|
||||
import fr.devinsy.statoolinfos.io.ODSFile;
|
||||
import fr.devinsy.statoolinfos.uptime.ServiceUptimes;
|
||||
import fr.devinsy.statoolinfos.uptime.ServiceUptimesFile;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ExportsPage.
|
||||
*/
|
||||
public class ExportsPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ExportsPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*/
|
||||
public static void build()
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
logger.info("EXPORTS CSV.");
|
||||
CSVFile.save(new File(htmlizeDirectory, "organizations.csv"), federation.getOrganizations());
|
||||
CSVFile.save(new File(htmlizeDirectory, "services.csv"), federation.getServicesAll());
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
logger.error("Error during CSV export: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
logger.info("EXPORTS JSON.");
|
||||
JSONFile.save(new File(htmlizeDirectory, "federation.json"), federation);
|
||||
JSONFile.save(new File(htmlizeDirectory, "organizations.json"), federation.getOrganizations());
|
||||
JSONFile.save(new File(htmlizeDirectory, "services.json"), federation.getServicesAll());
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
logger.error("Error during JSON export: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
logger.info("EXPORTS ODS.");
|
||||
ODSFile.save(new File(htmlizeDirectory, "organizations.ods"), federation.getOrganizations());
|
||||
ODSFile.save(new File(htmlizeDirectory, "services.ods"), federation.getServicesAll());
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.error("Error during ODS export: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
logger.info("EXPORTS SERVICE UPTIME JOURNAL.");
|
||||
ServiceUptimes uptimes = ServiceUptimes.of(federation.getServicesAll(), HtmlizerContext.instance().getUptimeJournal());
|
||||
ServiceUptimesFile.saveCSV(new File(htmlizeDirectory, "serviceUptimeJournal.csv"), uptimes);
|
||||
ServiceUptimesFile.saveODS(new File(htmlizeDirectory, "serviceUptimeJournal.ods"), uptimes);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.error("Error during Uptime export: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
String page = htmlize();
|
||||
FileUtils.write(new File(htmlizeDirectory, "exports.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (StatoolInfosException | IOException exception)
|
||||
{
|
||||
logger.error("Error building export page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize() throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.info("PAGE EXPORTS.");
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/exports.xhtml", null).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class CrawlJournalFederationPage.
|
||||
*/
|
||||
public class FederationCrawlJournalPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationCrawlJournalPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build() throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", FederationHeaderView.htmlize(federation));
|
||||
data.setContent("contentView", CrawlJournalView.htmlize(federation.getCrawlJournal()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
String page = WebCharterView.build(content, trail);
|
||||
FileUtils.write(new File(htmlizeDirectory, federation.getLocalFileBaseName() + "-crawl.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation crawl journal page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.DisplayMode;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class FederationHeaderView.
|
||||
*/
|
||||
public class FederationHeaderView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationHeaderView.class);
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param federation
|
||||
* the federation
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Federation federation) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setAttribute("federationRawButton", "href", federation.getTechnicalName() + ".properties");
|
||||
data.setAttribute("federationLogo", "src", federation.getLogoFileName());
|
||||
data.setEscapedContent("federationName", federation.getName());
|
||||
data.setEscapedContent("federationDescription", federation.getDescription());
|
||||
|
||||
if (federation.getWebsiteURL() != null)
|
||||
{
|
||||
data.setEscapedContent("federationURL", federation.getWebsiteURL().toString());
|
||||
data.setEscapedAttribute("federationURL", "href", federation.getWebsiteURL().toString());
|
||||
}
|
||||
data.setContent("federationStartDate", StringUtils.defaultIfBlank(federation.getStartDateValue(), "n/a"));
|
||||
|
||||
data.setAttribute("organizationsLink", "href", federation.getTechnicalName() + "-organizations.xhtml");
|
||||
data.setAttribute("servicesLink", "href", federation.getTechnicalName() + "-services.xhtml");
|
||||
data.setAttribute("rawLink", "href", federation.getTechnicalName() + ".properties");
|
||||
data.setAttribute("propertyCheckLink", "href", federation.getTechnicalName() + "-propertycheck.xhtml");
|
||||
data.setAttribute("statsLink", "href", federation.getTechnicalName() + "-stats.xhtml");
|
||||
data.setAttribute("metricsLink", "href", federation.getTechnicalName() + "-metrics-summary-months-last.xhtml");
|
||||
data.setAttribute("figuresLink", "href", federation.getTechnicalName() + "-services-figures.xhtml");
|
||||
|
||||
data.setAttribute("crawlLink", "href", federation.getTechnicalName() + "-crawl.xhtml");
|
||||
data.setAttribute("uptimeLink", "href", federation.getLocalFileBaseName() + "-uptimes.xhtml");
|
||||
|
||||
if (HtmlizerContext.instance().getUptimeJournal().hasRecentError(federation.getActiveServices()))
|
||||
{
|
||||
data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ko-mono.svg");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ok-mono.svg");
|
||||
}
|
||||
|
||||
if (federation.getCrawlJournal().getErrors().isEmpty())
|
||||
{
|
||||
data.setAttribute("crawlLinkImg", "src", "circle-icons/download-mono.svg");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("crawlLinkImg", "src", "circle-icons/download.svg");
|
||||
}
|
||||
|
||||
{
|
||||
PropertyChecks checks = federation.getInputChecksAll();
|
||||
|
||||
data.setContent("errorCount", checks.getErrorCount());
|
||||
data.setContent("warningCount", checks.getWarningCount());
|
||||
data.setContent("voidCount", checks.getVoidCount());
|
||||
|
||||
data.setAttribute("alertLink", "href", federation.getTechnicalName() + "-propertyalerts.xhtml");
|
||||
}
|
||||
|
||||
if (federation.getLegalURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("legalLink", "href", federation.getLegalURL().toString());
|
||||
data.setAttribute("legalLinkImg", "class", "");
|
||||
data.getIdData("legalLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (federation.getContactURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("contactLink", "href", federation.getContactURL().toString());
|
||||
data.setAttribute("contactLinkImg", "class", "");
|
||||
data.getIdData("contactLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(federation.getContactEmail()))
|
||||
{
|
||||
data.setEscapedAttribute("emailLink", "href", "mailto:" + federation.getContactEmail());
|
||||
data.setAttribute("emailLinkImg", "class", "");
|
||||
data.getIdData("emailLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (federation.getUserGuideURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("userDocLink", "href", federation.getUserGuideURL().toString());
|
||||
data.setAttribute("userDocLinkImg", "class", "");
|
||||
data.getIdData("userDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (federation.getTechnicalGuideURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("technicalDocLink", "href", federation.getTechnicalGuideURL().toString());
|
||||
data.setAttribute("technicalDocLinkImg", "class", "");
|
||||
data.getIdData("technicalDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federationHeaderView.xhtml", data).toString();
|
||||
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation header view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class FederationMetricsPage.
|
||||
*/
|
||||
public class FederationMetricGenericPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationMetricGenericPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @param federation
|
||||
* the federation
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Federation federation, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", FederationHeaderView.htmlize(federation));
|
||||
data.setContent("metricMenuView", FederationMetricMenuView.htmlize(federation, TypeMenu.GENERIC, view, period));
|
||||
|
||||
//
|
||||
FederationMetricHtmlizer.htmlize(data, "graphic.users", federation, view, period, "metrics.service.users", ChartColor.GREEN);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "graphic.users.ipv4-ipv6", federation, view, period, "service.users (ipv4 + ipv6)", "metrics.service.users.ipv4", ChartColor.YELLOW,
|
||||
"metrics.service.users.ipv6", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "graphic.users.ipv4", federation, view, period, "metrics.service.users.ipv4", ChartColor.YELLOW);
|
||||
FederationMetricHtmlizer.htmlize(data, "graphic.users.ipv6", federation, view, period, "metrics.service.users.ipv6", ChartColor.GREEN);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "graphic.accounts", federation, view, period, "metrics.service.accounts", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "graphic.accounts.active", federation, view, period, "metrics.service.accounts.active", ChartColor.GREEN);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "graphic.database.bytes", federation, view, period, "metrics.service.database.bytes", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "graphic.datafiles.bytes", federation, view, period, "metrics.service.datafiles.bytes", ChartColor.GREEN);
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricGenericView.xhtml", data).toString();
|
||||
|
||||
//
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Metrics génériques");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-generic-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation metrics page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,192 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.time.YearMonth;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.threeten.extra.YearWeek;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.WeekValues;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.YearValues;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
|
||||
/**
|
||||
* The Class MetricHtmlizeDataUtils.
|
||||
*/
|
||||
public class FederationMetricHtmlizer
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationMetricHtmlizer.class);
|
||||
|
||||
/**
|
||||
* Htmlize data.
|
||||
*
|
||||
* @param data
|
||||
* the data
|
||||
* @param metricId
|
||||
* the metric id
|
||||
* @param federation
|
||||
* the federation
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @param metricPath
|
||||
* the metric path
|
||||
* @param color
|
||||
* the color
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void htmlize(final TagDataManager data, final String metricId, final Federation federation, final ViewMenu view, final PeriodMenu period, final String metricPath,
|
||||
final ChartColor color) throws StatoolInfosException
|
||||
{
|
||||
if (view == ViewMenu.YEARS)
|
||||
{
|
||||
YearValues yearMetric = federation.getMetricYearValuesAll(metricPath);
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, yearMetric, color));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.MONTHS)
|
||||
{
|
||||
MonthValues monthMetric = federation.getMetricMonthValuesAll(metricPath);
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, monthMetric, color));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearMonth.now().minusMonths(11), YearMonth.now(), monthMetric, color));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearMonth.of(year, 01), YearMonth.of(year, 12), monthMetric, color));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.WEEKS)
|
||||
{
|
||||
WeekValues weekMetric = federation.getMetricWeekValuesAll(metricPath);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, weekMetric, color));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearWeek.now().minusYears(1), YearWeek.now(), weekMetric, color));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearWeek.of(year, 01), YearWeek.of(year, 53), weekMetric, color));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param data
|
||||
* the data
|
||||
* @param metricId
|
||||
* the metric id
|
||||
* @param federation
|
||||
* the federation
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @param metricLabel
|
||||
* the metric label
|
||||
* @param metricPath1
|
||||
* the metric path 1
|
||||
* @param color1
|
||||
* the color 1
|
||||
* @param metricPath2
|
||||
* the metric path 2
|
||||
* @param color2
|
||||
* the color 2
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void htmlize(final TagDataManager data, final String metricId, final Federation federation, final ViewMenu view, final PeriodMenu period, final String metricLabel,
|
||||
final String metricPath1, final ChartColor color1, final String metricPath2, final ChartColor color2) throws StatoolInfosException
|
||||
{
|
||||
if (view == ViewMenu.YEARS)
|
||||
{
|
||||
YearValues yearMetric1 = federation.getMetricYearValuesAll(metricPath1);
|
||||
YearValues yearMetric2 = federation.getMetricYearValuesAll(metricPath2);
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, yearMetric1, yearMetric2));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.MONTHS)
|
||||
{
|
||||
//
|
||||
MonthValues monthMetric1 = federation.getMetricMonthValuesAll(metricPath1);
|
||||
MonthValues monthMetric2 = federation.getMetricMonthValuesAll(metricPath2);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId,
|
||||
ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearMonth.now().minusMonths(11), YearMonth.now(), new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId,
|
||||
ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearMonth.of(year, 01), YearMonth.of(year, 12), new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.WEEKS)
|
||||
{
|
||||
WeekValues weekMetric1 = federation.getMetricWeekValuesAll(metricPath1);
|
||||
WeekValues weekMetric2 = federation.getMetricWeekValuesAll(metricPath2);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearWeek.now().minusYears(1), YearWeek.now(), new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearWeek.of(year, 01), YearWeek.of(year, 53), new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,264 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2023 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationMetricMenuView.
|
||||
*/
|
||||
public class FederationMetricMenuView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationMetricMenuView.class);
|
||||
|
||||
public enum PeriodMenu
|
||||
{
|
||||
FULL,
|
||||
LAST,
|
||||
Y2021,
|
||||
Y2022;
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
String result;
|
||||
|
||||
if (this.name().startsWith("Y"))
|
||||
{
|
||||
result = this.name().substring(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = this.name().toLowerCase();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the years.
|
||||
*
|
||||
* @return the years
|
||||
*/
|
||||
public static PeriodMenu[] getYears()
|
||||
{
|
||||
PeriodMenu[] result;
|
||||
|
||||
ArrayList<PeriodMenu> list = new ArrayList<PeriodMenu>();
|
||||
for (PeriodMenu item : values())
|
||||
{
|
||||
if (item.name().startsWith("Y"))
|
||||
{
|
||||
list.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
result = list.toArray(new PeriodMenu[0]);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public enum TypeMenu
|
||||
{
|
||||
SUMMARY,
|
||||
WEB,
|
||||
GENERIC,
|
||||
SPECIFIC;
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.name().toLowerCase();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ViewMenu
|
||||
{
|
||||
YEARS,
|
||||
MONTHS,
|
||||
WEEKS,
|
||||
DAYS;
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.name().toLowerCase();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param federation
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Federation federation, final TypeMenu type, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
String filename = String.format("%s-metrics-summary-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("summaryTypeButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-generic-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("genericTypeButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-specific-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("specificTypeButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-web-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("webTypeButton", "href", filename);
|
||||
|
||||
//
|
||||
filename = String.format("%s-metrics-%s-years-%s.xhtml", federation.getLocalFileBaseName(), type.getName(), PeriodMenu.FULL.getName());
|
||||
data.setAttribute("yearsViewButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-months-%s.xhtml", federation.getLocalFileBaseName(), type.getName(), period.getName());
|
||||
data.setAttribute("monthsViewButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-weeks-%s.xhtml", federation.getLocalFileBaseName(), type.getName(), period.getName());
|
||||
data.setAttribute("weeksViewButton", "href", filename);
|
||||
|
||||
data.setAttribute("daysViewButton", "href", "#");
|
||||
|
||||
//
|
||||
filename = String.format("%s-metrics-%s-%s-full.xhtml", federation.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("fullPeriodButton", "href", filename);
|
||||
|
||||
if (view != ViewMenu.YEARS)
|
||||
{
|
||||
filename = String.format("%s-metrics-%s-%s-last.xhtml", federation.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("lastPeriodButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-%s-2021.xhtml", federation.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("2021PeriodButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-%s-2022.xhtml", federation.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("2022PeriodButton", "href", filename);
|
||||
}
|
||||
|
||||
//
|
||||
if ((type == null) || (type == TypeMenu.SUMMARY))
|
||||
{
|
||||
data.appendAttribute("summaryTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (type == TypeMenu.GENERIC)
|
||||
{
|
||||
data.appendAttribute("genericTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (type == TypeMenu.WEB)
|
||||
{
|
||||
data.appendAttribute("webTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (type == TypeMenu.SPECIFIC)
|
||||
{
|
||||
data.appendAttribute("specificTypeButton", "class", "button selected");
|
||||
}
|
||||
|
||||
//
|
||||
if ((view == null) || (view == ViewMenu.YEARS))
|
||||
{
|
||||
data.appendAttribute("yearsViewButton", "class", "button selected");
|
||||
}
|
||||
else if (view == ViewMenu.MONTHS)
|
||||
{
|
||||
data.appendAttribute("monthsViewButton", "class", "button selected");
|
||||
}
|
||||
else if (view == ViewMenu.WEEKS)
|
||||
{
|
||||
data.appendAttribute("weeksViewButton", "class", "button selected");
|
||||
}
|
||||
else if (view == ViewMenu.DAYS)
|
||||
{
|
||||
data.appendAttribute("daysViewButton", "class", "button selected");
|
||||
}
|
||||
|
||||
//
|
||||
if ((period == null) || (period == PeriodMenu.FULL))
|
||||
{
|
||||
data.appendAttribute("fullPeriodButton", "class", "button selected");
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.appendAttribute("lastPeriodButton", "class", "button selected");
|
||||
}
|
||||
else if (period == PeriodMenu.Y2021)
|
||||
{
|
||||
data.appendAttribute("2021PeriodButton", "class", "button selected");
|
||||
}
|
||||
else if (period == PeriodMenu.Y2022)
|
||||
{
|
||||
data.appendAttribute("2022PeriodButton", "class", "button selected");
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/metricMenuView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building metric menu view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class FederationMetricsPage.
|
||||
*/
|
||||
public class FederationMetricSpecificPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationMetricSpecificPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Federation federation, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", FederationHeaderView.htmlize(federation));
|
||||
data.setContent("metricMenuView", FederationMetricMenuView.htmlize(federation, TypeMenu.SPECIFIC, view, period));
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString();
|
||||
|
||||
//
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Metrics spécifiques");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-specific-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation metrics page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class FederationMetricsPage.
|
||||
*/
|
||||
public class FederationMetricSummaryPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationMetricSummaryPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @param federation
|
||||
* the federation
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Federation federation, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", FederationHeaderView.htmlize(federation));
|
||||
data.setContent("metricMenuView", FederationMetricMenuView.htmlize(federation, TypeMenu.SUMMARY, view, period));
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.hits.humans", federation, view, period, "metrics.http.hits.humans", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.visitors", federation, view, period, "metrics.http.visitors", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.visits", federation, view, period, "metrics.http.visits", ChartColor.GREEN);
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Metrics résumé");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-summary-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation metrics page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class FederationMetricWebPage.
|
||||
*/
|
||||
public class FederationMetricWebPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationMetricWebPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Federation federation, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", FederationHeaderView.htmlize(federation));
|
||||
data.setContent("metricMenuView", FederationMetricMenuView.htmlize(federation, TypeMenu.WEB, view, period));
|
||||
|
||||
//
|
||||
FederationMetricHtmlizer.htmlize(data, "http.hits", federation, view, period, "metrics.http.hits", ChartColor.BLUE);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.hits-ipv4ipv6", federation, view, period, "http.hits (ipv4 + ipv6)", "metrics.http.hits.ipv4", ChartColor.YELLOW, "metrics.http.hits.ipv6",
|
||||
ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.hits.ipv4", federation, view, period, "metrics.http.hits.ipv4", ChartColor.YELLOW);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.hits.ipv6", federation, view, period, "metrics.http.hits.ipv6", ChartColor.GREEN);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.hits-humansbots", federation, view, period, "http.hits (humans + bots)", "metrics.http.hits.humans", ChartColor.GREEN,
|
||||
"metrics.http.hits.bots",
|
||||
ChartColor.YELLOW);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.hits.humans", federation, view, period, "metrics.http.hits.humans", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.hits.bots", federation, view, period, "metrics.http.hits.bots", ChartColor.YELLOW);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.hits.humans-ipv4ipv6", federation, view, period, "http.hits.humans (ipv4 + ipv6)", "metrics.http.hits.humans.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.hits.humans.ipv6", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.hits.humans.ipv4", federation, view, period, "metrics.http.hits.humans.ipv4", ChartColor.YELLOW);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.hits.humans.ipv6", federation, view, period, "metrics.http.hits.humans.ipv6", ChartColor.GREEN);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.errors", federation, view, period, "metrics.http.errors", ChartColor.RED);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.errors.php", federation, view, period, "metrics.http.errors.php", ChartColor.RED);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.files", federation, view, period, "metrics.http.files", ChartColor.BLUE);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.pages", federation, view, period, "metrics.http.pages", ChartColor.BLUE);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.bytes", federation, view, period, "metrics.http.bytes", ChartColor.BLUE);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.ip", federation, view, period, "metrics.http.ip", ChartColor.BLUE);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.ip-humansbots", federation, view, period, "http.ip (humans + bots)", "metrics.http.ip.humans", ChartColor.GREEN, "metrics.http.ip.bots",
|
||||
ChartColor.YELLOW);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.ip.humans", federation, view, period, "metrics.http.ip.humans", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.ip.bots", federation, view, period, "metrics.http.ip.bots", ChartColor.YELLOW);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.ip-ipv4ipv6", federation, view, period, "http.ip (ipv4 + ipv6)", "metrics.http.ip.ipv4", ChartColor.YELLOW, "metrics.http.ip.ipv6",
|
||||
ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.ip.ipv4", federation, view, period, "metrics.http.ip.ipv4", ChartColor.YELLOW);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.ip.ipv6", federation, view, period, "metrics.http.ip.ipv6", ChartColor.GREEN);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.requesters", federation, view, period, "metrics.http.requesters", ChartColor.BLUE);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.requesters-humansbots", federation, view, period, "http.requesters (humans + bots)", "metrics.http.requesters.humans", ChartColor.GREEN,
|
||||
"metrics.http.requesters.bots", ChartColor.YELLOW);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.requesters.humans", federation, view, period, "metrics.http.requesters.humans", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.requesters.bots", federation, view, period, "metrics.http.requesters.bots", ChartColor.YELLOW);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.requesters-ipv4ipv6", federation, view, period, "http.requesters (ipv4 + ipv6)", "metrics.http.requesters.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.requesters.ipv6", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.requesters.ipv4", federation, view, period, "metrics.http.requesters.ipv4", ChartColor.YELLOW);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.requesters.ipv6", federation, view, period, "metrics.http.requesters.ipv6", ChartColor.GREEN);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.visitors", federation, view, period, "metrics.http.visitors", ChartColor.BLUE);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.visitors-ipv4ipv6", federation, view, period, "http.visitors (ipv4 + ipv6)", "metrics.http.visitors.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.visitors.ipv6", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.visitors.ipv4", federation, view, period, "metrics.http.visitors.ipv4", ChartColor.YELLOW);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.visitors.ipv6", federation, view, period, "metrics.http.visitors.ipv6", ChartColor.GREEN);
|
||||
|
||||
FederationMetricHtmlizer.htmlize(data, "http.visits", federation, view, period, "metrics.http.visits", ChartColor.BLUE);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.visits-ipv4ipv6", federation, view, period, "http.visits (ipv4 + ipv6)", "metrics.http.visits.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.visits.ipv6", ChartColor.GREEN);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.visits.ipv4", federation, view, period, "metrics.http.visits.ipv4", ChartColor.YELLOW);
|
||||
FederationMetricHtmlizer.htmlize(data, "http.visits.ipv6", federation, view, period, "metrics.http.visits.ipv6", ChartColor.GREEN);
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString();
|
||||
|
||||
//
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Metrics web");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-web-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation metrics page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class FederationOrganizationsPage.
|
||||
*/
|
||||
public class FederationOrganizationsPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationOrganizationsPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void build() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
//
|
||||
logger.info("PAGE FEDERATION organizations page: {}.", federation.getName());
|
||||
String page = htmlize(federation);
|
||||
|
||||
FileUtils.write(new File(htmlizeDirectory, federation.getLocalFileBaseName() + "-organizations.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param federation
|
||||
* the organization
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String htmlize(final Federation federation) throws StatoolInfosException, IOException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("federationHeaderView", FederationHeaderView.htmlize(federation));
|
||||
|
||||
data.setContent("organizationListView", OrganizationListView.htmlize(federation.getMemberOrganizations(), federation.getAwayOrganizations()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federationOrganizations.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation organizations page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.catgenerator.core.CatGenerator;
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.ViewMenu;
|
||||
|
||||
/**
|
||||
* The Class FederationPage.
|
||||
*/
|
||||
public class FederationPages
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationPages.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void build() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
CrawlCache cache = HtmlizerContext.instance().getCache();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
//
|
||||
logger.info("PAGE FEDERATION Htmlize federation logo.");
|
||||
htmlizeFederationLogo(federation, cache, htmlizeDirectory);
|
||||
|
||||
//
|
||||
logger.info("PAGE FEDERATION Htmlize federation properties files.");
|
||||
FileUtils.copyFile(federation.getInputFile(), new File(htmlizeDirectory, federation.getTechnicalName() + ".properties"));
|
||||
|
||||
logger.info("PAGE FEDERATION federation page: {}.", federation.getName());
|
||||
String page = FederationOrganizationsPage.htmlize(federation);
|
||||
FileUtils.write(new File(htmlizeDirectory, "index.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
//
|
||||
FederationOrganizationsPage.build();
|
||||
FederationServicesPage.build();
|
||||
FederationServicesFiguresPage.build();
|
||||
FederationCrawlJournalPage.build();
|
||||
FederationPropertyCheckPage.build();
|
||||
FederationPropertyAlertPage.buildAll();
|
||||
FederationStatsPage.build();
|
||||
FederationUptimePage.build();
|
||||
|
||||
//
|
||||
logger.info("Htmlize federation metric pages: {}.", federation.getName());
|
||||
for (ViewMenu view : ViewMenu.values())
|
||||
{
|
||||
for (PeriodMenu period : PeriodMenu.values())
|
||||
{
|
||||
if ((view != ViewMenu.YEARS) || (period == PeriodMenu.FULL))
|
||||
{
|
||||
if (view != ViewMenu.DAYS)
|
||||
{
|
||||
FederationMetricSummaryPage.build(htmlizeDirectory, federation, view, period);
|
||||
FederationMetricGenericPage.build(htmlizeDirectory, federation, view, period);
|
||||
FederationMetricSpecificPage.build(htmlizeDirectory, federation, view, period);
|
||||
FederationMetricWebPage.build(htmlizeDirectory, federation, view, period);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize federation logo.
|
||||
*
|
||||
* @param federation
|
||||
* the federation
|
||||
* @param cache
|
||||
* the cache
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
private static void htmlizeFederationLogo(final Federation federation, final CrawlCache cache, final File htmlizeDirectory) throws IOException
|
||||
{
|
||||
logger.info("Htmlize federation logo.");
|
||||
|
||||
File target = new File(htmlizeDirectory, federation.getLogoFileName());
|
||||
|
||||
File logoFile = cache.restoreFile(federation.getLogoURL());
|
||||
if (logoFile == null)
|
||||
{
|
||||
logger.info("CatGeneratoring cat avatar: {}", target.getAbsoluteFile());
|
||||
CatGenerator.buildAvatarTo(federation.getTechnicalName(), target);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileUtils.copyFile(logoFile, target);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,154 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class FederationPropertyCheckAlertPage.
|
||||
*/
|
||||
public class FederationPropertyAlertPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationPropertyAlertPage.class);
|
||||
|
||||
public enum PropertyAlertScope
|
||||
{
|
||||
ALL,
|
||||
FEDERATION,
|
||||
ORGANIZATIONS,
|
||||
SERVICES,
|
||||
METRICS
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void buildAll() throws IOException, StatoolInfosException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
String page = htmlize(PropertyAlertScope.ALL);
|
||||
FileUtils.write(new File(htmlizeDirectory, federation.getTechnicalName() + "-propertyalerts.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
page = htmlize(PropertyAlertScope.FEDERATION);
|
||||
FileUtils.write(new File(htmlizeDirectory, federation.getLocalFileBaseName() + "-propertyalerts-federation.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
page = htmlize(PropertyAlertScope.ORGANIZATIONS);
|
||||
FileUtils.write(new File(htmlizeDirectory, federation.getLocalFileBaseName() + "-propertyalerts-organizations.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
page = htmlize(PropertyAlertScope.SERVICES);
|
||||
FileUtils.write(new File(htmlizeDirectory, federation.getLocalFileBaseName() + "-propertyalerts-services.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param scope
|
||||
* the scope
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final PropertyAlertScope scope) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", FederationHeaderView.htmlize(federation));
|
||||
// TODO submenu
|
||||
data.setAttribute("allButton", "href", federation.getLocalFileBaseName() + "-propertyalerts.xhtml");
|
||||
data.setAttribute("federationButton", "href", federation.getLocalFileBaseName() + "-propertyalerts-federation.xhtml");
|
||||
data.setAttribute("organizationButton", "href", federation.getLocalFileBaseName() + "-propertyalerts-organizations.xhtml");
|
||||
data.setAttribute("serviceButton", "href", federation.getLocalFileBaseName() + "-propertyalerts-services.xhtml");
|
||||
data.setAttribute("metricsButton", "href", federation.getLocalFileBaseName() + "-propertyalerts-metrics.xhtml");
|
||||
|
||||
PropertyChecks checks;
|
||||
if (scope == PropertyAlertScope.ALL)
|
||||
{
|
||||
checks = federation.getInputChecksAll().getAlertLines();
|
||||
}
|
||||
else if (scope == PropertyAlertScope.FEDERATION)
|
||||
{
|
||||
checks = federation.getInputChecks().getAlertLines();
|
||||
}
|
||||
else if (scope == PropertyAlertScope.ORGANIZATIONS)
|
||||
{
|
||||
checks = new PropertyChecks();
|
||||
for (Organization organization : federation.getOrganizations())
|
||||
{
|
||||
checks.addAll(organization.getInputChecks().getAlertLines());
|
||||
}
|
||||
}
|
||||
else if (scope == PropertyAlertScope.SERVICES)
|
||||
{
|
||||
checks = new PropertyChecks();
|
||||
for (Service service : federation.getServicesAll())
|
||||
{
|
||||
checks.addAll(service.getInputChecksAll().getAlertLines());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
checks = new PropertyChecks();
|
||||
}
|
||||
data.setContent("contentView", PropertyAlertView.htmlize(checks));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federationPropertyAlertView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Propriétés en alertes", federation.getLocalFileBaseName() + "-propertyalerts.xhtml");
|
||||
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation property file check alert page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class PropertyFileCheckPage.
|
||||
*/
|
||||
public class FederationPropertyCheckPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationPropertyCheckPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void build() throws IOException, StatoolInfosException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
String page = htmlize(federation);
|
||||
FileUtils.write(new File(htmlizeDirectory, federation.getTechnicalName() + "-propertycheck.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param federation
|
||||
* the federation
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Federation federation) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", FederationHeaderView.htmlize(federation));
|
||||
data.setContent("contentView", PropertyCheckView.htmlize(federation.getInputChecks()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Propriétés", federation.getLocalFileBaseName() + "-propertycheck.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation property file check page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class FederationServicesFiguresPage.
|
||||
*/
|
||||
public class FederationServicesFiguresPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationServicesFiguresPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void build() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
//
|
||||
logger.info("PAGE FEDERATION services figures page: {}.", federation.getName());
|
||||
String page = htmlize(federation);
|
||||
|
||||
FileUtils.write(new File(htmlizeDirectory, federation.getLocalFileBaseName() + "-services-figures.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param federation
|
||||
* the organization
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String htmlize(final Federation federation) throws StatoolInfosException, IOException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("federationHeaderView", FederationHeaderView.htmlize(federation));
|
||||
data.setContent("serviceListView", ServiceFigureView.htmlize(federation.getServices()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federationServices.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation services figures page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class FederationServicesPage.
|
||||
*/
|
||||
public class FederationServicesPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationServicesPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void build() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
//
|
||||
logger.info("PAGE FEDERATION services page: {}.", federation.getName());
|
||||
String page = htmlize(federation);
|
||||
|
||||
FileUtils.write(new File(htmlizeDirectory, federation.getLocalFileBaseName() + "-services.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param federation
|
||||
* the organization
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String htmlize(final Federation federation) throws StatoolInfosException, IOException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("federationHeaderView", FederationHeaderView.htmlize(federation));
|
||||
data.setContent("serviceListView", ServiceListView.htmlize(federation.getServices()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federationServices.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation services page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Organizations;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.stats.StatAgent;
|
||||
import fr.devinsy.statoolinfos.stats.services.RegistrationStats;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class FederationStatsPage.
|
||||
*/
|
||||
public class FederationStatsPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationStatsPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build() throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.debug("Building federation stats page {}…");
|
||||
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
// CrawlCache cache = HtmlizerContext.instance().getCache();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
Organizations organizations = federation.getActiveOrganizations();
|
||||
Services services = federation.getActiveServices();
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("federationHeaderView", FederationHeaderView.htmlize(federation));
|
||||
|
||||
data.setContent("turnoutChart", ChartHtmlizer.htmlizeOrganizationTurnoutChart(organizations));
|
||||
data.setContent("organizationCountryChart", ChartHtmlizer.htmlizeOrganizationCountryChart(organizations));
|
||||
data.setContent("organizationCountChart", ChartHtmlizer.htmlizeOrganizationCountChart(federation));
|
||||
data.setContent("organizationInOutChart", ChartHtmlizer.htmlizeOrganizationInOutChart(federation));
|
||||
|
||||
data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(federation));
|
||||
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(services));
|
||||
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(services));
|
||||
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(services));
|
||||
|
||||
data.setContent("hostNameChart", ChartHtmlizer.htmlizeHostNamePieChart(services));
|
||||
data.setContent("hostProviderHypervisorChart", ChartHtmlizer.htmlizeHostProviderHypervisorChart(services));
|
||||
|
||||
data.setContent("hostServerDistributionChart", ChartHtmlizer.htmlizeHostServerDistributionChart(services));
|
||||
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(services));
|
||||
|
||||
{
|
||||
RegistrationStats stats = StatAgent.statRegistrationTypes(services);
|
||||
|
||||
data.setContent("registrationTypeChart", ChartHtmlizer.htmlizeRegistrationBarChart(stats));
|
||||
data.setContent("registrationNoneTypeChart", ChartHtmlizer.htmlizeRegistrationNonePieChart(stats));
|
||||
data.setContent("registrationFreeTypeChart", ChartHtmlizer.htmlizeRegistrationFreePieChart(stats));
|
||||
data.setContent("registrationMemberTypeChart", ChartHtmlizer.htmlizeRegistrationMemberPieChart(stats));
|
||||
data.setContent("registrationClientTypeChart", ChartHtmlizer.htmlizeRegistrationClientPieChart(stats));
|
||||
}
|
||||
|
||||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(services));
|
||||
data.setContent("organisationTypeChart", ChartHtmlizer.htmlizeOrganizationTypeChart(organizations));
|
||||
|
||||
data.setContent("softwareDistributionPieChart", ChartHtmlizer.htmlizeSoftwareDistributionPieChart(services));
|
||||
data.setContent("categoryDistributionPieChart", ChartHtmlizer.htmlizeCatergoryDistributionPieChart(services));
|
||||
|
||||
data.setContent("softwareDistributionChart", ChartHtmlizer.htmlizeSoftwareDistributionChart());
|
||||
|
||||
data.setContent("categoryDistributionChart", ChartHtmlizer.htmlizeCategoryDistributionChart());
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federationStats.xhtml", data).toString();
|
||||
|
||||
//
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
FileUtils.write(new File(htmlizeDirectory, federation.getTechnicalName() + "-stats.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building federation stats page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.uptime.UptimeJournal;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class FederationUptimePage.
|
||||
*/
|
||||
public class FederationUptimePage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(FederationUptimePage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
UptimeJournal journal = HtmlizerContext.instance().getUptimeJournal();
|
||||
|
||||
String page = htmlize(federation, journal);
|
||||
FileUtils.write(new File(htmlizeDirectory, federation.getLocalFileBaseName() + "-uptimes.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param federation
|
||||
* the federation
|
||||
* @param journal
|
||||
* the journal
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static String htmlize(final Federation federation, final UptimeJournal journal) throws StatoolInfosException, IOException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", FederationHeaderView.htmlize(federation));
|
||||
data.setContent("uptimeView", UptimeView.htmlize(federation.getActiveServices(), journal));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/uptimePage.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Disponibilité des services", federation.getLocalFileBaseName() + "-uptimes.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building FederationUptime page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,184 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Category;
|
||||
import fr.devinsy.statoolinfos.core.Configuration;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
|
||||
import fr.devinsy.statoolinfos.util.URLUtils;
|
||||
|
||||
/**
|
||||
* The Class Htmlizer.
|
||||
*/
|
||||
public class Htmlizer
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(Htmlizer.class);
|
||||
|
||||
/**
|
||||
* Instantiates a new htmlizer.
|
||||
*/
|
||||
private Htmlizer()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear.
|
||||
*
|
||||
* @param configuration
|
||||
* the configuration
|
||||
*/
|
||||
public static void clear(final Configuration configuration)
|
||||
{
|
||||
logger.info("Htmlize directory setting: {}", configuration.getHtmlizeDirectoryPath());
|
||||
|
||||
String htmlDirectoryPath = configuration.getHtmlizeDirectoryPath();
|
||||
if (StringUtils.isBlank(htmlDirectoryPath))
|
||||
{
|
||||
logger.warn("Undefined htmlize directory.");
|
||||
}
|
||||
else if (!new File(htmlDirectoryPath).exists())
|
||||
{
|
||||
logger.warn("Htmlize directory does not exist: {}.", htmlDirectoryPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
File htmlizeDirectory = configuration.getHtmlizeDirectory();
|
||||
|
||||
for (File file : htmlizeDirectory.listFiles())
|
||||
{
|
||||
if ((file.isFile()) && (StringUtils.endsWithAny(file.getName(), ".properties", ".js", ".html", ".ico", ".css", ".jpg", ".png", ".xhtml")))
|
||||
{
|
||||
logger.info("Deleting " + file.getName());
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy categories stuff.
|
||||
*
|
||||
* @param path
|
||||
* the path
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
private static void copyCategoriesStuff(final String path, final File targetDirectory) throws IOException
|
||||
{
|
||||
if (StringUtils.isNotBlank(path))
|
||||
{
|
||||
File source = new File(path);
|
||||
File target = new File(targetDirectory, "categories");
|
||||
|
||||
for (File file : source.listFiles())
|
||||
{
|
||||
if (file.isFile())
|
||||
{
|
||||
FileUtils.copyFileToDirectory(file, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check.
|
||||
for (Category category : HtmlizerContext.instance().getCategories())
|
||||
{
|
||||
File categoryFile = new File(targetDirectory, category.getLogoPath());
|
||||
|
||||
if (!categoryFile.exists())
|
||||
{
|
||||
category.setLogoPath(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy stuff.
|
||||
*
|
||||
* @param target
|
||||
* the target
|
||||
* @throws IOException
|
||||
*/
|
||||
private static void copyStuff(final File targetDirectory) throws IOException
|
||||
{
|
||||
// Copy commons files (index, images, favicon, css…).
|
||||
if (!new File(targetDirectory, "index.html").exists())
|
||||
{
|
||||
String source = "/fr/devinsy/statoolinfos/htmlize/stuff/";
|
||||
URLUtils.copyDeeply(StatoolInfosUtils.class.getResource(source), targetDirectory);
|
||||
|
||||
URLUtils.copyResource(source + "statoolinfos-logo.jpg", new File(targetDirectory, "logo.jpg"));
|
||||
URLUtils.copyResource(source + "statoolinfos-logo.ico", new File(targetDirectory, "favicon.ico"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param configurationFile
|
||||
* the configuration file
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void htmlize(final File configurationFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
logger.info("Htmlize {}", configurationFile.getAbsolutePath());
|
||||
|
||||
HtmlizerContext.instance().configure(configurationFile);
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
copyStuff(htmlizeDirectory);
|
||||
copyCategoriesStuff(HtmlizerContext.instance().getConfiguration().get("conf.htmlize.categories.icons"), htmlizeDirectory);
|
||||
|
||||
AboutPage.build();
|
||||
CategoriesPage.build();
|
||||
CategoryPage.buildAll();
|
||||
EditoPage.build();
|
||||
ExportsPage.build();
|
||||
FederationPages.build();
|
||||
OrganizationPage.buildAll();
|
||||
OrganizationCrawlJournalPage.buildAll();
|
||||
OrganizationUptimePage.buildAll();
|
||||
OrganizationPropertyCheckPage.buildAll();
|
||||
OrganizationPropertyAlertPage.buildAll();
|
||||
PropertiesFilesPage.build();
|
||||
PropertyStatsPage.buildAll();
|
||||
ServicePage.buildAll();
|
||||
ServiceCrawlJournalPage.buildAll();
|
||||
ServicePropertyCheckPage.buildAll();
|
||||
ServicePropertyAlertPage.buildAll();
|
||||
ServiceUptimePage.buildAll();
|
||||
ServicesPage.build();
|
||||
SoftwaresPage.build();
|
||||
SoftwarePage.buildAll();
|
||||
SocialNetworksPage.buildAll();
|
||||
// PropertyCheckView.buildAll();
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class CrawlJournalOrganizationPage.
|
||||
*/
|
||||
public class OrganizationCrawlJournalPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationCrawlJournalPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param organization
|
||||
* the organization
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final Organization organization) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
data.setContent("contentView", CrawlJournalView.htmlize(organization.getCrawlJournal()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
String page = WebCharterView.build(content, trail);
|
||||
FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-crawl.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building organization crawl journal page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void buildAll() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
|
||||
for (Organization organization : federation.getOrganizations())
|
||||
{
|
||||
build(organization);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,181 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.DisplayMode;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationHeaderView.
|
||||
*/
|
||||
public class OrganizationHeaderView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationHeaderView.class);
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param organization
|
||||
* the organization
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Organization organization) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("htmlizing service header page {}…", organization.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setAttribute("organizationRawButton", "href", organization.getTechnicalName() + ".properties");
|
||||
|
||||
data.setAttribute("organizationLogo", "src", organization.getLogoFileName());
|
||||
data.setEscapedContent("organizationName", organization.get("organization.name"));
|
||||
|
||||
if (organization.getWebsiteURL() != null)
|
||||
{
|
||||
data.setEscapedContent("organizationURL", organization.getWebsiteURL().toString());
|
||||
data.setEscapedAttribute("organizationURL", "href", organization.getWebsiteURL().toString());
|
||||
}
|
||||
data.setEscapedContent("organizationDescription", organization.get("organization.description"));
|
||||
|
||||
data.setEscapedContent("organizationMemberOfName", StringUtils.defaultIfBlank(organization.getFederation().getName(), "n/a"));
|
||||
data.setContent("organizationStartDate", StringUtils.defaultIfBlank(organization.getStartDateValue(), "n/a"));
|
||||
data.setContent("organizationEndDate", StringUtils.defaultIfBlank(organization.getEndDateValue(), "n/a"));
|
||||
data.setContent("organizationAge", StringUtils.defaultIfBlank(organization.getAge(), "n/a"));
|
||||
if (StringUtils.isBlank(organization.getEndDateValue()))
|
||||
{
|
||||
data.setContent("organizationMemberOfWord", "depuis");
|
||||
data.setAttribute("organizationEndDateData", "style", "display: none;");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setContent("organizationMemberOfWord", ":");
|
||||
}
|
||||
|
||||
data.setContent("organizationMemberStartDate", StringUtils.defaultIfBlank(organization.getMemberStartDateValue(), "n/a"));
|
||||
data.setContent("organizationMemberEndDate", StringUtils.defaultIfBlank(organization.getMemberEndDateValue(), "n/a"));
|
||||
data.setContent("organizationMemberAge", StringUtils.defaultIfBlank(organization.getMemberAge(), "n/a"));
|
||||
if (StringUtils.isBlank(organization.getMemberEndDateValue()))
|
||||
{
|
||||
data.setAttribute("organizationMemberEndDateData", "style", "display: none;");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setContent("organizationStartDateWord", "");
|
||||
}
|
||||
|
||||
data.setAttribute("organizationsLink", "href", organization.getFederation().getTechnicalName() + "-organizations.xhtml");
|
||||
data.setAttribute("servicesLink", "href", organization.getTechnicalName() + "-services.xhtml");
|
||||
data.setAttribute("rawLink", "href", organization.getTechnicalName() + ".properties");
|
||||
data.setAttribute("rawCheckLink", "href", organization.getTechnicalName() + "-propertycheck.xhtml");
|
||||
|
||||
data.setAttribute("statsLink", "href", organization.getTechnicalName() + "-stats.xhtml");
|
||||
data.setAttribute("metricsLink", "href", organization.getTechnicalName() + "-metrics-summary-months-last.xhtml");
|
||||
|
||||
data.setAttribute("crawlLink", "href", organization.getTechnicalName() + "-crawl.xhtml");
|
||||
if (organization.getCrawlJournal().getErrors().isEmpty())
|
||||
{
|
||||
data.setAttribute("crawlLinkImg", "src", "circle-icons/download-mono.svg");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("crawlLinkImg", "src", "circle-icons/download.svg");
|
||||
}
|
||||
|
||||
data.setAttribute("uptimeLink", "href", organization.getLocalFileBaseName() + "-uptimes.xhtml");
|
||||
if (HtmlizerContext.instance().getUptimeJournal().hasRecentError(organization.getActiveServices()))
|
||||
{
|
||||
data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ko-mono.svg");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ok-mono.svg");
|
||||
}
|
||||
|
||||
{
|
||||
PropertyChecks checks = organization.getInputChecksAll();
|
||||
|
||||
data.setContent("errorCount", checks.getErrorCount());
|
||||
data.setContent("warningCount", checks.getWarningCount());
|
||||
data.setContent("voidCount", checks.getVoidCount());
|
||||
|
||||
data.setAttribute("alertLink", "href", organization.getTechnicalName() + "-propertyalerts.xhtml");
|
||||
}
|
||||
|
||||
if (organization.getLegalURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("legalLink", "href", organization.getLegalURL().toString());
|
||||
data.setAttribute("legalLinkImg", "class", "");
|
||||
data.getIdData("legalLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (organization.getContactURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("contactLink", "href", organization.getContactURL().toString());
|
||||
data.setAttribute("contactLinkImg", "class", "");
|
||||
data.getIdData("contactLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(organization.getContactEmail()))
|
||||
{
|
||||
data.setEscapedAttribute("emailLink", "href", "mailto:" + organization.getContactEmail());
|
||||
data.setAttribute("emailLinkImg", "class", "");
|
||||
data.getIdData("emailLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (organization.getUserGuideURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("userDocLink", "href", organization.getUserGuideURL().toString());
|
||||
data.setAttribute("userDocLinkImg", "class", "");
|
||||
data.getIdData("userDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (organization.getTechnicalGuideURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("technicalDocLink", "href", organization.getTechnicalGuideURL().toString());
|
||||
data.setAttribute("technicalDocLinkImg", "class", "");
|
||||
data.getIdData("technicalDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organizationHeaderView.xhtml", data).toString();
|
||||
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service header view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.Organizations;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
|
||||
import fr.devinsy.strings.StringList;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationsView.
|
||||
*/
|
||||
public class OrganizationListView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationListView.class);
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param organizations
|
||||
* the organizations
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static String htmlize(final Organizations organizations, final Organizations aways) throws StatoolInfosException, IOException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
Organizations actives = organizations.filterActive();
|
||||
data.setContent("organizationCount", actives.size());
|
||||
data.setContent("serviceCount", actives.getActiveServiceCount());
|
||||
|
||||
String monthLabel = LocalDate.now().minusMonths(1).format(DateTimeFormatter.ofPattern("MMMM yyyy")).replace(" ", " ");
|
||||
data.setContent("monthLabel", monthLabel);
|
||||
data.setAttribute("userCountHeaderColumn", "title", monthLabel);
|
||||
data.setAttribute("visitCountHeaderColumn", "title", monthLabel);
|
||||
|
||||
int index = 0;
|
||||
for (Organization organization : actives.sortByReverseServiceCount())
|
||||
{
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineNameLink", "href", organization.getTechnicalName() + ".xhtml");
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineLogo", "src", organization.getLogoFileName());
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineLogo", "alt", organization.getName());
|
||||
data.setEscapedContent("organizationListLine", index, "organizationListLineNameValue", organization.getName());
|
||||
|
||||
if (organization.getWebsiteURL() != null)
|
||||
{
|
||||
data.setEscapedContent("organizationListLine", index, "organizationListLineUrlLink", organization.getWebsiteURL().toString());
|
||||
data.setEscapedAttribute("organizationListLine", index, "organizationListLineUrlLink", "href", organization.getWebsiteURL().toString());
|
||||
}
|
||||
data.setContent("organizationListLine", index, "organizationListLineServiceCount", StatoolInfosUtils.defaultIfZero(organization.getActiveServiceCount(), "😿"));
|
||||
data.setContent("organizationListLine", index, "organizationListLineUserCount", StatoolInfosUtils.defaultIfZero(organization.getPreviousMonthUserCount(), "😢"));
|
||||
data.setContent("organizationListLine", index, "organizationListLineVisitCount", StatoolInfosUtils.defaultIfZero(organization.getPreviousMonthVisitCount(), "😞"));
|
||||
|
||||
data.setContent("organizationListLine", index, "organizationListLineDate", organization.getCrawledDate().format(DateTimeFormatter.ofPattern("dd/MM/YYYY")));
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineDate", "title", organization.getCrawledDate().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
|
||||
Organizations idles = organizations.getIdles();
|
||||
if (idles.isEmpty())
|
||||
{
|
||||
data.setContent("idleMembers", "aucun.");
|
||||
}
|
||||
else
|
||||
{
|
||||
StringList buffer = new StringList();
|
||||
for (Organization idle : idles)
|
||||
{
|
||||
buffer.add(String.format("<a href=\"%s\" style=\"text-decoration: none;\">%s</a>", idle.getTechnicalName() + ".xhtml", idle.getName()));
|
||||
}
|
||||
data.setContent("idleMembers", buffer.toString("", ", ", "."));
|
||||
}
|
||||
|
||||
if (aways.isEmpty())
|
||||
{
|
||||
data.setContent("awayMembers", "aucun.");
|
||||
}
|
||||
else
|
||||
{
|
||||
StringList buffer = new StringList();
|
||||
for (Organization away : aways)
|
||||
{
|
||||
buffer.add(String.format("<a href=\"%s\" style=\"text-decoration: none;\">%s</a>", away.getTechnicalName() + ".xhtml", away.getName()));
|
||||
}
|
||||
data.setContent("awayMembers", buffer.toString("", ", ", "."));
|
||||
}
|
||||
|
||||
String page = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organizationListView.xhtml", data).toString();
|
||||
|
||||
result = XidynUtils.extractBodyContent(page);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building organizations view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationGenericMetricPage.
|
||||
*/
|
||||
public class OrganizationMetricGenericPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationMetricGenericPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @param organization
|
||||
* the organization
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Organization organization, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
data.setContent("metricMenuView", OrganizationMetricMenuView.htmlize(organization, TypeMenu.GENERIC, view, period));
|
||||
|
||||
//
|
||||
OrganizationMetricHtmlizer.htmlize(data, "graphic.users", organization, view, period, "metrics.service.users", ChartColor.GREEN);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "graphic.users.ipv4-ipv6", organization, view, period, "service.users (ipv4 + ipv6)", "metrics.service.users.ipv4", ChartColor.YELLOW,
|
||||
"metrics.service.users.ipv6", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "graphic.users.ipv4", organization, view, period, "metrics.service.users.ipv4", ChartColor.YELLOW);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "graphic.users.ipv6", organization, view, period, "metrics.service.users.ipv6", ChartColor.GREEN);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "graphic.accounts", organization, view, period, "metrics.service.accounts", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "graphic.accounts.active", organization, view, period, "metrics.service.accounts.active", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "graphic.database.bytes", organization, view, period, "metrics.service.database.bytes", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "graphic.datafiles.bytes", organization, view, period, "metrics.service.datafiles.bytes", ChartColor.GREEN);
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricGenericView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Metrics génériques");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-generic-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building organization generic metric page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,190 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.time.YearMonth;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.threeten.extra.YearWeek;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.WeekValues;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.YearValues;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
|
||||
/**
|
||||
* The Class OrganizationMetricHtmlizer.
|
||||
*/
|
||||
public class OrganizationMetricHtmlizer
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationMetricHtmlizer.class);
|
||||
|
||||
/**
|
||||
* Htmlize data.
|
||||
*
|
||||
* @param data
|
||||
* the data
|
||||
* @param metricId
|
||||
* the metric id
|
||||
* @param organization
|
||||
* the organization
|
||||
* @param metricPath
|
||||
* the metric path
|
||||
* @param color
|
||||
* the color
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void htmlize(final TagDataManager data, final String metricId, final Organization organization, final ViewMenu view, final PeriodMenu period, final String metricPath,
|
||||
final ChartColor color) throws StatoolInfosException
|
||||
{
|
||||
if (view == ViewMenu.YEARS)
|
||||
{
|
||||
YearValues yearMetric = organization.getMetricYearValuesAll(metricPath);
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, yearMetric, color));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.MONTHS)
|
||||
{
|
||||
MonthValues monthMetric = organization.getMetricMonthValuesAll(metricPath);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, monthMetric, color));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearMonth.now().minusMonths(11), YearMonth.now(), monthMetric, color));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearMonth.of(year, 01), YearMonth.of(year, 12), monthMetric, color));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.WEEKS)
|
||||
{
|
||||
WeekValues weekMetric = organization.getMetricWeekValuesAll(metricPath);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, weekMetric, color));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearWeek.now().minusYears(1), YearWeek.now(), weekMetric, color));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearWeek.of(year, 01), YearWeek.of(year, 53), weekMetric, color));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize data.
|
||||
*
|
||||
* @param data
|
||||
* the data
|
||||
* @param metricId
|
||||
* the metric id
|
||||
* @param organization
|
||||
* the organization
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @param metricLabel
|
||||
* the metric label
|
||||
* @param metricPath1
|
||||
* the metric path 1
|
||||
* @param color1
|
||||
* the color 1
|
||||
* @param metricPath2
|
||||
* the metric path 2
|
||||
* @param color2
|
||||
* the color 2
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void htmlize(final TagDataManager data, final String metricId, final Organization organization, final ViewMenu view, final PeriodMenu period, final String metricLabel,
|
||||
final String metricPath1, final ChartColor color1, final String metricPath2, final ChartColor color2) throws StatoolInfosException
|
||||
{
|
||||
if (view == ViewMenu.YEARS)
|
||||
{
|
||||
YearValues yearMetric1 = organization.getMetricYearValuesAll(metricPath1);
|
||||
YearValues yearMetric2 = organization.getMetricYearValuesAll(metricPath2);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId,
|
||||
ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, yearMetric1, yearMetric2));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.MONTHS)
|
||||
{
|
||||
MonthValues monthMetric1 = organization.getMetricMonthValuesAll(metricPath1);
|
||||
MonthValues monthMetric2 = organization.getMetricMonthValuesAll(metricPath2);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId,
|
||||
ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearMonth.now().minusMonths(11), YearMonth.now(), new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId,
|
||||
ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearMonth.of(year, 01), YearMonth.of(year, 12), new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.WEEKS)
|
||||
{
|
||||
WeekValues weekMetric1 = organization.getMetricWeekValuesAll(metricPath1);
|
||||
WeekValues weekMetric2 = organization.getMetricWeekValuesAll(metricPath2);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearWeek.now().minusYears(1), YearWeek.now(), new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearWeek.of(year, 01), YearWeek.of(year, 53), new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,264 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2023 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationMetricMenuView.
|
||||
*/
|
||||
public class OrganizationMetricMenuView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationMetricMenuView.class);
|
||||
|
||||
public enum PeriodMenu
|
||||
{
|
||||
FULL,
|
||||
LAST,
|
||||
Y2021,
|
||||
Y2022;
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
String result;
|
||||
|
||||
if (this.name().startsWith("Y"))
|
||||
{
|
||||
result = this.name().substring(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = this.name().toLowerCase();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the years.
|
||||
*
|
||||
* @return the years
|
||||
*/
|
||||
public static PeriodMenu[] getYears()
|
||||
{
|
||||
PeriodMenu[] result;
|
||||
|
||||
ArrayList<PeriodMenu> list = new ArrayList<PeriodMenu>();
|
||||
for (PeriodMenu item : values())
|
||||
{
|
||||
if (item.name().startsWith("Y"))
|
||||
{
|
||||
list.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
result = list.toArray(new PeriodMenu[0]);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public enum TypeMenu
|
||||
{
|
||||
SUMMARY,
|
||||
WEB,
|
||||
GENERIC,
|
||||
SPECIFIC;
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.name().toLowerCase();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ViewMenu
|
||||
{
|
||||
YEARS,
|
||||
MONTHS,
|
||||
WEEKS,
|
||||
DAYS;
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.name().toLowerCase();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param organization
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Organization organization, final TypeMenu type, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
String filename = String.format("%s-metrics-summary-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("summaryTypeButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-generic-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("genericTypeButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-specific-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("specificTypeButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-web-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("webTypeButton", "href", filename);
|
||||
|
||||
//
|
||||
filename = String.format("%s-metrics-%s-years-%s.xhtml", organization.getLocalFileBaseName(), type.getName(), PeriodMenu.FULL.getName());
|
||||
data.setAttribute("yearsViewButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-months-%s.xhtml", organization.getLocalFileBaseName(), type.getName(), period.getName());
|
||||
data.setAttribute("monthsViewButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-weeks-%s.xhtml", organization.getLocalFileBaseName(), type.getName(), period.getName());
|
||||
data.setAttribute("weeksViewButton", "href", filename);
|
||||
|
||||
data.setAttribute("daysViewButton", "href", "#");
|
||||
|
||||
//
|
||||
if (view != ViewMenu.YEARS)
|
||||
{
|
||||
filename = String.format("%s-metrics-%s-%s-full.xhtml", organization.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("fullPeriodButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-%s-last.xhtml", organization.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("lastPeriodButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-%s-2021.xhtml", organization.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("2021PeriodButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-%s-2022.xhtml", organization.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("2022PeriodButton", "href", filename);
|
||||
}
|
||||
|
||||
//
|
||||
if ((type == null) || (type == TypeMenu.SUMMARY))
|
||||
{
|
||||
data.appendAttribute("summaryTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (type == TypeMenu.GENERIC)
|
||||
{
|
||||
data.appendAttribute("genericTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (type == TypeMenu.WEB)
|
||||
{
|
||||
data.appendAttribute("webTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (type == TypeMenu.SPECIFIC)
|
||||
{
|
||||
data.appendAttribute("specificTypeButton", "class", "button selected");
|
||||
}
|
||||
|
||||
//
|
||||
if ((view == null) || (view == ViewMenu.YEARS))
|
||||
{
|
||||
data.appendAttribute("yearsViewButton", "class", "button selected");
|
||||
}
|
||||
else if (view == ViewMenu.MONTHS)
|
||||
{
|
||||
data.appendAttribute("monthsViewButton", "class", "button selected");
|
||||
}
|
||||
else if (view == ViewMenu.WEEKS)
|
||||
{
|
||||
data.appendAttribute("weeksViewButton", "class", "button selected");
|
||||
}
|
||||
else if (view == ViewMenu.DAYS)
|
||||
{
|
||||
data.appendAttribute("daysViewButton", "class", "button selected");
|
||||
}
|
||||
|
||||
//
|
||||
if ((period == null) || (period == PeriodMenu.FULL))
|
||||
{
|
||||
data.appendAttribute("fullPeriodButton", "class", "button selected");
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.appendAttribute("lastPeriodButton", "class", "button selected");
|
||||
}
|
||||
else if (period == PeriodMenu.Y2021)
|
||||
{
|
||||
data.appendAttribute("2021PeriodButton", "class", "button selected");
|
||||
}
|
||||
else if (period == PeriodMenu.Y2022)
|
||||
{
|
||||
data.appendAttribute("2022PeriodButton", "class", "button selected");
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/metricMenuView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building metric menu view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationSpecificMetricPage.
|
||||
*/
|
||||
public class OrganizationMetricSpecificPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationMetricSpecificPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @param organization
|
||||
* the organization
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Organization organization, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.debug("Building oranization specific metric page {}…", organization.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
data.setContent("metricMenuView", OrganizationMetricMenuView.htmlize(organization, TypeMenu.SPECIFIC, view, period));
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Metrics spécifiques");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-specific-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building organization specific metric page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationGeneralStatsPage.
|
||||
*/
|
||||
public class OrganizationMetricSummaryPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationMetricSummaryPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @param organization
|
||||
* the organization
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Organization organization, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
data.setContent("metricMenuView", OrganizationMetricMenuView.htmlize(organization, TypeMenu.SUMMARY, view, period));
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.hits.humans", organization, view, period, "metrics.http.hits.humans", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.visitors", organization, view, period, "metrics.http.visitors", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.visits", organization, view, period, "metrics.http.visits", ChartColor.GREEN);
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString();
|
||||
|
||||
//
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Metrics résumé");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-summary-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building organization summary page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,151 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationWebMetricPage.
|
||||
*/
|
||||
public class OrganizationMetricWebPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationMetricWebPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @param organization
|
||||
* the organization
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Organization organization, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
data.setContent("metricMenuView", OrganizationMetricMenuView.htmlize(organization, TypeMenu.WEB, view, period));
|
||||
|
||||
//
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.hits", organization, view, period, "metrics.http.hits", ChartColor.BLUE);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.hits-ipv4ipv6", organization, view, period, "http.hits (ipv4 + ipv6)", "metrics.http.hits.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.hits.ipv6",
|
||||
ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.hits.ipv4", organization, view, period, "metrics.http.hits.ipv4", ChartColor.YELLOW);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.hits.ipv6", organization, view, period, "metrics.http.hits.ipv6", ChartColor.GREEN);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.hits-humansbots", organization, view, period, "http.hits (humans + bots)", "metrics.http.hits.humans", ChartColor.GREEN,
|
||||
"metrics.http.hits.bots", ChartColor.YELLOW);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.hits.humans", organization, view, period, "metrics.http.hits.humans", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.hits.bots", organization, view, period, "metrics.http.hits.bots", ChartColor.YELLOW);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.hits.humans-ipv4ipv6", organization, view, period, "http.hits.humans (ipv4 + ipv6)", "metrics.http.hits.humans.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.hits.humans.ipv6", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.hits.humans.ipv4", organization, view, period, "metrics.http.hits.humans.ipv4", ChartColor.YELLOW);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.hits.humans.ipv6", organization, view, period, "metrics.http.hits.humans.ipv6", ChartColor.GREEN);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.errors", organization, view, period, "metrics.http.errors", ChartColor.RED);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.errors.php", organization, view, period, "metrics.http.errors.php", ChartColor.RED);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.files", organization, view, period, "metrics.http.files", ChartColor.BLUE);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.pages", organization, view, period, "metrics.http.pages", ChartColor.BLUE);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.bytes", organization, view, period, "metrics.http.bytes", ChartColor.BLUE);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.ip", organization, view, period, "metrics.http.ip", ChartColor.BLUE);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.ip-humansbots", organization, view, period, "http.ip (humans + bots)", "metrics.http.ip.humans", ChartColor.GREEN,
|
||||
"metrics.http.ip.bots", ChartColor.YELLOW);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.ip.humans", organization, view, period, "metrics.http.ip.humans", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.ip.bots", organization, view, period, "metrics.http.ip.bots", ChartColor.YELLOW);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.ip-ipv4ipv6", organization, view, period, "http.ip (ipv4 + ipv6)", "metrics.http.ip.ipv4", ChartColor.YELLOW, "metrics.http.ip.ipv6",
|
||||
ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.ip.ipv4", organization, view, period, "metrics.http.ip.ipv4", ChartColor.YELLOW);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.ip.ipv6", organization, view, period, "metrics.http.ip.ipv6", ChartColor.GREEN);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.requesters", organization, view, period, "metrics.http.requesters", ChartColor.BLUE);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.requesters-humansbots", organization, view, period, "http.requesters (humans + bots)", "metrics.http.requesters.humans", ChartColor.GREEN,
|
||||
"metrics.http.requesters.bots", ChartColor.YELLOW);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.requesters.humans", organization, view, period, "metrics.http.requesters.humans", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.requesters.bots", organization, view, period, "metrics.http.requesters.bots", ChartColor.YELLOW);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.requesters-ipv4ipv6", organization, view, period, "http.requesters(ipv4 + ipv6)", "metrics.http.requesters.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.requesters.ipv6", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.requesters.ipv4", organization, view, period, "metrics.http.requesters.ipv4", ChartColor.YELLOW);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.requesters.ipv6", organization, view, period, "metrics.http.requesters.ipv6", ChartColor.GREEN);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.visitors", organization, view, period, "metrics.http.visitors", ChartColor.BLUE);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.visitors-ipv4ipv6", organization, view, period, "http.visitors (ipv4 + ipv6)", "metrics.http.visitors.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.visitors.ipv6", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.visitors.ipv4", organization, view, period, "metrics.http.visitors.ipv4", ChartColor.YELLOW);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.visitors.ipv6", organization, view, period, "metrics.http.visitors.ipv6", ChartColor.GREEN);
|
||||
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.visits", organization, view, period, "metrics.http.visits", ChartColor.BLUE);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.visits-ipv4ipv6", organization, view, period, "http.visits (ipv4 + ipv6)", "metrics.http.visits.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.visits.ipv6", ChartColor.GREEN);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.visits.ipv4", organization, view, period, "metrics.http.visits.ipv4", ChartColor.YELLOW);
|
||||
OrganizationMetricHtmlizer.htmlize(data, "http.visits.ipv6", organization, view, period, "metrics.http.visits.ipv6", ChartColor.GREEN);
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Metrics web");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-web-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building organization web metric page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,182 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.catgenerator.core.CatGenerator;
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationPage.
|
||||
*/
|
||||
public class OrganizationPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationPage.class);
|
||||
|
||||
/**
|
||||
* Builds the view.
|
||||
*
|
||||
* @param organization
|
||||
* the organization
|
||||
* @throws IOException
|
||||
* @throws StatoolInfosException
|
||||
*/
|
||||
public static void build(final Organization organization) throws IOException, StatoolInfosException
|
||||
{
|
||||
CrawlCache cache = HtmlizerContext.instance().getCache();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
// Manage the logo file.
|
||||
logger.info("Htmlize organization logo: {}.", organization.getName());
|
||||
htmlizeOrganizationLogo(organization, cache, htmlizeDirectory);
|
||||
|
||||
//
|
||||
logger.info("Htmlize organization properties file: {}.", organization.getName());
|
||||
FileUtils.copyFile(organization.getInputFile(), new File(htmlizeDirectory, organization.getTechnicalName() + ".properties"));
|
||||
|
||||
//
|
||||
logger.info("Htmlize organization page: {}.", organization.getName());
|
||||
String page = OrganizationPage.htmlize(organization);
|
||||
FileUtils.write(new File(htmlizeDirectory, organization.getTechnicalName() + ".xhtml"), page, StandardCharsets.UTF_8);
|
||||
FileUtils.write(new File(htmlizeDirectory, organization.getTechnicalName() + "-services.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
//
|
||||
OrganizationPropertyAlertPage.buildAll();
|
||||
|
||||
//
|
||||
logger.info("Htmlize organization general stats page: {}.", organization.getName());
|
||||
page = OrganizationStatsPage.htmlize(organization);
|
||||
FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-stats.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
//
|
||||
logger.info("Htmlize organization metric pages: {}.", organization.getName());
|
||||
for (ViewMenu view : ViewMenu.values())
|
||||
{
|
||||
for (PeriodMenu period : PeriodMenu.values())
|
||||
{
|
||||
if ((view != ViewMenu.YEARS) || (period == PeriodMenu.FULL))
|
||||
{
|
||||
if (view != ViewMenu.DAYS)
|
||||
{
|
||||
OrganizationMetricSummaryPage.build(htmlizeDirectory, organization, view, period);
|
||||
OrganizationMetricGenericPage.build(htmlizeDirectory, organization, view, period);
|
||||
OrganizationMetricSpecificPage.build(htmlizeDirectory, organization, view, period);
|
||||
OrganizationMetricWebPage.build(htmlizeDirectory, organization, view, period);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void buildAll() throws IOException, StatoolInfosException
|
||||
{
|
||||
for (Organization organization : HtmlizerContext.instance().getFederation().getOrganizations())
|
||||
{
|
||||
build(organization);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param organization
|
||||
* the organization
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Organization organization) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building organization page {}…", organization.get("organization.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("organizationHeaderView", OrganizationHeaderView.htmlize(organization));
|
||||
data.setContent("serviceListView", ServiceListView.htmlize(organization.getServices().sortByName()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organization.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(organization.getName(), organization.getTechnicalName() + ".xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building organization page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize organization logo.
|
||||
*
|
||||
* @param organization
|
||||
* the organization
|
||||
* @param cache
|
||||
* the cache
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
private static void htmlizeOrganizationLogo(final Organization organization, final CrawlCache cache, final File htmlizeDirectory) throws IOException
|
||||
{
|
||||
File target = new File(htmlizeDirectory, organization.getLogoFileName());
|
||||
|
||||
File logoFile = cache.restoreFile(organization.getLogoURL());
|
||||
if (logoFile == null)
|
||||
{
|
||||
logger.info("CatGeneratoring cat avatar: {}", target.getAbsoluteFile());
|
||||
CatGenerator.buildAvatarTo(organization.getTechnicalName(), target);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileUtils.copyFile(logoFile, target);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationPropertyFileAlertPage.
|
||||
*/
|
||||
public class OrganizationPropertyAlertPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationPropertyAlertPage.class);
|
||||
|
||||
/**
|
||||
* Builds the all 1.
|
||||
*
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void buildAll() throws IOException, StatoolInfosException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
for (Organization organization : federation.getOrganizations())
|
||||
{
|
||||
String page = htmlize(organization);
|
||||
FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-propertyalerts.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param organization
|
||||
* the organization
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Organization organization) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
data.setContent("contentView", PropertyAlertView.htmlize(organization.getInputChecksAll().getAlertLines()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Propriétés en alertes", organization.getLocalFileBaseName() + "-propertyalerts.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building organization property check alert page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationPropertyFileCheckView.
|
||||
*/
|
||||
public class OrganizationPropertyCheckPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationPropertyCheckPage.class);
|
||||
|
||||
/**
|
||||
* Builds the all 1.
|
||||
*
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void buildAll() throws IOException, StatoolInfosException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
for (Organization organization : federation.getOrganizations())
|
||||
{
|
||||
String page = htmlize(organization);
|
||||
FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-propertycheck.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param organization
|
||||
* the organization
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Organization organization) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
data.setContent("contentView", PropertyCheckView.htmlize(organization.getInputChecks()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Propriétés", organization.getLocalFileBaseName() + "-propertycheck.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building organization property file check page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.stats.StatAgent;
|
||||
import fr.devinsy.statoolinfos.stats.services.RegistrationStats;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationStatsPage.
|
||||
*/
|
||||
public class OrganizationStatsPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationStatsPage.class);
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param organization
|
||||
* the organization
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static String htmlize(final Organization organization) throws StatoolInfosException, IOException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building organization stats page {}…");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
|
||||
//
|
||||
data.setContent("turnoutChart", ChartHtmlizer.htmlizeOrganizationTurnoutChart(organization));
|
||||
|
||||
Services services = organization.getActiveServices();
|
||||
data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(organization));
|
||||
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(services));
|
||||
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(services));
|
||||
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(services));
|
||||
|
||||
data.setContent("hostNameChart", ChartHtmlizer.htmlizeHostNamePieChart(services));
|
||||
data.setContent("hostProviderHypervisorChart", ChartHtmlizer.htmlizeHostProviderHypervisorChart(services));
|
||||
|
||||
data.setContent("hostServerDistributionChart", ChartHtmlizer.htmlizeHostServerDistributionChart(services));
|
||||
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(services));
|
||||
|
||||
{
|
||||
RegistrationStats stats = StatAgent.statRegistrationTypes(services);
|
||||
|
||||
data.setContent("registrationTypeChart", ChartHtmlizer.htmlizeRegistrationBarChart(stats));
|
||||
data.setContent("registrationNoneTypeChart", ChartHtmlizer.htmlizeRegistrationNonePieChart(stats));
|
||||
data.setContent("registrationFreeTypeChart", ChartHtmlizer.htmlizeRegistrationFreePieChart(stats));
|
||||
data.setContent("registrationMemberTypeChart", ChartHtmlizer.htmlizeRegistrationMemberPieChart(stats));
|
||||
data.setContent("registrationClientTypeChart", ChartHtmlizer.htmlizeRegistrationClientPieChart(stats));
|
||||
}
|
||||
|
||||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(services));
|
||||
data.setContent("organisationTypeChart", ChartHtmlizer.htmlizeOrganizationTypeChart(organization));
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organizationStatsPage.xhtml", data).toString();
|
||||
|
||||
//
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(organization.getName(), organization.getTechnicalName() + ".xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building organization stats page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.uptime.UptimeJournal;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationUptimePage.
|
||||
*/
|
||||
public class OrganizationUptimePage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationUptimePage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final Organization organization) throws StatoolInfosException, IOException
|
||||
{
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
UptimeJournal journal = HtmlizerContext.instance().getUptimeJournal();
|
||||
|
||||
String page = htmlize(organization, journal);
|
||||
FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-uptimes.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws StatoolInfosException
|
||||
*/
|
||||
public static void buildAll() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
|
||||
for (Organization organization : federation.getOrganizations())
|
||||
{
|
||||
build(organization);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param organization
|
||||
* the organization
|
||||
* @param journal
|
||||
* the journal
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Organization organization, final UptimeJournal journal) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
data.setContent("uptimeView", UptimeView.htmlize(organization.getServices(), journal));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/uptimePage.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Disponibilité des services", organization.getLocalFileBaseName() + "-uptimes.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building about page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,165 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.statoolinfos.stats.StatAgent;
|
||||
import fr.devinsy.statoolinfos.stats.propertyfiles.PropertiesFileStat;
|
||||
import fr.devinsy.statoolinfos.stats.propertyfiles.PropertiesFileStats;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class OrganizationPage.
|
||||
*/
|
||||
public class PropertiesFilesPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(PropertiesFilesPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws MalformedURLException
|
||||
* @throws StatoolInfosException
|
||||
*/
|
||||
public static void build() throws MalformedURLException, IOException, StatoolInfosException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
CrawlCache cache = HtmlizerContext.instance().getCache();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
logger.info("Htmlize propertiesFiles page.");
|
||||
PropertiesFileStats stats = StatAgent.statAllPropertiesFiles(federation, cache).sortByName();
|
||||
String page = PropertiesFilesPage.htmlize(stats);
|
||||
FileUtils.write(new File(htmlizeDirectory, "propertiesFiles.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param stats
|
||||
* the stats
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final PropertiesFileStats stats) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building propertyFiles page.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("fileCount", stats.size());
|
||||
data.setContent("lineCount", stats.getLineCount());
|
||||
data.setContent("propertyCount", stats.getPropertyCount());
|
||||
data.setContent("blankPropertyCount", stats.getBlankPropertyCount());
|
||||
data.setContent("filledPropertyCount", stats.getFilledPropertyCount());
|
||||
data.setContent("warningCount", stats.getWarningCount());
|
||||
data.setContent("errorCount", stats.getErrorCount());
|
||||
data.setContent("voidCount", stats.getVoidCount());
|
||||
|
||||
//
|
||||
int index = 0;
|
||||
for (PropertiesFileStat stat : stats.sortByName())
|
||||
{
|
||||
data.setAttribute("fileListLine", index, "fileListLineNameLink", "href", stat.getLocalName());
|
||||
data.setEscapedContent("fileListLine", index, "fileListLineNameLink", stat.getLocalName());
|
||||
|
||||
data.setAttribute("fileListLine", index, "fileListLineOwnerLink", "href", stat.getOrganization().getTechnicalName() + ".xhtml");
|
||||
data.setEscapedContent("fileListLine", index, "fileListLineNameValue", stat.getOrganization().getName());
|
||||
data.setAttribute("fileListLine", index, "fileListLineOwnerLogo", "src", stat.getOrganization().getLogoFileName());
|
||||
|
||||
data.setContent("fileListLine", index, "fileListLineLineCount", stat.getLineCount());
|
||||
data.setContent("fileListLine", index, "fileListLineActiveCount", stat.getPropertyCount());
|
||||
data.setContent("fileListLine", index, "fileListLineBlankPropertyCount", stat.getBlankPropertyCount());
|
||||
data.setContent("fileListLine", index, "fileListLineFilledPropertyCount", stat.getFilledPropertyCount());
|
||||
|
||||
if (stat.getWarningCount() > 0)
|
||||
{
|
||||
data.setAttribute("fileListLine", index, "fileListLineWarningCountLink", "href", stat.getLocalName().replace(".properties", "-propertycheck.xhtml"));
|
||||
data.setContent("fileListLine", index, "fileListLineWarningCountLink", stat.getWarningCount());
|
||||
data.setAttribute("fileListLine", index, "fileListLineWarningCount", "style", "background-color: yellow;");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setContent("fileListLine", index, "fileListLineWarningCount", stat.getWarningCount());
|
||||
}
|
||||
|
||||
if (stat.getErrorCount() > 0)
|
||||
{
|
||||
data.setAttribute("fileListLine", index, "fileListLineErrorCountLink", "href", stat.getLocalName().replace(".properties", "-propertycheck.xhtml"));
|
||||
data.setContent("fileListLine", index, "fileListLineErrorCountLink", stat.getErrorCount());
|
||||
data.setAttribute("fileListLine", index, "fileListLineErrorCount", "style", "background-color: red;");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setContent("fileListLine", index, "fileListLineErrorCount", stat.getErrorCount());
|
||||
}
|
||||
|
||||
if (stat.getVoidCount() > 0)
|
||||
{
|
||||
data.setAttribute("fileListLine", index, "fileListLineVoidCountLink", "href", stat.getLocalName().replace(".properties", "-propertycheck.xhtml"));
|
||||
data.setContent("fileListLine", index, "fileListLineVoidCountLink", stat.getVoidCount());
|
||||
data.setAttribute("fileListLine", index, "fileListLineVoidCount", "style", "background-color: rgb(54, 162, 235, 0.2);");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setContent("fileListLine", index, "fileListLineVoidCount", stat.getVoidCount());
|
||||
}
|
||||
|
||||
data.setContent("fileListLine", index, "fileListLineDate", stat.getUpdateDate().format(DateTimeFormatter.ofPattern("dd/MM/YYYY")));
|
||||
data.setAttribute("fileListLine", index, "fileListLineDate", "title", stat.getUpdateDate().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertiesFiles.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Fichiers", "propertiesFiles.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building propertiesFiles page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,146 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.checker.PropertyCheck;
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.core.Service.Status;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class PropertyFileCheckPage.
|
||||
*/
|
||||
public class PropertyAlertPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(PropertyAlertPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param title
|
||||
* the title
|
||||
* @param checks
|
||||
* the checks
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final String title, final PropertyChecks checks) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building propertyFilesCheck page…");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("lineCount", checks.size());
|
||||
data.setContent("errorCount", checks.getErrorCount());
|
||||
data.setContent("warningCount", checks.getWarningCount());
|
||||
data.setContent("voidCount", checks.getVoidCount());
|
||||
|
||||
//
|
||||
data.setContent("statsTitle", title);
|
||||
|
||||
//
|
||||
int index = 0;
|
||||
if (checks.isEmpty())
|
||||
{
|
||||
data.setAttribute("blockTable", "class", "xid:nodisplay");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (PropertyCheck check : checks)
|
||||
{
|
||||
//
|
||||
data.setEscapedContent("line", index, "lineFileName", check.getFileName());
|
||||
data.setContent("line", index, "lineIndex", check.getIndex());
|
||||
data.setEscapedContent("line", index, "lineComment", check.getComment());
|
||||
data.setEscapedContent("line", index, "lineContent", check.getLine());
|
||||
data.setAttribute("line", index, "lineContent", "class", statusToCSS(check.getStatus()));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyCheck.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Propriétés", "propertyStats.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Status to CSS.
|
||||
*
|
||||
* @param status
|
||||
* the status
|
||||
* @return the string
|
||||
*/
|
||||
public static String statusToCSS(final Status status)
|
||||
{
|
||||
String result;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case OK:
|
||||
result = "bg_ok";
|
||||
break;
|
||||
|
||||
case WARNING:
|
||||
result = "bg_warning";
|
||||
break;
|
||||
|
||||
case ALERT:
|
||||
result = "bg_alert";
|
||||
break;
|
||||
|
||||
case ERROR:
|
||||
result = "bg_error";
|
||||
break;
|
||||
|
||||
case OVER:
|
||||
result = "bg_over";
|
||||
break;
|
||||
|
||||
case VOID:
|
||||
default:
|
||||
result = "bg_void";
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.checker.PropertyCheck;
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.core.Service.Status;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class PropertyFileAlertView.
|
||||
*/
|
||||
public class PropertyAlertView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(PropertyAlertView.class);
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param checks
|
||||
* the checks
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final PropertyChecks checks) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("lineCount", checks.size());
|
||||
data.setContent("errorCount", checks.getErrorCount());
|
||||
data.setContent("warningCount", checks.getWarningCount());
|
||||
data.setContent("voidCount", checks.getVoidCount());
|
||||
|
||||
//
|
||||
int index = 0;
|
||||
if (checks.isEmpty())
|
||||
{
|
||||
data.setAttribute("blockTable", "class", "xid:nodisplay");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (PropertyCheck check : checks)
|
||||
{
|
||||
//
|
||||
data.setEscapedContent("line", index, "lineFileName", check.getFileName());
|
||||
data.setContent("line", index, "lineIndex", check.getIndex());
|
||||
data.setEscapedContent("line", index, "lineComment", check.getComment());
|
||||
data.setEscapedContent("line", index, "lineContent", check.getLine());
|
||||
data.setAttribute("line", index, "lineContent", "class", statusToCSS(check.getStatus()));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyAlertView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building property file alert view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Status to CSS.
|
||||
*
|
||||
* @param status
|
||||
* the status
|
||||
* @return the string
|
||||
*/
|
||||
public static String statusToCSS(final Status status)
|
||||
{
|
||||
String result;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case OK:
|
||||
result = "bg_ok";
|
||||
break;
|
||||
|
||||
case WARNING:
|
||||
result = "bg_warning";
|
||||
break;
|
||||
|
||||
case ALERT:
|
||||
result = "bg_alert";
|
||||
break;
|
||||
|
||||
case ERROR:
|
||||
result = "bg_error";
|
||||
break;
|
||||
|
||||
case OVER:
|
||||
result = "bg_over";
|
||||
break;
|
||||
|
||||
case VOID:
|
||||
default:
|
||||
result = "bg_void";
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,253 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.checker.PropertyCheck;
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Metrics;
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.Service.Status;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class PropertyFileCheckView.
|
||||
*/
|
||||
public class PropertyCheckView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(PropertyCheckView.class);
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void buildAll() throws IOException, StatoolInfosException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
PropertyChecks allAlertChecks = new PropertyChecks();
|
||||
PropertyChecks federationAlertChecks = new PropertyChecks();
|
||||
PropertyChecks organizationAlertChecks = new PropertyChecks();
|
||||
PropertyChecks serviceAlertChecks = new PropertyChecks();
|
||||
|
||||
//
|
||||
PropertyChecks alerts = federation.getInputChecks().getAlertLines().setFileName(federation.getName());
|
||||
allAlertChecks.addAll(alerts);
|
||||
federationAlertChecks.addAll(alerts);
|
||||
|
||||
//
|
||||
for (Organization organization : federation.getOrganizations())
|
||||
{
|
||||
PropertyChecks checks = organization.getInputChecks();
|
||||
|
||||
// Ignore ghost organizations.
|
||||
if (organization.getServiceCount() > 0)
|
||||
{
|
||||
alerts = checks.getAlertLines().setFileName(organization.getLocalFileName());
|
||||
allAlertChecks.addAll(alerts);
|
||||
organizationAlertChecks.addAll(alerts);
|
||||
|
||||
for (Service service : organization.getServices())
|
||||
{
|
||||
alerts = service.getInputChecks().getAlertLines().setFileName(service.getLocalFileName());
|
||||
allAlertChecks.addAll(alerts);
|
||||
serviceAlertChecks.addAll(alerts);
|
||||
|
||||
for (Metrics metrics : service.getMetrics())
|
||||
{
|
||||
alerts = metrics.getInputChecks().getAlertLines().setFileName(metrics.getLocalFileName());
|
||||
allAlertChecks.addAll(alerts);
|
||||
serviceAlertChecks.addAll(alerts);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
String page = PropertyAlertPage.htmlize("Tous", allAlertChecks);
|
||||
FileUtils.write(new File(htmlizeDirectory, "alertChecks.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
page = PropertyAlertPage.htmlize("Fédération", federationAlertChecks);
|
||||
FileUtils.write(new File(htmlizeDirectory, "alertChecks-federation.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
page = PropertyAlertPage.htmlize("Membres", organizationAlertChecks);
|
||||
FileUtils.write(new File(htmlizeDirectory, "alertChecks-organizations.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
page = PropertyAlertPage.htmlize("Services", serviceAlertChecks);
|
||||
FileUtils.write(new File(htmlizeDirectory, "alertChecks-services.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param checks
|
||||
* the checks
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final PropertyChecks checks) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("lineCount", checks.size());
|
||||
data.setContent("warningCount", checks.getWarningCount());
|
||||
data.setContent("errorCount", checks.getErrorCount());
|
||||
data.setContent("voidCount", checks.getVoidCount());
|
||||
|
||||
//
|
||||
data.setContent("statsTitle", "Propriétés");
|
||||
|
||||
//
|
||||
int index = 0;
|
||||
if (checks.isEmpty())
|
||||
{
|
||||
data.setAttribute("fullBlockTable", "class", "xid:nodisplay");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (PropertyCheck check : checks)
|
||||
{
|
||||
data.setContent("line", index, "lineIndex", check.getIndex());
|
||||
data.setEscapedContent("line", index, "lineComment", check.getComment());
|
||||
data.setEscapedContent("line", index, "lineContent", check.getLine());
|
||||
data.setAttribute("line", index, "lineContent", "class", statusToCSS(check.getStatus()));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
index = 0;
|
||||
PropertyChecks subchecks = checks.getActiveLines();
|
||||
if (subchecks.isEmpty())
|
||||
{
|
||||
data.setAttribute("shrunkBlockTable", "class", "xid:nodisplay");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (PropertyCheck check : subchecks)
|
||||
{
|
||||
data.setContent("shrunkLine", index, "shrunkLineIndex", check.getIndex());
|
||||
data.setEscapedContent("shrunkLine", index, "shrunkLineContent", check.getLine());
|
||||
data.setEscapedContent("shrunkLine", index, "shrunkLineComment", check.getComment());
|
||||
data.setAttribute("shrunkLine", index, "shrunkLineContent", "class", statusToCSS(check.getStatus()));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
index = 0;
|
||||
subchecks = checks.getAlertLines();
|
||||
if (subchecks.isEmpty())
|
||||
{
|
||||
data.setAttribute("alertBlockTable", "class", "xid:nodisplay");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (PropertyCheck check : subchecks)
|
||||
{
|
||||
data.setContent("alertLine", index, "alertLineIndex", check.getIndex());
|
||||
data.setEscapedContent("alertLine", index, "alertLineContent", check.getLine());
|
||||
data.setEscapedContent("alertLine", index, "alertLineComment", check.getComment());
|
||||
data.setAttribute("alertLine", index, "alertLineContent", "class", statusToCSS(check.getStatus()));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyCheckView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building property check view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Status to CSS.
|
||||
*
|
||||
* @param status
|
||||
* the status
|
||||
* @return the string
|
||||
*/
|
||||
public static String statusToCSS(final Status status)
|
||||
{
|
||||
String result;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case OK:
|
||||
result = "bg_ok";
|
||||
break;
|
||||
|
||||
case WARNING:
|
||||
result = "bg_warning";
|
||||
break;
|
||||
|
||||
case ALERT:
|
||||
result = "bg_alert";
|
||||
break;
|
||||
|
||||
case ERROR:
|
||||
result = "bg_error";
|
||||
break;
|
||||
|
||||
case OVER:
|
||||
result = "bg_over";
|
||||
break;
|
||||
|
||||
case VOID:
|
||||
default:
|
||||
result = "bg_void";
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.statoolinfos.stats.StatAgent;
|
||||
import fr.devinsy.statoolinfos.stats.properties.PropertyStat;
|
||||
import fr.devinsy.statoolinfos.stats.properties.PropertyStatList;
|
||||
import fr.devinsy.statoolinfos.stats.properties.PropertyStats;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class PropertyStatsPage.
|
||||
*/
|
||||
public class PropertyStatsPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(PropertyStatsPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void buildAll() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
CrawlCache cache = HtmlizerContext.instance().getCache();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
logger.info("Htmlize propertyStats page.");
|
||||
|
||||
PropertyStats stats = StatAgent.statAllProperties(federation);
|
||||
String page = PropertyStatsPage.htmlize("Toutes les propriétés", stats);
|
||||
FileUtils.write(new File(htmlizeDirectory, "propertyStats.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
PropertyStats federationStats = StatAgent.statFederationProperties(federation);
|
||||
page = PropertyStatsPage.htmlize("Les propriétés de la fédération", federationStats);
|
||||
FileUtils.write(new File(htmlizeDirectory, "propertyStats-federation.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
PropertyStats organizationsStats = StatAgent.statOrganizationsProperties(federation.getActiveOrganizations());
|
||||
page = PropertyStatsPage.htmlize("Les propriétés des organizations", organizationsStats);
|
||||
FileUtils.write(new File(htmlizeDirectory, "propertyStats-organizations.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
PropertyStats servicesStats = StatAgent.statServicesProperties(federation.getActiveServices());
|
||||
page = PropertyStatsPage.htmlize("Les propriétés des services", servicesStats);
|
||||
FileUtils.write(new File(htmlizeDirectory, "propertyStats-services.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param title
|
||||
* the title
|
||||
* @param stats
|
||||
* the stats
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final String title, final PropertyStats stats) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building propertyStats page…");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("statsTitle", title);
|
||||
data.setContent("propertyCount", stats.getPropertyCount());
|
||||
data.setContent("fileCount", stats.getFileCount());
|
||||
|
||||
//
|
||||
PropertyStatList generalStats = stats.getGeneralPropertyStats().getList().sortByReverseFilledCount();
|
||||
data.setContent("generalPropertyCount", generalStats.size());
|
||||
int index = 0;
|
||||
for (PropertyStat stat : generalStats)
|
||||
{
|
||||
data.setEscapedContent("generalPropertyLine", index, "generalPropertyLinePath", stat.getPath());
|
||||
data.setContent("generalPropertyLine", index, "generalPropertyLineBlankCount", stat.getBlankCount());
|
||||
data.setContent("generalPropertyLine", index, "generalPropertyLineBlankCountPercentage", StatoolInfosUtils.toPercentage(stat.getBlankCount(), stats.getFileCount()));
|
||||
data.setContent("generalPropertyLine", index, "generalPropertyLineFilledCount", stat.getFilledCount());
|
||||
data.setContent("generalPropertyLine", index, "generalPropertyLineFilledCountPercentage", StatoolInfosUtils.toPercentage(stat.getFilledCount(), stats.getFileCount()));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
|
||||
//
|
||||
PropertyStatList metricStats = stats.getMetricPropertyStats().getList().sortByReverseFilledCount();
|
||||
data.setContent("metricPropertyCount", metricStats.size());
|
||||
index = 0;
|
||||
for (PropertyStat stat : metricStats)
|
||||
{
|
||||
data.setEscapedContent("metricPropertyLine", index, "metricPropertyLinePath", stat.getPath());
|
||||
data.setContent("metricPropertyLine", index, "metricPropertyLineBlankCount", stat.getBlankCount());
|
||||
data.setContent("metricPropertyLine", index, "metricPropertyLineBlankCountPercentage", StatoolInfosUtils.toPercentage(stat.getBlankCount(), stats.getFileCount()));
|
||||
data.setContent("metricPropertyLine", index, "metricPropertyLineFilledCount", stat.getFilledCount());
|
||||
data.setContent("metricPropertyLine", index, "metricPropertyLineFilledCountPercentage", StatoolInfosUtils.toPercentage(stat.getFilledCount(), stats.getFileCount()));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Propriétés", "propertyStats.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class CrawlJournalServicePage.
|
||||
*/
|
||||
public class ServiceCrawlJournalPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceCrawlJournalPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final Service service) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("contentView", CrawlJournalView.htmlize(service.getCrawlJournal()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-crawl.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service crawl journal page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void buildAll() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
|
||||
for (Service service : federation.getServicesAll())
|
||||
{
|
||||
build(service);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,126 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class ServiceFigureView.
|
||||
*/
|
||||
public class ServiceFigureView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceFigureView.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param services
|
||||
* the services
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Services services) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building services figures view.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("serviceCount", services.size());
|
||||
YearMonth month = YearMonth.now();
|
||||
data.setContent("currentMonth", month.format(DateTimeFormatter.ofPattern("MMMM yyyy")));
|
||||
|
||||
if (services.isEmpty())
|
||||
{
|
||||
data.setAttribute("serviceListLine", "class", "xid:nodisplay");
|
||||
}
|
||||
else
|
||||
{
|
||||
String monthLabel = LocalDate.now().minusMonths(1).format(DateTimeFormatter.ofPattern("MMMM yyyy")).replace(" ", " ");
|
||||
data.setContent("monthLabel", monthLabel);
|
||||
data.setAttribute("userCountHeaderColumn", "title", monthLabel);
|
||||
data.setAttribute("visitCountHeaderColumn", "title", monthLabel);
|
||||
|
||||
int index = 0;
|
||||
for (Service service : services.sortByName())
|
||||
{
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineOrganizationLink", "href", service.getOrganization().getTechnicalName() + ".xhtml");
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineOrganizationLogo", "src", service.getOrganization().getLogoFileName());
|
||||
data.setEscapedAttribute("serviceListLine", index, "serviceListLineOrganizationLogo", "title", service.getOrganization().getName());
|
||||
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineLogo", "src", service.getLogoFileName());
|
||||
data.setEscapedContent("serviceListLine", index, "serviceListLineNameValue", service.getName());
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineNameLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
|
||||
data.setAttribute("serviceListLine", index, "serviceStatusImg", "src", "status-" + service.getStatus().toString().toLowerCase() + ".png");
|
||||
data.setAttribute("serviceListLine", index, "serviceStatusImg", "title", StringUtils.defaultIfBlank(service.getStatusDescription(), service.getStatus().toString()));
|
||||
|
||||
if (service.getWebsiteURL() != null)
|
||||
{
|
||||
data.setEscapedContent("serviceListLine", index, "serviceListLineUrlLink", service.getWebsiteURL().toString());
|
||||
data.setEscapedContent("serviceListLine", index, "serviceListLineWebsiteLink", service.getWebsiteURL().toString());
|
||||
data.setEscapedAttribute("serviceListLine", index, "serviceListLineWebsiteLink", "href", service.getWebsiteURL().toString());
|
||||
}
|
||||
|
||||
data.setEscapedContent("serviceListLine", index, "serviceListLineSoftwareLink", service.getSoftwareName());
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineSoftwareLink", "href", "software-" + service.getSoftwareTechnicalName() + ".xhtml");
|
||||
|
||||
data.setContent("serviceListLine", index, "serviceListLineHitCount", StatoolInfosUtils.defaultIfZero(service.getMonthHitCount(month), "😢"));
|
||||
data.setContent("serviceListLine", index, "serviceListLineVisitCount", StatoolInfosUtils.defaultIfZero(service.getMonthVisitCount(month), "😞"));
|
||||
data.setContent("serviceListLine", index, "serviceListLineVisitorCount", StatoolInfosUtils.defaultIfZero(service.getMonthVisitorCount(month), "😞"));
|
||||
data.setContent("serviceListLine", index, "serviceListLineUserCount", StatoolInfosUtils.defaultIfZero(service.getMonthUserCount(month), "😢"));
|
||||
data.setContent("serviceListLine", index, "serviceListLineAccountCount", StatoolInfosUtils.defaultIfZero(service.getMonthAccountCount(month), "😇"));
|
||||
data.setContent("serviceListLine", index, "serviceListLineActiveAccountCount", StatoolInfosUtils.defaultIfZero(service.getMonthActiveAccountCount(month), "😇"));
|
||||
data.setContent("serviceListLine", index, "serviceListLineDatabaseBytes", StatoolInfosUtils.defaultIfZero(service.getMonthDatabaseBytes(month), "😇"));
|
||||
data.setContent("serviceListLine", index, "serviceListLineDatafilesBytes", StatoolInfosUtils.defaultIfZero(service.getMonthDatafilesBytes(month), "😇"));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceFigureView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(result);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,220 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.DisplayMode;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class ServiceHeaderView.
|
||||
*/
|
||||
public class ServiceHeaderView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceHeaderView.class);
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setAttribute("serviceLogo", "src", service.getLogoFileName());
|
||||
|
||||
data.setEscapedContent("serviceName", service.getName());
|
||||
if (service.getWebsiteURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("serviceName", "href", service.getWebsiteURL().toString());
|
||||
data.setEscapedContent("serviceURL", service.getWebsiteURL().toString());
|
||||
data.setEscapedAttribute("serviceURL", "href", service.getWebsiteURL().toString());
|
||||
}
|
||||
|
||||
data.setEscapedContent("serviceDescription", StringUtils.defaultIfBlank(service.getDescription(), "n/a"));
|
||||
|
||||
data.setContent("serviceStartDate", StringUtils.defaultIfBlank(service.getStartDateValue(), "n/a"));
|
||||
data.setContent("serviceEndDate", StringUtils.defaultIfBlank(service.getEndDateValue(), "n/a"));
|
||||
data.setContent("serviceAge", StringUtils.defaultIfBlank(service.getAge(), "n/a"));
|
||||
if (StringUtils.isBlank(service.getEndDateValue()))
|
||||
{
|
||||
data.setAttribute("serviceEndDateData", "style", "display: none;");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("serviceStartDateWord", "style", "display: none;");
|
||||
}
|
||||
|
||||
data.setAttribute("serviceStatusImg", "src", "status-" + service.getStatus().toString().toLowerCase() + ".png");
|
||||
data.setAttribute("serviceStatusImg", "title", StringUtils.defaultIfBlank(service.getStatusDescription(), service.getStatus().toString()));
|
||||
|
||||
data.setAttribute("organizationsLink", "href", service.getOrganization().getTechnicalName() + "-services.xhtml");
|
||||
data.setAttribute("servicesLink", "href", service.getLocalFileBaseName() + "-services.xhtml");
|
||||
|
||||
data.setAttribute("rawLink", "href", service.getLocalFileBaseName() + ".properties");
|
||||
data.setAttribute("rawCheckLink", "href", service.getLocalFileBaseName() + "-propertycheck.xhtml");
|
||||
|
||||
data.setAttribute("statsLink", "href", service.getLocalFileBaseName() + ".xhtml");
|
||||
data.setAttribute("metricsLink", "href", service.getLocalFileBaseName() + "-metrics-summary-months-last.xhtml");
|
||||
|
||||
if (service.getLegalURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("legalLink", "href", service.getLegalURL().toString());
|
||||
data.setAttribute("legalLinkImg", "class", "");
|
||||
data.getIdData("legalLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.getContactURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("contactLink", "href", service.getContactURL().toString());
|
||||
data.setAttribute("contactLinkImg", "class", "");
|
||||
data.getIdData("contactLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getContactEmail()))
|
||||
{
|
||||
data.setEscapedAttribute("emailLink", "href", "mailto:" + service.getContactEmail());
|
||||
data.setAttribute("emailLinkImg", "class", "");
|
||||
data.getIdData("emailLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.getUserGuideURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("userDocLink", "href", service.getUserGuideURL().toString());
|
||||
data.setAttribute("userDocLinkImg", "class", "");
|
||||
data.getIdData("userDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.getTechnicalGuideURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("technicalDocLink", "href", service.getTechnicalGuideURL().toString());
|
||||
data.setAttribute("technicalDocLinkImg", "class", "");
|
||||
data.getIdData("technicalDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
//
|
||||
if (service.isRegistrationNone())
|
||||
{
|
||||
data.setAttribute("registrationNoneImg", "class", "");
|
||||
data.getIdData("registrationNoneImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationFree())
|
||||
{
|
||||
data.setAttribute("registrationFreeImg", "class", "");
|
||||
data.getIdData("registrationFreeImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationMember())
|
||||
{
|
||||
data.setAttribute("registrationMemberImg", "class", "");
|
||||
data.getIdData("registrationMemberImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationClient())
|
||||
{
|
||||
data.setAttribute("registrationClientImg", "class", "");
|
||||
data.getIdData("registrationClientImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationLoadFull())
|
||||
{
|
||||
data.setAttribute("registrationLoadImg", "class", "");
|
||||
data.getIdData("registrationLoadImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
//
|
||||
data.setEscapedContent("softwareName", StringUtils.defaultIfBlank(service.getSoftwareName(), "n/a"));
|
||||
data.setContent("softwareVersion", StringUtils.defaultIfBlank(service.getSoftwareVersion(), "n/a"));
|
||||
data.setEscapedContent("softwareLicenseName", StringUtils.defaultIfBlank(service.getSoftwareLicenseName(), "n/a"));
|
||||
if (service.getSoftwareWebsite() != null)
|
||||
{
|
||||
data.setEscapedAttribute("softwareWebsiteLink", "href", service.getSoftwareWebsite().toString());
|
||||
data.setAttribute("softwareWebsiteLinkImg", "class", "");
|
||||
data.getIdData("softwareWebsiteLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.getSoftwareLicenseURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("softwareLicenseLink", "href", service.getSoftwareLicenseURL().toString());
|
||||
data.setAttribute("softwareLicenseLinkImg", "class", "");
|
||||
data.getIdData("softwareLicenseLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.getSoftwareSourceURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("softwareSourceLink", "href", service.getSoftwareSourceURL().toString());
|
||||
data.setAttribute("softwareSourceLinkImg", "class", "");
|
||||
data.getIdData("softwareSourceLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
data.setAttribute("crawlLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-crawl.xhtml");
|
||||
if (service.getCrawlJournal().getErrors().isEmpty())
|
||||
{
|
||||
data.setAttribute("crawlLinkImg", "src", "circle-icons/download-mono.svg");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("crawlLinkImg", "src", "circle-icons/download.svg");
|
||||
}
|
||||
|
||||
data.setAttribute("uptimeLink", "href", service.getLocalFileBaseName() + "-uptimes.xhtml");
|
||||
Services services = new Services();
|
||||
services.add(service);
|
||||
if (HtmlizerContext.instance().getUptimeJournal().hasRecentError(services))
|
||||
{
|
||||
data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ko-mono.svg");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ok-mono.svg");
|
||||
}
|
||||
|
||||
{
|
||||
PropertyChecks checks = service.getInputChecksAll();
|
||||
data.setContent("errorCount", checks.getErrorCount());
|
||||
data.setContent("warningCount", checks.getWarningCount());
|
||||
data.setContent("voidCount", checks.getVoidCount());
|
||||
|
||||
data.setAttribute("alertLink", "href", service.getLocalFileBaseName() + "-propertyalerts.xhtml");
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceHeaderView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service header view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,202 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.DisplayMode;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class ServiceListView.
|
||||
*/
|
||||
public class ServiceListView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceListView.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param services
|
||||
* the services
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Services services) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building service list view.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("serviceCount", services.size());
|
||||
|
||||
if (services.isEmpty())
|
||||
{
|
||||
data.setAttribute("serviceListLine", "class", "xid:nodisplay");
|
||||
}
|
||||
else
|
||||
{
|
||||
String monthLabel = LocalDate.now().minusMonths(1).format(DateTimeFormatter.ofPattern("MMMM yyyy")).replace(" ", " ");
|
||||
data.setContent("monthLabel", monthLabel);
|
||||
data.setAttribute("userCountHeaderColumn", "title", monthLabel);
|
||||
data.setAttribute("visitCountHeaderColumn", "title", monthLabel);
|
||||
|
||||
int index = 0;
|
||||
for (Service service : services.sortByName())
|
||||
{
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineLogo", "src", service.getLogoFileName());
|
||||
data.setEscapedContent("serviceListLine", index, "serviceListLineNameValue", service.getName());
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineNameLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineOrganizationLink", "href", service.getOrganization().getTechnicalName() + ".xhtml");
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineOrganizationLogo", "src", service.getOrganization().getLogoFileName());
|
||||
data.setEscapedContent("serviceListLine", index, "serviceListLineOrganizationValue", service.getOrganization().getName());
|
||||
|
||||
if (service.getWebsiteURL() != null)
|
||||
{
|
||||
data.setEscapedContent("serviceListLine", index, "serviceListLineUrlLink", service.getWebsiteURL().toString());
|
||||
data.setEscapedContent("serviceListLine", index, "serviceListLineWebsiteLink", service.getWebsiteURL().toString());
|
||||
data.setEscapedAttribute("serviceListLine", index, "serviceListLineWebsiteLink", "href", service.getWebsiteURL().toString());
|
||||
}
|
||||
|
||||
data.setEscapedContent("serviceListLine", index, "serviceListLineSoftwareLink", service.getSoftwareName());
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineSoftwareLink", "href", "software-" + service.getSoftwareTechnicalName() + ".xhtml");
|
||||
|
||||
data.setContent("serviceListLine", index, "serviceListLineUserCount", StatoolInfosUtils.defaultIfZero(service.getPreviousMonthUserCount(), "😢"));
|
||||
data.setContent("serviceListLine", index, "serviceListLineVisitCount", StatoolInfosUtils.defaultIfZero(service.getPreviousMonthVisitCount(), "😞"));
|
||||
|
||||
data.setEscapedContent("serviceListLine", index, "serviceListLineDate", service.getCrawledDate().format(DateTimeFormatter.ofPattern("dd/MM/YYYY")));
|
||||
data.setEscapedAttribute("serviceListLine", index, "serviceListLineDate", "title", service.getCrawledDate().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
|
||||
data.setAttribute("serviceListLine", index, "serviceStatusImg", "src", "status-" + service.getStatus().toString().toLowerCase() + ".png");
|
||||
data.setAttribute("serviceListLine", index, "serviceStatusImg", "title", StringUtils.defaultIfBlank(service.getStatusDescription(), service.getStatus().toString()));
|
||||
|
||||
if (service.getLegalURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("serviceListLine", index, "legalLink", "href", service.getLegalURL().toString());
|
||||
data.setAttribute("serviceListLine", index, "legalLinkImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "legalLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.getContactURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("serviceListLine", index, "contactLink", "href", service.getContactURL().toString());
|
||||
data.setAttribute("serviceListLine", index, "contactLinkImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "contactLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getContactEmail()))
|
||||
{
|
||||
data.setEscapedAttribute("serviceListLine", index, "emailLink", "href", "mailto:" + service.getContactEmail());
|
||||
data.setAttribute("serviceListLine", index, "emailLinkImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "emailLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.getUserGuideURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("serviceListLine", index, "userDocLink", "href", service.getUserGuideURL().toString());
|
||||
data.setAttribute("serviceListLine", index, "userDocLinkImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "userDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.getTechnicalGuideURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("serviceListLine", index, "technicalDocLink", "href", service.getTechnicalGuideURL().toString());
|
||||
data.setAttribute("serviceListLine", index, "technicalDocLinkImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "technicalDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
//
|
||||
if (service.isRegistrationNone())
|
||||
{
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineRegistrationNoneImg", "class", "toto");
|
||||
data.getIdData("serviceListLine", index, "serviceListLineRegistrationNoneImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationFree())
|
||||
{
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineRegistrationFreeImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "serviceListLineRegistrationFreeImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationMember())
|
||||
{
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineRegistrationMemberImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "serviceListLineRegistrationMemberImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationClient())
|
||||
{
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineRegistrationClientImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "serviceListLineRegistrationClientImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationLoadFull())
|
||||
{
|
||||
data.setAttribute("serviceListLine", index, "serviceListLineRegistrationLoadImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "serviceListLineRegistrationLoadImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
//
|
||||
data.setEscapedContent("softwareName", StringUtils.defaultIfBlank(service.getSoftwareName(), "n/a"));
|
||||
data.setEscapedContent("softwareVersion", StringUtils.defaultIfBlank(service.getSoftwareVersion(), "n/a"));
|
||||
data.setEscapedContent("softwareLicenseName", StringUtils.defaultIfBlank(service.getSoftwareLicenseName(), "n/a"));
|
||||
if (service.getSoftwareWebsite() != null)
|
||||
{
|
||||
data.setEscapedAttribute("serviceListLine", index, "softwareWebsiteLink", "href", service.getSoftwareWebsite().toString());
|
||||
data.setAttribute("serviceListLine", index, "softwareWebsiteLinkImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "softwareWebsiteLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.getSoftwareLicenseURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("serviceListLine", index, "softwareLicenseLink", "href", service.getSoftwareLicenseURL().toString());
|
||||
data.setAttribute("serviceListLine", index, "softwareLicenseLinkImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "softwareLicenseLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.getSoftwareSourceURL() != null)
|
||||
{
|
||||
data.setEscapedAttribute("serviceListLine", index, "softwareSourceLink", "href", service.getSoftwareSourceURL().toString());
|
||||
data.setAttribute("serviceListLine", index, "softwareSourceLinkImg", "class", "");
|
||||
data.getIdData("serviceListLine", index, "softwareSourceLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceListView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(result);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServicePage.
|
||||
*/
|
||||
public class ServiceMetricGenericPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceMetricGenericPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @param service
|
||||
* the service
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Service service, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("metricMenuView", ServiceMetricMenuView.htmlize(service, TypeMenu.GENERIC, view, period));
|
||||
|
||||
//
|
||||
ServiceMetricHtmlizer.htmlize(data, "graphic.users", service, view, period, "metrics.service.users", ChartColor.GREEN);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "graphic.users.ipv4-ipv6", service, view, period, "service.users (ipv4 + ipv6)", "metrics.service.users.ipv4", ChartColor.YELLOW,
|
||||
"metrics.service.users.ipv6", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "graphic.users.ipv4", service, view, period, "metrics.service.users.ipv4", ChartColor.YELLOW);
|
||||
ServiceMetricHtmlizer.htmlize(data, "graphic.users.ipv6", service, view, period, "metrics.service.users.ipv6", ChartColor.GREEN);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "graphic.accounts", service, view, period, "metrics.service.accounts", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "graphic.accounts.active", service, view, period, "metrics.service.accounts.active", ChartColor.GREEN);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "graphic.database.bytes", service, view, period, "metrics.service.database.bytes", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "graphic.datafiles.bytes", service, view, period, "metrics.service.datafiles.bytes", ChartColor.GREEN);
|
||||
|
||||
// TODO
|
||||
// metrics.moderation.accounts.reported.* =
|
||||
// metrics.moderation.accounts.sanctioned.* =
|
||||
// metrics.moderation.accounts.disabled.* =
|
||||
// metrics.moderation.accounts.silenced.* =
|
||||
// metrics.moderation.accounts.cancelled.* =
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricGenericView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Metrics génériques");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-generic-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service generic metric view: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,187 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.time.YearMonth;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.threeten.extra.YearWeek;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.WeekValues;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.YearValues;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
|
||||
/**
|
||||
* The Class MetricHtmlizeDataUtils.
|
||||
*/
|
||||
public class ServiceMetricHtmlizer
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceMetricHtmlizer.class);
|
||||
|
||||
/**
|
||||
* Htmlize data.
|
||||
*
|
||||
* @param data
|
||||
* the data
|
||||
* @param metricId
|
||||
* the metric id
|
||||
* @param service
|
||||
* the service
|
||||
* @param metricPath
|
||||
* the metric path
|
||||
* @param color
|
||||
* the color
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void htmlize(final TagDataManager data, final String metricId, final Service service, final ViewMenu view, final PeriodMenu period, final String metricPath,
|
||||
final ChartColor color) throws StatoolInfosException
|
||||
{
|
||||
if (view == ViewMenu.YEARS)
|
||||
{
|
||||
YearValues yearMetric = service.getMetricYearValues(metricPath);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, yearMetric, color));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.MONTHS)
|
||||
{
|
||||
MonthValues monthMetric = service.getMetricMonthValues(metricPath);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, monthMetric, color));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearMonth.now().minusMonths(11), YearMonth.now(), monthMetric, color));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearMonth.of(year, 01), YearMonth.of(year, 12), monthMetric, color));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.WEEKS)
|
||||
{
|
||||
WeekValues weekMetric = service.getMetricWeekValues(metricPath);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, weekMetric, color));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearWeek.now().minusYears(1), YearWeek.now(), weekMetric, color));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearWeek.of(year, 01), YearWeek.of(year, 53), weekMetric, color));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize data.
|
||||
*
|
||||
* @param data
|
||||
* the data
|
||||
* @param metricId
|
||||
* the metric id
|
||||
* @param service
|
||||
* the service
|
||||
* @param metricLabel
|
||||
* the metric label
|
||||
* @param metricPath1
|
||||
* the metric path 1
|
||||
* @param color1
|
||||
* the color 1
|
||||
* @param metricPath2
|
||||
* the metric path 2
|
||||
* @param color2
|
||||
* the color 2
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void htmlize(final TagDataManager data, final String metricId, final Service service, final ViewMenu view, final PeriodMenu period, final String metricLabel,
|
||||
final String metricPath1, final ChartColor color1, final String metricPath2, final ChartColor color2) throws StatoolInfosException
|
||||
{
|
||||
if (view == ViewMenu.YEARS)
|
||||
{
|
||||
YearValues yearMetric1 = service.getMetricYearValues(metricPath1);
|
||||
YearValues yearMetric2 = service.getMetricYearValues(metricPath2);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId,
|
||||
ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, yearMetric1, yearMetric2));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.MONTHS)
|
||||
{
|
||||
MonthValues monthMetric1 = service.getMetricMonthValues(metricPath1);
|
||||
MonthValues monthMetric2 = service.getMetricMonthValues(metricPath2);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId,
|
||||
ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearMonth.now().minusMonths(11), YearMonth.now(), new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId,
|
||||
ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearMonth.of(year, 01), YearMonth.of(year, 12), new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
|
||||
}
|
||||
}
|
||||
else if (view == ViewMenu.WEEKS)
|
||||
{
|
||||
WeekValues weekMetric1 = service.getMetricWeekValues(metricPath1);
|
||||
WeekValues weekMetric2 = service.getMetricWeekValues(metricPath2);
|
||||
|
||||
if (period == PeriodMenu.FULL)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearWeek.now().minusYears(1), YearWeek.now(), new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
|
||||
}
|
||||
else
|
||||
{
|
||||
int year = Integer.parseInt(period.name().substring(1));
|
||||
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearWeek.of(year, 01), YearWeek.of(year, 53), new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,264 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2023 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class ServiceMetricMenuView.
|
||||
*/
|
||||
public class ServiceMetricMenuView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceMetricMenuView.class);
|
||||
|
||||
public enum PeriodMenu
|
||||
{
|
||||
FULL,
|
||||
LAST,
|
||||
Y2021,
|
||||
Y2022;
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
String result;
|
||||
|
||||
if (this.name().startsWith("Y"))
|
||||
{
|
||||
result = this.name().substring(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = this.name().toLowerCase();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the years.
|
||||
*
|
||||
* @return the years
|
||||
*/
|
||||
public static PeriodMenu[] getYears()
|
||||
{
|
||||
PeriodMenu[] result;
|
||||
|
||||
ArrayList<PeriodMenu> list = new ArrayList<PeriodMenu>();
|
||||
for (PeriodMenu item : values())
|
||||
{
|
||||
if (item.name().startsWith("Y"))
|
||||
{
|
||||
list.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
result = list.toArray(new PeriodMenu[0]);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public enum TypeMenu
|
||||
{
|
||||
SUMMARY,
|
||||
WEB,
|
||||
GENERIC,
|
||||
SPECIFIC;
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.name().toLowerCase();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ViewMenu
|
||||
{
|
||||
YEARS,
|
||||
MONTHS,
|
||||
WEEKS,
|
||||
DAYS;
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.name().toLowerCase();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service, final TypeMenu type, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
String filename = String.format("%s-metrics-summary-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("summaryTypeButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-generic-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("genericTypeButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-specific-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("specificTypeButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-web-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
data.setAttribute("webTypeButton", "href", filename);
|
||||
|
||||
//
|
||||
filename = String.format("%s-metrics-%s-years-%s.xhtml", service.getLocalFileBaseName(), type.getName(), PeriodMenu.FULL.getName());
|
||||
data.setAttribute("yearsViewButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-months-%s.xhtml", service.getLocalFileBaseName(), type.getName(), period.getName());
|
||||
data.setAttribute("monthsViewButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-weeks-%s.xhtml", service.getLocalFileBaseName(), type.getName(), period.getName());
|
||||
data.setAttribute("weeksViewButton", "href", filename);
|
||||
|
||||
data.setAttribute("daysViewButton", "href", "#");
|
||||
|
||||
//
|
||||
filename = String.format("%s-metrics-%s-%s-full.xhtml", service.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("fullPeriodButton", "href", filename);
|
||||
|
||||
if (view != ViewMenu.YEARS)
|
||||
{
|
||||
filename = String.format("%s-metrics-%s-%s-last.xhtml", service.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("lastPeriodButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-%s-2021.xhtml", service.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("2021PeriodButton", "href", filename);
|
||||
|
||||
filename = String.format("%s-metrics-%s-%s-2022.xhtml", service.getLocalFileBaseName(), type.getName(), view.getName());
|
||||
data.setAttribute("2022PeriodButton", "href", filename);
|
||||
}
|
||||
|
||||
//
|
||||
if ((type == null) || (type == TypeMenu.SUMMARY))
|
||||
{
|
||||
data.appendAttribute("summaryTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (type == TypeMenu.GENERIC)
|
||||
{
|
||||
data.appendAttribute("genericTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (type == TypeMenu.WEB)
|
||||
{
|
||||
data.appendAttribute("webTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (type == TypeMenu.SPECIFIC)
|
||||
{
|
||||
data.appendAttribute("specificTypeButton", "class", "button selected");
|
||||
}
|
||||
|
||||
//
|
||||
if ((view == null) || (view == ViewMenu.YEARS))
|
||||
{
|
||||
data.appendAttribute("yearsViewButton", "class", "button selected");
|
||||
}
|
||||
else if (view == ViewMenu.MONTHS)
|
||||
{
|
||||
data.appendAttribute("monthsViewButton", "class", "button selected");
|
||||
}
|
||||
else if (view == ViewMenu.WEEKS)
|
||||
{
|
||||
data.appendAttribute("weeksViewButton", "class", "button selected");
|
||||
}
|
||||
else if (view == ViewMenu.DAYS)
|
||||
{
|
||||
data.appendAttribute("daysViewButton", "class", "button selected");
|
||||
}
|
||||
|
||||
//
|
||||
if ((period == null) || (period == PeriodMenu.FULL))
|
||||
{
|
||||
data.appendAttribute("fullPeriodButton", "class", "button selected");
|
||||
}
|
||||
else if (period == PeriodMenu.LAST)
|
||||
{
|
||||
data.appendAttribute("lastPeriodButton", "class", "button selected");
|
||||
}
|
||||
else if (period == PeriodMenu.Y2021)
|
||||
{
|
||||
data.appendAttribute("2021PeriodButton", "class", "button selected");
|
||||
}
|
||||
else if (period == PeriodMenu.Y2022)
|
||||
{
|
||||
data.appendAttribute("2022PeriodButton", "class", "button selected");
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/metricMenuView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building metric menu view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServicePage.
|
||||
*/
|
||||
public class ServiceMetricSpecificPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceMetricSpecificPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @param service
|
||||
* the service
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Service service, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("metricMenuView", ServiceMetricMenuView.htmlize(service, TypeMenu.SPECIFIC, view, period));
|
||||
|
||||
//
|
||||
int index = 1;
|
||||
for (String metricPath : service.getMetricSpecificPrefixes())
|
||||
{
|
||||
ServiceMetricHtmlizer.htmlize(data, "foo" + index++, service, view, period, metricPath, ChartColor.BLUE);
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSpecificView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Metrics spécifiques");
|
||||
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-specific-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service specific metrics view: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServiceSummaryMetricPage.
|
||||
*/
|
||||
public class ServiceMetricSummaryPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceMetricSummaryPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @param service
|
||||
* the service
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Service service, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("metricMenuView", ServiceMetricMenuView.htmlize(service, TypeMenu.SUMMARY, view, period));
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.hits.humans", service, view, period, "metrics.http.hits.humans", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.visitors", service, view, period, "metrics.http.visitors", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.visits", service, view, period, "metrics.http.visits", ChartColor.GREEN);
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Metrics résumé");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-summary-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.TypeMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServicePage.
|
||||
*/
|
||||
public class ServiceMetricWebPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceMetricWebPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param htmlizeDirectory
|
||||
* the htmlize directory
|
||||
* @param service
|
||||
* the service
|
||||
* @param view
|
||||
* the view
|
||||
* @param period
|
||||
* the period
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File htmlizeDirectory, final Service service, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("metricMenuView", ServiceMetricMenuView.htmlize(service, TypeMenu.WEB, view, period));
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.hits", service, view, period, "metrics.http.hits", ChartColor.BLUE);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.hits-ipv4ipv6", service, view, period, "http.hits (ipv4 + ipv6)", "metrics.http.hits.ipv4", ChartColor.YELLOW, "metrics.http.hits.ipv6",
|
||||
ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.hits.ipv4", service, view, period, "metrics.http.hits.ipv4", ChartColor.YELLOW);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.hits.ipv6", service, view, period, "metrics.http.hits.ipv6", ChartColor.GREEN);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.hits-humansbots", service, view, period, "http.hits (humans + bots)", "metrics.http.hits.humans", ChartColor.GREEN,
|
||||
"metrics.http.hits.bots",
|
||||
ChartColor.YELLOW);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.hits.humans", service, view, period, "metrics.http.hits.humans", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.hits.bots", service, view, period, "metrics.http.hits.bots", ChartColor.YELLOW);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.hits.humans-ipv4ipv6", service, view, period, "http.hits.humans (ipv4 + ipv6)", "metrics.http.hits.humans.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.hits.humans.ipv6", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.hits.humans.ipv4", service, view, period, "metrics.http.hits.humans.ipv4", ChartColor.YELLOW);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.hits.humans.ipv6", service, view, period, "metrics.http.hits.humans.ipv6", ChartColor.GREEN);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.errors", service, view, period, "metrics.http.errors", ChartColor.RED);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.errors.php", service, view, period, "metrics.http.errors.php", ChartColor.RED);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.files", service, view, period, "metrics.http.files", ChartColor.BLUE);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.pages", service, view, period, "metrics.http.pages", ChartColor.BLUE);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.bytes", service, view, period, "metrics.http.bytes", ChartColor.BLUE);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.ip", service, view, period, "metrics.http.ip", ChartColor.BLUE);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.ip-humansbots", service, view, period, "http.ip (humans + bots)", "metrics.http.ip.humans", ChartColor.GREEN, "metrics.http.ip.bots",
|
||||
ChartColor.YELLOW);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.ip.humans", service, view, period, "metrics.http.ip.humans", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.ip.bots", service, view, period, "metrics.http.ip.bots", ChartColor.YELLOW);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.ip-ipv4ipv6", service, view, period, "http.ip (ipv4 + ipv6)", "metrics.http.ip.ipv4", ChartColor.YELLOW, "metrics.http.ip.ipv6",
|
||||
ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.ip.ipv4", service, view, period, "metrics.http.ip.ipv4", ChartColor.YELLOW);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.ip.ipv6", service, view, period, "metrics.http.ip.ipv6", ChartColor.GREEN);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.requesters", service, view, period, "metrics.http.requesters", ChartColor.BLUE);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.requesters-humansbots", service, view, period, "http.requesters (humans + bots)", "metrics.http.requesters.humans", ChartColor.GREEN,
|
||||
"metrics.http.requesters.bots", ChartColor.YELLOW);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.requesters.humans", service, view, period, "metrics.http.requesters.humans", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.requesters.bots", service, view, period, "metrics.http.requesters.bots", ChartColor.YELLOW);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.requesters-ipv4ipv6", service, view, period, "http.requesters (ipv4 + ipv6)", "metrics.http.requesters.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.requesters.ipv6", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.requesters.ipv4", service, view, period, "metrics.http.requesters.ipv4", ChartColor.YELLOW);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.requesters.ipv6", service, view, period, "metrics.http.requesters.ipv6", ChartColor.GREEN);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.visitors", service, view, period, "metrics.http.visitors", ChartColor.BLUE);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.visitors-ipv4ipv6", service, view, period, "http.visitors (ipv4 + ipv6)", "metrics.http.visitors.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.visitors.ipv6", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.visitors.ipv4", service, view, period, "metrics.http.visitors.ipv4", ChartColor.YELLOW);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.visitors.ipv6", service, view, period, "metrics.http.visitors.ipv6", ChartColor.GREEN);
|
||||
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.visits", service, view, period, "metrics.http.visits", ChartColor.BLUE);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.visits-ipv4ipv6", service, view, period, "http.visits (ipv4 + ipv6)", "metrics.http.visits.ipv4", ChartColor.YELLOW,
|
||||
"metrics.http.visits.ipv6", ChartColor.GREEN);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.visits.ipv4", service, view, period, "metrics.http.visits.ipv4", ChartColor.YELLOW);
|
||||
ServiceMetricHtmlizer.htmlize(data, "http.visits.ipv6", service, view, period, "metrics.http.visits.ipv6", ChartColor.GREEN);
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Metrics web");
|
||||
String page = WebCharterView.build(content, trail);
|
||||
|
||||
String filename = String.format("%s-metrics-web-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());
|
||||
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,185 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.catgenerator.core.BirdGenerator;
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Metrics;
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.PeriodMenu;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.ViewMenu;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServicePage.
|
||||
*/
|
||||
public class ServicePage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServicePage.class);
|
||||
|
||||
/**
|
||||
* Builds the view.
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws StatoolInfosException
|
||||
*/
|
||||
public static void build(final Service service) throws IOException, StatoolInfosException
|
||||
{
|
||||
CrawlCache cache = HtmlizerContext.instance().getCache();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
// Manage the logo file.
|
||||
logger.info("Htmlize service logo: {}.", service.getName());
|
||||
htmlizeServiceLogo(service, cache, htmlizeDirectory);
|
||||
|
||||
//
|
||||
logger.info("Htmlize service properties file: {}.", service.getName());
|
||||
FileUtils.copyFile(service.getInputFile(),
|
||||
new File(htmlizeDirectory, service.getLocalFileBaseName() + ".properties"));
|
||||
|
||||
//
|
||||
for (Metrics metrics : service.getMetrics())
|
||||
{
|
||||
FileUtils.copyFile(metrics.getInputFile(),
|
||||
new File(htmlizeDirectory, metrics.getLocalFileBaseName() + ".properties"));
|
||||
}
|
||||
|
||||
//
|
||||
logger.info("Htmlize service page: {}.", service.getName());
|
||||
String page = ServicePage.htmlize(service);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + ".xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
ServiceServicesPage.build(service);
|
||||
|
||||
//
|
||||
logger.info("Htmlize service metric pages: {}.", service.getName());
|
||||
for (ViewMenu view : ViewMenu.values())
|
||||
{
|
||||
for (PeriodMenu period : PeriodMenu.values())
|
||||
{
|
||||
if ((view != ViewMenu.YEARS) || (period == PeriodMenu.FULL))
|
||||
{
|
||||
if (view != ViewMenu.DAYS)
|
||||
{
|
||||
ServiceMetricSummaryPage.build(htmlizeDirectory, service, view, period);
|
||||
ServiceMetricGenericPage.build(htmlizeDirectory, service, view, period);
|
||||
ServiceMetricSpecificPage.build(htmlizeDirectory, service, view, period);
|
||||
ServiceMetricWebPage.build(htmlizeDirectory, service, view, period);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void buildAll() throws IOException, StatoolInfosException
|
||||
{
|
||||
for (Service service : HtmlizerContext.instance().getFederation().getServicesAll())
|
||||
{
|
||||
build(service);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building service page {}…", service.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("statsView", ServiceStatsView.htmlize(service));
|
||||
|
||||
//
|
||||
// data.setContent("fooChart", graphicIndex++,
|
||||
// LineMonthsChartView.build());
|
||||
|
||||
// service.getPrefixes();
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param service
|
||||
* @param cache
|
||||
* @param htmlizeDirectory
|
||||
* @throws IOException
|
||||
*/
|
||||
private static void htmlizeServiceLogo(final Service service, final CrawlCache cache, final File htmlizeDirectory) throws IOException
|
||||
{
|
||||
File target = new File(htmlizeDirectory, service.getLogoFileName());
|
||||
|
||||
File logoFile = cache.restoreFile(service.getLogoURL());
|
||||
if (logoFile == null)
|
||||
{
|
||||
logger.info("BirdGeneratoring cat avatar: {}", target.getAbsoluteFile());
|
||||
BirdGenerator.buildAvatarTo(service.getTechnicalName(), target);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileUtils.copyFile(logoFile, target);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,146 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Metrics;
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServicePropertyCheckAlertPage.
|
||||
*/
|
||||
public class ServicePropertyAlertPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServicePropertyAlertPage.class);
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void buildAll() throws IOException, StatoolInfosException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
for (Service service : federation.getServicesAll())
|
||||
{
|
||||
String page = htmlize(service);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-propertyalerts.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
for (Metrics metrics : service.getMetrics())
|
||||
{
|
||||
page = htmlize(service, metrics);
|
||||
FileUtils.write(new File(htmlizeDirectory, metrics.getLocalFileBaseName() + "-propertyalerts.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("contentView", PropertyAlertView.htmlize(service.getInputChecksAll().getAlertLines()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Propriétés en alertes", service.getLocalFileBaseName() + "-propertyalerts.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service property file alert page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @param metrics
|
||||
* the metrics
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service, final Metrics metrics) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("contentView", PropertyAlertView.htmlize(metrics.getInputChecks().getAlertLines()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Propriétés en alertes", service.getLocalFileBaseName() + "-propertyalerts.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building metrics property file check alert page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,147 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Metrics;
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServicePropertyFileCheckView.
|
||||
*/
|
||||
public class ServicePropertyCheckPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServicePropertyCheckPage.class);
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void buildAll() throws IOException, StatoolInfosException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
for (Service service : federation.getServicesAll())
|
||||
{
|
||||
String page = htmlize(service);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-propertycheck.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
for (Metrics metrics : service.getMetrics())
|
||||
{
|
||||
page = htmlize(service, metrics);
|
||||
FileUtils.write(new File(htmlizeDirectory, metrics.getLocalFileBaseName() + "-propertycheck.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("contentView", PropertyCheckView.htmlize(service.getInputChecks()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Propriétés", service.getLocalFileBaseName() + "-propertycheck.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service property file check page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @param metrics
|
||||
* the metrics
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service, final Metrics metrics) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("contentView", PropertyCheckView.htmlize(metrics.getInputChecks()));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Propriétés", service.getLocalFileBaseName() + "-propertycheck.xhtml");
|
||||
trail.add("Propriétés", metrics.getLocalFileBaseName() + "-propertycheck.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building metrics property file check page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.catgenerator.core.BirdGenerator;
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class ServiceServicesPage.
|
||||
*/
|
||||
public class ServiceServicesPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceServicesPage.class);
|
||||
|
||||
/**
|
||||
* Builds the view.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static void build(final Service service) throws IOException, StatoolInfosException
|
||||
{
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
//
|
||||
String page = htmlize(service);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-services.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
|
||||
Services services = new Services();
|
||||
services.add(service);
|
||||
data.setContent("servicesView", ServiceListView.htmlize(services));
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceServices.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.stats.StatAgent;
|
||||
import fr.devinsy.statoolinfos.stats.services.RegistrationStats;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class ServiceStatsPage.
|
||||
*/
|
||||
public class ServiceStatsView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceStatsView.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building service stats view {}…", service.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("turnoutChart", ChartHtmlizer.htmlizeOrganizationTurnoutChart(service));
|
||||
|
||||
Services services = Services.of(service);
|
||||
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(services));
|
||||
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(services));
|
||||
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(services));
|
||||
|
||||
data.setContent("hostNameChart", ChartHtmlizer.htmlizeHostNamePieChart(services));
|
||||
data.setContent("hostProviderHypervisorChart", ChartHtmlizer.htmlizeHostProviderHypervisorChart(services));
|
||||
|
||||
data.setContent("hostServerDistributionChart", ChartHtmlizer.htmlizeHostServerDistributionChart(services));
|
||||
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(services));
|
||||
|
||||
{
|
||||
RegistrationStats stats = StatAgent.statRegistrationTypes(services);
|
||||
|
||||
data.setContent("registrationTypeChart", ChartHtmlizer.htmlizeRegistrationBarChart(stats));
|
||||
data.setContent("registrationNoneTypeChart", ChartHtmlizer.htmlizeRegistrationNonePieChart(stats));
|
||||
data.setContent("registrationFreeTypeChart", ChartHtmlizer.htmlizeRegistrationFreePieChart(stats));
|
||||
data.setContent("registrationMemberTypeChart", ChartHtmlizer.htmlizeRegistrationMemberPieChart(stats));
|
||||
data.setContent("registrationClientTypeChart", ChartHtmlizer.htmlizeRegistrationClientPieChart(stats));
|
||||
}
|
||||
|
||||
data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(services));
|
||||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(services));
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceStatsView.xhtml", data).toString();
|
||||
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.uptime.UptimeJournal;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServiceUptimePage.
|
||||
*/
|
||||
public class ServiceUptimePage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceUptimePage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final Service service) throws StatoolInfosException, IOException
|
||||
{
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
UptimeJournal journal = HtmlizerContext.instance().getUptimeJournal();
|
||||
|
||||
String page = htmlize(service, journal);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-uptimes.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void buildAll() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
|
||||
for (Service service : federation.getServicesAll())
|
||||
{
|
||||
build(service);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @param journal
|
||||
* the journal
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service, final UptimeJournal journal) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
|
||||
Services services = new Services();
|
||||
services.add(service);
|
||||
data.setContent("uptimeView", UptimeView.htmlize(services, journal));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/uptimePage.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
|
||||
trail.add("Disponibilité des services", service.getLocalFileBaseName() + "-uptimes.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building about page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServicesPage.
|
||||
*/
|
||||
public class ServicesPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServicesPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws StatoolInfosException
|
||||
*/
|
||||
public static void build() throws IOException, StatoolInfosException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
logger.info("Htmlize services page.");
|
||||
String page = ServicesPage.htmlize(federation.getServices());
|
||||
FileUtils.write(new File(htmlizeDirectory, "services.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param services
|
||||
* the services
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Services services) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building services page.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("serviceListView", ServiceListView.htmlize(services));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/services.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Services", "services.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.Organizations;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.DisplayMode;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class SocialNetworksPage.
|
||||
*/
|
||||
public class SocialNetworksPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(SocialNetworksPage.class);
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void buildAll() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
CrawlCache cache = HtmlizerContext.instance().getCache();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
logger.info("Htmlize social networks pages.");
|
||||
Organizations organizations = federation.getOrganizations().filterBySocialNetworks();
|
||||
String page = SocialNetworksPage.htmlize("Réseaux sociaux", organizations);
|
||||
FileUtils.write(new File(htmlizeDirectory, "socialNetworks.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param title
|
||||
* the title
|
||||
* @param organizations
|
||||
* the organizations
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final String title, final Organizations organizations) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building social networks page {}…");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setEscapedContent("title", title);
|
||||
data.setContent("organizationCount", organizations.size());
|
||||
|
||||
int index = 0;
|
||||
for (Organization organization : organizations)
|
||||
{
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineNameLink", "href", organization.getTechnicalName() + ".xhtml");
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineLogo", "src", organization.getLogoFileName());
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineLogo", "alt", organization.getName());
|
||||
data.setEscapedContent("organizationListLine", index, "organizationListLineNameValue", organization.getName());
|
||||
|
||||
if (organization.getWebsiteURL() != null)
|
||||
{
|
||||
data.setEscapedContent("organizationListLine", index, "organizationListLineUrlLink", organization.getWebsiteURL().toString());
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineUrlLink", "href", organization.getWebsiteURL().toString());
|
||||
}
|
||||
if (StringUtils.isNotBlank(organization.getDiasporaWebpage()))
|
||||
{
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineDiasporaImg", "class", "");
|
||||
data.getIdData("organizationListLine", index, "organizationListLineDiasporaImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineDiasporaLink", "href", organization.getDiasporaWebpage());
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineDiaspora", "data-search", "1");
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineDiaspora", "data-order", "1");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(organization.getFunkwhaleWebpage()))
|
||||
{
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineFunkwhaleImg", "class", "");
|
||||
data.getIdData("organizationListLine", index, "organizationListLineFunkwhaleImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineFunkwhaleLink", "href", organization.getFunkwhaleWebpage());
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineFunkwhale", "data-search", "1");
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineFunkwhale", "data-order", "1");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(organization.getMastodonWebpage()))
|
||||
{
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineMastodonImg", "class", "");
|
||||
data.getIdData("organizationListLine", index, "organizationListLineMastodonImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineMastodonLink", "href", organization.getMastodonWebpage());
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineMastodon", "data-search", "1");
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineMastodon", "data-order", "1");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(organization.getMobilizonWebpage()))
|
||||
{
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineMobilizonImg", "class", "");
|
||||
data.getIdData("organizationListLine", index, "organizationListLineMobilizonImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineMobilizonLink", "href", organization.getMobilizonWebpage());
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineMobilizon", "data-search", "1");
|
||||
data.setAttribute("organizationListLine", index, "organizationListLineMobilizon", "data-order", "1");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(organization.getPixelfedWebpage()))
|
||||
{
|
||||
data.setAttribute("organizationListLine", index, "organizationListLinePixelfedImg", "class", "");
|
||||
data.getIdData("organizationListLine", index, "organizationListLinePixelfedImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
data.setAttribute("organizationListLine", index, "organizationListLinePixelfedLink", "href", organization.getPixelfedWebpage());
|
||||
data.setAttribute("organizationListLine", index, "organizationListLinePixelfed", "data-search", "1");
|
||||
data.setAttribute("organizationListLine", index, "organizationListLinePixelfed", "data-order", "1");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(organization.getPeertubeWebpage()))
|
||||
{
|
||||
data.setAttribute("organizationListLine", index, "organizationListLinePeertubeImg", "class", "");
|
||||
data.getIdData("organizationListLine", index, "organizationListLinePeertubeImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
data.setAttribute("organizationListLine", index, "organizationListLinePeertubeLink", "href", organization.getPeertubeWebpage());
|
||||
data.setAttribute("organizationListLine", index, "organizationListLinePeertube", "data-search", "1");
|
||||
data.setAttribute("organizationListLine", index, "organizationListLinePeertube", "data-order", "1");
|
||||
}
|
||||
|
||||
index += 1;
|
||||
}
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/socialNetworks.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building social networks page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.Software;
|
||||
import fr.devinsy.statoolinfos.core.Softwares;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class SoftwarePage.
|
||||
*/
|
||||
public class SoftwarePage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(SoftwarePage.class);
|
||||
|
||||
/**
|
||||
* Builds the all.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void buildAll() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
logger.info("Htmlize software pages.");
|
||||
Softwares catalog = federation.getSoftwares();
|
||||
for (Software software : catalog.values())
|
||||
{
|
||||
Services services = federation.getServices().getBy(software);
|
||||
String page = SoftwarePage.htmlize(software, services);
|
||||
FileUtils.write(new File(htmlizeDirectory, "software-" + software.getTechnicalName() + ".xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param software
|
||||
* the software
|
||||
* @param services
|
||||
* the services
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Software software, final Services services) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building services page.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setEscapedContent("softwareName", software.getName());
|
||||
data.setEscapedContent("softwareDescription", software.getDescription());
|
||||
data.setContent("serviceCount", services.size());
|
||||
|
||||
data.setContent("serviceListView", ServiceListView.htmlize(services));
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/software.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Logiciels", "softwares.xhtml");
|
||||
trail.add(software.getName(), "software-" + software.getTechnicalName() + ".xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building software page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Categories;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
|
||||
import fr.devinsy.statoolinfos.htmlize.CategoriesView.Mode;
|
||||
import fr.devinsy.statoolinfos.stats.StatAgent;
|
||||
import fr.devinsy.statoolinfos.stats.softwares.SoftwareStat;
|
||||
import fr.devinsy.statoolinfos.stats.softwares.SoftwareStats;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class SoftwaresPage.
|
||||
*/
|
||||
public class SoftwaresPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(SoftwaresPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void build() throws StatoolInfosException, IOException
|
||||
{
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
Categories categories = HtmlizerContext.instance().getCategories();
|
||||
|
||||
logger.info("Htmlize softwares page.");
|
||||
SoftwareStats stats = StatAgent.statAllSoftwares(federation, categories);
|
||||
String page = SoftwaresPage.htmlize(stats);
|
||||
FileUtils.write(new File(htmlizeDirectory, "softwares.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param stats
|
||||
* the stats
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final SoftwareStats stats) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building softwares page.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("softwareCount", stats.size());
|
||||
|
||||
int index = 0;
|
||||
for (SoftwareStat stat : stats.sortByName())
|
||||
{
|
||||
data.setEscapedContent("softwareListLine", index, "softwareListLineNameLink", stat.getName());
|
||||
data.setAttribute("softwareListLine", index, "softwareListLineNameLink", "href", "software-" + stat.getTechnicalName() + ".xhtml");
|
||||
|
||||
data.setContent("softwareListLine", index, "softwareListLineCategory", CategoriesView.build(stat.getCategories(), Mode.ALL));
|
||||
|
||||
data.setContent("softwareListLine", index, "softwareListLineOrganizationCount", stat.getOrganizationCount());
|
||||
data.setContent("softwareListLine", index, "softwareListLineServiceCount", StatoolInfosUtils.defaultIfZero(stat.getServiceCount(), "😿"));
|
||||
data.setContent("softwareListLine", index, "softwareListLineUserCount", StatoolInfosUtils.defaultIfZero(stat.getUserCount(), "😢"));
|
||||
data.setContent("softwareListLine", index, "softwareListLineVisitCount", StatoolInfosUtils.defaultIfZero(stat.getVisitCount(), "😞"));
|
||||
|
||||
index += 1;
|
||||
}
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/softwares.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add("Logiciels", "softwares.xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building softwares page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,216 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.uptime.UptimeJournal;
|
||||
import fr.devinsy.statoolinfos.uptime.UptimeStat;
|
||||
import fr.devinsy.statoolinfos.uptime.UptimeStatus;
|
||||
import fr.devinsy.strings.StringList;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class UptimeView.
|
||||
*/
|
||||
public class UptimeView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(UptimeView.class);
|
||||
|
||||
/**
|
||||
* Gets the stat.
|
||||
*
|
||||
* @param services
|
||||
* the services
|
||||
* @param date
|
||||
* the date
|
||||
* @return the stat
|
||||
*/
|
||||
public static UptimeStat getStat(final UptimeJournal journal, final Services services, final LocalDate date)
|
||||
{
|
||||
UptimeStat result;
|
||||
|
||||
result = new UptimeStat();
|
||||
|
||||
if ((services != null) || (date != null))
|
||||
{
|
||||
for (Service service : services.sortByName())
|
||||
{
|
||||
UptimeStat stat = journal.getStat(service.getWebsiteURL(), date);
|
||||
if (stat.getStatus() == UptimeStatus.OK)
|
||||
{
|
||||
result.incOk();
|
||||
}
|
||||
else if (stat.getStatus() == UptimeStatus.WARNING)
|
||||
{
|
||||
result.incWarning();
|
||||
}
|
||||
else if (stat.getStatus() == UptimeStatus.ALERT)
|
||||
{
|
||||
result.incAlert();
|
||||
}
|
||||
else if (stat.getStatus() == UptimeStatus.ERROR)
|
||||
{
|
||||
result.incError();
|
||||
}
|
||||
else if (stat.getStatus() == UptimeStatus.VOID)
|
||||
{
|
||||
result.incVoid();
|
||||
}
|
||||
}
|
||||
|
||||
if (result.getCount() == 0)
|
||||
{
|
||||
result.setStatus(UptimeStatus.VOID);
|
||||
}
|
||||
else if (result.getOkCount() != result.getCount())
|
||||
{
|
||||
result.setStatus(UptimeStatus.ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.setStatus(UptimeStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param services
|
||||
* the services
|
||||
* @param journal
|
||||
* the journal
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Services services, final UptimeJournal journal) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
LocalDate now = LocalDate.now();
|
||||
|
||||
UptimeStat last = getStat(journal, services, now);
|
||||
|
||||
data.setContent("okCount", last.getOkCount());
|
||||
data.setContent("warningCount", last.getWarningCount());
|
||||
data.setContent("alertCount", last.getAlertCount());
|
||||
data.setContent("errorCount", last.getErrorCount());
|
||||
data.setContent("voidCount", last.getVoidCount());
|
||||
data.setContent("unavailableCount", last.getUnavailableCount());
|
||||
|
||||
for (int dayCount = 0; dayCount < 22; dayCount++)
|
||||
{
|
||||
LocalDate date = now.minusDays(dayCount);
|
||||
|
||||
//
|
||||
data.setContent("lineHeader-" + dayCount, StringUtils.capitalize(date.format(DateTimeFormatter.ofPattern("EEEE", Locale.FRENCH)).substring(0, 2)));
|
||||
data.setAttribute("lineHeader-" + dayCount, "title", date.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")));
|
||||
|
||||
DayOfWeek weekDay = date.getDayOfWeek();
|
||||
if ((weekDay == DayOfWeek.SUNDAY) || (weekDay == DayOfWeek.SATURDAY))
|
||||
{
|
||||
data.setAttribute("lineHeader-" + dayCount, "style", "background-color: gainsboro;");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("lineHeader-" + dayCount, "style", "background-color: #ececec;");
|
||||
}
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
for (Service service : services.sortByName())
|
||||
{
|
||||
//
|
||||
data.setAttribute("line", index, "lineLogo", "src", service.getLogoFileName());
|
||||
data.setEscapedContent("line", index, "lineNameValue", service.getName());
|
||||
data.setAttribute("line", index, "lineNameLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
|
||||
data.setAttribute("line", index, "lineOrganizationLink", "href", service.getOrganization().getTechnicalName() + ".xhtml");
|
||||
data.setAttribute("line", index, "lineOrganizationLogo", "src", service.getOrganization().getLogoFileName());
|
||||
data.setEscapedContent("line", index, "lineOrganizationValue", service.getOrganization().getName());
|
||||
|
||||
//
|
||||
for (int dayCount = 0; dayCount < 22; dayCount++)
|
||||
{
|
||||
LocalDate date = now.minusDays(dayCount);
|
||||
|
||||
//
|
||||
DayOfWeek weekDay = date.getDayOfWeek();
|
||||
if ((weekDay == DayOfWeek.SUNDAY) || (weekDay == DayOfWeek.SATURDAY))
|
||||
{
|
||||
data.setAttribute("line", index, "uptime-" + dayCount, "style", "background-color: gainsboro;");
|
||||
}
|
||||
|
||||
//
|
||||
UptimeStat stat = journal.getStat(service.getWebsiteURL(), date);
|
||||
StringList lines = new StringList();
|
||||
String header = String.format("%d ok + %d err", stat.getOkCount(), stat.getErrorCount());
|
||||
lines.add(header);
|
||||
header = date.format(DateTimeFormatter.ofPattern("dd/MM/yyyy"));
|
||||
lines.add(header);
|
||||
if (stat.getErrorCount() > 0)
|
||||
{
|
||||
lines.addAll(journal.getUptimes(service.getWebsiteURL(), date).toTimeList());
|
||||
}
|
||||
|
||||
data.setAttribute("line", index, "statusImg-" + dayCount, "src", "status-" + stat.getStatus().toString().toLowerCase() + ".png");
|
||||
// String title = String.format("%d ok + %d err %s",
|
||||
// stat.getOkCount(), stat.getErrorCount(),
|
||||
// date.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")));
|
||||
data.setAttribute("line", index, "statusImg-" + dayCount, "title", lines.toStringSeparatedBy(" "));
|
||||
}
|
||||
|
||||
//
|
||||
index += 1;
|
||||
}
|
||||
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/uptimeView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building about page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.util.BuildInformation;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class WebCharterView.
|
||||
*/
|
||||
public class WebCharterView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(WebCharterView.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param content
|
||||
* the content
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String build(final String content) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = build(content, new BreadcrumbTrail());
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param content
|
||||
* the content
|
||||
* @param trail
|
||||
* the trail
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String build(final String content, final BreadcrumbTrail trail) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building WebCharterView.");
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("federationButton", HtmlizerContext.instance().getFederation().getName());
|
||||
data.setContent("versionsup", BuildInformation.instance().version());
|
||||
data.setContent("lastUpdateDate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd/MM/yyyy HH':'mm", Locale.FRANCE)));
|
||||
data.setContent("webCharterContent", XidynUtils.extractBodyContent(content));
|
||||
data.setContent("breadcrumbTrail", trail.toString());
|
||||
data.setAttribute("federationStatsButton", "href", HtmlizerContext.instance().getFederation().getTechnicalName() + "-stats.xhtml");
|
||||
|
||||
result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/webCharterView.xhtml", data).toString();
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building webCharter view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>StatoolInfos</title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="keywords" content="statoolinfos,devinsy,federation" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
|
||||
<script src="sorttable.js" />
|
||||
<script src="Chart.bundle.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Introduction</h2>
|
||||
<p>StatoolInfos is a simple tool of statistics about federation, organizations and services.</p>
|
||||
|
||||
<h2>License and source repository</h2>
|
||||
<p>The original author of StatoolInfos is Christian P. MOMON.</p>
|
||||
<p>StatoolInfo is a free software released under the GNU AGPL license.</p>
|
||||
<p>The official source repository is:</p>
|
||||
<ul>
|
||||
<li><a href="https://forge.devinsy.fr/devinsy/statoolinfos">https://forge.devinsy.fr/devinsy/statoolinfos</a></li>
|
||||
</ul>
|
||||
<p>Contributors: Angie, MrFlos, Quentin Duchemin, Fabrice61, Thomas @TConstans, @labecasse, Antoine Jaba, @setop, Jérémy Collot,
|
||||
Pilou, Kepon, Laurent Sleto…</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>StatoolInfos</title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="keywords" content="statoolinfos,devinsy,federation" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
|
||||
<script src="sorttable.js" />
|
||||
<script src="Chart.bundle.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="center_table" style="width: 1100px;">
|
||||
<div class="center" >
|
||||
<h2>Catégories</h2>
|
||||
|
||||
<div><span id="categoryCount">n/a</span> catégories</div>
|
||||
</div>
|
||||
<table id="categoryList" class="table_classic left">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="" style="width: 300px;">Nom de la catégorie</th>
|
||||
<th class="">Logiciels</th>
|
||||
<th class="" style="width: 100px;">Services</th>
|
||||
<th class="" style="width: 100px;">Organisations</th>
|
||||
<th class="" style="width: 100px;">Utilisateurs mensuels</th>
|
||||
<th class="" style="width: 100px;">Visites mensuelles</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr id="categoryListLine">
|
||||
<td id="categoryListLineName" style="padding-top: 0; padding-bottom: 0;">
|
||||
<a href="#" id="categoryListLineNameLink">
|
||||
<img id="categoryListLineNameLogo" src="categories/default.svg" style="width: 26px; height: 26px; padding-top:0; padding-bottom: 0; vertical-align: middle;"/>
|
||||
<span id="categoryListLineNameValue">n/a</span>
|
||||
</a>
|
||||
</td>
|
||||
<td id="categoryListLineSoftwares">n/a</td>
|
||||
<td id="categoryListLineServiceCount" class="td_number">n/a</td>
|
||||
<td id="categoryListLineOrganizationCount" class="td_number">n/a</td>
|
||||
<td id="categoryListLineUserCount" class="td_number">n/a</td>
|
||||
<td id="categoryListLineVisitCount" class="td_number">n/a</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
$.extend($.fn.dataTable.ext.type.order,
|
||||
{
|
||||
"custom-sort-asc": function(x, y)
|
||||
{
|
||||
if (!(!isNaN(x) || !isNaN(y)))
|
||||
return 0;
|
||||
else if (isNaN(x))
|
||||
return -1;
|
||||
else if (isNaN(y))
|
||||
return +1;
|
||||
else
|
||||
return x-y;
|
||||
},
|
||||
"custom-sort-desc": function(x, y)
|
||||
{
|
||||
if (!(!isNaN(x) || !isNaN(y)))
|
||||
return 0;
|
||||
else if (isNaN(x))
|
||||
return +1;
|
||||
else if (isNaN(y))
|
||||
return -1;
|
||||
else
|
||||
return y-x;
|
||||
}
|
||||
});
|
||||
|
||||
$('#categoryList').DataTable(
|
||||
{
|
||||
paging: false,
|
||||
ordering: true,
|
||||
"order": [[ 0, "asc" ]],
|
||||
language: dataTableFrench,
|
||||
"columnDefs":
|
||||
[
|
||||
{ targets: 4, "type": 'custom-sort' },
|
||||
{ targets: 5, "type": 'custom-sort' }
|
||||
]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>StatoolInfos</title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="keywords" content="statoolinfos,devinsy,federation" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="category">
|
||||
<a id="categoryLink" href="#" title="Catégorie">
|
||||
<img id="categoryLogo" src="categories/default.svg" style="width: 26px; height: 26px; padding-top:0; padding-bottom: 0; vertical-align: middle;"/>
|
||||
<span id="categoryName">n/a</span>
|
||||
</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>StatoolInfos</title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="keywords" content="statoolinfos,devinsy,federation" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
|
||||
<script src="sorttable.js" />
|
||||
<script src="Chart.bundle.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="center" >
|
||||
<div class="row center">
|
||||
<div class="column">
|
||||
<img id="categoryLogo" src="categories/default.svg" style="width: 100px; height: 100px;"/>
|
||||
</div>
|
||||
<div class="column" style="border: 0px solid red; max-width: 400px;">
|
||||
<div id="categoryName" class="content_title">n/a</div>
|
||||
<div class="content_subtitle"><a id="categoryDescription" href="#" style="text-decoration: none;">URL n/a</a></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="center_table" style="width: 800px;">Logiciels : <span id="categorySoftwares">n/a</span></div>
|
||||
<div>Nombre de services : <span id="serviceCount">n/a</span></div>
|
||||
</div>
|
||||
<div id="serviceListView" />
|
||||
</body>
|
||||
</html>
|
|
@ -1,228 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize.charts;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.strings.StringList;
|
||||
|
||||
/**
|
||||
* The Class BarChart.
|
||||
*/
|
||||
public class BarChart
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(BarChart.class);
|
||||
|
||||
private String title;
|
||||
private boolean displayTitle;
|
||||
private StringList labels;
|
||||
private BarChartDatasets datasets;
|
||||
private boolean stacked;
|
||||
private boolean animated;
|
||||
|
||||
/**
|
||||
* Instantiates a new bar chart.
|
||||
*
|
||||
* @param title
|
||||
* the title
|
||||
*/
|
||||
public BarChart(final String title)
|
||||
{
|
||||
this.title = title;
|
||||
this.displayTitle = true;
|
||||
this.labels = new StringList();
|
||||
this.datasets = new BarChartDatasets();
|
||||
this.stacked = false;
|
||||
this.animated = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param datasetIndex
|
||||
* the dataset index
|
||||
* @param value
|
||||
* the value
|
||||
* @param color
|
||||
* the color
|
||||
*/
|
||||
public void add(final int datasetIndex, final double value, final ChartColor color)
|
||||
{
|
||||
this.datasets.get(datasetIndex).add(new BarChartData(null, value, color));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param label
|
||||
* the label
|
||||
* @param value
|
||||
* the value
|
||||
* @param color
|
||||
* the color
|
||||
*/
|
||||
public void add(final String label, final double value, final ChartColor color)
|
||||
{
|
||||
this.labels.add(label);
|
||||
this.datasets.get(0).add(new BarChartData(label, value, color));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the dataset.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @return the int
|
||||
*/
|
||||
public int addDataset(final String name)
|
||||
{
|
||||
int result;
|
||||
|
||||
this.datasets.add(new BarChartDataset(name));
|
||||
|
||||
result = this.datasets.size() - 1;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the colors.
|
||||
*
|
||||
* @return the colors
|
||||
*/
|
||||
public ChartColors getColors()
|
||||
{
|
||||
ChartColors result;
|
||||
|
||||
result = this.datasets.get(0).getColors();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dataset.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @return the dataset
|
||||
*/
|
||||
public BarChartDataset getDataset(final int index)
|
||||
{
|
||||
BarChartDataset result;
|
||||
|
||||
result = this.datasets.get(index);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the datasets.
|
||||
*
|
||||
* @return the datasets
|
||||
*/
|
||||
public BarChartDatasets getDatasets()
|
||||
{
|
||||
return this.datasets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the labels.
|
||||
*
|
||||
* @return the labels
|
||||
*/
|
||||
public StringList getLabels()
|
||||
{
|
||||
StringList result;
|
||||
|
||||
result = this.labels;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title.
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return this.title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is animated.
|
||||
*
|
||||
* @return true, if is animated
|
||||
*/
|
||||
public boolean isAnimated()
|
||||
{
|
||||
return this.animated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is display title.
|
||||
*
|
||||
* @return true, if is display title
|
||||
*/
|
||||
public boolean isDisplayTitle()
|
||||
{
|
||||
return this.displayTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is stacked.
|
||||
*
|
||||
* @return true, if is stacked
|
||||
*/
|
||||
public boolean isStacked()
|
||||
{
|
||||
return this.stacked;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the animated.
|
||||
*
|
||||
* @param animated
|
||||
* the new animated
|
||||
*/
|
||||
public void setAnimated(final boolean animated)
|
||||
{
|
||||
this.animated = animated;
|
||||
}
|
||||
|
||||
public void setDisplayTitle(final boolean displayTitle)
|
||||
{
|
||||
this.displayTitle = displayTitle;
|
||||
}
|
||||
|
||||
public void setStacked(final boolean stacked)
|
||||
{
|
||||
this.stacked = stacked;
|
||||
}
|
||||
|
||||
public void setTitle(final String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize.charts;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The Class BarChartData.
|
||||
*/
|
||||
public class BarChartData
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(BarChartData.class);
|
||||
|
||||
private String label;
|
||||
private double value;
|
||||
private ChartColor color;
|
||||
|
||||
/**
|
||||
* Instantiates a new pie chart data.
|
||||
*
|
||||
* @param label
|
||||
* the label
|
||||
* @param value
|
||||
* the value
|
||||
* @param color
|
||||
* the color
|
||||
*/
|
||||
public BarChartData(final String label, final double value, final ChartColor color)
|
||||
{
|
||||
this.label = label;
|
||||
this.value = value;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the color.
|
||||
*
|
||||
* @return the color
|
||||
*/
|
||||
public ChartColor getColor()
|
||||
{
|
||||
return this.color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the label.
|
||||
*
|
||||
* @return the label
|
||||
*/
|
||||
public String getLabel()
|
||||
{
|
||||
return this.label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value.
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
public double getValue()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color.
|
||||
*
|
||||
* @param color
|
||||
* the new color
|
||||
*/
|
||||
public void setColor(final ChartColor color)
|
||||
{
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the label.
|
||||
*
|
||||
* @param label
|
||||
* the new label
|
||||
*/
|
||||
public void setLabel(final String label)
|
||||
{
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value.
|
||||
*
|
||||
* @param value
|
||||
* the new value
|
||||
*/
|
||||
public void setValue(final double value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue