Constraints.java
package org.europa.together.utils.acl;
import org.europa.together.application.LogbackLogger;
import org.europa.together.application.PropertyFileReader;
import org.europa.together.business.Logger;
import org.europa.together.business.PropertyReader;
/**
* Constraints for the package Portal.
*/
public final class Constraints {
private static final Logger LOGGER = new LogbackLogger(Constraints.class);
private static final String FILE
= "org/europa/together/configuration/acl/module.properties";
/**
* Constructor.
*/
private Constraints() {
throw new UnsupportedOperationException();
}
/**
* URI Parameter for versioning the public REST API of this module. Reasons
* to increment the version number are: <br/>
* <li>Changes in the data structure of any JSON object.</li>
* <li>Removing of any API call</li>
* <li>Incompatibilities</li>
*/
public static final int REST_API_VERSION = 1;
/**
* The Software License of the artifact.
*/
public static final String LICENSE = "Apache License 2.0";
/**
* Module name used for ConfigurationDAO.
*/
public static final String MODULE_NAME = getAppInfo("module");
/**
* Version of the module. This Version is autogenerated by the Maven POM
* file version entry.
*/
public static final String MODULE_VERSION = getAppInfo("version");
/**
* A short description of the module.
*/
public static final String MODULE_DESCRIPTION = getAppInfo("description");
/**
* Implements a static version of toString();.
*
* @return Constraints as String
*/
public static String printConstraintInfo() {
return "ACL Constraints DEBUG Info."
+ "\n\t Module Name: " + MODULE_NAME
+ "\n\t Module Version: " + MODULE_VERSION
+ "\n\t Rest API Version: " + REST_API_VERSION
+ "\n\t Module Description: " + MODULE_DESCRIPTION
+ "\n\t Software License: " + LICENSE;
}
/* ###################################################################### */
private static String getAppInfo(final String propertyName) {
PropertyReader propertyReader = new PropertyFileReader();
String value = "";
try {
propertyReader.appendPropertiesFromClasspath(FILE);
value = propertyReader.getPropertyAsString(propertyName);
} catch (Exception ex) {
LOGGER.catchException(ex);
}
return value;
}
}