diff options
Diffstat (limited to 'ONAP-REST')
141 files changed, 14589 insertions, 14589 deletions
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java b/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java index 325dda58d..edb7e830f 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java @@ -29,436 +29,436 @@ import com.att.research.xacml.util.XACMLProperties; * */ public class XACMLRestProperties extends XACMLProperties { - /** - * A unique identifier for the PDP servlet instance. Usually set to the URL - * it is running as in the J2EE container. - * - * Eg. http://localhost:8080/pdp/ - */ - public static final String PROP_PDP_ID = "xacml.rest.pdp.id"; - /** - * A PDP servlet's configuration directory. Holds the pip and policy - * configuration data as well as the local policy cache. - * - * Eg: /opt/app/xacml/config - */ - public static final String PROP_PDP_CONFIG = "xacml.rest.pdp.config"; - // Resilience feature- - public static final String PROP_PDP_WEBAPPS = "xacml.rest.pdp.webapps"; - //Closed Loop JSON table - public static final String PROP_ADMIN_CLOSEDLOOP = "xacml.rest.admin.closedLoopJSON"; - /** - * Set this property to true or false if the PDP servlet should register - * itself upon startup with the PAP servlet. - */ - public static final String PROP_PDP_REGISTER = "xacml.rest.pdp.register"; - /** - * Number of seconds the PDP will sleep while retrying registration with the - * PAP. This value must be greater or equal to 5. - */ - public static final String PROP_PDP_REGISTER_SLEEP = "xacml.rest.pdp.register.sleep"; - /** - * Number of retry attempts at registration with the PAP. A value of -1 - * indicates infinite retries. - */ - public static final String PROP_PDP_REGISTER_RETRIES = "xacml.rest.pdp.register.retries"; - /** - * Max content length accepted for an incoming POST XML/JSON request. - * Default is 32767 bytes. - */ - public static final String PROP_PDP_MAX_CONTENT = "xacml.rest.pdp.maxcontent"; - /** - * Custom HTTP header used by PDP to send the value of the PROP_PDP_ID - */ - public static final String PROP_PDP_HTTP_HEADER_ID = "X-XACML-PDP-ID"; - /** - * Custom HHTP header used by PDP to send its heartbeat value. - */ - public static final String PROP_PDP_HTTP_HEADER_HB = "X-XACML-PDP-HB"; - /* - * Custom HTTP header used by PDP to send the value of the - * X-XACML-PDP-JMX-PORT - */ - public static final String PROP_PDP_HTTP_HEADER_JMX_PORT = "X-XACML-PDP-JMX-PORT"; - /** - * The URL of the PAP servlet. Used by PDP servlet's to communicate. Because - * administrators can set whatever context they want to run the PAP servlet, - * it isn't easy to determine a return URL for the PAP servlet. This is - * especially true upon initialization. - */ - public static final String PROP_PAP_URL = "xacml.rest.pap.url"; - /** - * A comma divided list of urls pointing to avaiable PAP urls. - * If one or more fail, the other servers in the list can - * handle the requests. - */ - public static final String PROP_PAP_URLS = "xacml.rest.pap.urls"; - public static final String PROP_PAP_FAILED_URLS = "xacml.rest.pap.failedUrls"; - public static final String PROP_PAP_SUCCEEDED_URLS = "xacml.rest.pap.succeededUrls"; - - /** - * Upon startup, have the PAP servlet send latest configuration information - * to all the PDP nodes it knows about. - */ - public static final String PROP_PAP_INITIATE_PDP_CONFIG = "xacml.rest.pap.initiate.pdp"; - /** - * The interval the PAP servlet uses to send heartbeat requests to the PDP - * nodes. - */ - public static final String PROP_PAP_HEARTBEAT_INTERVAL = "xacml.rest.pap.heartbeat.interval"; - /** - * Timeout value used by the PAP servlet when trying to check the heartbeat - * of a PDP node. - */ - public static final String PROP_PAP_HEARTBEAT_TIMEOUT = "xacml.rest.pap.heartbeat.timeout"; - /* - * This is the domain you can setup for your organization, it should be a URI. - * Eg. com:sample:foo - */ - public static final String PROP_PAP_DOMAIN = "xacml.rest.pap.domain"; - - /* - * Local path to where user workspaces exist. The user workspace contains temporary files, the - * user's clone of the GIT repository, anything specific to the user, etc. - */ - public static final String PROP_PAP_WORKSPACE = "xacml.rest.pap.workspace"; - - /* - * Local path to where the GIT repository exists. - * - * Eg. /opt/app/xacml/repository - */ - public static final String PROP_PAP_REPOSITORY = "xacml.rest.pap.repository"; - - /* - * Database driver property - */ - public static final String PROP_PAP_DB_DRIVER = "javax.persistence.jdbc.driver"; - - /* - * Database url - */ - public static final String PROP_PAP_DB_URL = "javax.persistence.jdbc.url"; - - /* - * Database user - */ - public static final String PROP_PAP_DB_USER = "javax.persistence.jdbc.user"; - - /* - * Database password - */ - public static final String PROP_PAP_DB_PASSWORD = "javax.persistence.jdbc.password"; - - /* - * Time in ms which a Policy DB transaction will wait to get the transaction lock object - */ - public static final String PROP_PAP_TRANS_WAIT = "xacml.rest.pap.transaction.waitms"; - - /* - * Policy DB transaction timeout in ms after it has obtained the transaction lock object - */ - public static final String PROP_PAP_TRANS_TIMEOUT = "xacml.rest.pap.transaction.timeoutms"; - - /* - * Policy Audit transaction timeout in ms after it has obtained the transaction lock object - */ - public static final String PROP_PAP_AUDIT_TIMEOUT = "xacml.rest.pap.audit.timeoutms"; - - /* - * Value determines direction of audit. Value=true will synch the file system to contents of the DB. - * Value=false will synch the DB to the contents of the file system. - */ - public static final String PROP_PAP_AUDIT_FLAG = "xacml.rest.pap.filesystem.audit"; - - /* - * Value for enable/disable of audit functionality - */ - public static final String PROP_PAP_RUN_AUDIT_FLAG = "xacml.rest.pap.run.audit.flag"; - - /* - * Controls how long the timeout will be when a pap sends a notification to another pap - */ - public static final String PROP_PAP_NOTIFY_TIMEOUT = "xacml.rest.pap.notify.timeoutms"; - /* - * Value for Enable/Disable of AutoPush Flag. - */ - public static final String PROP_PAP_PUSH_FLAG = "xacml.rest.pap.autopush.flag"; - - /* - * Properties file for the AutoPush Functionality. - */ - public static final String PROP_PAP_PUSH_FILE = "xacml.rest.pap.autopush.file"; - - /* - * Local path to where the GIT repository exists. - * - * Eg. /opt/app/xacml/repository - */ - public static final String PROP_ADMIN_REPOSITORY = "xacml.rest.admin.repository"; - /* - * Local path to where user workspaces exist. The user workspace contains - * temporary files, the user's clone of the GIT repository, anything - * specific to the user, etc. - */ - public static final String PROP_ADMIN_WORKSPACE = "xacml.rest.admin.workspace"; - /* - * This is the domain you can setup for your organization, it should be a - * URI. - * - * Eg. com:sample:foo - */ - public static final String PROP_ADMIN_DOMAIN = "xacml.rest.admin.domain"; - /** - * PROP_ADMIN_USER_NAME is simply a name for the logged in user. - * - * AC authentication is out the scope of the web application itself. It is - * up to the developer to setup authentication as they please in the J2EE - * container used to run the web application. Whatever authentication - * mechanism they use, they should then set the attribute into the - * HttpSession object. The Admin Console will be able to read that value - * (default to "guest") in. - * - * ((HttpServletRequest) - * request).getSession().setAttribute("xacml.rest.admin.user.name", - * "Homer"); - * - */ - public static final String PROP_ADMIN_USER_NAME = "xacml.rest.admin.user.name"; - /** - * - * PROP_ADMIN_USER_ID is an id for the logged in user. - * - * Eg. hs1234 - * - * @see #PROP_ADMIN_USER_NAME for more information. - */ - public static final String PROP_ADMIN_USER_ID = "xacml.rest.admin.user.id"; - /** - * - * PROP_ADMIN_USER_EMAIL is a user's email address. - * - * @see #PROP_ADMIN_USER_NAME for more information. - */ - public static final String PROP_ADMIN_USER_EMAIL = "xacml.rest.admin.user.email"; - /** - * Directory path containing sub-directories where the Subscriber servlet - * puts files sent through data feeds. - */ - public static final String PROP_SUBSCRIBER_INCOMING = "xacml.subscriber.incoming"; - /** - * The specific data feed name for the Subscriber servlet to register for. - */ - public static final String PROP_SUBSCRIBER_FEED = "xacml.subscriber.feed"; - /** - * Value for the log time frame that is to be stored in the database any - * logs after this time frame will be removed. - */ - public static final String PROP_LOG_TIMEFRAME = "xacml.log.timeframe"; - /** - * Value for the DB connections used to store the log files. - */ - public static final String PROP_LOG_DB_DRIVER = "xacml.log.db.driver"; - public static final String PROP_LOG_DB_URL = "xacml.log.db.url"; - public static final String PROP_LOG_DB_USER = "xacml.log.db.user"; - public static final String PROP_LOG_DB_PASSWORD = "xacml.log.db.password"; - /* - * Value for JMX port for the PDP - */ - public static final String PROP_PDP_JMX_PORT = "xacml.jmx.port"; + /** + * A unique identifier for the PDP servlet instance. Usually set to the URL + * it is running as in the J2EE container. + * + * Eg. http://localhost:8080/pdp/ + */ + public static final String PROP_PDP_ID = "xacml.rest.pdp.id"; + /** + * A PDP servlet's configuration directory. Holds the pip and policy + * configuration data as well as the local policy cache. + * + * Eg: /opt/app/xacml/config + */ + public static final String PROP_PDP_CONFIG = "xacml.rest.pdp.config"; + // Resilience feature- + public static final String PROP_PDP_WEBAPPS = "xacml.rest.pdp.webapps"; + //Closed Loop JSON table + public static final String PROP_ADMIN_CLOSEDLOOP = "xacml.rest.admin.closedLoopJSON"; + /** + * Set this property to true or false if the PDP servlet should register + * itself upon startup with the PAP servlet. + */ + public static final String PROP_PDP_REGISTER = "xacml.rest.pdp.register"; + /** + * Number of seconds the PDP will sleep while retrying registration with the + * PAP. This value must be greater or equal to 5. + */ + public static final String PROP_PDP_REGISTER_SLEEP = "xacml.rest.pdp.register.sleep"; + /** + * Number of retry attempts at registration with the PAP. A value of -1 + * indicates infinite retries. + */ + public static final String PROP_PDP_REGISTER_RETRIES = "xacml.rest.pdp.register.retries"; + /** + * Max content length accepted for an incoming POST XML/JSON request. + * Default is 32767 bytes. + */ + public static final String PROP_PDP_MAX_CONTENT = "xacml.rest.pdp.maxcontent"; + /** + * Custom HTTP header used by PDP to send the value of the PROP_PDP_ID + */ + public static final String PROP_PDP_HTTP_HEADER_ID = "X-XACML-PDP-ID"; + /** + * Custom HHTP header used by PDP to send its heartbeat value. + */ + public static final String PROP_PDP_HTTP_HEADER_HB = "X-XACML-PDP-HB"; + /* + * Custom HTTP header used by PDP to send the value of the + * X-XACML-PDP-JMX-PORT + */ + public static final String PROP_PDP_HTTP_HEADER_JMX_PORT = "X-XACML-PDP-JMX-PORT"; + /** + * The URL of the PAP servlet. Used by PDP servlet's to communicate. Because + * administrators can set whatever context they want to run the PAP servlet, + * it isn't easy to determine a return URL for the PAP servlet. This is + * especially true upon initialization. + */ + public static final String PROP_PAP_URL = "xacml.rest.pap.url"; + /** + * A comma divided list of urls pointing to avaiable PAP urls. + * If one or more fail, the other servers in the list can + * handle the requests. + */ + public static final String PROP_PAP_URLS = "xacml.rest.pap.urls"; + public static final String PROP_PAP_FAILED_URLS = "xacml.rest.pap.failedUrls"; + public static final String PROP_PAP_SUCCEEDED_URLS = "xacml.rest.pap.succeededUrls"; - /* - * Value for refresh rate - */ - public static final String PROP_REFRESH_RATE = "xacml.refresh.rate"; + /** + * Upon startup, have the PAP servlet send latest configuration information + * to all the PDP nodes it knows about. + */ + public static final String PROP_PAP_INITIATE_PDP_CONFIG = "xacml.rest.pap.initiate.pdp"; + /** + * The interval the PAP servlet uses to send heartbeat requests to the PDP + * nodes. + */ + public static final String PROP_PAP_HEARTBEAT_INTERVAL = "xacml.rest.pap.heartbeat.interval"; + /** + * Timeout value used by the PAP servlet when trying to check the heartbeat + * of a PDP node. + */ + public static final String PROP_PAP_HEARTBEAT_TIMEOUT = "xacml.rest.pap.heartbeat.timeout"; + /* + * This is the domain you can setup for your organization, it should be a URI. + * Eg. com:sample:foo + */ + public static final String PROP_PAP_DOMAIN = "xacml.rest.pap.domain"; - // added for Security between Policy Components. - // 6/26 - /* - * PROP_PAP_USERID is the PAP Unique User ID - */ - public static final String PROP_PAP_USERID = "xacml.rest.pap.userid"; - /* - * PROP_PAP_PASS is the PAP password - */ - public static final String PROP_PAP_PASS = "xacml.rest.pap.password"; - /* - * PROP_PAP_PASS is the PAP password - */ - public static final String PROP_CONFIG_URL = "xacml.rest.config.url"; - /* - * PROP_PDP_USERID is the PDP Unique User ID - */ - public static final String PROP_PDP_USERID = "xacml.rest.pdp.userid"; - /* - * PROP_PDP_PASS is the PDP password - */ - public static final String PROP_PDP_PASS = "xacml.rest.pdp.password"; - /* - * PROP_PDP_IDFILE is the PDP Authentication File - */ - public static final String PROP_PDP_IDFILE = "xacml.rest.pdp.idfile"; - /* - * PROP_PEP_IDFILE is the Client Authentication File - */ - public static final String PROP_PEP_IDFILE = "xacml.rest.pep.idfile"; - /* - * webapps Location of the PAP-REST server - */ - public static final String PROP_PAP_WEBAPPS= "xacml.rest.config.webapps"; - /* - * Value for Notification Option - */ - public static final String PROP_NOTIFICATION_TYPE = "NOTIFICATION_TYPE"; - /* - * Value for Notification DMaaP servers - */ - public static final String PROP_NOTIFICATION_SERVERS = "NOTIFICATION_SERVERS"; - /* - * Value for Notification Delay - */ - public static final String PROP_NOTIFICATION_DELAY= "NOTIFICATION_DELAY"; - /* - * Value for Notification Topic - */ - public static final String PROP_NOTIFICATION_TOPIC= "NOTIFICATION_TOPIC"; - /* - * Value for Notification Topic - */ - public static final String PROP_UEB_API_KEY= "UEB_API_KEY"; - /* - * Value for Notification Topic - */ - public static final String PROP_UEB_API_SECRET= "UEB_API_SECRET"; - /* - * Closedloop Fault Policy Template Version - */ - public static final String TemplateVersion_Fault= "xacml.rest.closedLoopFault"; - /* - * Closedloop PM Policy Template Version - */ - public static final String TemplateVersion_PM= "xacml.rest.closedLoopPM"; - /* - * Value for model properties file - */ - public static final String PROP_ADMIN_MICROSERVICE = "xacml.rest.admin.microServiceModel"; - /* - * MicroService Policy Template Version - */ - public static final String TemplateVersion_MS= "xacml.rest.microServices"; - /* - * Optimization Policy Template Version - */ - public static final String TemplateVersion_OOF= "xacml.rest.optimization"; - /* - * Firewall Policy Template Version - */ - public static final String TemplateVersion_FW= "xacml.rest.firewallPolicy"; - /* - * Size of SelectList for Users in MS - * - */ - public static final String PROP_USER_SELECTLIST_WINDOW_SIZE= "xacml.user.column.count"; - /* - * Audit function in pap admin to Update userinfo table to syncronize with Roles table - */ - public static final String PROP_ROLES_USERINFO_AUDIT= "xacml.audit.userInfo"; - /* - * test Environment LoginId - */ - public static final String PROP_TEST_ENVIRONMENT_LOGINID= "xacml.testEnvironment.loginId"; - /* - * Size of of the page length for sqlcontainer - * - */ - public static final String PROP_SQLCONTAINER_PAGE_LENGTH= "xacml.sqlcontainer.page.length"; - /* - * add values used to connect to restful api - * - */ - public static final String PROP_RESTFUL_INTERFACE= "xacm.restful.interface.file"; - /* - * add pattern to identify what values are designed as required - * - */ - public static final String PROP_XCORE_REQUIRED_PATTERN= "xacm.xcor.required.pattern"; - /* - * Time before a cache value is evicted - * - */ - public static final String PROP_CACHE_LIVE_TIME= "xacm.cache.live.time"; - /* - * Highest value allowed in priority - * - */ - public static final String PROP_PRIORITY_COUNT= "xacml.max.priority.count"; - /* - * The name of the PAP. Must be unique across the system - */ - public static final String PAP_RESOURCE_NAME="xacml.rest.pap.resource.name"; - /* - * The name of the site in which the PAP resides - */ - public static final String PAP_SITE_NAME="site_name"; - /* - * The node type of the PAP - really a no-op since it's value is pap - */ - public static final String PAP_NODE_TYPE="node_type"; - /* - * A list of the groups of resources/nodes on which the PAP is dependent. The members of a - * group are comma-separated and the groups are separated with semicolons. - */ - public static final String PAP_DEPENDENCY_GROUPS="dependency_groups"; - /* - * The (optional) period of time in seconds between executions of the integrity audit. - * Value < 0 : Audit does not run (default value if property is not present = -1) - * Value = 0 : Audit runs continuously - * Value > 0 : The period of time in seconds between execution of the audit on a particular node - */ - public static final String PAP_INTEGRITY_AUDIT_PERIOD_SECONDS = "integrity_audit_period_seconds"; - /* - * The name of the Admin. Must be unique across the system - */ - public static final String ADMIN_RESOURCE_NAME="xacml.rest.admin.resource.name"; - /* - * The name of the PDP. Must be unique across the system - */ - public static final String PDP_RESOURCE_NAME="xacml.rest.pdp.resource.name"; - /* - * Audit function in pap admin to Update userinfo table to syncronize with Roles table - */ - public static final String PROP_AUTOMATIC_POLICYPUSH= "xacml.automatic.push"; - /* - * Add Limit for Onap Portal Dashboard tab data - */ - public static final String PROP_ONAP_LOGLIMIT = "xacml.onap.dashboard.logTableLimit"; - public static final String PROP_ONAP_SYSTEMALERTLIMIT = "xacml.onap.dashboard.systemAlertTableLimit"; - /* - * Diff of the policies for the Firewall Feature. - */ - public static final String PROP_FW_GETURL = "FW_GETURL"; - public static final String PROP_FW_AUTHOURL = "FW_AUTHOURL"; - public static final String PROP_FW_PROXY = "FW_PROXY"; - public static final String PROP_FW_PORT = "FW_PORT"; - - /* - * The number of Risk Levels allowed - */ - public static final String ADMIN_RISK_LEVEL_COUNT="xacml.risk.level.count"; - /* - * The maxium Level displayed on the UI for Micro Services - */ - public static final String PROP_MODEL_LEVEL = "xacml.model.level"; - - /* - * Value for Incoming Notification tries - * - * */ - public static final String PROP_PAP_INCOMINGNOTIFICATION_TRIES = "xacml.rest.pap.incomingnotification.tries"; - - - // Static class, hide constructor + /* + * Local path to where user workspaces exist. The user workspace contains temporary files, the + * user's clone of the GIT repository, anything specific to the user, etc. + */ + public static final String PROP_PAP_WORKSPACE = "xacml.rest.pap.workspace"; + + /* + * Local path to where the GIT repository exists. + * + * Eg. /opt/app/xacml/repository + */ + public static final String PROP_PAP_REPOSITORY = "xacml.rest.pap.repository"; + + /* + * Database driver property + */ + public static final String PROP_PAP_DB_DRIVER = "javax.persistence.jdbc.driver"; + + /* + * Database url + */ + public static final String PROP_PAP_DB_URL = "javax.persistence.jdbc.url"; + + /* + * Database user + */ + public static final String PROP_PAP_DB_USER = "javax.persistence.jdbc.user"; + + /* + * Database password + */ + public static final String PROP_PAP_DB_PASSWORD = "javax.persistence.jdbc.password"; + + /* + * Time in ms which a Policy DB transaction will wait to get the transaction lock object + */ + public static final String PROP_PAP_TRANS_WAIT = "xacml.rest.pap.transaction.waitms"; + + /* + * Policy DB transaction timeout in ms after it has obtained the transaction lock object + */ + public static final String PROP_PAP_TRANS_TIMEOUT = "xacml.rest.pap.transaction.timeoutms"; + + /* + * Policy Audit transaction timeout in ms after it has obtained the transaction lock object + */ + public static final String PROP_PAP_AUDIT_TIMEOUT = "xacml.rest.pap.audit.timeoutms"; + + /* + * Value determines direction of audit. Value=true will synch the file system to contents of the DB. + * Value=false will synch the DB to the contents of the file system. + */ + public static final String PROP_PAP_AUDIT_FLAG = "xacml.rest.pap.filesystem.audit"; + + /* + * Value for enable/disable of audit functionality + */ + public static final String PROP_PAP_RUN_AUDIT_FLAG = "xacml.rest.pap.run.audit.flag"; + + /* + * Controls how long the timeout will be when a pap sends a notification to another pap + */ + public static final String PROP_PAP_NOTIFY_TIMEOUT = "xacml.rest.pap.notify.timeoutms"; + /* + * Value for Enable/Disable of AutoPush Flag. + */ + public static final String PROP_PAP_PUSH_FLAG = "xacml.rest.pap.autopush.flag"; + + /* + * Properties file for the AutoPush Functionality. + */ + public static final String PROP_PAP_PUSH_FILE = "xacml.rest.pap.autopush.file"; + + /* + * Local path to where the GIT repository exists. + * + * Eg. /opt/app/xacml/repository + */ + public static final String PROP_ADMIN_REPOSITORY = "xacml.rest.admin.repository"; + /* + * Local path to where user workspaces exist. The user workspace contains + * temporary files, the user's clone of the GIT repository, anything + * specific to the user, etc. + */ + public static final String PROP_ADMIN_WORKSPACE = "xacml.rest.admin.workspace"; + /* + * This is the domain you can setup for your organization, it should be a + * URI. + * + * Eg. com:sample:foo + */ + public static final String PROP_ADMIN_DOMAIN = "xacml.rest.admin.domain"; + /** + * PROP_ADMIN_USER_NAME is simply a name for the logged in user. + * + * AC authentication is out the scope of the web application itself. It is + * up to the developer to setup authentication as they please in the J2EE + * container used to run the web application. Whatever authentication + * mechanism they use, they should then set the attribute into the + * HttpSession object. The Admin Console will be able to read that value + * (default to "guest") in. + * + * ((HttpServletRequest) + * request).getSession().setAttribute("xacml.rest.admin.user.name", + * "Homer"); + * + */ + public static final String PROP_ADMIN_USER_NAME = "xacml.rest.admin.user.name"; + /** + * + * PROP_ADMIN_USER_ID is an id for the logged in user. + * + * Eg. hs1234 + * + * @see #PROP_ADMIN_USER_NAME for more information. + */ + public static final String PROP_ADMIN_USER_ID = "xacml.rest.admin.user.id"; + /** + * + * PROP_ADMIN_USER_EMAIL is a user's email address. + * + * @see #PROP_ADMIN_USER_NAME for more information. + */ + public static final String PROP_ADMIN_USER_EMAIL = "xacml.rest.admin.user.email"; + /** + * Directory path containing sub-directories where the Subscriber servlet + * puts files sent through data feeds. + */ + public static final String PROP_SUBSCRIBER_INCOMING = "xacml.subscriber.incoming"; + /** + * The specific data feed name for the Subscriber servlet to register for. + */ + public static final String PROP_SUBSCRIBER_FEED = "xacml.subscriber.feed"; + /** + * Value for the log time frame that is to be stored in the database any + * logs after this time frame will be removed. + */ + public static final String PROP_LOG_TIMEFRAME = "xacml.log.timeframe"; + /** + * Value for the DB connections used to store the log files. + */ + public static final String PROP_LOG_DB_DRIVER = "xacml.log.db.driver"; + public static final String PROP_LOG_DB_URL = "xacml.log.db.url"; + public static final String PROP_LOG_DB_USER = "xacml.log.db.user"; + public static final String PROP_LOG_DB_PASSWORD = "xacml.log.db.password"; + /* + * Value for JMX port for the PDP + */ + public static final String PROP_PDP_JMX_PORT = "xacml.jmx.port"; + + /* + * Value for refresh rate + */ + public static final String PROP_REFRESH_RATE = "xacml.refresh.rate"; + + // added for Security between Policy Components. + // 6/26 + /* + * PROP_PAP_USERID is the PAP Unique User ID + */ + public static final String PROP_PAP_USERID = "xacml.rest.pap.userid"; + /* + * PROP_PAP_PASS is the PAP password + */ + public static final String PROP_PAP_PASS = "xacml.rest.pap.password"; + /* + * PROP_PAP_PASS is the PAP password + */ + public static final String PROP_CONFIG_URL = "xacml.rest.config.url"; + /* + * PROP_PDP_USERID is the PDP Unique User ID + */ + public static final String PROP_PDP_USERID = "xacml.rest.pdp.userid"; + /* + * PROP_PDP_PASS is the PDP password + */ + public static final String PROP_PDP_PASS = "xacml.rest.pdp.password"; + /* + * PROP_PDP_IDFILE is the PDP Authentication File + */ + public static final String PROP_PDP_IDFILE = "xacml.rest.pdp.idfile"; + /* + * PROP_PEP_IDFILE is the Client Authentication File + */ + public static final String PROP_PEP_IDFILE = "xacml.rest.pep.idfile"; + /* + * webapps Location of the PAP-REST server + */ + public static final String PROP_PAP_WEBAPPS= "xacml.rest.config.webapps"; + /* + * Value for Notification Option + */ + public static final String PROP_NOTIFICATION_TYPE = "NOTIFICATION_TYPE"; + /* + * Value for Notification DMaaP servers + */ + public static final String PROP_NOTIFICATION_SERVERS = "NOTIFICATION_SERVERS"; + /* + * Value for Notification Delay + */ + public static final String PROP_NOTIFICATION_DELAY= "NOTIFICATION_DELAY"; + /* + * Value for Notification Topic + */ + public static final String PROP_NOTIFICATION_TOPIC= "NOTIFICATION_TOPIC"; + /* + * Value for Notification Topic + */ + public static final String PROP_UEB_API_KEY= "UEB_API_KEY"; + /* + * Value for Notification Topic + */ + public static final String PROP_UEB_API_SECRET= "UEB_API_SECRET"; + /* + * Closedloop Fault Policy Template Version + */ + public static final String TemplateVersion_Fault= "xacml.rest.closedLoopFault"; + /* + * Closedloop PM Policy Template Version + */ + public static final String TemplateVersion_PM= "xacml.rest.closedLoopPM"; + /* + * Value for model properties file + */ + public static final String PROP_ADMIN_MICROSERVICE = "xacml.rest.admin.microServiceModel"; + /* + * MicroService Policy Template Version + */ + public static final String TemplateVersion_MS= "xacml.rest.microServices"; + /* + * Optimization Policy Template Version + */ + public static final String TemplateVersion_OOF= "xacml.rest.optimization"; + /* + * Firewall Policy Template Version + */ + public static final String TemplateVersion_FW= "xacml.rest.firewallPolicy"; + /* + * Size of SelectList for Users in MS + * + */ + public static final String PROP_USER_SELECTLIST_WINDOW_SIZE= "xacml.user.column.count"; + /* + * Audit function in pap admin to Update userinfo table to syncronize with Roles table + */ + public static final String PROP_ROLES_USERINFO_AUDIT= "xacml.audit.userInfo"; + /* + * test Environment LoginId + */ + public static final String PROP_TEST_ENVIRONMENT_LOGINID= "xacml.testEnvironment.loginId"; + /* + * Size of of the page length for sqlcontainer + * + */ + public static final String PROP_SQLCONTAINER_PAGE_LENGTH= "xacml.sqlcontainer.page.length"; + /* + * add values used to connect to restful api + * + */ + public static final String PROP_RESTFUL_INTERFACE= "xacm.restful.interface.file"; + /* + * add pattern to identify what values are designed as required + * + */ + public static final String PROP_XCORE_REQUIRED_PATTERN= "xacm.xcor.required.pattern"; + /* + * Time before a cache value is evicted + * + */ + public static final String PROP_CACHE_LIVE_TIME= "xacm.cache.live.time"; + /* + * Highest value allowed in priority + * + */ + public static final String PROP_PRIORITY_COUNT= "xacml.max.priority.count"; + /* + * The name of the PAP. Must be unique across the system + */ + public static final String PAP_RESOURCE_NAME="xacml.rest.pap.resource.name"; + /* + * The name of the site in which the PAP resides + */ + public static final String PAP_SITE_NAME="site_name"; + /* + * The node type of the PAP - really a no-op since it's value is pap + */ + public static final String PAP_NODE_TYPE="node_type"; + /* + * A list of the groups of resources/nodes on which the PAP is dependent. The members of a + * group are comma-separated and the groups are separated with semicolons. + */ + public static final String PAP_DEPENDENCY_GROUPS="dependency_groups"; + /* + * The (optional) period of time in seconds between executions of the integrity audit. + * Value < 0 : Audit does not run (default value if property is not present = -1) + * Value = 0 : Audit runs continuously + * Value > 0 : The period of time in seconds between execution of the audit on a particular node + */ + public static final String PAP_INTEGRITY_AUDIT_PERIOD_SECONDS = "integrity_audit_period_seconds"; + /* + * The name of the Admin. Must be unique across the system + */ + public static final String ADMIN_RESOURCE_NAME="xacml.rest.admin.resource.name"; + /* + * The name of the PDP. Must be unique across the system + */ + public static final String PDP_RESOURCE_NAME="xacml.rest.pdp.resource.name"; + /* + * Audit function in pap admin to Update userinfo table to syncronize with Roles table + */ + public static final String PROP_AUTOMATIC_POLICYPUSH= "xacml.automatic.push"; + /* + * Add Limit for Onap Portal Dashboard tab data + */ + public static final String PROP_ONAP_LOGLIMIT = "xacml.onap.dashboard.logTableLimit"; + public static final String PROP_ONAP_SYSTEMALERTLIMIT = "xacml.onap.dashboard.systemAlertTableLimit"; + /* + * Diff of the policies for the Firewall Feature. + */ + public static final String PROP_FW_GETURL = "FW_GETURL"; + public static final String PROP_FW_AUTHOURL = "FW_AUTHOURL"; + public static final String PROP_FW_PROXY = "FW_PROXY"; + public static final String PROP_FW_PORT = "FW_PORT"; + + /* + * The number of Risk Levels allowed + */ + public static final String ADMIN_RISK_LEVEL_COUNT="xacml.risk.level.count"; + /* + * The maxium Level displayed on the UI for Micro Services + */ + public static final String PROP_MODEL_LEVEL = "xacml.model.level"; + + /* + * Value for Incoming Notification tries + * + * */ + public static final String PROP_PAP_INCOMINGNOTIFICATION_TRIES = "xacml.rest.pap.incomingnotification.tries"; + + + // Static class, hide constructor private XACMLRestProperties() { - super(); + super(); } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java b/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java index 8a59ec603..184d1ff60 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java @@ -22,22 +22,22 @@ package org.onap.policy.rest; public class XacmlAdminAuthorization { - public enum Role { - ROLE_GUEST("guest"), - ROLE_ADMIN("admin"), - ROLE_EDITOR("editor"), - ROLE_SUPERGUEST("super-guest"), - ROLE_SUPEREDITOR("super-editor"), - ROLE_SUPERADMIN("super-admin"); - - String userRole; - - Role(String a) { - this.userRole = a; - } - @Override - public String toString() { - return this.userRole; - } - } + public enum Role { + ROLE_GUEST("guest"), + ROLE_ADMIN("admin"), + ROLE_EDITOR("editor"), + ROLE_SUPERGUEST("super-guest"), + ROLE_SUPEREDITOR("super-editor"), + ROLE_SUPERADMIN("super-admin"); + + String userRole; + + Role(String a) { + this.userRole = a; + } + @Override + public String toString() { + return this.userRole; + } + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressGroupJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressGroupJson.java index 6f7b88fbe..19f1d1d49 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressGroupJson.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressGroupJson.java @@ -26,59 +26,59 @@ import java.util.List; public class AddressGroupJson { - protected String name; - protected String description; - protected List<AddressMembersJson> members; - - // name - public String getName() { - return name; - } + protected String name; + protected String description; + protected List<AddressMembersJson> members; - public void setName(String value) { - this.name = value; - } - - @Override - public boolean equals(Object obj){ - if(obj == null){ - return false; - } - if(this.getClass() != obj.getClass()){ - return false; - } - AddressGroupJson servGroupobj=(AddressGroupJson) obj; - if(this.getName().equals(servGroupobj.getName())){ - return true; - } - return false; - } - @Override - public int hashCode() { - return Integer.valueOf(name.charAt(0)+(name.charAt(1))); - } - - // description - public String getDescription() { - return description; - } + // name + public String getName() { + return name; + } + + public void setName(String value) { + this.name = value; + } - public void setDescription(String value) { - this.description = value; - } - - public List<AddressMembersJson> getMembers() + @Override + public boolean equals(Object obj){ + if(obj == null){ + return false; + } + if(this.getClass() != obj.getClass()){ + return false; + } + AddressGroupJson servGroupobj=(AddressGroupJson) obj; + if(this.getName().equals(servGroupobj.getName())){ + return true; + } + return false; + } + @Override + public int hashCode() { + return Integer.valueOf(name.charAt(0)+(name.charAt(1))); + } + + // description + public String getDescription() { + return description; + } + + public void setDescription(String value) { + this.description = value; + } + + public List<AddressMembersJson> getMembers() { - if(members==null) - { - members= new ArrayList<>(); - } + if(members==null) + { + members= new ArrayList<>(); + } return this.members; } - public void setMembers(List<AddressMembersJson> members) - { - this.members = members; - } + public void setMembers(List<AddressMembersJson> members) + { + this.members = members; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressJson.java index 00875864e..9604055f0 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressJson.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressJson.java @@ -23,23 +23,23 @@ package org.onap.policy.rest.adapter; public class AddressJson { - protected String type; - protected String name; - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - // type - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } + protected String type; + protected String name; + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + // type + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembers.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembers.java index e6b993fb9..aa89361c7 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembers.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembers.java @@ -37,13 +37,13 @@ public class AddressMembers { } public String getName() { - return name; - } + return name; + } + + public void setName(String name) { + this.name = name; + } - public void setName(String name) { - this.name = name; - } - public String getValue() { return value; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembersJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembersJson.java index e97d2b2cf..53168fb97 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembersJson.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembersJson.java @@ -36,11 +36,11 @@ public class AddressMembersJson { } public String getName() { - return name; - } + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } }
\ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AutoPushTabAdapter.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AutoPushTabAdapter.java index 93d332ce3..9430f0cd9 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AutoPushTabAdapter.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AutoPushTabAdapter.java @@ -25,18 +25,18 @@ import java.util.List; public class AutoPushTabAdapter { - private List<Object> pdpDatas; - private List<Object> policyDatas; - public List<Object> getPdpDatas() { - return pdpDatas; - } - public void setPdpDatas(List<Object> pdpDatas) { - this.pdpDatas = pdpDatas; - } - public List<Object> getPolicyDatas() { - return policyDatas; - } - public void setPolicyDatas(List<Object> policyDatas) { - this.policyDatas = policyDatas; - } + private List<Object> pdpDatas; + private List<Object> policyDatas; + public List<Object> getPdpDatas() { + return pdpDatas; + } + public void setPdpDatas(List<Object> pdpDatas) { + this.pdpDatas = pdpDatas; + } + public List<Object> getPolicyDatas() { + return policyDatas; + } + public void setPolicyDatas(List<Object> policyDatas) { + this.policyDatas = policyDatas; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultBody.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultBody.java index 73909d923..0e2ed3a18 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultBody.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultBody.java @@ -23,242 +23,242 @@ package org.onap.policy.rest.adapter; public class ClosedLoopFaultBody { - - private boolean trinity; - private boolean vUSP; - private boolean mcr; - private boolean gamma; - private boolean vDNS; - - private String vnfType; - private String vServices; - private String ONAPname; - - private String closedLoopPolicyStatus; - private ClosedLoopSignatures triggerSignatures; - private String actions; - private int timeInterval; - private int timeOutvPRO; - private int timeOutRuby; - private int retrys; - private int agingWindow; - private String geoLink; - private String emailAddress; - private ClosedLoopSignatures verificationSignatures; - private ClosedLoopPolicyConditions conditions; - private ClosedLoopFaultTriggerUISignatures triggerSignaturesUsedForUI; - private ClosedLoopFaultTriggerUISignatures verificationSignaturesUsedForUI; - private int triggerTimeWindowUsedForUI; - private int verificationTimeWindowUsedForUI; - private String pepName; - private String pepAction; - private String templateVersion; - private int trapMaxAge; - - - public Integer getTrapMaxAge() { - return trapMaxAge; - } - - public void setTrapMaxAge(int trapMaxAge) { - this.trapMaxAge = trapMaxAge; - } - - public String getTemplateVersion() { - return templateVersion; - } - - public void setTemplateVersion(String templateVersion) { - this.templateVersion = templateVersion; - } - - public Integer getTimeOutvPRO() { - return timeOutvPRO; - } - - public void setTimeOutvPRO(int timeOutvPRO) { - this.timeOutvPRO = timeOutvPRO; - } - - - public Integer getTriggerTimeWindowUsedForUI() { - return triggerTimeWindowUsedForUI; - } - - public String getPepName() { - return pepName; - } - - public void setPepName(String pepName) { - this.pepName = pepName; - } - - public String getPepAction() { - return pepAction; - } - - public void setPepAction(String pepAction) { - this.pepAction = pepAction; - } - - public void setTriggerTimeWindowUsedForUI(int triggerTimeWindowUsedForUI) { - this.triggerTimeWindowUsedForUI = triggerTimeWindowUsedForUI; - } - - public Integer getVerificationTimeWindowUsedForUI() { - return verificationTimeWindowUsedForUI; - } - - public void setVerificationTimeWindowUsedForUI( - int verificationTimeWindowUsedForUI) { - this.verificationTimeWindowUsedForUI = verificationTimeWindowUsedForUI; - } - - public String getONAPname(){ - return ONAPname; - } - - public void setONAPname(String ONAPname){ - this.ONAPname = ONAPname; - } - - public String getvServices() { - return vServices; - } - public void setvServices(String vServices) { - this.vServices = vServices; - } - - public ClosedLoopFaultTriggerUISignatures getVerificationSignaturesUsedForUI() { - return verificationSignaturesUsedForUI; - } - public void setVerificationSignaturesUsedForUI( - ClosedLoopFaultTriggerUISignatures verificationSignaturesUsedForUI) { - this.verificationSignaturesUsedForUI = verificationSignaturesUsedForUI; - } - public ClosedLoopFaultTriggerUISignatures getTriggerSignaturesUsedForUI() { - return triggerSignaturesUsedForUI; - } - public void setTriggerSignaturesUsedForUI( - ClosedLoopFaultTriggerUISignatures triggerSignaturesUsedForUI) { - this.triggerSignaturesUsedForUI = triggerSignaturesUsedForUI; - } - public ClosedLoopPolicyConditions getConditions() { - return conditions; - } - public void setConditions(ClosedLoopPolicyConditions conditions) { - this.conditions = conditions; - } - - public String getVnfType() { - return vnfType; - } - public void setVnfType(String vnfType) { - this.vnfType = vnfType; - } - - public Integer getAgingWindow() { - return agingWindow; - } - public void setAgingWindow(int agingWindow) { - this.agingWindow = agingWindow; - } - - public String getClosedLoopPolicyStatus() { - return closedLoopPolicyStatus; - } - public void setClosedLoopPolicyStatus( - String closedLoopPolicyStatus) { - this.closedLoopPolicyStatus = closedLoopPolicyStatus; - } - public ClosedLoopSignatures getTriggerSignatures() { - return triggerSignatures; - } - public void setTriggerSignatures(ClosedLoopSignatures triggerSignatures) { - this.triggerSignatures = triggerSignatures; - } - public String getActions() { - return actions; - } - public void setActions(String actions) { - this.actions = actions; - } - public Integer getTimeInterval() { - return timeInterval; - } - public void setTimeInterval(int timeInterval) { - this.timeInterval = timeInterval; - } - public Integer getTimeOutRuby() { - return timeOutRuby; - } - public void setTimeOutRuby(int timeOutRuby) { - this.timeOutRuby = timeOutRuby; - } - public Integer getRetrys() { - return retrys; - } - public void setRetrys(int retrys) { - this.retrys = retrys; - } - public String getGeoLink() { - return geoLink; - } - public void setGeoLink(String geoLink) { - this.geoLink = geoLink; - } - public String getEmailAddress() { - return emailAddress; - } - public void setEmailAddress(String emailAddress) { - this.emailAddress = emailAddress; - } - public ClosedLoopSignatures getVerificationSignatures() { - return verificationSignatures; - } - public void setVerificationSignatures( - ClosedLoopSignatures verificationSignatures) { - this.verificationSignatures = verificationSignatures; - } - - public boolean isvDNS() { - return vDNS; - } - - public void setvDNS(boolean vDNS) { - this.vDNS = vDNS; - } - - public boolean isTrinity() { - return trinity; - } - - public void setTrinity(boolean trinity) { - this.trinity = trinity; - } - - public boolean isvUSP() { - return vUSP; - } - - public void setvUSP(boolean vUSP) { - this.vUSP = vUSP; - } - - public boolean isMcr() { - return mcr; - } - - public void setMcr(boolean mcr) { - this.mcr = mcr; - } - - public boolean isGamma() { - return gamma; - } - - public void setGamma(boolean gamma) { - this.gamma = gamma; - } + + private boolean trinity; + private boolean vUSP; + private boolean mcr; + private boolean gamma; + private boolean vDNS; + + private String vnfType; + private String vServices; + private String ONAPname; + + private String closedLoopPolicyStatus; + private ClosedLoopSignatures triggerSignatures; + private String actions; + private int timeInterval; + private int timeOutvPRO; + private int timeOutRuby; + private int retrys; + private int agingWindow; + private String geoLink; + private String emailAddress; + private ClosedLoopSignatures verificationSignatures; + private ClosedLoopPolicyConditions conditions; + private ClosedLoopFaultTriggerUISignatures triggerSignaturesUsedForUI; + private ClosedLoopFaultTriggerUISignatures verificationSignaturesUsedForUI; + private int triggerTimeWindowUsedForUI; + private int verificationTimeWindowUsedForUI; + private String pepName; + private String pepAction; + private String templateVersion; + private int trapMaxAge; + + + public Integer getTrapMaxAge() { + return trapMaxAge; + } + + public void setTrapMaxAge(int trapMaxAge) { + this.trapMaxAge = trapMaxAge; + } + + public String getTemplateVersion() { + return templateVersion; + } + + public void setTemplateVersion(String templateVersion) { + this.templateVersion = templateVersion; + } + + public Integer getTimeOutvPRO() { + return timeOutvPRO; + } + + public void setTimeOutvPRO(int timeOutvPRO) { + this.timeOutvPRO = timeOutvPRO; + } + + + public Integer getTriggerTimeWindowUsedForUI() { + return triggerTimeWindowUsedForUI; + } + + public String getPepName() { + return pepName; + } + + public void setPepName(String pepName) { + this.pepName = pepName; + } + + public String getPepAction() { + return pepAction; + } + + public void setPepAction(String pepAction) { + this.pepAction = pepAction; + } + + public void setTriggerTimeWindowUsedForUI(int triggerTimeWindowUsedForUI) { + this.triggerTimeWindowUsedForUI = triggerTimeWindowUsedForUI; + } + + public Integer getVerificationTimeWindowUsedForUI() { + return verificationTimeWindowUsedForUI; + } + + public void setVerificationTimeWindowUsedForUI( + int verificationTimeWindowUsedForUI) { + this.verificationTimeWindowUsedForUI = verificationTimeWindowUsedForUI; + } + + public String getONAPname(){ + return ONAPname; + } + + public void setONAPname(String ONAPname){ + this.ONAPname = ONAPname; + } + + public String getvServices() { + return vServices; + } + public void setvServices(String vServices) { + this.vServices = vServices; + } + + public ClosedLoopFaultTriggerUISignatures getVerificationSignaturesUsedForUI() { + return verificationSignaturesUsedForUI; + } + public void setVerificationSignaturesUsedForUI( + ClosedLoopFaultTriggerUISignatures verificationSignaturesUsedForUI) { + this.verificationSignaturesUsedForUI = verificationSignaturesUsedForUI; + } + public ClosedLoopFaultTriggerUISignatures getTriggerSignaturesUsedForUI() { + return triggerSignaturesUsedForUI; + } + public void setTriggerSignaturesUsedForUI( + ClosedLoopFaultTriggerUISignatures triggerSignaturesUsedForUI) { + this.triggerSignaturesUsedForUI = triggerSignaturesUsedForUI; + } + public ClosedLoopPolicyConditions getConditions() { + return conditions; + } + public void setConditions(ClosedLoopPolicyConditions conditions) { + this.conditions = conditions; + } + + public String getVnfType() { + return vnfType; + } + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public Integer getAgingWindow() { + return agingWindow; + } + public void setAgingWindow(int agingWindow) { + this.agingWindow = agingWindow; + } + + public String getClosedLoopPolicyStatus() { + return closedLoopPolicyStatus; + } + public void setClosedLoopPolicyStatus( + String closedLoopPolicyStatus) { + this.closedLoopPolicyStatus = closedLoopPolicyStatus; + } + public ClosedLoopSignatures getTriggerSignatures() { + return triggerSignatures; + } + public void setTriggerSignatures(ClosedLoopSignatures triggerSignatures) { + this.triggerSignatures = triggerSignatures; + } + public String getActions() { + return actions; + } + public void setActions(String actions) { + this.actions = actions; + } + public Integer getTimeInterval() { + return timeInterval; + } + public void setTimeInterval(int timeInterval) { + this.timeInterval = timeInterval; + } + public Integer getTimeOutRuby() { + return timeOutRuby; + } + public void setTimeOutRuby(int timeOutRuby) { + this.timeOutRuby = timeOutRuby; + } + public Integer getRetrys() { + return retrys; + } + public void setRetrys(int retrys) { + this.retrys = retrys; + } + public String getGeoLink() { + return geoLink; + } + public void setGeoLink(String geoLink) { + this.geoLink = geoLink; + } + public String getEmailAddress() { + return emailAddress; + } + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + public ClosedLoopSignatures getVerificationSignatures() { + return verificationSignatures; + } + public void setVerificationSignatures( + ClosedLoopSignatures verificationSignatures) { + this.verificationSignatures = verificationSignatures; + } + + public boolean isvDNS() { + return vDNS; + } + + public void setvDNS(boolean vDNS) { + this.vDNS = vDNS; + } + + public boolean isTrinity() { + return trinity; + } + + public void setTrinity(boolean trinity) { + this.trinity = trinity; + } + + public boolean isvUSP() { + return vUSP; + } + + public void setvUSP(boolean vUSP) { + this.vUSP = vUSP; + } + + public boolean isMcr() { + return mcr; + } + + public void setMcr(boolean mcr) { + this.mcr = mcr; + } + + public boolean isGamma() { + return gamma; + } + + public void setGamma(boolean gamma) { + this.gamma = gamma; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatas.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatas.java index efbbf27a6..103cb2d2c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatas.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatas.java @@ -23,47 +23,47 @@ import java.util.List; public class ClosedLoopFaultTrapDatas { - private List<Object> trap1; - private List<Object> trap2; - private List<Object> trap3; - private List<Object> trap4; - private List<Object> trap5; - private List<Object> trap6; - public List<Object> getTrap1() { - return trap1; - } - public void setTrap1(List<Object> trap1) { - this.trap1 = trap1; - } - public List<Object> getTrap2() { - return trap2; - } - public void setTrap2(List<Object> trap2) { - this.trap2 = trap2; - } - public List<Object> getTrap3() { - return trap3; - } - public void setTrap3(List<Object> trap3) { - this.trap3 = trap3; - } - public List<Object> getTrap4() { - return trap4; - } - public void setTrap4(List<Object> trap4) { - this.trap4 = trap4; - } - public List<Object> getTrap5() { - return trap5; - } - public void setTrap5(List<Object> trap5) { - this.trap5 = trap5; - } - public List<Object> getTrap6() { - return trap6; - } - public void setTrap6(List<Object> trap6) { - this.trap6 = trap6; - } + private List<Object> trap1; + private List<Object> trap2; + private List<Object> trap3; + private List<Object> trap4; + private List<Object> trap5; + private List<Object> trap6; + public List<Object> getTrap1() { + return trap1; + } + public void setTrap1(List<Object> trap1) { + this.trap1 = trap1; + } + public List<Object> getTrap2() { + return trap2; + } + public void setTrap2(List<Object> trap2) { + this.trap2 = trap2; + } + public List<Object> getTrap3() { + return trap3; + } + public void setTrap3(List<Object> trap3) { + this.trap3 = trap3; + } + public List<Object> getTrap4() { + return trap4; + } + public void setTrap4(List<Object> trap4) { + this.trap4 = trap4; + } + public List<Object> getTrap5() { + return trap5; + } + public void setTrap5(List<Object> trap5) { + this.trap5 = trap5; + } + public List<Object> getTrap6() { + return trap6; + } + public void setTrap6(List<Object> trap6) { + this.trap6 = trap6; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTriggerUISignatures.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTriggerUISignatures.java index 6363aa95f..b3625c995 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTriggerUISignatures.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTriggerUISignatures.java @@ -23,22 +23,22 @@ package org.onap.policy.rest.adapter; public class ClosedLoopFaultTriggerUISignatures { - - private String signatures; - - private String connectSignatures; - - public String getConnectSignatures() { - return connectSignatures; - } - public void setConnectSignatures(String connectSignatures) { - this.connectSignatures = connectSignatures; - } - public String getSignatures() { - return signatures; - } - public void setSignatures(String signatures) { - this.signatures = signatures; - } - + + private String signatures; + + private String connectSignatures; + + public String getConnectSignatures() { + return connectSignatures; + } + public void setConnectSignatures(String connectSignatures) { + this.connectSignatures = connectSignatures; + } + public String getSignatures() { + return signatures; + } + public void setSignatures(String signatures) { + this.signatures = signatures; + } + } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPMBody.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPMBody.java index 53a9b126d..22d6e6f8a 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPMBody.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPMBody.java @@ -24,110 +24,110 @@ package org.onap.policy.rest.adapter; import java.util.Map; public class ClosedLoopPMBody { - - private boolean trinity; - private boolean vUSP; - private boolean mcr; - private boolean gamma; - private boolean vDNS; - private String geoLink; - private String vServices; - private String ONAPname; - - private String emailAddress; - - private String serviceTypePolicyName; - - private Map<String, String> attributes; - private String templateVersion; - - public String getTemplateVersion() { - return templateVersion; - } - - public void setTemplateVersion(String templateVersion) { - this.templateVersion = templateVersion; - } - - public String getONAPname(){ - return ONAPname; - } - - public void setONAPname(String ONAPname){ - this.ONAPname = ONAPname; - } - - public String getvServices() { - return vServices; - } - - public void setvServices(String vServices) { - this.vServices = vServices; - } - - public Map<String, String> getAttributes() { - return attributes; - } - - public void setAttributes(Map<String, String> map) { - this.attributes = map; - } - - public String getGeoLink() { - return geoLink; - } - - public void setGeoLink(String geoLink) { - this.geoLink = geoLink; - } - - public String getEmailAddress() { - return emailAddress; - } - - public void setEmailAddress(String emailAddress) { - this.emailAddress = emailAddress; - } - - public String getServiceTypePolicyName() { - return serviceTypePolicyName; - } - - public void setServiceTypePolicyName(String serviceTypePolicyName) { - this.serviceTypePolicyName = serviceTypePolicyName; - } - - public boolean isGamma() { - return gamma; - } - public void setGamma(boolean gamma) { - this.gamma = gamma; - } - public boolean isvDNS() { - return vDNS; - } - public void setvDNS(boolean vDNS) { - this.vDNS = vDNS; - } - - public boolean isTrinity() { - return trinity; - } - public void setTrinity(boolean trinity) { - this.trinity = trinity; - } - public boolean isvUSP() { - return vUSP; - } - public void setvUSP(boolean vUSP) { - this.vUSP = vUSP; - } - public boolean isMcr() { - return mcr; - } - public void setMcr(boolean mcr) { - this.mcr = mcr; - } + + private boolean trinity; + private boolean vUSP; + private boolean mcr; + private boolean gamma; + private boolean vDNS; + private String geoLink; + private String vServices; + private String ONAPname; + + private String emailAddress; + + private String serviceTypePolicyName; + + private Map<String, String> attributes; + private String templateVersion; + + public String getTemplateVersion() { + return templateVersion; + } + + public void setTemplateVersion(String templateVersion) { + this.templateVersion = templateVersion; + } + + public String getONAPname(){ + return ONAPname; + } + + public void setONAPname(String ONAPname){ + this.ONAPname = ONAPname; + } + + public String getvServices() { + return vServices; + } + + public void setvServices(String vServices) { + this.vServices = vServices; + } + + public Map<String, String> getAttributes() { + return attributes; + } + + public void setAttributes(Map<String, String> map) { + this.attributes = map; + } + + public String getGeoLink() { + return geoLink; + } + + public void setGeoLink(String geoLink) { + this.geoLink = geoLink; + } + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public String getServiceTypePolicyName() { + return serviceTypePolicyName; + } + + public void setServiceTypePolicyName(String serviceTypePolicyName) { + this.serviceTypePolicyName = serviceTypePolicyName; + } + + public boolean isGamma() { + return gamma; + } + public void setGamma(boolean gamma) { + this.gamma = gamma; + } + public boolean isvDNS() { + return vDNS; + } + public void setvDNS(boolean vDNS) { + this.vDNS = vDNS; + } + + public boolean isTrinity() { + return trinity; + } + public void setTrinity(boolean trinity) { + this.trinity = trinity; + } + public boolean isvUSP() { + return vUSP; + } + public void setvUSP(boolean vUSP) { + this.vUSP = vUSP; + } + public boolean isMcr() { + return mcr; + } + public void setMcr(boolean mcr) { + this.mcr = mcr; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyConditions.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyConditions.java index 5b3838985..012c1465a 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyConditions.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyConditions.java @@ -22,18 +22,18 @@ package org.onap.policy.rest.adapter; public enum ClosedLoopPolicyConditions { - SEND("DCAE should send event notification"), + SEND("DCAE should send event notification"), - NOTSEND("DCAE should not send event notification"); - private String name; + NOTSEND("DCAE should not send event notification"); + private String name; - private ClosedLoopPolicyConditions(String name){ - this.name = name; - } + private ClosedLoopPolicyConditions(String name){ + this.name = name; + } - @Override - public String toString(){ - return this.name; - } + @Override + public String toString(){ + return this.name; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyStatus.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyStatus.java index fd8f2b6cf..2da5202d8 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyStatus.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyStatus.java @@ -22,20 +22,20 @@ package org.onap.policy.rest.adapter; public enum ClosedLoopPolicyStatus { - ACTIVE("active"), - - INACTIVE("inactive") - ; - - private String name; - - private ClosedLoopPolicyStatus(String name){ - this.name = name; - } - - @Override - public String toString(){ - return this.name; - } + ACTIVE("active"), + + INACTIVE("inactive") + ; + + private String name; + + private ClosedLoopPolicyStatus(String name){ + this.name = name; + } + + @Override + public String toString(){ + return this.name; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopSignatures.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopSignatures.java index b2226f95f..97b6da992 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopSignatures.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopSignatures.java @@ -23,30 +23,30 @@ package org.onap.policy.rest.adapter; public class ClosedLoopSignatures { - private String signatures; - - private int timeWindow; - - private Integer trapMaxAge; - - public String getSignatures() { - return signatures; - } - public void setSignatures(String signatures) { - this.signatures = signatures; - } - - public Integer getTimeWindow() { - return timeWindow; - } - public void setTimeWindow(Integer timeWindow) { - this.timeWindow = timeWindow; - } - - public Integer getTrapMaxAge() { - return trapMaxAge; - } - public void setTrapMaxAge(Integer trapMaxAge) { - this.trapMaxAge = trapMaxAge; - } + private String signatures; + + private int timeWindow; + + private Integer trapMaxAge; + + public String getSignatures() { + return signatures; + } + public void setSignatures(String signatures) { + this.signatures = signatures; + } + + public Integer getTimeWindow() { + return timeWindow; + } + public void setTimeWindow(Integer timeWindow) { + this.timeWindow = timeWindow; + } + + public Integer getTrapMaxAge() { + return trapMaxAge; + } + public void setTrapMaxAge(Integer trapMaxAge) { + this.trapMaxAge = trapMaxAge; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeletePolicyCondition.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeletePolicyCondition.java index b4fb5d973..89099f376 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeletePolicyCondition.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeletePolicyCondition.java @@ -22,17 +22,17 @@ package org.onap.policy.rest.adapter; public enum DeletePolicyCondition { - ONE("Are you sure you want to delete Current Version of policy"), + ONE("Are you sure you want to delete Current Version of policy"), - ALL("Are you sure you want to delete All Versions of policy"); - private String name; + ALL("Are you sure you want to delete All Versions of policy"); + private String name; - private DeletePolicyCondition(String name){ - this.name = name; - } + private DeletePolicyCondition(String name){ + this.name = name; + } - @Override - public String toString(){ - return this.name; - } + @Override + public String toString(){ + return this.name; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeployNowJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeployNowJson.java index 6c41253a1..d8eda56a3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeployNowJson.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeployNowJson.java @@ -23,14 +23,14 @@ package org.onap.policy.rest.adapter; public class DeployNowJson { - protected boolean deployNow; - - // deployNow - public boolean getDeployNow() { - return deployNow; - } + protected boolean deployNow; - public void setDeployNow(boolean value) { - this.deployNow = value; - } + // deployNow + public boolean getDeployNow() { + return deployNow; + } + + public void setDeployNow(boolean value) { + this.deployNow = value; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/GridData.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/GridData.java index 4e5b4a313..4b77a6107 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/GridData.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/GridData.java @@ -24,31 +24,31 @@ package org.onap.policy.rest.adapter; import java.util.List; public class GridData { - private List<Object> attributes; - private List<Object> transportProtocols; - private List<Object> appProtocols; + private List<Object> attributes; + private List<Object> transportProtocols; + private List<Object> appProtocols; - public List<Object> getAttributes() { - return attributes; - } + public List<Object> getAttributes() { + return attributes; + } - public void setAttributes(List<Object> attributes) { - this.attributes = attributes; - } + public void setAttributes(List<Object> attributes) { + this.attributes = attributes; + } - public List<Object> getAppProtocols() { - return appProtocols; - } + public List<Object> getAppProtocols() { + return appProtocols; + } - public void setAppProtocols(List<Object> appProtocols) { - this.appProtocols = appProtocols; - } + public void setAppProtocols(List<Object> appProtocols) { + this.appProtocols = appProtocols; + } - public List<Object> getTransportProtocols() { - return transportProtocols; - } + public List<Object> getTransportProtocols() { + return transportProtocols; + } - public void setTransportProtocols(List<Object> transportProtocols) { - this.transportProtocols = transportProtocols; - } + public void setTransportProtocols(List<Object> transportProtocols) { + this.transportProtocols = transportProtocols; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/IdMap.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/IdMap.java index 3557aae11..8784ccca6 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/IdMap.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/IdMap.java @@ -23,20 +23,20 @@ package org.onap.policy.rest.adapter; public class IdMap { - protected String astraId; - protected String vendorId; - - public String getAstraId() { - return astraId; - } - public void setAstraId(String astraId) { - this.astraId = astraId; - } - public String getVendorId() { - return vendorId; - } - public void setVendorId(String vendorId) { - this.vendorId = vendorId; - } - + protected String astraId; + protected String vendorId; + + public String getAstraId() { + return astraId; + } + public void setAstraId(String astraId) { + this.astraId = astraId; + } + public String getVendorId() { + return vendorId; + } + public void setVendorId(String vendorId) { + this.vendorId = vendorId; + } + }
\ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyExportAdapter.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyExportAdapter.java index 2b42207ff..6911aa233 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyExportAdapter.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyExportAdapter.java @@ -24,13 +24,13 @@ package org.onap.policy.rest.adapter; import java.util.List; public class PolicyExportAdapter { - - private List<Object> policyDatas; - - public List<Object> getPolicyDatas() { - return policyDatas; - } - public void setPolicyDatas(List<Object> policyDatas) { - this.policyDatas = policyDatas; - } + + private List<Object> policyDatas; + + public List<Object> getPolicyDatas() { + return policyDatas; + } + public void setPolicyDatas(List<Object> policyDatas) { + this.policyDatas = policyDatas; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java index e815fe2b9..dc1819ff0 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java @@ -29,141 +29,141 @@ import javax.persistence.EntityManagerFactory; import org.onap.policy.rest.jpa.OnapName; public class PolicyRestAdapter { - - /* - * - * Note : Make Sure if any variables are added in PolicyRestAdapter.java, add them to PolicyElasticData.java file - * - * - * */ - - - //Common - private Object data; - private String policyName = null; - private String configBodyData = null; - private String configType = null; - private String policyID = null; - private String policyType = null; - private String comboPolicyType; - private String configPolicyType = null; - private String policyDescription = null; - private String onapName = null; - private String configName = null; - private String ruleID = null; - private String parentPath; - private boolean isValidData = false; - private String adminNotification = null; - private boolean isEditPolicy = false; - private boolean isViewPolicy = false; - private boolean isDraft = false; - private Object policyData = null; - private String gitPath; - private boolean readOnly; - private String configHome; - private String configUrl; - private String finalPolicyPath; - private String version; - private String jsonBody; - private String apiflag; - private String prevJsonBody; - private Integer highestVersion; - private EntityManagerFactory entityManagerFactory = null; - private Boolean policyExists = false; - private String oldPolicyFileName = null; - private String domain = null; - private String userId; - private String newFileName; - private String clWarning = null; - private String newCLName = null; - private String existingCLName = null; - //Used by GUI - private OnapName onapNameField; - private Object jsonBodyData; - private String dirPath; - private String configBodyPath; - private List<Object> attributes; - private List<Object> settings; - private List<Object> ruleAlgorithmschoices; - - private Map<?, ?> serviceTypePolicyName; + + /* + * + * Note : Make Sure if any variables are added in PolicyRestAdapter.java, add them to PolicyElasticData.java file + * + * + * */ + + + //Common + private Object data; + private String policyName = null; + private String configBodyData = null; + private String configType = null; + private String policyID = null; + private String policyType = null; + private String comboPolicyType; + private String configPolicyType = null; + private String policyDescription = null; + private String onapName = null; + private String configName = null; + private String ruleID = null; + private String parentPath; + private boolean isValidData = false; + private String adminNotification = null; + private boolean isEditPolicy = false; + private boolean isViewPolicy = false; + private boolean isDraft = false; + private Object policyData = null; + private String gitPath; + private boolean readOnly; + private String configHome; + private String configUrl; + private String finalPolicyPath; + private String version; + private String jsonBody; + private String apiflag; + private String prevJsonBody; + private Integer highestVersion; + private EntityManagerFactory entityManagerFactory = null; + private Boolean policyExists = false; + private String oldPolicyFileName = null; + private String domain = null; + private String userId; + private String newFileName; + private String clWarning = null; + private String newCLName = null; + private String existingCLName = null; + //Used by GUI + private OnapName onapNameField; + private Object jsonBodyData; + private String dirPath; + private String configBodyPath; + private List<Object> attributes; + private List<Object> settings; + private List<Object> ruleAlgorithmschoices; + + private Map<?, ?> serviceTypePolicyName; - private Map<?, ?> verticaMetrics; + private Map<?, ?> verticaMetrics; private Map<?, ?> description; private Map<?, ?> attributeFields; //ClosedLoop - private String clearTimeOut; - private String trapMaxAge; - private String verificationclearTimeOut; - private Map<String , String> dynamicLayoutMap; - private ClosedLoopFaultTrapDatas trapDatas; - private ClosedLoopFaultTrapDatas faultDatas; - + private String clearTimeOut; + private String trapMaxAge; + private String verificationclearTimeOut; + private Map<String , String> dynamicLayoutMap; + private ClosedLoopFaultTrapDatas trapDatas; + private ClosedLoopFaultTrapDatas faultDatas; + //FireWall private String fwPolicyType; - private List<Object> fwattributes; - private String parentForChild; - private String securityZone; - - //Action & Decision - private String ruleCombiningAlgId = null; - private Map<String,String> dynamicFieldConfigAttributes; - private Map<String,String> dynamicSettingsMap; - private Map<String,String> dropDownMap; - private String actionPerformer = null; - private String actionAttribute = null; - private List<String> dynamicRuleAlgorithmLabels; - private List<String> dynamicRuleAlgorithmCombo; - private List<String> dynamicRuleAlgorithmField1; - private List<String> dynamicRuleAlgorithmField2; - private List<Object> dynamicVariableList; - private List<String> dataTypeList; - private String actionAttributeValue; - private String ruleProvider; - private String actionBody = null; - private String actionDictHeader = null; - private String actionDictType = null; - private String actionDictUrl = null; - private String actionDictMethod = null; - private YAMLParams yamlparams; - private List<String> blackListEntries; - private List<String> appendBlackListEntries; - private String blackListEntryType; - - //Rainy Day Decision - private RainyDayParams rainyday; - private Map<String,String> rainydayMap; - private List<String> errorCodeList; - private List<String> treatmentList; - - //MicroSerice - private String serviceType = null; - private String uuid = null; - private String location = null; + private List<Object> fwattributes; + private String parentForChild; + private String securityZone; + + //Action & Decision + private String ruleCombiningAlgId = null; + private Map<String,String> dynamicFieldConfigAttributes; + private Map<String,String> dynamicSettingsMap; + private Map<String,String> dropDownMap; + private String actionPerformer = null; + private String actionAttribute = null; + private List<String> dynamicRuleAlgorithmLabels; + private List<String> dynamicRuleAlgorithmCombo; + private List<String> dynamicRuleAlgorithmField1; + private List<String> dynamicRuleAlgorithmField2; + private List<Object> dynamicVariableList; + private List<String> dataTypeList; + private String actionAttributeValue; + private String ruleProvider; + private String actionBody = null; + private String actionDictHeader = null; + private String actionDictType = null; + private String actionDictUrl = null; + private String actionDictMethod = null; + private YAMLParams yamlparams; + private List<String> blackListEntries; + private List<String> appendBlackListEntries; + private String blackListEntryType; + + //Rainy Day Decision + private RainyDayParams rainyday; + private Map<String,String> rainydayMap; + private List<String> errorCodeList; + private List<String> treatmentList; + + //MicroSerice + private String serviceType = null; + private String uuid = null; + private String location = null; private String priority = null; private String msLocation = null; private Object policyJSON = null; //BRMS Policies private String ruleName; - private Map<String,String> brmsParamBody=null; - private String brmsController = null; + private Map<String,String> brmsParamBody=null; + private String brmsController = null; private List<String> brmsDependency = null; private LinkedHashMap<?, ?> ruleData; - private LinkedHashMap<?,?> ruleListData; - private Map<String,String> drlRuleAndUIParams=null; + private LinkedHashMap<?,?> ruleListData; + private Map<String,String> drlRuleAndUIParams=null; - //Safe Policy - private String policyScope; - private String providerComboBox = null; - private String riskType; - private String riskLevel; - private String guard = null; - private String ttlDate; - private Map<String,String> matching; - - private List<Object> triggerSignatures; + //Safe Policy + private String policyScope; + private String providerComboBox = null; + private String riskType; + private String riskLevel; + private String guard = null; + private String ttlDate; + private Map<String,String> matching; + + private List<Object> triggerSignatures; private List<Object> symptomSignatures; private String logicalConnector; private String policyStatus; @@ -171,433 +171,433 @@ public class PolicyRestAdapter { private String supressionType; - public List<Object> getTriggerSignatures() { - return triggerSignatures; - } - public void setTriggerSignatures(List<Object> triggerSignatures) { - this.triggerSignatures = triggerSignatures; - } - public List<Object> getSymptomSignatures() { - return symptomSignatures; - } - public void setSymptomSignatures(List<Object> symptomSignatures) { - this.symptomSignatures = symptomSignatures; - } - public String getLogicalConnector() { - return logicalConnector; - } - public void setLogicalConnector(String logicalConnector) { - this.logicalConnector = logicalConnector; - } - public String getPolicyStatus() { - return policyStatus; - } - public void setPolicyStatus(String policyStatus) { - this.policyStatus = policyStatus; - } - public String getGocServerScope() { - return gocServerScope; - } - public void setGocServerScope(String gocServerScope) { - this.gocServerScope = gocServerScope; - } - - public String getSupressionType() { - return supressionType; - } - public void setSupressionType(String supressionType) { - this.supressionType = supressionType; - } - - /********************************************************************************/ - - + public List<Object> getTriggerSignatures() { + return triggerSignatures; + } + public void setTriggerSignatures(List<Object> triggerSignatures) { + this.triggerSignatures = triggerSignatures; + } + public List<Object> getSymptomSignatures() { + return symptomSignatures; + } + public void setSymptomSignatures(List<Object> symptomSignatures) { + this.symptomSignatures = symptomSignatures; + } + public String getLogicalConnector() { + return logicalConnector; + } + public void setLogicalConnector(String logicalConnector) { + this.logicalConnector = logicalConnector; + } + public String getPolicyStatus() { + return policyStatus; + } + public void setPolicyStatus(String policyStatus) { + this.policyStatus = policyStatus; + } + public String getGocServerScope() { + return gocServerScope; + } + public void setGocServerScope(String gocServerScope) { + this.gocServerScope = gocServerScope; + } + + public String getSupressionType() { + return supressionType; + } + public void setSupressionType(String supressionType) { + this.supressionType = supressionType; + } + + /********************************************************************************/ - public String getComboPolicyType() { - return comboPolicyType; - } - public void setComboPolicyType(String comboPolicyType) { - this.comboPolicyType = comboPolicyType; - } - public String getGitPath() { - return gitPath; - } - public void setGitPath(String gitPath) { - this.gitPath = gitPath; - } - public String getOldPolicyFileName() { - return oldPolicyFileName; - } - public void setOldPolicyFileName(String oldPolicyFileName) { - this.oldPolicyFileName = oldPolicyFileName; - } - public String getDomainDir() { - return domain; - } - public void setDomainDir(String domain) { - this.domain = domain; - } - public Integer getHighestVersion() { - return highestVersion; - } - public void setHighestVersion(Integer highestVersion) { - this.highestVersion = highestVersion; - } - public Object getData() { - return data; - } - public void setData(Object data) { - this.data = data; - } - public String getPolicyName() { - return policyName; - } - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - public String getConfigBodyData() { - return configBodyData; - } - public void setConfigBodyData(String configBodyData) { - this.configBodyData = configBodyData; - } - public String getConfigType() { - return configType; - } - public void setConfigType(String configType) { - this.configType = configType; - } - public String getPolicyID() { - return policyID; - } - public void setPolicyID(String policyID) { - this.policyID = policyID; - } - public String getPolicyType() { - return policyType; - } - public void setPolicyType(String policyType) { - this.policyType = policyType; - } - public String getPolicyDescription() { - return policyDescription; - } - public void setPolicyDescription(String policyDescription) { - this.policyDescription = policyDescription; - } - public String getOnapName() { - return onapName; - } - public void setOnapName(String onapName) { - this.onapName = onapName; - } - public String getConfigName() { - return configName; - } - public void setConfigName(String configName) { - this.configName = configName; - } - public String getRuleID() { - return ruleID; - } - public void setRuleID(String ruleID) { - this.ruleID = ruleID; - } - public String getRuleCombiningAlgId() { - return ruleCombiningAlgId; - } - public void setRuleCombiningAlgId(String ruleCombiningAlgId) { - this.ruleCombiningAlgId = ruleCombiningAlgId; - } - public Map<String,String> getDynamicFieldConfigAttributes() { - return dynamicFieldConfigAttributes; - } - public void setDynamicFieldConfigAttributes( - Map<String,String> dynamicFieldConfigAttributes) { - this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes; - } - public String getParentPath() { - return parentPath; - } - public void setParentPath(String parentPath) { - this.parentPath = parentPath; - } - public boolean isEditPolicy() { - return isEditPolicy; - } - public void setEditPolicy(boolean isEditPolicy) { - this.isEditPolicy = isEditPolicy; - } - public boolean isViewPolicy() { - return isViewPolicy; - } - public void setViewPolicy(boolean isViewPolicy) { - this.isViewPolicy = isViewPolicy; - } - public Object getPolicyData() { - return policyData; - } - public void setPolicyData(Object policyData) { - this.policyData = policyData; - } - public boolean isReadOnly() { - return readOnly; - } - public void setReadOnly(boolean readOnly) { - this.readOnly = readOnly; - } - public boolean isValidData() { - return isValidData; - } - public void setValidData(boolean isValidData) { - this.isValidData = isValidData; - } - public String getAdminNotification() { - return adminNotification; - } - public void setAdminNotification(String adminNotification) { - this.adminNotification = adminNotification; - } - public String getConfigHome() { - return configHome; - } - public void setConfigHome(String configHome) { - this.configHome = configHome; - } - public String getConfigUrl() { - return configUrl; - } - public void setConfigUrl(String configUrl) { - this.configUrl = configUrl; - } - public String getFinalPolicyPath() { - return finalPolicyPath; - } - public void setFinalPolicyPath(String finalPolicyPath) { - this.finalPolicyPath = finalPolicyPath; - } - public String getVersion() { - return version; - } - public void setVersion(String version) { - this.version = version; - } - public String getJsonBody() { - return jsonBody; - } - public void setJsonBody(String jsonBody) { - this.jsonBody = jsonBody; - } - public String getPrevJsonBody() { - return prevJsonBody; - } - public void setPrevJsonBody(String prevJsonBody) { - this.prevJsonBody = prevJsonBody; - } - public String getApiflag() { - return apiflag; - } - public void setApiflag(String apiflag) { - this.apiflag = apiflag; - } - /** - * @return the actionPerformer - */ - public String getActionPerformer() { - return actionPerformer; - } - /** - * @param actionPerformer the actionPerformer to set - */ - public void setActionPerformer(String actionPerformer) { - this.actionPerformer = actionPerformer; - } - /** - * @return the actionAttribute - */ - public String getActionAttribute() { - return actionAttribute; - } - /** - * @param actionAttribute the actionAttribute to set - */ - public void setActionAttribute(String actionAttribute) { - this.actionAttribute = actionAttribute; - } - /** - * @return the dynamicRuleAlgorithmLabels - */ - public List<String> getDynamicRuleAlgorithmLabels() { - return dynamicRuleAlgorithmLabels; - } - /** - * @param dynamicRuleAlgorithmLabels the dynamicRuleAlgorithmLabels to set - */ - public void setDynamicRuleAlgorithmLabels( - List<String> dynamicRuleAlgorithmLabels) { - this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels; - } - /** - * @return the dynamicRuleAlgorithmCombo - */ - public List<String> getDynamicRuleAlgorithmCombo() { - return dynamicRuleAlgorithmCombo; - } - /** - * @param dynamicRuleAlgorithmCombo the dynamicRuleAlgorithmCombo to set - */ - public void setDynamicRuleAlgorithmCombo(List<String> dynamicRuleAlgorithmCombo) { - this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo; - } - /** - * @return the dynamicRuleAlgorithmField1 - */ - public List<String> getDynamicRuleAlgorithmField1() { - return dynamicRuleAlgorithmField1; - } - /** - * @param dynamicRuleAlgorithmField1 the dynamicRuleAlgorithmField1 to set - */ - public void setDynamicRuleAlgorithmField1( - List<String> dynamicRuleAlgorithmField1) { - this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1; - } - /** - * @return the dynamicRuleAlgorithmField2 - */ - public List<String> getDynamicRuleAlgorithmField2() { - return dynamicRuleAlgorithmField2; - } - /** - * @param dynamicRuleAlgorithmField2 the dynamicRuleAlgorithmField2 to set - */ - public void setDynamicRuleAlgorithmField2( - List<String> dynamicRuleAlgorithmField2) { - this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2; - } - public Map<String,String> getDropDownMap() { - return dropDownMap; - } - public void setDropDownMap(Map<String,String> dropDownMap) { - this.dropDownMap = dropDownMap; - } - public Map<String,String> getDynamicSettingsMap() { - return dynamicSettingsMap; - } - public void setDynamicSettingsMap(Map<String,String> dynamicSettingsMap) { - this.dynamicSettingsMap = dynamicSettingsMap; - } - public List<Object> getDynamicVariableList() { - return dynamicVariableList; - } - public void setDynamicVariableList(List<Object> dynamicVariableList) { - this.dynamicVariableList = dynamicVariableList; - } - public List<String> getDataTypeList() { - return dataTypeList; - } - public void setDataTypeList(List<String> dataTypeList) { - this.dataTypeList = dataTypeList; - } - public boolean isDraft() { - return isDraft; - } - public void setDraft(boolean isDraft) { - this.isDraft = isDraft; - } - public String getConfigPolicyType() { - return configPolicyType; - } - public void setConfigPolicyType(String configPolicyType) { - this.configPolicyType = configPolicyType; - } - public String getServiceType() { - return serviceType; - } - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - public String getUuid() { - return uuid; - } - public void setUuid(String uuid) { - this.uuid = uuid; - } - public String getLocation() { - return location; - } - public void setLocation(String location) { - this.location = location; - } + + public String getComboPolicyType() { + return comboPolicyType; + } + public void setComboPolicyType(String comboPolicyType) { + this.comboPolicyType = comboPolicyType; + } + public String getGitPath() { + return gitPath; + } + public void setGitPath(String gitPath) { + this.gitPath = gitPath; + } + public String getOldPolicyFileName() { + return oldPolicyFileName; + } + public void setOldPolicyFileName(String oldPolicyFileName) { + this.oldPolicyFileName = oldPolicyFileName; + } + public String getDomainDir() { + return domain; + } + public void setDomainDir(String domain) { + this.domain = domain; + } + public Integer getHighestVersion() { + return highestVersion; + } + public void setHighestVersion(Integer highestVersion) { + this.highestVersion = highestVersion; + } + public Object getData() { + return data; + } + public void setData(Object data) { + this.data = data; + } + public String getPolicyName() { + return policyName; + } + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + public String getConfigBodyData() { + return configBodyData; + } + public void setConfigBodyData(String configBodyData) { + this.configBodyData = configBodyData; + } + public String getConfigType() { + return configType; + } + public void setConfigType(String configType) { + this.configType = configType; + } + public String getPolicyID() { + return policyID; + } + public void setPolicyID(String policyID) { + this.policyID = policyID; + } + public String getPolicyType() { + return policyType; + } + public void setPolicyType(String policyType) { + this.policyType = policyType; + } + public String getPolicyDescription() { + return policyDescription; + } + public void setPolicyDescription(String policyDescription) { + this.policyDescription = policyDescription; + } + public String getOnapName() { + return onapName; + } + public void setOnapName(String onapName) { + this.onapName = onapName; + } + public String getConfigName() { + return configName; + } + public void setConfigName(String configName) { + this.configName = configName; + } + public String getRuleID() { + return ruleID; + } + public void setRuleID(String ruleID) { + this.ruleID = ruleID; + } + public String getRuleCombiningAlgId() { + return ruleCombiningAlgId; + } + public void setRuleCombiningAlgId(String ruleCombiningAlgId) { + this.ruleCombiningAlgId = ruleCombiningAlgId; + } + public Map<String,String> getDynamicFieldConfigAttributes() { + return dynamicFieldConfigAttributes; + } + public void setDynamicFieldConfigAttributes( + Map<String,String> dynamicFieldConfigAttributes) { + this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes; + } + public String getParentPath() { + return parentPath; + } + public void setParentPath(String parentPath) { + this.parentPath = parentPath; + } + public boolean isEditPolicy() { + return isEditPolicy; + } + public void setEditPolicy(boolean isEditPolicy) { + this.isEditPolicy = isEditPolicy; + } + public boolean isViewPolicy() { + return isViewPolicy; + } + public void setViewPolicy(boolean isViewPolicy) { + this.isViewPolicy = isViewPolicy; + } + public Object getPolicyData() { + return policyData; + } + public void setPolicyData(Object policyData) { + this.policyData = policyData; + } + public boolean isReadOnly() { + return readOnly; + } + public void setReadOnly(boolean readOnly) { + this.readOnly = readOnly; + } + public boolean isValidData() { + return isValidData; + } + public void setValidData(boolean isValidData) { + this.isValidData = isValidData; + } + public String getAdminNotification() { + return adminNotification; + } + public void setAdminNotification(String adminNotification) { + this.adminNotification = adminNotification; + } + public String getConfigHome() { + return configHome; + } + public void setConfigHome(String configHome) { + this.configHome = configHome; + } + public String getConfigUrl() { + return configUrl; + } + public void setConfigUrl(String configUrl) { + this.configUrl = configUrl; + } + public String getFinalPolicyPath() { + return finalPolicyPath; + } + public void setFinalPolicyPath(String finalPolicyPath) { + this.finalPolicyPath = finalPolicyPath; + } + public String getVersion() { + return version; + } + public void setVersion(String version) { + this.version = version; + } + public String getJsonBody() { + return jsonBody; + } + public void setJsonBody(String jsonBody) { + this.jsonBody = jsonBody; + } + public String getPrevJsonBody() { + return prevJsonBody; + } + public void setPrevJsonBody(String prevJsonBody) { + this.prevJsonBody = prevJsonBody; + } + public String getApiflag() { + return apiflag; + } + public void setApiflag(String apiflag) { + this.apiflag = apiflag; + } + /** + * @return the actionPerformer + */ + public String getActionPerformer() { + return actionPerformer; + } + /** + * @param actionPerformer the actionPerformer to set + */ + public void setActionPerformer(String actionPerformer) { + this.actionPerformer = actionPerformer; + } + /** + * @return the actionAttribute + */ + public String getActionAttribute() { + return actionAttribute; + } + /** + * @param actionAttribute the actionAttribute to set + */ + public void setActionAttribute(String actionAttribute) { + this.actionAttribute = actionAttribute; + } + /** + * @return the dynamicRuleAlgorithmLabels + */ + public List<String> getDynamicRuleAlgorithmLabels() { + return dynamicRuleAlgorithmLabels; + } + /** + * @param dynamicRuleAlgorithmLabels the dynamicRuleAlgorithmLabels to set + */ + public void setDynamicRuleAlgorithmLabels( + List<String> dynamicRuleAlgorithmLabels) { + this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels; + } + /** + * @return the dynamicRuleAlgorithmCombo + */ + public List<String> getDynamicRuleAlgorithmCombo() { + return dynamicRuleAlgorithmCombo; + } + /** + * @param dynamicRuleAlgorithmCombo the dynamicRuleAlgorithmCombo to set + */ + public void setDynamicRuleAlgorithmCombo(List<String> dynamicRuleAlgorithmCombo) { + this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo; + } + /** + * @return the dynamicRuleAlgorithmField1 + */ + public List<String> getDynamicRuleAlgorithmField1() { + return dynamicRuleAlgorithmField1; + } + /** + * @param dynamicRuleAlgorithmField1 the dynamicRuleAlgorithmField1 to set + */ + public void setDynamicRuleAlgorithmField1( + List<String> dynamicRuleAlgorithmField1) { + this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1; + } + /** + * @return the dynamicRuleAlgorithmField2 + */ + public List<String> getDynamicRuleAlgorithmField2() { + return dynamicRuleAlgorithmField2; + } + /** + * @param dynamicRuleAlgorithmField2 the dynamicRuleAlgorithmField2 to set + */ + public void setDynamicRuleAlgorithmField2( + List<String> dynamicRuleAlgorithmField2) { + this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2; + } + public Map<String,String> getDropDownMap() { + return dropDownMap; + } + public void setDropDownMap(Map<String,String> dropDownMap) { + this.dropDownMap = dropDownMap; + } + + public Map<String,String> getDynamicSettingsMap() { + return dynamicSettingsMap; + } + public void setDynamicSettingsMap(Map<String,String> dynamicSettingsMap) { + this.dynamicSettingsMap = dynamicSettingsMap; + } + public List<Object> getDynamicVariableList() { + return dynamicVariableList; + } + public void setDynamicVariableList(List<Object> dynamicVariableList) { + this.dynamicVariableList = dynamicVariableList; + } + public List<String> getDataTypeList() { + return dataTypeList; + } + public void setDataTypeList(List<String> dataTypeList) { + this.dataTypeList = dataTypeList; + } + public boolean isDraft() { + return isDraft; + } + public void setDraft(boolean isDraft) { + this.isDraft = isDraft; + } + public String getConfigPolicyType() { + return configPolicyType; + } + public void setConfigPolicyType(String configPolicyType) { + this.configPolicyType = configPolicyType; + } + public String getServiceType() { + return serviceType; + } + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + public String getLocation() { + return location; + } + public void setLocation(String location) { + this.location = location; + } public String getPriority() { return priority; } public void setPriority(String priority) { this.priority = priority; } - public Map<String, String> getBrmsParamBody() { - return brmsParamBody; - } - public void setBrmsParamBody(Map<String, String> brmsParamBody) { - this.brmsParamBody = brmsParamBody; - } - public EntityManagerFactory getEntityManagerFactory() { - return entityManagerFactory; - } - public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) { - this.entityManagerFactory = entityManagerFactory; - } - /** - * @return the policyExists - */ - public Boolean getPolicyExists() { - return policyExists; - } - /** - * @param policyExists the policyExists to set - */ - public void setPolicyExists(Boolean policyExists) { - this.policyExists = policyExists; - } - public String getPolicyScope() { - return policyScope; - } - - public void setPolicyScope(String domainDir) { - this. policyScope=domainDir; - } - public String getProviderComboBox() { - return providerComboBox; - } - public void setProviderComboBox(String providerComboBox) { - this.providerComboBox = providerComboBox; - } - public String getRiskType() { - return riskType; - } - public void setRiskType(String riskType) { - this.riskType = riskType; - } - public String getGuard() { - return guard; - } - public void setGuard(String guard) { - this.guard = guard; - } - public String getRiskLevel() { - return riskLevel; - } - public void setRiskLevel(String riskLevel) { - this.riskLevel = riskLevel; - } - public String getTtlDate() { - return ttlDate; - } - public void setTtlDate(String ttlDate) { - this.ttlDate = ttlDate; - } - public String getBrmsController() { + public Map<String, String> getBrmsParamBody() { + return brmsParamBody; + } + public void setBrmsParamBody(Map<String, String> brmsParamBody) { + this.brmsParamBody = brmsParamBody; + } + public EntityManagerFactory getEntityManagerFactory() { + return entityManagerFactory; + } + public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) { + this.entityManagerFactory = entityManagerFactory; + } + /** + * @return the policyExists + */ + public Boolean getPolicyExists() { + return policyExists; + } + /** + * @param policyExists the policyExists to set + */ + public void setPolicyExists(Boolean policyExists) { + this.policyExists = policyExists; + } + public String getPolicyScope() { + return policyScope; + } + + public void setPolicyScope(String domainDir) { + this. policyScope=domainDir; + } + public String getProviderComboBox() { + return providerComboBox; + } + public void setProviderComboBox(String providerComboBox) { + this.providerComboBox = providerComboBox; + } + public String getRiskType() { + return riskType; + } + public void setRiskType(String riskType) { + this.riskType = riskType; + } + public String getGuard() { + return guard; + } + public void setGuard(String guard) { + this.guard = guard; + } + public String getRiskLevel() { + return riskLevel; + } + public void setRiskLevel(String riskLevel) { + this.riskLevel = riskLevel; + } + public String getTtlDate() { + return ttlDate; + } + public void setTtlDate(String ttlDate) { + this.ttlDate = ttlDate; + } + public String getBrmsController() { return brmsController; } public void setBrmsController(String brmsController) { @@ -610,322 +610,322 @@ public class PolicyRestAdapter { this.brmsDependency = brmsDependency; } public Map<String, String> getMatching() { - return matching; - } - public void setMatching(Map<String, String> matching) { - this.matching = matching; - } - public String getUserId() { - return userId; - } - public void setUserId(String userId) { - this.userId = userId; - } - public String getNewFileName() { - return newFileName; - } - public void setNewFileName(String newFileName) { - this.newFileName = newFileName; - } - public OnapName getOnapNameField() { - return onapNameField; - } - public void setOnapNameField(OnapName onapNameField) { - this.onapNameField = onapNameField; - } - public Object getJsonBodyData() { - return jsonBodyData; - } - public void setJsonBodyData(Object jsonBodyData) { - this.jsonBodyData = jsonBodyData; - } - public String getDirPath() { - return dirPath; - } - public void setDirPath(String dirPath) { - this.dirPath = dirPath; - } - public String getConfigBodyPath() { - return configBodyPath; - } - public void setConfigBodyPath(String configBodyPath) { - this.configBodyPath = configBodyPath; - } - public List<Object> getAttributes() { - return attributes; - } - public void setAttributes(List<Object> attributes) { - this.attributes = attributes; - } - public List<Object> getSettings() { - return settings; - } - public void setSettings(List<Object> settings) { - this.settings = settings; - } - public List<Object> getRuleAlgorithmschoices() { - return ruleAlgorithmschoices; - } - public void setRuleAlgorithmschoices(List<Object> ruleAlgorithmschoices) { - this.ruleAlgorithmschoices = ruleAlgorithmschoices; - } - public Map<?, ?> getServiceTypePolicyName() { - return serviceTypePolicyName; - } - public void setServiceTypePolicyName(Map<?, ?> serviceTypePolicyName) { - this.serviceTypePolicyName = serviceTypePolicyName; - } - public Map<?, ?> getVerticaMetrics() { - return verticaMetrics; - } - public void setVerticaMetrics(Map<?, ?> verticaMetrics) { - this.verticaMetrics = verticaMetrics; - } - public Map<?, ?> getDescription() { - return description; - } - public void setDescription(LinkedHashMap<?, ?> description) { - this.description = description; - } - public Map<?, ?> getAttributeFields() { - return attributeFields; - } - public void setAttributeFields(LinkedHashMap<?, ?> attributeFields) { - this.attributeFields = attributeFields; - } - public String getClearTimeOut() { - return clearTimeOut; - } - public void setClearTimeOut(String clearTimeOut) { - this.clearTimeOut = clearTimeOut; - } - public String getTrapMaxAge() { - return trapMaxAge; - } - public void setTrapMaxAge(String trapMaxAge) { - this.trapMaxAge = trapMaxAge; - } - public String getVerificationclearTimeOut() { - return verificationclearTimeOut; - } - public void setVerificationclearTimeOut(String verificationclearTimeOut) { - this.verificationclearTimeOut = verificationclearTimeOut; - } - public Map<String, String> getDynamicLayoutMap() { - return dynamicLayoutMap; - } - public void setDynamicLayoutMap(Map<String, String> dynamicLayoutMap) { - this.dynamicLayoutMap = dynamicLayoutMap; - } - public String getFwPolicyType() { - return fwPolicyType; - } - public void setFwPolicyType(String fwPolicyType) { - this.fwPolicyType = fwPolicyType; - } - public List<Object> getFwattributes() { - return fwattributes; - } - public void setFwattributes(List<Object> fwattributes) { - this.fwattributes = fwattributes; - } - public String getParentForChild() { - return parentForChild; - } - public void setParentForChild(String parentForChild) { - this.parentForChild = parentForChild; - } - public String getRuleName() { - return ruleName; - } - public void setRuleName(String ruleName) { - this.ruleName = ruleName; - } - public LinkedHashMap<?, ?> getRuleData() { - return ruleData; - } - public void setRuleData(LinkedHashMap<?, ?> ruleData) { - this.ruleData = ruleData; - } - public LinkedHashMap<?, ?> getRuleListData() { - return ruleListData; - } - public void setRuleListData(LinkedHashMap<?, ?> ruleListData) { - this.ruleListData = ruleListData; - } - public String getSecurityZone() { - return securityZone; - } - public void setSecurityZone(String securityZone) { - this.securityZone = securityZone; - } - public String getActionAttributeValue() { - return actionAttributeValue; - } - public void setActionAttributeValue(String actionAttributeValue) { - this.actionAttributeValue = actionAttributeValue; - } - public String getRuleProvider() { - return ruleProvider; - } - public void setRuleProvider(String ruleProvider) { - this.ruleProvider = ruleProvider; - } - public String getMsLocation() { - return msLocation; - } - public void setMsLocation(String msLocation) { - this.msLocation = msLocation; - } - public Map<String,String> getDrlRuleAndUIParams() { - return drlRuleAndUIParams; - } - public void setDrlRuleAndUIParams(Map<String,String> drlRuleAndUIParams) { - this.drlRuleAndUIParams = drlRuleAndUIParams; - } - public String getActionBody() { - return actionBody; - } - public void setActionBody(String actionBody) { - this.actionBody = actionBody; - } - public String getActionDictHeader() { - return actionDictHeader; - } - public void setActionDictHeader(String actionDictHeader) { - this.actionDictHeader = actionDictHeader; - } - public String getActionDictType() { - return actionDictType; - } - public void setActionDictType(String actionDictType) { - this.actionDictType = actionDictType; - } - public String getActionDictUrl() { - return actionDictUrl; - } - public void setActionDictUrl(String actionDictUrl) { - this.actionDictUrl = actionDictUrl; - } - public String getActionDictMethod() { - return actionDictMethod; - } - public void setActionDictMethod(String actionDictMethod) { - this.actionDictMethod = actionDictMethod; - } - public String getClWarning() { - return clWarning; - } - public void setClWarning(String clWarning) { - this.clWarning = clWarning; - } - public String getNewCLName() { - return newCLName; - } - public void setNewCLName(String newCLName) { - this.newCLName = newCLName; - } - public String getExistingCLName() { - return existingCLName; - } - public void setExistingCLName(String existingCLName) { - this.existingCLName = existingCLName; - } - public YAMLParams getYamlparams() { - return yamlparams; - } - public void setYamlparams(YAMLParams yamlparams) { - this.yamlparams = yamlparams; - } - /** - * @return the rainyday - */ - public RainyDayParams getRainyday() { - return rainyday; - } - /** - * @param rainyday the rainyday to set - */ - public void setRainyday(RainyDayParams rainyday) { - this.rainyday = rainyday; - } - /** - * @return the errorCodeList - */ - public List<String> getErrorCodeList() { - return errorCodeList; - } - /** - * @param errorCodeList the errorCodeList to set - */ - public void setErrorCodeList(List<String> errorCodeList) { - this.errorCodeList = errorCodeList; - } - /** - * @return the treatmentList - */ - public List<String> getTreatmentList() { - return treatmentList; - } - /** - * @param treatmentList the treatmentList to set - */ - public void setTreatmentList(List<String> treatmentList) { - this.treatmentList = treatmentList; - } - /** - * @return the rainydayMap - */ - public Map<String,String> getRainydayMap() { - return rainydayMap; - } - /** - * @param rainydayMap the rainydayMap to set - */ - public void setRainydayMap(Map<String,String> rainydayMap) { - this.rainydayMap = rainydayMap; - } - /** - * @return the policyJSON - */ - public Object getPolicyJSON() { - return policyJSON; - } - /** - * @param policyJSON the policyJSON to set - */ - public void setPolicyJSON(Object policyJSON) { - this.policyJSON = policyJSON; - } - - public ClosedLoopFaultTrapDatas getTrapDatas() { - return trapDatas; - } - public void setTrapDatas(ClosedLoopFaultTrapDatas trapDatas) { - this.trapDatas = trapDatas; - } - public ClosedLoopFaultTrapDatas getFaultDatas() { - return faultDatas; - } - public void setFaultDatas(ClosedLoopFaultTrapDatas faultDatas) { - this.faultDatas = faultDatas; - } - public List<String> getAppendBlackListEntries() { - return appendBlackListEntries; - } - public void setAppendBlackListEntries(List<String> appendBlackListEntries) { - this.appendBlackListEntries = appendBlackListEntries; - } - public List<String> getBlackListEntries() { - return blackListEntries; - } - public void setBlackListEntries(List<String> blackListEntries) { - this.blackListEntries = blackListEntries; - } - public String getBlackListEntryType() { - return blackListEntryType; - } - public void setBlackListEntryType(String blackListEntryType) { - this.blackListEntryType = blackListEntryType; - } + return matching; + } + public void setMatching(Map<String, String> matching) { + this.matching = matching; + } + public String getUserId() { + return userId; + } + public void setUserId(String userId) { + this.userId = userId; + } + public String getNewFileName() { + return newFileName; + } + public void setNewFileName(String newFileName) { + this.newFileName = newFileName; + } + public OnapName getOnapNameField() { + return onapNameField; + } + public void setOnapNameField(OnapName onapNameField) { + this.onapNameField = onapNameField; + } + public Object getJsonBodyData() { + return jsonBodyData; + } + public void setJsonBodyData(Object jsonBodyData) { + this.jsonBodyData = jsonBodyData; + } + public String getDirPath() { + return dirPath; + } + public void setDirPath(String dirPath) { + this.dirPath = dirPath; + } + public String getConfigBodyPath() { + return configBodyPath; + } + public void setConfigBodyPath(String configBodyPath) { + this.configBodyPath = configBodyPath; + } + public List<Object> getAttributes() { + return attributes; + } + public void setAttributes(List<Object> attributes) { + this.attributes = attributes; + } + public List<Object> getSettings() { + return settings; + } + public void setSettings(List<Object> settings) { + this.settings = settings; + } + public List<Object> getRuleAlgorithmschoices() { + return ruleAlgorithmschoices; + } + public void setRuleAlgorithmschoices(List<Object> ruleAlgorithmschoices) { + this.ruleAlgorithmschoices = ruleAlgorithmschoices; + } + public Map<?, ?> getServiceTypePolicyName() { + return serviceTypePolicyName; + } + public void setServiceTypePolicyName(Map<?, ?> serviceTypePolicyName) { + this.serviceTypePolicyName = serviceTypePolicyName; + } + public Map<?, ?> getVerticaMetrics() { + return verticaMetrics; + } + public void setVerticaMetrics(Map<?, ?> verticaMetrics) { + this.verticaMetrics = verticaMetrics; + } + public Map<?, ?> getDescription() { + return description; + } + public void setDescription(LinkedHashMap<?, ?> description) { + this.description = description; + } + public Map<?, ?> getAttributeFields() { + return attributeFields; + } + public void setAttributeFields(LinkedHashMap<?, ?> attributeFields) { + this.attributeFields = attributeFields; + } + public String getClearTimeOut() { + return clearTimeOut; + } + public void setClearTimeOut(String clearTimeOut) { + this.clearTimeOut = clearTimeOut; + } + public String getTrapMaxAge() { + return trapMaxAge; + } + public void setTrapMaxAge(String trapMaxAge) { + this.trapMaxAge = trapMaxAge; + } + public String getVerificationclearTimeOut() { + return verificationclearTimeOut; + } + public void setVerificationclearTimeOut(String verificationclearTimeOut) { + this.verificationclearTimeOut = verificationclearTimeOut; + } + public Map<String, String> getDynamicLayoutMap() { + return dynamicLayoutMap; + } + public void setDynamicLayoutMap(Map<String, String> dynamicLayoutMap) { + this.dynamicLayoutMap = dynamicLayoutMap; + } + public String getFwPolicyType() { + return fwPolicyType; + } + public void setFwPolicyType(String fwPolicyType) { + this.fwPolicyType = fwPolicyType; + } + public List<Object> getFwattributes() { + return fwattributes; + } + public void setFwattributes(List<Object> fwattributes) { + this.fwattributes = fwattributes; + } + public String getParentForChild() { + return parentForChild; + } + public void setParentForChild(String parentForChild) { + this.parentForChild = parentForChild; + } + public String getRuleName() { + return ruleName; + } + public void setRuleName(String ruleName) { + this.ruleName = ruleName; + } + public LinkedHashMap<?, ?> getRuleData() { + return ruleData; + } + public void setRuleData(LinkedHashMap<?, ?> ruleData) { + this.ruleData = ruleData; + } + public LinkedHashMap<?, ?> getRuleListData() { + return ruleListData; + } + public void setRuleListData(LinkedHashMap<?, ?> ruleListData) { + this.ruleListData = ruleListData; + } + public String getSecurityZone() { + return securityZone; + } + public void setSecurityZone(String securityZone) { + this.securityZone = securityZone; + } + public String getActionAttributeValue() { + return actionAttributeValue; + } + public void setActionAttributeValue(String actionAttributeValue) { + this.actionAttributeValue = actionAttributeValue; + } + public String getRuleProvider() { + return ruleProvider; + } + public void setRuleProvider(String ruleProvider) { + this.ruleProvider = ruleProvider; + } + public String getMsLocation() { + return msLocation; + } + public void setMsLocation(String msLocation) { + this.msLocation = msLocation; + } + public Map<String,String> getDrlRuleAndUIParams() { + return drlRuleAndUIParams; + } + public void setDrlRuleAndUIParams(Map<String,String> drlRuleAndUIParams) { + this.drlRuleAndUIParams = drlRuleAndUIParams; + } + public String getActionBody() { + return actionBody; + } + public void setActionBody(String actionBody) { + this.actionBody = actionBody; + } + public String getActionDictHeader() { + return actionDictHeader; + } + public void setActionDictHeader(String actionDictHeader) { + this.actionDictHeader = actionDictHeader; + } + public String getActionDictType() { + return actionDictType; + } + public void setActionDictType(String actionDictType) { + this.actionDictType = actionDictType; + } + public String getActionDictUrl() { + return actionDictUrl; + } + public void setActionDictUrl(String actionDictUrl) { + this.actionDictUrl = actionDictUrl; + } + public String getActionDictMethod() { + return actionDictMethod; + } + public void setActionDictMethod(String actionDictMethod) { + this.actionDictMethod = actionDictMethod; + } + public String getClWarning() { + return clWarning; + } + public void setClWarning(String clWarning) { + this.clWarning = clWarning; + } + public String getNewCLName() { + return newCLName; + } + public void setNewCLName(String newCLName) { + this.newCLName = newCLName; + } + public String getExistingCLName() { + return existingCLName; + } + public void setExistingCLName(String existingCLName) { + this.existingCLName = existingCLName; + } + public YAMLParams getYamlparams() { + return yamlparams; + } + public void setYamlparams(YAMLParams yamlparams) { + this.yamlparams = yamlparams; + } + /** + * @return the rainyday + */ + public RainyDayParams getRainyday() { + return rainyday; + } + /** + * @param rainyday the rainyday to set + */ + public void setRainyday(RainyDayParams rainyday) { + this.rainyday = rainyday; + } + /** + * @return the errorCodeList + */ + public List<String> getErrorCodeList() { + return errorCodeList; + } + /** + * @param errorCodeList the errorCodeList to set + */ + public void setErrorCodeList(List<String> errorCodeList) { + this.errorCodeList = errorCodeList; + } + /** + * @return the treatmentList + */ + public List<String> getTreatmentList() { + return treatmentList; + } + /** + * @param treatmentList the treatmentList to set + */ + public void setTreatmentList(List<String> treatmentList) { + this.treatmentList = treatmentList; + } + /** + * @return the rainydayMap + */ + public Map<String,String> getRainydayMap() { + return rainydayMap; + } + /** + * @param rainydayMap the rainydayMap to set + */ + public void setRainydayMap(Map<String,String> rainydayMap) { + this.rainydayMap = rainydayMap; + } + /** + * @return the policyJSON + */ + public Object getPolicyJSON() { + return policyJSON; + } + /** + * @param policyJSON the policyJSON to set + */ + public void setPolicyJSON(Object policyJSON) { + this.policyJSON = policyJSON; + } + + public ClosedLoopFaultTrapDatas getTrapDatas() { + return trapDatas; + } + public void setTrapDatas(ClosedLoopFaultTrapDatas trapDatas) { + this.trapDatas = trapDatas; + } + public ClosedLoopFaultTrapDatas getFaultDatas() { + return faultDatas; + } + public void setFaultDatas(ClosedLoopFaultTrapDatas faultDatas) { + this.faultDatas = faultDatas; + } + public List<String> getAppendBlackListEntries() { + return appendBlackListEntries; + } + public void setAppendBlackListEntries(List<String> appendBlackListEntries) { + this.appendBlackListEntries = appendBlackListEntries; + } + public List<String> getBlackListEntries() { + return blackListEntries; + } + public void setBlackListEntries(List<String> blackListEntries) { + this.blackListEntries = blackListEntries; + } + public String getBlackListEntryType() { + return blackListEntryType; + } + public void setBlackListEntryType(String blackListEntryType) { + this.blackListEntryType = blackListEntryType; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PrefixIPList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PrefixIPList.java index 23ae537bb..5c764dada 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PrefixIPList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PrefixIPList.java @@ -49,16 +49,16 @@ public class PrefixIPList { public List<AddressMembers> getMembers() { - if(members==null) - { - members= new ArrayList<>(); - } + if(members==null) + { + members= new ArrayList<>(); + } return this.members; } - public void setMembers(List<AddressMembers> members) - { - this.members = members; - } + public void setMembers(List<AddressMembers> members) + { + this.members = members; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/RainyDayParams.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/RainyDayParams.java index ce31b88ee..54635f3e5 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/RainyDayParams.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/RainyDayParams.java @@ -23,97 +23,97 @@ package org.onap.policy.rest.adapter; import java.util.List; public class RainyDayParams { - private String serviceType; - private String vnfType; - private String bbid; - private String workstep; - private List<Object> treatmentTableChoices; - private List<String> errorcode; - private List<String> treatment; + private String serviceType; + private String vnfType; + private String bbid; + private String workstep; + private List<Object> treatmentTableChoices; + private List<String> errorcode; + private List<String> treatment; + + /** + * @return the serviceType + */ + public String getServiceType() { + return serviceType; + } + /** + * @param serviceType the serviceType to set + */ + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + /** + * @return the vnfType + */ + public String getVnfType() { + return vnfType; + } + /** + * @param vnfType the vnfType to set + */ + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + /** + * @return the workstep + */ + public String getWorkstep() { + return workstep; + } + /** + * @param workstep the workstep to set + */ + public void setWorkstep(String workstep) { + this.workstep = workstep; + } + /** + * @return the bbid + */ + public String getBbid() { + return bbid; + } + /** + * @param bbid the bbid to set + */ + public void setBbid(String bbid) { + this.bbid = bbid; + } + /** + * @return the treatmentTableChoices + */ + public List<Object> getTreatmentTableChoices() { + return treatmentTableChoices; + } + /** + * @param treatmentTableChoices the treatmentTableChoices to set + */ + public void setTreatmentTableChoices(List<Object> treatmentTableChoices) { + this.treatmentTableChoices = treatmentTableChoices; + } + /** + * @return the errorcode + */ + public List<String> getErrorcode() { + return errorcode; + } + /** + * @param errorcode the errorcode to set + */ + public void setErrorcode(List<String> errorcode) { + this.errorcode = errorcode; + } + /** + * @return the treatment + */ + public List<String> getTreatment() { + return treatment; + } + /** + * @param treatment the treatment to set + */ + public void setTreatment(List<String> treatment) { + this.treatment = treatment; + } - /** - * @return the serviceType - */ - public String getServiceType() { - return serviceType; - } - /** - * @param serviceType the serviceType to set - */ - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - /** - * @return the vnfType - */ - public String getVnfType() { - return vnfType; - } - /** - * @param vnfType the vnfType to set - */ - public void setVnfType(String vnfType) { - this.vnfType = vnfType; - } - /** - * @return the workstep - */ - public String getWorkstep() { - return workstep; - } - /** - * @param workstep the workstep to set - */ - public void setWorkstep(String workstep) { - this.workstep = workstep; - } - /** - * @return the bbid - */ - public String getBbid() { - return bbid; - } - /** - * @param bbid the bbid to set - */ - public void setBbid(String bbid) { - this.bbid = bbid; - } - /** - * @return the treatmentTableChoices - */ - public List<Object> getTreatmentTableChoices() { - return treatmentTableChoices; - } - /** - * @param treatmentTableChoices the treatmentTableChoices to set - */ - public void setTreatmentTableChoices(List<Object> treatmentTableChoices) { - this.treatmentTableChoices = treatmentTableChoices; - } - /** - * @return the errorcode - */ - public List<String> getErrorcode() { - return errorcode; - } - /** - * @param errorcode the errorcode to set - */ - public void setErrorcode(List<String> errorcode) { - this.errorcode = errorcode; - } - /** - * @return the treatment - */ - public List<String> getTreatment() { - return treatment; - } - /** - * @param treatment the treatment to set - */ - public void setTreatment(List<String> treatment) { - this.treatment = treatment; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceGroupJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceGroupJson.java index 363f73f7e..4c8708d7a 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceGroupJson.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceGroupJson.java @@ -26,60 +26,60 @@ import java.util.List; public class ServiceGroupJson { - protected String name; - protected String description; - protected List<ServiceMembers> members; - - // name - public String getName() { - return name; - } + protected String name; + protected String description; + protected List<ServiceMembers> members; - public void setName(String value) { - this.name = value; - } + // name + public String getName() { + return name; + } + + public void setName(String value) { + this.name = value; + } + + @Override + public boolean equals(Object obj){ + if(obj == null){ + return false; + } + if(this.getClass() != obj.getClass()){ + return false; + } + ServiceGroupJson servGroupobj=(ServiceGroupJson) obj; + if(this.getName().equals(servGroupobj.getName())){ + return true; + } + return false; + } - @Override - public boolean equals(Object obj){ - if(obj == null){ - return false; - } - if(this.getClass() != obj.getClass()){ - return false; - } - ServiceGroupJson servGroupobj=(ServiceGroupJson) obj; - if(this.getName().equals(servGroupobj.getName())){ - return true; - } - return false; - } + @Override + public int hashCode() { + return Integer.valueOf(name.charAt(0)+(name.charAt(1))); + } - @Override - public int hashCode() { - return Integer.valueOf(name.charAt(0)+(name.charAt(1))); - } - - // description - public String getDescription() { - return description; - } + // description + public String getDescription() { + return description; + } + + public void setDescription(String value) { + this.description = value; + } - public void setDescription(String value) { - this.description = value; - } - - public List<ServiceMembers> getMembers() + public List<ServiceMembers> getMembers() { - if(members==null) - { - members= new ArrayList<>(); - } + if(members==null) + { + members= new ArrayList<>(); + } return this.members; } - public void setMembers(List<ServiceMembers> members) - { - this.members = members; - } + public void setMembers(List<ServiceMembers> members) + { + this.members = members; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceListJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceListJson.java index f80f51908..0ca4ce6b9 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceListJson.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceListJson.java @@ -24,90 +24,90 @@ package org.onap.policy.rest.adapter; public class ServiceListJson { - protected String name; - protected String description; - protected String type; - protected String transportProtocol; - protected String appProtocol; - protected String ports; - // name - public String getName() { - return name; - } - - public void setName(String value) { - this.name = value; - } - - @Override - public boolean equals(Object obj){ - if(obj == null){ - return false; - } - if(this.getClass() != obj.getClass()){ - return false; - } - ServiceListJson servobj=(ServiceListJson) obj; - if(this.getName().equals(servobj.getName())){ - return true; - } - return false; - } - - @Override - public int hashCode() { - if(name!=null){ - return Integer.valueOf(name.charAt(0)+(name.charAt(1))); - }else{ - return 0; - } - } - - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - // type - public String getType() { - return type; - } - - public void setType(String value) { - this.type = value; - } - - // transportProtocol - public String getTransportProtocol() { - return transportProtocol; - } - - public void setTransportProtocol(String value) { - this.transportProtocol = value; - } - - // appProtocol - public String getAppProtocol() { - return appProtocol; - } - - public void setAppProtocol(String value) { - this.appProtocol = value; - } - - // ports - public String getPorts() { - return ports; - } - - public void setPorts(String value) { - this.ports = value; - } - - + protected String name; + protected String description; + protected String type; + protected String transportProtocol; + protected String appProtocol; + protected String ports; + // name + public String getName() { + return name; + } + + public void setName(String value) { + this.name = value; + } + + @Override + public boolean equals(Object obj){ + if(obj == null){ + return false; + } + if(this.getClass() != obj.getClass()){ + return false; + } + ServiceListJson servobj=(ServiceListJson) obj; + if(this.getName().equals(servobj.getName())){ + return true; + } + return false; + } + + @Override + public int hashCode() { + if(name!=null){ + return Integer.valueOf(name.charAt(0)+(name.charAt(1))); + }else{ + return 0; + } + } + + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + // type + public String getType() { + return type; + } + + public void setType(String value) { + this.type = value; + } + + // transportProtocol + public String getTransportProtocol() { + return transportProtocol; + } + + public void setTransportProtocol(String value) { + this.transportProtocol = value; + } + + // appProtocol + public String getAppProtocol() { + return appProtocol; + } + + public void setAppProtocol(String value) { + this.appProtocol = value; + } + + // ports + public String getPorts() { + return ports; + } + + public void setPorts(String value) { + this.ports = value; + } + + } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceMembers.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceMembers.java index 632d5a4e8..107f18aa3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceMembers.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceMembers.java @@ -24,25 +24,25 @@ package org.onap.policy.rest.adapter; public class ServiceMembers { - protected String type; - protected String name; - - // type - public String getType() { - return type; - } - - public void setType(String value) { - this.type = value; - } - - // transportProtocol - public String getName() { - return name; - } - - public void setName(String value) { - this.name = value; - } + protected String type; + protected String name; + + // type + public String getType() { + return type; + } + + public void setType(String value) { + this.type = value; + } + + // transportProtocol + public String getName() { + return name; + } + + public void setName(String value) { + this.name = value; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServicesJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServicesJson.java index 5cb9e9801..30963d998 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServicesJson.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServicesJson.java @@ -23,22 +23,22 @@ package org.onap.policy.rest.adapter; public class ServicesJson { - protected String type; - protected String name; - // type - public String getType() { - return type; - } + protected String type; + protected String name; + // type + public String getType() { + return type; + } - public void setType(String type) { - this.type = type; - } - - public String getName() { - return name; - } + public void setType(String type) { + this.type = type; + } - public void setName(String value) { - this.name = value; - } + public String getName() { + return name; + } + + public void setName(String value) { + this.name = value; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TagDefines.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TagDefines.java index 339b0e1f5..9066ec49e 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TagDefines.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TagDefines.java @@ -21,21 +21,21 @@ package org.onap.policy.rest.adapter; public class TagDefines { - String key; - String value; - - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - - + String key; + String value; + + public String getKey() { + return key; + } + public void setKey(String key) { + this.key = key; + } + public String getValue() { + return value; + } + public void setValue(String value) { + this.value = value; + } + + } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Tags.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Tags.java index d046a2f97..5f1498be4 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Tags.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Tags.java @@ -25,35 +25,35 @@ import java.util.List; public class Tags { - String ruleName; - List<TagDefines> tags; - String tagPickerName; - String networkRole; - - public String getRuleName() { - return ruleName; - } - public void setRuleName(String ruleName) { - this.ruleName = ruleName; - } - public List<TagDefines> getTags() { - return tags; - } - public void setTags(List<TagDefines> tags) { - this.tags = tags; - } - public String getTagPickerName() { - return tagPickerName; - } - - public void setTagPickerName(String tagPickerName) { - this.tagPickerName = tagPickerName; - } - public String getNetworkRole() { - return networkRole; - } - public void setNetworkRole(String networkRole) { - this.networkRole = networkRole; - } - + String ruleName; + List<TagDefines> tags; + String tagPickerName; + String networkRole; + + public String getRuleName() { + return ruleName; + } + public void setRuleName(String ruleName) { + this.ruleName = ruleName; + } + public List<TagDefines> getTags() { + return tags; + } + public void setTags(List<TagDefines> tags) { + this.tags = tags; + } + public String getTagPickerName() { + return tagPickerName; + } + + public void setTagPickerName(String tagPickerName) { + this.tagPickerName = tagPickerName; + } + public String getNetworkRole() { + return networkRole; + } + public void setNetworkRole(String networkRole) { + this.networkRole = networkRole; + } + } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Term.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Term.java index d709f0df3..ce76da27f 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Term.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Term.java @@ -29,23 +29,23 @@ import java.util.Set; public class Term { - - String position; - protected String ruleName; - protected List<String> fromZones; - protected List<String> toZones; - protected boolean negateSource; //hardcoded - protected boolean negateDestination; //hardcoded - protected List<AddressJson> sourceList; - protected List<AddressJson> destinationList; - protected List<ServicesJson> sourceServices; - protected Set<ServicesJson> destServices; - protected String action; - protected String description; - boolean enabled; //hardcoded - boolean log; //hardcoded - - //position + + String position; + protected String ruleName; + protected List<String> fromZones; + protected List<String> toZones; + protected boolean negateSource; //hardcoded + protected boolean negateDestination; //hardcoded + protected List<AddressJson> sourceList; + protected List<AddressJson> destinationList; + protected List<ServicesJson> sourceServices; + protected Set<ServicesJson> destServices; + protected String action; + protected String description; + boolean enabled; //hardcoded + boolean log; //hardcoded + + //position public String getPosition() { return position; } @@ -65,10 +65,10 @@ public class Term { //From Zone public List<String> getFromZones() { - if (fromZones==null) - { - fromZones= new ArrayList<>(); - } + if (fromZones==null) + { + fromZones= new ArrayList<>(); + } return fromZones; } @@ -78,10 +78,10 @@ public class Term { //To Zone public List<String> getToZones() { - if (toZones==null) - { - toZones= new ArrayList<>(); - } + if (toZones==null) + { + toZones= new ArrayList<>(); + } return toZones; } @@ -111,10 +111,10 @@ public class Term { //SourceList public List<AddressJson> getSourceList() { - if(sourceList==null) - { - sourceList= new ArrayList<>(); - } + if(sourceList==null) + { + sourceList= new ArrayList<>(); + } return this.sourceList; } @@ -125,10 +125,10 @@ public class Term { //Destination List public List<AddressJson> getDestinationList() { - if(destinationList==null) - { - destinationList= new ArrayList<>(); - } + if(destinationList==null) + { + destinationList= new ArrayList<>(); + } return this.destinationList; } @@ -138,31 +138,31 @@ public class Term { //Source Services public List<ServicesJson> getSourceServices() { - if(sourceServices==null) - { - sourceServices= new ArrayList<>(); - } + if(sourceServices==null) + { + sourceServices= new ArrayList<>(); + } return this.sourceServices; } public void setSourceServices(List<ServicesJson> sourceServices) { this.sourceServices = sourceServices; } - + //Destination services. public Set<ServicesJson> getDestServices() { - if(destServices==null) - { - destServices= new HashSet<>(); - } + if(destServices==null) + { + destServices= new HashSet<>(); + } return this.destServices; } public void setDestServices(Set<ServicesJson> destServices) { this.destServices = destServices; } - - //Action + + //Action public String getAction() { return action; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TermCollector.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TermCollector.java index 76a80cb1c..dc221ece4 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TermCollector.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TermCollector.java @@ -29,117 +29,117 @@ import java.util.Set; public class TermCollector { - private String serviceTypeId; - private String configName; - private DeployNowJson deploymentOption; - private String securityZoneId; - private String vendorServiceId; - private VendorSpecificData vendorSpecificData= new VendorSpecificData(); - - protected Set<Object> serviceGroups; - protected Set<Object> addressGroups; - protected List<Term> firewallRuleList; - - protected List<Tags> ruleToTag; - - public List<Tags> getRuleToTag() { - return ruleToTag; - } - - public void setRuleToTag(List<Tags> ruleToTag) { - this.ruleToTag = ruleToTag; - } - - //SecurityTypeId - public String getServiceTypeId() { - return serviceTypeId; - } - - public void setServiceTypeId(String serviceTypeId) { - this.serviceTypeId = serviceTypeId; - } - - //ConfigName - public String getConfigName() { - return configName; - } - - public void setConfigName(String configName) { - this.configName = configName; - } - - //DeploymentControl - public DeployNowJson getDeploymentOption() { - return deploymentOption; - } - - public void setDeploymentOption(DeployNowJson deploymentOption) { - this.deploymentOption = deploymentOption; - } - - //SecurityZoneId - public String getSecurityZoneId() { - return securityZoneId; - } - public void setSecurityZoneId(String securityZoneId) { - this.securityZoneId = securityZoneId; - } - - - //ServiceGroup - public Set<Object> getServiceGroups() { - if(serviceGroups==null) - { - serviceGroups= new HashSet<>(); - } - return this.serviceGroups; - } - - public void setServiceGroups(Set<Object> servListArray) { - this.serviceGroups = servListArray; - } - - //AddressGroup - public Set<Object> getAddressGroups() { - if(addressGroups==null) - { - addressGroups= new HashSet<>(); - } - return this.addressGroups; - } - - public void setAddressGroups(Set<Object> addressGroups) { - this.addressGroups = addressGroups; - } - - //FirewallRuleList - public List<Term> getFirewallRuleList() { - - if(firewallRuleList==null) - { - firewallRuleList= new ArrayList<>(); - } - return this.firewallRuleList; - } - - public void setFirewallRuleList(List<Term> firewallRuleList) { - this.firewallRuleList = firewallRuleList; - } - - //vendorServiceId - public String getVendorServiceId() { - return vendorServiceId; - } - - public void setVendorServiceId(String vendorServiceId) { - this.vendorServiceId = vendorServiceId; - } - - public VendorSpecificData getVendorSpecificData() { - return vendorSpecificData; - } - - public void setVendorSpecificData(VendorSpecificData vendorSpecificData) { - this.vendorSpecificData = vendorSpecificData; - } + private String serviceTypeId; + private String configName; + private DeployNowJson deploymentOption; + private String securityZoneId; + private String vendorServiceId; + private VendorSpecificData vendorSpecificData= new VendorSpecificData(); + + protected Set<Object> serviceGroups; + protected Set<Object> addressGroups; + protected List<Term> firewallRuleList; + + protected List<Tags> ruleToTag; + + public List<Tags> getRuleToTag() { + return ruleToTag; + } + + public void setRuleToTag(List<Tags> ruleToTag) { + this.ruleToTag = ruleToTag; + } + + //SecurityTypeId + public String getServiceTypeId() { + return serviceTypeId; + } + + public void setServiceTypeId(String serviceTypeId) { + this.serviceTypeId = serviceTypeId; + } + + //ConfigName + public String getConfigName() { + return configName; + } + + public void setConfigName(String configName) { + this.configName = configName; + } + + //DeploymentControl + public DeployNowJson getDeploymentOption() { + return deploymentOption; + } + + public void setDeploymentOption(DeployNowJson deploymentOption) { + this.deploymentOption = deploymentOption; + } + + //SecurityZoneId + public String getSecurityZoneId() { + return securityZoneId; + } + public void setSecurityZoneId(String securityZoneId) { + this.securityZoneId = securityZoneId; + } + + + //ServiceGroup + public Set<Object> getServiceGroups() { + if(serviceGroups==null) + { + serviceGroups= new HashSet<>(); + } + return this.serviceGroups; + } + + public void setServiceGroups(Set<Object> servListArray) { + this.serviceGroups = servListArray; + } + + //AddressGroup + public Set<Object> getAddressGroups() { + if(addressGroups==null) + { + addressGroups= new HashSet<>(); + } + return this.addressGroups; + } + + public void setAddressGroups(Set<Object> addressGroups) { + this.addressGroups = addressGroups; + } + + //FirewallRuleList + public List<Term> getFirewallRuleList() { + + if(firewallRuleList==null) + { + firewallRuleList= new ArrayList<>(); + } + return this.firewallRuleList; + } + + public void setFirewallRuleList(List<Term> firewallRuleList) { + this.firewallRuleList = firewallRuleList; + } + + //vendorServiceId + public String getVendorServiceId() { + return vendorServiceId; + } + + public void setVendorServiceId(String vendorServiceId) { + this.vendorServiceId = vendorServiceId; + } + + public VendorSpecificData getVendorSpecificData() { + return vendorSpecificData; + } + + public void setVendorSpecificData(VendorSpecificData vendorSpecificData) { + this.vendorSpecificData = vendorSpecificData; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/VendorSpecificData.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/VendorSpecificData.java index a9c645e8a..4f665e908 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/VendorSpecificData.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/VendorSpecificData.java @@ -25,14 +25,14 @@ import java.util.List; public class VendorSpecificData { - private List<IdMap> idMap= new ArrayList<>(); + private List<IdMap> idMap= new ArrayList<>(); - public List<IdMap> getIdMap() { - return idMap; - } + public List<IdMap> getIdMap() { + return idMap; + } - public void setIdMap(List<IdMap> idMap) { - this.idMap = idMap; - } + public void setIdMap(List<IdMap> idMap) { + this.idMap = idMap; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java index e67a23ad8..ec43a19f2 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java @@ -23,75 +23,75 @@ package org.onap.policy.rest.adapter; import java.util.List; public class YAMLParams { - private String actor; - private String recipe; - private String clname; - private String limit; - private String timeWindow; - private String timeUnits; - private String guardActiveStart; - private String guardActiveEnd; - private List<String> blackList; - private List<String> targets; - - public String getActor() { - return actor; - } - public void setActor(String actor) { - this.actor = actor; - } - public String getRecipe() { - return recipe; - } - public void setRecipe(String recipe) { - this.recipe = recipe; - } - public String getLimit() { - return limit; - } - public void setLimit(String limit) { - this.limit = limit; - } - public String getTimeWindow() { - return timeWindow; - } - public void setTimeWindow(String timeWindow) { - this.timeWindow = timeWindow; - } - public String getGuardActiveStart() { - return guardActiveStart; - } - public void setGuardActiveStart(String guardActiveStart) { - this.guardActiveStart = guardActiveStart; - } - public String getGuardActiveEnd() { - return guardActiveEnd; - } - public void setGuardActiveEnd(String guardActiveEnd) { - this.guardActiveEnd = guardActiveEnd; - } - public List<String> getBlackList() { - return blackList; - } - public void setBlackList(List<String> blackList) { - this.blackList = blackList; - } - public String getClname() { - return clname; - } - public void setClname(String clname) { - this.clname = clname; - } - public String getTimeUnits() { - return timeUnits; - } - public void setTimeUnits(String timeUnits) { - this.timeUnits = timeUnits; - } - public List<String> getTargets() { - return targets; - } - public void setTargets(List<String> targets) { - this.targets = targets; - } + private String actor; + private String recipe; + private String clname; + private String limit; + private String timeWindow; + private String timeUnits; + private String guardActiveStart; + private String guardActiveEnd; + private List<String> blackList; + private List<String> targets; + + public String getActor() { + return actor; + } + public void setActor(String actor) { + this.actor = actor; + } + public String getRecipe() { + return recipe; + } + public void setRecipe(String recipe) { + this.recipe = recipe; + } + public String getLimit() { + return limit; + } + public void setLimit(String limit) { + this.limit = limit; + } + public String getTimeWindow() { + return timeWindow; + } + public void setTimeWindow(String timeWindow) { + this.timeWindow = timeWindow; + } + public String getGuardActiveStart() { + return guardActiveStart; + } + public void setGuardActiveStart(String guardActiveStart) { + this.guardActiveStart = guardActiveStart; + } + public String getGuardActiveEnd() { + return guardActiveEnd; + } + public void setGuardActiveEnd(String guardActiveEnd) { + this.guardActiveEnd = guardActiveEnd; + } + public List<String> getBlackList() { + return blackList; + } + public void setBlackList(List<String> blackList) { + this.blackList = blackList; + } + public String getClname() { + return clname; + } + public void setClname(String clname) { + this.clname = clname; + } + public String getTimeUnits() { + return timeUnits; + } + public void setTimeUnits(String timeUnits) { + this.timeUnits = timeUnits; + } + public List<String> getTargets() { + return targets; + } + public void setTargets(List<String> targets) { + this.targets = targets; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/dao/CommonClassDao.java b/ONAP-REST/src/main/java/org/onap/policy/rest/dao/CommonClassDao.java index 4d0fd40d8..0056a2bf5 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/dao/CommonClassDao.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/dao/CommonClassDao.java @@ -27,31 +27,31 @@ import javax.script.SimpleBindings; public interface CommonClassDao { - //Common methods - List<Object> getData(@SuppressWarnings("rawtypes") Class className); - List<Object> getDataById(@SuppressWarnings("rawtypes") Class className, String columnName, String key); - List<String> getDataByColumn(@SuppressWarnings("rawtypes") Class className, String columnName); - List<Object> checkDuplicateEntry(String value, String columnName, @SuppressWarnings("rawtypes") Class className); - Object getEntityItem(@SuppressWarnings("rawtypes") Class className, String columnName, String key); - List<Object> getDataByQuery(String query, SimpleBindings params); - List<Object> getMultipleDataOnAddingConjunction(@SuppressWarnings("rawtypes") Class className, String columnName, List<String> data); - void save(Object entity); - void delete(Object entity); - void update(Object entity); - void updateQuery(String query); - - //Group Policy Scope - List<Object> checkExistingGroupListforUpdate(String groupListValue, String groupNameValue); - - - //Roles - List<PolicyRoles> getUserRoles(); - - - //ClosedLoops - void updateClAlarms(String clName, String alarms); - void updateClYaml(String clName, String yaml); - void deleteAll(); + //Common methods + List<Object> getData(@SuppressWarnings("rawtypes") Class className); + List<Object> getDataById(@SuppressWarnings("rawtypes") Class className, String columnName, String key); + List<String> getDataByColumn(@SuppressWarnings("rawtypes") Class className, String columnName); + List<Object> checkDuplicateEntry(String value, String columnName, @SuppressWarnings("rawtypes") Class className); + Object getEntityItem(@SuppressWarnings("rawtypes") Class className, String columnName, String key); + List<Object> getDataByQuery(String query, SimpleBindings params); + List<Object> getMultipleDataOnAddingConjunction(@SuppressWarnings("rawtypes") Class className, String columnName, List<String> data); + void save(Object entity); + void delete(Object entity); + void update(Object entity); + void updateQuery(String query); + + //Group Policy Scope + List<Object> checkExistingGroupListforUpdate(String groupListValue, String groupNameValue); + + + //Roles + List<PolicyRoles> getUserRoles(); + + + //ClosedLoops + void updateClAlarms(String clName, String alarms); + void updateClYaml(String clName, String yaml); + void deleteAll(); diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImpl.java b/ONAP-REST/src/main/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImpl.java index 8aa04356f..66401ccb3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImpl.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImpl.java @@ -47,10 +47,10 @@ import org.springframework.stereotype.Component; @Component public class PolicyValidationDaoImpl implements CommonClassDao{ - private static final Logger LOGGER = FlexLogger.getLogger(PolicyValidationDaoImpl.class); - private static final String DB_CONNECTION_CLOSING_ERROR = "Error While Closing Connection/Statement"; - private static final String DBTABLE_QUERY_ERROR = "Error While Querying Table"; - private static SessionFactory sessionfactory; + private static final Logger LOGGER = FlexLogger.getLogger(PolicyValidationDaoImpl.class); + private static final String DB_CONNECTION_CLOSING_ERROR = "Error While Closing Connection/Statement"; + private static final String DBTABLE_QUERY_ERROR = "Error While Querying Table"; + private static SessionFactory sessionfactory; public static SessionFactory getSessionfactory() { return sessionfactory; @@ -69,350 +69,350 @@ public class PolicyValidationDaoImpl implements CommonClassDao{ //Default Constructor } - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public List<Object> getData(Class className) { - Session session = sessionfactory.openSession(); - List<Object> data = null; - try{ - Criteria cr = session.createCriteria(className); - data = cr.list(); - }catch(Exception e){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + e); - }finally{ - try{ - session.close(); - }catch(Exception e){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR+e); - } - } - return data; - } - - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public List<Object> getDataById(Class className, String columnName, String key) { - Session session = sessionfactory.openSession(); - List<Object> data = null; - try { - Criteria cr = session.createCriteria(className); - if(columnName.contains(":") && key.contains(":")){ - String[] columns = columnName.split(":"); - String[] keys = key.split(":"); - for(int i=0; i < columns.length; i++){ - cr.add(Restrictions.eq(columns[i], keys[i])); - } - }else{ - cr.add(Restrictions.eq(columnName, key)); - } - data = cr.list(); - } catch (Exception e) { - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + e); - }finally{ - try{ - session.close(); - }catch(Exception e1){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); - } - } - return data; - } - - @Override - public void save(Object entity) { - Session session = sessionfactory.openSession(); - Transaction tx = session.beginTransaction(); - try { - session.persist(entity); - tx.commit(); - }catch(Exception e){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving data to Table"+e); - }finally{ - try{ - session.close(); - }catch(Exception e1){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); - } - } - - } - - @Override - public void delete(Object entity) { - Session session = sessionfactory.openSession(); - Transaction tx = session.beginTransaction(); - try { - session.delete(entity); - tx.commit(); - }catch(Exception e){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting data from Table"+e); - }finally{ - try{ - session.close(); - }catch(Exception e1){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); - } - } - - } - - - @Override - public void update(Object entity) { - Session session = sessionfactory.openSession(); - Transaction tx = session.beginTransaction(); - try { - session.update(entity); - tx.commit(); - }catch(Exception e){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating data to Table"+e); - }finally{ - try{ - session.close(); - }catch(Exception e1){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); - } - } - - } - - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public List<Object> checkDuplicateEntry(String value, String columnName, Class className) { - Session session = sessionfactory.openSession(); - Transaction tx = session.beginTransaction(); - List<Object> data = null; - String[] columnNames = null; - if(columnName != null && columnName.contains(":")){ - columnNames = columnName.split(":"); - } - String[] values = null; - if(value != null && value.contains(":")){ - values = value.split(":"); - } - try { - Criteria cr = session.createCriteria(className); - if(columnNames != null && values != null && columnNames.length == values.length){ - for (int i = 0; i < columnNames.length; i++){ - cr.add(Restrictions.eq(columnNames[i],values[i])); - } - }else{ - cr.add(Restrictions.eq(columnName,value)); - } - data = cr.list(); - tx.commit(); - } catch (Exception e) { - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying for Duplicate Entries for Table"+e + className); - }finally{ - try{ - session.close(); - }catch(Exception e1){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); - } - } - return data; - } - - - @SuppressWarnings("unchecked") - @Override - public List<PolicyRoles> getUserRoles() { - Session session = sessionfactory.openSession(); - Transaction tx = session.beginTransaction(); - List<PolicyRoles> rolesData = null; - try { - Criteria cr = session.createCriteria(PolicyRoles.class); - Disjunction disjunction = Restrictions.disjunction(); - Conjunction conjunction1 = Restrictions.conjunction(); - conjunction1.add(Restrictions.eq("role", "admin")); - Conjunction conjunction2 = Restrictions.conjunction(); - conjunction2.add(Restrictions.eq("role", "editor")); - Conjunction conjunction3 = Restrictions.conjunction(); - conjunction3.add(Restrictions.eq("role", "guest")); - disjunction.add(conjunction1); - disjunction.add(conjunction2); - disjunction.add(conjunction3); - rolesData = cr.add(disjunction).list(); - tx.commit(); - } catch (Exception e) { - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyRoles Table"+e); - }finally{ - try{ - session.close(); - }catch(Exception e1){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); - } - } - return rolesData; - } - - - @Override - public List<Object> checkExistingGroupListforUpdate(String arg0, String arg1) { - return Collections.emptyList(); - } - - - @Override - public void deleteAll() { - // Do nothing because this method is not used and is a placeholder to avoid 'Unimplemented Method' error - } - - - @SuppressWarnings("unchecked") - @Override - public List<Object> getDataByQuery(String query, SimpleBindings params) { - Session session = sessionfactory.openSession(); - Transaction tx = session.beginTransaction(); - List<Object> data = null; - try { - Query hbquery = session.createQuery(query); - for (Map.Entry<String, Object> paramPair : params.entrySet()) { - if(paramPair.getValue() instanceof java.lang.Long){ - hbquery.setLong(paramPair.getKey(), (long) paramPair.getValue()); - } - else{ - hbquery.setParameter(paramPair.getKey(), paramPair.getValue()); - } - } - data = hbquery.list(); - tx.commit(); - } catch (Exception e) { - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + e); - throw e; - }finally{ - try{ - session.close(); - }catch(HibernateException e1){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); - } - } - return data; - } - - - @SuppressWarnings("rawtypes") - @Override - public Object getEntityItem(Class className, String columnName, String key) { - Session session = sessionfactory.openSession(); - Transaction tx = session.beginTransaction(); - Object data = null; - try { - Criteria cr = session.createCriteria(className); - if(columnName.contains(":") && key.contains(":")){ - String[] columns = columnName.split(":"); - String[] keys = key.split(":"); - for(int i=0; i < columns.length; i++){ - cr.add(Restrictions.eq(columns[i], keys[i])); - } - }else{ - cr.add(Restrictions.eq(columnName, key)); - } - data = cr.list().get(0); - tx.commit(); - } catch (Exception e) { - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + e); - }finally{ - try{ - session.close(); - }catch(Exception e1){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); - } - } - return data; - } - - - @Override - public void updateClAlarms(String arg0, String arg1) { - // Do nothing because this method is not used and is a placeholder to avoid 'Unimplemented Method' error - } - - - @Override - public void updateClYaml(String arg0, String arg1) { - // Do nothing because this method is not used and is a placeholder to avoid 'Unimplemented Method' error - } - - - @Override - public void updateQuery(String query) { - Session session = sessionfactory.openSession(); - Transaction tx = session.beginTransaction(); - try { - Query hbquery = session.createQuery(query); - hbquery.executeUpdate(); - tx.commit(); - } catch (Exception e) { - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating Database Table"+e); - }finally{ - try{ - session.close(); - }catch(Exception e1){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); - } - } - - } - - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public List<String> getDataByColumn(Class className, String columnName) { - Session session = sessionfactory.openSession(); - List<String> data = null; - try{ - Criteria cr = session.createCriteria(className); - cr.setProjection(Projections.property(columnName)); - data = cr.list(); - }catch(Exception e){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + e); - }finally{ - try{ - session.close(); - }catch(Exception e){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e); - } - } - return data; - } - - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public List<Object> getMultipleDataOnAddingConjunction(Class className, String columnName, List<String> data) { - Session session = sessionfactory.openSession(); - Transaction tx = session.beginTransaction(); - List<Object> entityData = null; - try { - Criteria cr = session.createCriteria(className); - Disjunction disjunction = Restrictions.disjunction(); - List<Conjunction> conjunctionList = new ArrayList<>(); - String[] columNames = columnName.split(":"); - for(int i =0; i < data.size(); i++){ - String[] entiySplit = data.get(i).split(":"); - Conjunction conjunction = Restrictions.conjunction(); - conjunction.add(Restrictions.eq(columNames[0], entiySplit[0])); - conjunction.add(Restrictions.eq(columNames[1], entiySplit[1])); - conjunctionList.add(conjunction); - } - for(int j =0 ; j < conjunctionList.size(); j++){ - disjunction.add(conjunctionList.get(j)); - } - entityData = cr.add(disjunction).list(); - tx.commit(); - } catch (Exception e) { - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + className + e); - }finally{ - try{ - session.close(); - }catch(Exception e1){ - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); - } - } - return entityData; - } + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public List<Object> getData(Class className) { + Session session = sessionfactory.openSession(); + List<Object> data = null; + try{ + Criteria cr = session.createCriteria(className); + data = cr.list(); + }catch(Exception e){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + e); + }finally{ + try{ + session.close(); + }catch(Exception e){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR+e); + } + } + return data; + } + + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public List<Object> getDataById(Class className, String columnName, String key) { + Session session = sessionfactory.openSession(); + List<Object> data = null; + try { + Criteria cr = session.createCriteria(className); + if(columnName.contains(":") && key.contains(":")){ + String[] columns = columnName.split(":"); + String[] keys = key.split(":"); + for(int i=0; i < columns.length; i++){ + cr.add(Restrictions.eq(columns[i], keys[i])); + } + }else{ + cr.add(Restrictions.eq(columnName, key)); + } + data = cr.list(); + } catch (Exception e) { + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + e); + }finally{ + try{ + session.close(); + }catch(Exception e1){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); + } + } + return data; + } + + @Override + public void save(Object entity) { + Session session = sessionfactory.openSession(); + Transaction tx = session.beginTransaction(); + try { + session.persist(entity); + tx.commit(); + }catch(Exception e){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving data to Table"+e); + }finally{ + try{ + session.close(); + }catch(Exception e1){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); + } + } + + } + + @Override + public void delete(Object entity) { + Session session = sessionfactory.openSession(); + Transaction tx = session.beginTransaction(); + try { + session.delete(entity); + tx.commit(); + }catch(Exception e){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting data from Table"+e); + }finally{ + try{ + session.close(); + }catch(Exception e1){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); + } + } + + } + + + @Override + public void update(Object entity) { + Session session = sessionfactory.openSession(); + Transaction tx = session.beginTransaction(); + try { + session.update(entity); + tx.commit(); + }catch(Exception e){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating data to Table"+e); + }finally{ + try{ + session.close(); + }catch(Exception e1){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); + } + } + + } + + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public List<Object> checkDuplicateEntry(String value, String columnName, Class className) { + Session session = sessionfactory.openSession(); + Transaction tx = session.beginTransaction(); + List<Object> data = null; + String[] columnNames = null; + if(columnName != null && columnName.contains(":")){ + columnNames = columnName.split(":"); + } + String[] values = null; + if(value != null && value.contains(":")){ + values = value.split(":"); + } + try { + Criteria cr = session.createCriteria(className); + if(columnNames != null && values != null && columnNames.length == values.length){ + for (int i = 0; i < columnNames.length; i++){ + cr.add(Restrictions.eq(columnNames[i],values[i])); + } + }else{ + cr.add(Restrictions.eq(columnName,value)); + } + data = cr.list(); + tx.commit(); + } catch (Exception e) { + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying for Duplicate Entries for Table"+e + className); + }finally{ + try{ + session.close(); + }catch(Exception e1){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); + } + } + return data; + } + + + @SuppressWarnings("unchecked") + @Override + public List<PolicyRoles> getUserRoles() { + Session session = sessionfactory.openSession(); + Transaction tx = session.beginTransaction(); + List<PolicyRoles> rolesData = null; + try { + Criteria cr = session.createCriteria(PolicyRoles.class); + Disjunction disjunction = Restrictions.disjunction(); + Conjunction conjunction1 = Restrictions.conjunction(); + conjunction1.add(Restrictions.eq("role", "admin")); + Conjunction conjunction2 = Restrictions.conjunction(); + conjunction2.add(Restrictions.eq("role", "editor")); + Conjunction conjunction3 = Restrictions.conjunction(); + conjunction3.add(Restrictions.eq("role", "guest")); + disjunction.add(conjunction1); + disjunction.add(conjunction2); + disjunction.add(conjunction3); + rolesData = cr.add(disjunction).list(); + tx.commit(); + } catch (Exception e) { + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyRoles Table"+e); + }finally{ + try{ + session.close(); + }catch(Exception e1){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); + } + } + return rolesData; + } + + + @Override + public List<Object> checkExistingGroupListforUpdate(String arg0, String arg1) { + return Collections.emptyList(); + } + + + @Override + public void deleteAll() { + // Do nothing because this method is not used and is a placeholder to avoid 'Unimplemented Method' error + } + + + @SuppressWarnings("unchecked") + @Override + public List<Object> getDataByQuery(String query, SimpleBindings params) { + Session session = sessionfactory.openSession(); + Transaction tx = session.beginTransaction(); + List<Object> data = null; + try { + Query hbquery = session.createQuery(query); + for (Map.Entry<String, Object> paramPair : params.entrySet()) { + if(paramPair.getValue() instanceof java.lang.Long){ + hbquery.setLong(paramPair.getKey(), (long) paramPair.getValue()); + } + else{ + hbquery.setParameter(paramPair.getKey(), paramPair.getValue()); + } + } + data = hbquery.list(); + tx.commit(); + } catch (Exception e) { + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + e); + throw e; + }finally{ + try{ + session.close(); + }catch(HibernateException e1){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); + } + } + return data; + } + + + @SuppressWarnings("rawtypes") + @Override + public Object getEntityItem(Class className, String columnName, String key) { + Session session = sessionfactory.openSession(); + Transaction tx = session.beginTransaction(); + Object data = null; + try { + Criteria cr = session.createCriteria(className); + if(columnName.contains(":") && key.contains(":")){ + String[] columns = columnName.split(":"); + String[] keys = key.split(":"); + for(int i=0; i < columns.length; i++){ + cr.add(Restrictions.eq(columns[i], keys[i])); + } + }else{ + cr.add(Restrictions.eq(columnName, key)); + } + data = cr.list().get(0); + tx.commit(); + } catch (Exception e) { + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + e); + }finally{ + try{ + session.close(); + }catch(Exception e1){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); + } + } + return data; + } + + + @Override + public void updateClAlarms(String arg0, String arg1) { + // Do nothing because this method is not used and is a placeholder to avoid 'Unimplemented Method' error + } + + + @Override + public void updateClYaml(String arg0, String arg1) { + // Do nothing because this method is not used and is a placeholder to avoid 'Unimplemented Method' error + } + + + @Override + public void updateQuery(String query) { + Session session = sessionfactory.openSession(); + Transaction tx = session.beginTransaction(); + try { + Query hbquery = session.createQuery(query); + hbquery.executeUpdate(); + tx.commit(); + } catch (Exception e) { + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating Database Table"+e); + }finally{ + try{ + session.close(); + }catch(Exception e1){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); + } + } + + } + + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public List<String> getDataByColumn(Class className, String columnName) { + Session session = sessionfactory.openSession(); + List<String> data = null; + try{ + Criteria cr = session.createCriteria(className); + cr.setProjection(Projections.property(columnName)); + data = cr.list(); + }catch(Exception e){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + e); + }finally{ + try{ + session.close(); + }catch(Exception e){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e); + } + } + return data; + } + + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public List<Object> getMultipleDataOnAddingConjunction(Class className, String columnName, List<String> data) { + Session session = sessionfactory.openSession(); + Transaction tx = session.beginTransaction(); + List<Object> entityData = null; + try { + Criteria cr = session.createCriteria(className); + Disjunction disjunction = Restrictions.disjunction(); + List<Conjunction> conjunctionList = new ArrayList<>(); + String[] columNames = columnName.split(":"); + for(int i =0; i < data.size(); i++){ + String[] entiySplit = data.get(i).split(":"); + Conjunction conjunction = Restrictions.conjunction(); + conjunction.add(Restrictions.eq(columNames[0], entiySplit[0])); + conjunction.add(Restrictions.eq(columNames[1], entiySplit[1])); + conjunctionList.add(conjunction); + } + for(int j =0 ; j < conjunctionList.size(); j++){ + disjunction.add(conjunctionList.get(j)); + } + entityData = cr.add(disjunction).list(); + tx.commit(); + } catch (Exception e) { + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DBTABLE_QUERY_ERROR + className + e); + }finally{ + try{ + session.close(); + }catch(Exception e1){ + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + DB_CONNECTION_CLOSING_ERROR + e1); + } + } + return entityData; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java index 9336a907b..16f6e7347 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java @@ -48,180 +48,180 @@ import com.fasterxml.jackson.annotation.JsonBackReference; @Entity @Table(name="ActionBodyEntity") @NamedQueries({ - @NamedQuery(name=" ActionBodyEntity.findAll", query="SELECT e FROM ActionBodyEntity e "), - @NamedQuery(name="ActionBodyEntity.deleteAll", query="DELETE FROM ActionBodyEntity WHERE 1=1") + @NamedQuery(name=" ActionBodyEntity.findAll", query="SELECT e FROM ActionBodyEntity e "), + @NamedQuery(name="ActionBodyEntity.deleteAll", query="DELETE FROM ActionBodyEntity WHERE 1=1") }) public class ActionBodyEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="actionBodyId") - @JsonBackReference - private long actionBodyId; - - @Column(name="actionBodyName", nullable=false, length=255) - private String actionBodyName = ""; - - @Version - @Column(name="version") - private int version; - - @Lob - @Column(name="actionBody", nullable=false, columnDefinition="TEXT") - private String actionBody = "NoBody"; - - @Column(name="created_by", nullable=false, length=255) - private String createdBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Column(name="modified_by", nullable=false, length=255) - private String modifiedBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @Column(name="deleted", nullable=false) - private boolean deleted = false; - - public ActionBodyEntity() { - //An empty constructor - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - /** - * @return the configurationDataId - */ - public long getActionBodyId() { - return actionBodyId; - } - /** - * @param name the configuration body name to set - */ - public void setActionBodyName(String name) { - this.actionBodyName = name; - } - public String getActionBodyName(){ - return this.actionBodyName; - } - - /** - * @return the actionBody - */ - public String getActionBody() { - return actionBody; - } - /** - * @param body the configBody to set - */ - public void setActionBody(String body) { - this.actionBody = body; - } - /** - * @return the createdBy - */ - public String getCreatedBy() { - return createdBy; - } - /** - * @param createdBy the createdBy to set - */ - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - /** - * @return the modifiedBy - */ - public String getModifiedBy() { - return modifiedBy; - } - /** - * @param modifiedBy the modifiedBy to set - */ - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } - /** - * @return the modifiedDate - */ - public Date getModifiedDate() { - return modifiedDate; - } - /** - * @param modifiedDate the modifiedDate to set - */ - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - /** - * @return the version - */ - public int getVersion() { - return version; - } - /** - * @return the createdDate - */ - public Date getCreatedDate() { - return createdDate; - } - - /** - * @return the deleted - */ - public boolean isDeleted() { - return deleted; - } - - /** - * @param deleted the deleted to set - */ - public void setDeleted(boolean deleted) { - this.deleted = deleted; - } - - @Override - public int hashCode() { - return Objects.hash(actionBodyId, actionBodyName, version, actionBody, - createdBy, createdDate, modifiedBy, modifiedDate, deleted); - } - - @Override - public boolean equals(Object obj) { - if(obj == null){ - return false; - } - if(obj == this){ - return true; - } - if(!(obj instanceof ActionBodyEntity)){ - return false; - } - - return actionBodyId == ((ActionBodyEntity) obj).actionBodyId && - actionBodyName.equals(((ActionBodyEntity) obj).actionBodyName) && - version == ((ActionBodyEntity) obj).version && - actionBody.equals(((ActionBodyEntity) obj).actionBody) && - createdBy.equals(((ActionBodyEntity) obj).createdBy) && - createdDate.equals(((ActionBodyEntity) obj).createdDate) && - modifiedBy.equals(((ActionBodyEntity) obj).modifiedBy) && - modifiedDate.equals(((ActionBodyEntity) obj).modifiedDate) && - deleted == ((ActionBodyEntity) obj).deleted; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="actionBodyId") + @JsonBackReference + private long actionBodyId; + + @Column(name="actionBodyName", nullable=false, length=255) + private String actionBodyName = ""; + + @Version + @Column(name="version") + private int version; + + @Lob + @Column(name="actionBody", nullable=false, columnDefinition="TEXT") + private String actionBody = "NoBody"; + + @Column(name="created_by", nullable=false, length=255) + private String createdBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Column(name="modified_by", nullable=false, length=255) + private String modifiedBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @Column(name="deleted", nullable=false) + private boolean deleted = false; + + public ActionBodyEntity() { + //An empty constructor + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + /** + * @return the configurationDataId + */ + public long getActionBodyId() { + return actionBodyId; + } + /** + * @param name the configuration body name to set + */ + public void setActionBodyName(String name) { + this.actionBodyName = name; + } + public String getActionBodyName(){ + return this.actionBodyName; + } + + /** + * @return the actionBody + */ + public String getActionBody() { + return actionBody; + } + /** + * @param body the configBody to set + */ + public void setActionBody(String body) { + this.actionBody = body; + } + /** + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + /** + * @param createdBy the createdBy to set + */ + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + /** + * @return the modifiedBy + */ + public String getModifiedBy() { + return modifiedBy; + } + /** + * @param modifiedBy the modifiedBy to set + */ + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + /** + * @return the modifiedDate + */ + public Date getModifiedDate() { + return modifiedDate; + } + /** + * @param modifiedDate the modifiedDate to set + */ + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + /** + * @return the version + */ + public int getVersion() { + return version; + } + /** + * @return the createdDate + */ + public Date getCreatedDate() { + return createdDate; + } + + /** + * @return the deleted + */ + public boolean isDeleted() { + return deleted; + } + + /** + * @param deleted the deleted to set + */ + public void setDeleted(boolean deleted) { + this.deleted = deleted; + } + + @Override + public int hashCode() { + return Objects.hash(actionBodyId, actionBodyName, version, actionBody, + createdBy, createdDate, modifiedBy, modifiedDate, deleted); + } + + @Override + public boolean equals(Object obj) { + if(obj == null){ + return false; + } + if(obj == this){ + return true; + } + if(!(obj instanceof ActionBodyEntity)){ + return false; + } + + return actionBodyId == ((ActionBodyEntity) obj).actionBodyId && + actionBodyName.equals(((ActionBodyEntity) obj).actionBodyName) && + version == ((ActionBodyEntity) obj).version && + actionBody.equals(((ActionBodyEntity) obj).actionBody) && + createdBy.equals(((ActionBodyEntity) obj).createdBy) && + createdDate.equals(((ActionBodyEntity) obj).createdDate) && + modifiedBy.equals(((ActionBodyEntity) obj).modifiedBy) && + modifiedDate.equals(((ActionBodyEntity) obj).modifiedDate) && + deleted == ((ActionBodyEntity) obj).deleted; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java index aeaa14a62..d3e870bff 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java @@ -36,43 +36,43 @@ import javax.persistence.Table; @Table(name="actionlist") @NamedQuery(name="ActionList.findAll", query="SELECT e FROM ActionList e ") public class ActionList implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="actionname", nullable=false) - @OrderBy("asc") - private String actionName; - - @Column(name="description") - private String description; - - public String getActionName() { - return this.actionName; - } + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public void setActionName(String actionName) { - this.actionName = actionName; + @Column(name="actionname", nullable=false) + @OrderBy("asc") + private String actionName; - } - - public String getDescription() { - return this.description; - } + @Column(name="description") + private String description; - public void setDescription(String description) { - this.description = description; - } - public int getId() { - return this.id; - } + public String getActionName() { + return this.actionName; + } + + public void setActionName(String actionName) { + this.actionName = actionName; + + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } - public void setId(int id) { - this.id = id; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java index 7abd9a043..e9a29446d 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java @@ -44,146 +44,146 @@ import javax.persistence.TemporalType; @Entity @Table(name="ActionPolicyDict") @NamedQueries({ - @NamedQuery(name="ActionPolicyDict.findAll", query="SELECT e FROM ActionPolicyDict e") + @NamedQuery(name="ActionPolicyDict.findAll", query="SELECT e FROM ActionPolicyDict e") }) public class ActionPolicyDict implements Serializable { - private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="ATTRIBUTE_NAME", nullable=false) - @OrderBy("asc") - private String attributeName; - - @Column(name="Type", nullable=false) - @OrderBy("asc") - private String type; - - @Column(name="URL", nullable=false) - @OrderBy("asc") - private String url; - - @Column(name="Method", nullable=false) - @OrderBy("asc") - private String method; - - @Column(name="Headers", nullable=true) - @OrderBy("asc") - private String header; - - @Column(name="Body", nullable=true) - @OrderBy("asc") - private String body; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - public int getId() { - return this.id; - } - public void setId(int id) { - this.id = id; - } - - public Date getCreatedDate() { - return this.createdDate; - } - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - public String getDescription() { - return this.description; - } - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - public String getUrl() { - return url; - } - public void setUrl(String url) { - this.url = url; - } - public String getMethod() { - return method; - } - public void setMethod(String method) { - this.method = method; - } - public String getHeader() { - return header; - } - public void setHeader(String header) { - this.header = header; - } - - public String getBody() { - return body; - } - public void setBody(String body) { - this.body = body; - } - public String getAttributeName() { - return attributeName; - } - public void setAttributeName(String attributeName) { - this.attributeName = attributeName; - } + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="ATTRIBUTE_NAME", nullable=false) + @OrderBy("asc") + private String attributeName; + + @Column(name="Type", nullable=false) + @OrderBy("asc") + private String type; + + @Column(name="URL", nullable=false) + @OrderBy("asc") + private String url; + + @Column(name="Method", nullable=false) + @OrderBy("asc") + private String method; + + @Column(name="Headers", nullable=true) + @OrderBy("asc") + private String header; + + @Column(name="Body", nullable=true) + @OrderBy("asc") + private String body; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + public int getId() { + return this.id; + } + public void setId(int id) { + this.id = id; + } + + public Date getCreatedDate() { + return this.createdDate; + } + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + public String getDescription() { + return this.description; + } + public void setDescription(String description) { + this.description = description; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + public String getMethod() { + return method; + } + public void setMethod(String method) { + this.method = method; + } + public String getHeader() { + return header; + } + public void setHeader(String header) { + this.header = header; + } + + public String getBody() { + return body; + } + public void setBody(String body) { + this.body = body; + } + public String getAttributeName() { + return attributeName; + } + public void setAttributeName(String attributeName) { + this.attributeName = attributeName; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java index 4d31ec9e7..c71969a8b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java @@ -36,55 +36,55 @@ import javax.persistence.Table; @Table(name="AddressGroup") @NamedQuery(name="AddressGroup.findAll", query="SELECT e FROM AddressGroup e ") public class AddressGroup implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="prefixlist") - private String prefixList; - - - @Column(name="description") - private String description; - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getGroupName() { - return this.name; - } - - public void setGroupName(String serviceName) { - this.name = serviceName; - - } - - public String getPrefixList() { - return this.prefixList; - } - - public void setServiceList(String prefixList) { - this.prefixList = prefixList; - - } - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; + + @Column(name="prefixlist") + private String prefixList; + + + @Column(name="description") + private String description; + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getGroupName() { + return this.name; + } + + public void setGroupName(String serviceName) { + this.name = serviceName; + + } + + public String getPrefixList() { + return this.prefixList; + } + + public void setServiceList(String prefixList) { + this.prefixList = prefixList; + + } + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java index 3a4624ae1..3389d391e 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java @@ -53,298 +53,298 @@ import com.fasterxml.jackson.annotation.JsonIgnore; @Table(name="Attribute") @NamedQuery(name="Attribute.findAll", query="SELECT a FROM Attribute a order by a.priority asc, a.xacmlId asc") public class Attribute implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - //bi-directional many-to-one association to Category - @ManyToOne - @JoinColumn(name="constraint_type", nullable=true) - @JsonIgnore - private ConstraintType constraintType; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @Column(name="PRIORITY", nullable=true) - @OrderBy("asc") - private String priority; - - @Column(name="ATTRIBUTE_VALUE", nullable=true) - @OrderBy("asc") - private String attributeValue; - - @Column(name="xacml_id", unique = true, nullable=false) - @OrderBy("asc") - private String xacmlId = "urn"; - - //bi-directional many-to-one association to ConstraintValue - @OneToMany(mappedBy="attribute", orphanRemoval=true, cascade=CascadeType.REMOVE) - @JsonIgnore - private Set<ConstraintValue> constraintValues = new HashSet<>(); - - //bi-directional many-to-one association to Category - @ManyToOne - @JoinColumn(name="category") - @JsonIgnore - private Category categoryBean; - - //bi-directional many-to-one association to Datatype - @ManyToOne - @JoinColumn(name="datatype") - private Datatype datatypeBean; - - @Column(name="is_designator", nullable=false) - @JsonIgnore - private char isDesignator = '1'; - - @Column(name="selector_path", nullable=true, length=2048) - private String selectorPath; - - - - @Transient - private String issuer = null; - - @Transient - private boolean mustBePresent = false; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - - public Attribute() { - //An empty constructor - } - - public Attribute(String domain) { - this.xacmlId = domain; - } - - public Attribute(Attribute copy) { - this(copy.getXacmlId() + ":(0)"); - this.constraintType = copy.getConstraintType(); - this.categoryBean = copy.getCategoryBean(); - this.datatypeBean = copy.getDatatypeBean(); - this.description = copy.getDescription(); - for (ConstraintValue value : copy.getConstraintValues()) { - ConstraintValue newValue = new ConstraintValue(value); - newValue.setAttribute(this); - this.addConstraintValue(newValue); - } - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public ConstraintType getConstraintType() { - return this.constraintType; - } - - public void setConstraintType(ConstraintType constraintType) { - this.constraintType = constraintType; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - public String getXacmlId() { - return this.xacmlId; - } - - - public void setXacmlId(String xacmlId) { - this.xacmlId = xacmlId; - } - - public Set<ConstraintValue> getConstraintValues() { - return this.constraintValues; - } - - public void setConstraintValues(Set<ConstraintValue> constraintValues) { - for (ConstraintValue value : this.constraintValues) { - value.setAttribute(this); - } - this.constraintValues = constraintValues; - } - - public ConstraintValue addConstraintValue(ConstraintValue constraintValue) { - if (this.constraintValues == null) { - this.constraintValues = new HashSet<>(); - } - this.constraintValues.add(constraintValue); - constraintValue.setAttribute(this); - - return constraintValue; - } - - public ConstraintValue removeConstraintValue(ConstraintValue constraintValue) { - this.constraintValues.remove(constraintValue); - constraintValue.setAttribute(null); - - return constraintValue; - } - - public void removeAllConstraintValues() { - if (this.constraintValues == null) { - return; - } - for (ConstraintValue value : this.constraintValues) { - value.setAttribute(null); - } - this.constraintValues.clear(); - } - - public Category getCategoryBean() { - return this.categoryBean; - } - - public void setCategoryBean(Category categoryBean) { - this.categoryBean = categoryBean; - } - - public Datatype getDatatypeBean() { - return this.datatypeBean; - } - - public void setDatatypeBean(Datatype datatypeBean) { - this.datatypeBean = datatypeBean; - } - - public char getIsDesignator() { - return this.isDesignator; - } - - public void setIsDesignator(char is) { - this.isDesignator = is; - } - - public String getSelectorPath() { - return this.selectorPath; - } - - public void setSelectorPath(String path) { - this.selectorPath = path; - } - - @Transient - public String getIssuer() { - return issuer; - } - - @Transient - public void setIssuer(String issuer) { - this.issuer = issuer; - } - - @Transient - public boolean isMustBePresent() { - return mustBePresent; - } - - @Transient - public void setMustBePresent(boolean mustBePresent) { - this.mustBePresent = mustBePresent; - } - - @Transient - public boolean isDesignator() { - return this.isDesignator == '1'; - } - - @Transient - public void setIsDesignator(boolean is) { - if (is) { - this.isDesignator = '1'; - } else { - this.isDesignator = '0'; - } - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public String getAttributeValue() { - return attributeValue; - } - - public void setAttributeValue(String attributeValue) { - this.attributeValue = attributeValue; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + //bi-directional many-to-one association to Category + @ManyToOne + @JoinColumn(name="constraint_type", nullable=true) + @JsonIgnore + private ConstraintType constraintType; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @Column(name="PRIORITY", nullable=true) + @OrderBy("asc") + private String priority; + + @Column(name="ATTRIBUTE_VALUE", nullable=true) + @OrderBy("asc") + private String attributeValue; + + @Column(name="xacml_id", unique = true, nullable=false) + @OrderBy("asc") + private String xacmlId = "urn"; + + //bi-directional many-to-one association to ConstraintValue + @OneToMany(mappedBy="attribute", orphanRemoval=true, cascade=CascadeType.REMOVE) + @JsonIgnore + private Set<ConstraintValue> constraintValues = new HashSet<>(); + + //bi-directional many-to-one association to Category + @ManyToOne + @JoinColumn(name="category") + @JsonIgnore + private Category categoryBean; + + //bi-directional many-to-one association to Datatype + @ManyToOne + @JoinColumn(name="datatype") + private Datatype datatypeBean; + + @Column(name="is_designator", nullable=false) + @JsonIgnore + private char isDesignator = '1'; + + @Column(name="selector_path", nullable=true, length=2048) + private String selectorPath; + + + + @Transient + private String issuer = null; + + @Transient + private boolean mustBePresent = false; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + + public Attribute() { + //An empty constructor + } + + public Attribute(String domain) { + this.xacmlId = domain; + } + + public Attribute(Attribute copy) { + this(copy.getXacmlId() + ":(0)"); + this.constraintType = copy.getConstraintType(); + this.categoryBean = copy.getCategoryBean(); + this.datatypeBean = copy.getDatatypeBean(); + this.description = copy.getDescription(); + for (ConstraintValue value : copy.getConstraintValues()) { + ConstraintValue newValue = new ConstraintValue(value); + newValue.setAttribute(this); + this.addConstraintValue(newValue); + } + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public ConstraintType getConstraintType() { + return this.constraintType; + } + + public void setConstraintType(ConstraintType constraintType) { + this.constraintType = constraintType; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public String getXacmlId() { + return this.xacmlId; + } + + + public void setXacmlId(String xacmlId) { + this.xacmlId = xacmlId; + } + + public Set<ConstraintValue> getConstraintValues() { + return this.constraintValues; + } + + public void setConstraintValues(Set<ConstraintValue> constraintValues) { + for (ConstraintValue value : this.constraintValues) { + value.setAttribute(this); + } + this.constraintValues = constraintValues; + } + + public ConstraintValue addConstraintValue(ConstraintValue constraintValue) { + if (this.constraintValues == null) { + this.constraintValues = new HashSet<>(); + } + this.constraintValues.add(constraintValue); + constraintValue.setAttribute(this); + + return constraintValue; + } + + public ConstraintValue removeConstraintValue(ConstraintValue constraintValue) { + this.constraintValues.remove(constraintValue); + constraintValue.setAttribute(null); + + return constraintValue; + } + + public void removeAllConstraintValues() { + if (this.constraintValues == null) { + return; + } + for (ConstraintValue value : this.constraintValues) { + value.setAttribute(null); + } + this.constraintValues.clear(); + } + + public Category getCategoryBean() { + return this.categoryBean; + } + + public void setCategoryBean(Category categoryBean) { + this.categoryBean = categoryBean; + } + + public Datatype getDatatypeBean() { + return this.datatypeBean; + } + + public void setDatatypeBean(Datatype datatypeBean) { + this.datatypeBean = datatypeBean; + } + + public char getIsDesignator() { + return this.isDesignator; + } + + public void setIsDesignator(char is) { + this.isDesignator = is; + } + + public String getSelectorPath() { + return this.selectorPath; + } + + public void setSelectorPath(String path) { + this.selectorPath = path; + } + + @Transient + public String getIssuer() { + return issuer; + } + + @Transient + public void setIssuer(String issuer) { + this.issuer = issuer; + } + + @Transient + public boolean isMustBePresent() { + return mustBePresent; + } + + @Transient + public void setMustBePresent(boolean mustBePresent) { + this.mustBePresent = mustBePresent; + } + + @Transient + public boolean isDesignator() { + return this.isDesignator == '1'; + } + + @Transient + public void setIsDesignator(boolean is) { + if (is) { + this.isDesignator = '1'; + } else { + this.isDesignator = '0'; + } + } + + public String getPriority() { + return priority; + } + + public void setPriority(String priority) { + this.priority = priority; + } + + public String getAttributeValue() { + return attributeValue; + } + + public void setAttributeValue(String attributeValue) { + this.attributeValue = attributeValue; + } } - + diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java index 75e3d681e..d05b2d4af 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java @@ -39,56 +39,56 @@ import javax.persistence.Table; @Table(name="AttributeAssignment") @NamedQuery(name="AttributeAssignment.findAll", query="SELECT a FROM AttributeAssignment a") public class AttributeAssignment implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String EXPRESSION_APPLY = "Apply"; - public static final String EXPRESSION_SELECTOR = "AttributeSelector"; - public static final String EXPRESSION_VALUE = "AttributeValue"; - public static final String EXPRESSION_FUNCTION = "Function"; - public static final String EXPRESSION_REFERENCE = "VarableReference"; - public static final String EXPRESSION_DESIGNATOR = "AttributeDesignator"; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="attribute_id") - private int attributeId; - - //bi-directional many-to-one association to Obadvice - @Column(name="expression", nullable=false) - private String expression; - - //bi-directional many-to-one association to Obadvice - @ManyToOne - private Obadvice obadvice; - - public AttributeAssignment() { - //An empty constructor - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public int getAttributeId() { - return this.attributeId; - } - - public void setAttributeId(int attributeId) { - this.attributeId = attributeId; - } - - public String getExpression() { - return expression; - } - - public void setExpression(String expression) { - this.expression = expression; - } + private static final long serialVersionUID = 1L; + + public static final String EXPRESSION_APPLY = "Apply"; + public static final String EXPRESSION_SELECTOR = "AttributeSelector"; + public static final String EXPRESSION_VALUE = "AttributeValue"; + public static final String EXPRESSION_FUNCTION = "Function"; + public static final String EXPRESSION_REFERENCE = "VarableReference"; + public static final String EXPRESSION_DESIGNATOR = "AttributeDesignator"; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="attribute_id") + private int attributeId; + + //bi-directional many-to-one association to Obadvice + @Column(name="expression", nullable=false) + private String expression; + + //bi-directional many-to-one association to Obadvice + @ManyToOne + private Obadvice obadvice; + + public AttributeAssignment() { + //An empty constructor + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public int getAttributeId() { + return this.attributeId; + } + + public void setAttributeId(int attributeId) { + this.attributeId = attributeId; + } + + public String getExpression() { + return expression; + } + + public void setExpression(String expression) { + this.expression = expression; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java index e1a6f5434..7e47c0fb3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java @@ -51,85 +51,85 @@ import org.onap.policy.rest.jpa.UserInfo; @Table(name="BRMSParamTemplate") @NamedQuery(name="BRMSParamTemplate.findAll", query="SELECT b FROM BRMSParamTemplate b ") public class BRMSParamTemplate implements Serializable{ - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="param_template_name", nullable=false, unique=true) - @OrderBy("asc") - private String ruleName; - - @Lob - @Column(name="rule",nullable=false) - private String rule; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getRule(){ - return this.rule; - } - - public void setRule(String rule){ - this.rule = rule; - } - - public String getRuleName(){ - return this.ruleName; - } - - public void setRuleName(String ruleName){ - this.ruleName = ruleName; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="param_template_name", nullable=false, unique=true) + @OrderBy("asc") + private String ruleName; + + @Lob + @Column(name="rule",nullable=false) + private String rule; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getRule(){ + return this.rule; + } + + public void setRule(String rule){ + this.rule = rule; + } + + public String getRuleName(){ + return this.ruleName; + } + + public void setRuleName(String ruleName){ + this.ruleName = ruleName; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java index 5fc3067f4..94838b4b5 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java @@ -45,106 +45,106 @@ import javax.persistence.TemporalType; @Table(name = "ClosedLoopD2Services") @NamedQuery(name="ClosedLoopD2Services.findAll", query="SELECT c FROM ClosedLoopD2Services c ") public class ClosedLoopD2Services implements Serializable{ - private static final long serialVersionUID = 1L; - - @Id - @Column(name ="id") - @GeneratedValue(strategy = GenerationType.AUTO) - private int id; - - @Column(name="service_Name", nullable=false, unique=true) - @OrderBy("asc") - private String serviceName; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - public ClosedLoopD2Services(){ - //An empty constructor - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public Date getModifiedDate() { - return modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } + private static final long serialVersionUID = 1L; + + @Id + @Column(name ="id") + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + @Column(name="service_Name", nullable=false, unique=true) + @OrderBy("asc") + private String serviceName; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + public ClosedLoopD2Services(){ + //An empty constructor + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public Date getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java index 6db176b12..e81f6123b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java @@ -46,103 +46,103 @@ import javax.persistence.TemporalType; @Table(name = "ClosedLoopSite") @NamedQuery(name="ClosedLoopSite.findAll", query="SELECT c FROM ClosedLoopSite c ") public class ClosedLoopSite implements Serializable{ - private static final long serialVersionUID = 1L; - - - @Id - @Column(name ="id") - @GeneratedValue(strategy = GenerationType.AUTO) - private int id; - - @Column(name="site_Name", nullable=false, unique=true) - @OrderBy("asc") - private String siteName; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getSiteName() { - return siteName; - } - - public void setSiteName(String siteName) { - this.siteName = siteName; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public Date getModifiedDate() { - return modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } + private static final long serialVersionUID = 1L; + + + @Id + @Column(name ="id") + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + @Column(name="site_Name", nullable=false, unique=true) + @OrderBy("asc") + private String siteName; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getSiteName() { + return siteName; + } + + public void setSiteName(String siteName) { + this.siteName = siteName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public Date getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java index 53695d81a..721a2c5f4 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java @@ -35,65 +35,65 @@ import javax.persistence.Table; @Entity @Table(name="ClosedLoops") @NamedQueries({ - @NamedQuery(name="ClosedLoops.findAll", query="SELECT e FROM ClosedLoops e"), - @NamedQuery(name="ClosedLoops.deleteAll", query="DELETE FROM ClosedLoops WHERE 1=1") + @NamedQuery(name="ClosedLoops.findAll", query="SELECT e FROM ClosedLoops e"), + @NamedQuery(name="ClosedLoops.deleteAll", query="DELETE FROM ClosedLoops WHERE 1=1") }) public class ClosedLoops implements Serializable { - /** - * - */ - private static final long serialVersionUID = -7796845092457926842L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="closedLoopControlName", nullable=false, length=255) - @OrderBy("asc") - private String closedLoopControlName; - - @Column(name="alarmConditions", nullable=true, length=255) - private String alarmConditions; - - @Column(name="yaml", nullable=true, length=1028) - private String yaml; - - public ClosedLoops() { - //An empty constructor - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getAlarmConditions() { - return alarmConditions; - } - - public void setAlarmConditions(String alarmConditions) { - this.alarmConditions = alarmConditions; - } - - public String getYaml() { - return yaml; - } - - public void setYaml(String yaml) { - this.yaml = yaml; - } - + /** + * + */ + private static final long serialVersionUID = -7796845092457926842L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="closedLoopControlName", nullable=false, length=255) + @OrderBy("asc") + private String closedLoopControlName; + + @Column(name="alarmConditions", nullable=true, length=255) + private String alarmConditions; + + @Column(name="yaml", nullable=true, length=1028) + private String yaml; + + public ClosedLoops() { + //An empty constructor + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getClosedLoopControlName() { + return closedLoopControlName; + } + + public void setClosedLoopControlName(String closedLoopControlName) { + this.closedLoopControlName = closedLoopControlName; + } + + public String getAlarmConditions() { + return alarmConditions; + } + + public void setAlarmConditions(String alarmConditions) { + this.alarmConditions = alarmConditions; + } + + public String getYaml() { + return yaml; + } + + public void setYaml(String yaml) { + this.yaml = yaml; + } + }
\ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java index 4c15c525e..7bb73f36a 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java @@ -49,210 +49,210 @@ import com.fasterxml.jackson.annotation.JsonBackReference; @Entity @Table(name="ConfigurationDataEntity") @NamedQueries({ - @NamedQuery(name="ConfigurationDataEntity.findAll", query="SELECT e FROM ConfigurationDataEntity e "), - @NamedQuery(name="ConfigurationDataEntity.deleteAll", query="DELETE FROM ConfigurationDataEntity WHERE 1=1") + @NamedQuery(name="ConfigurationDataEntity.findAll", query="SELECT e FROM ConfigurationDataEntity e "), + @NamedQuery(name="ConfigurationDataEntity.deleteAll", query="DELETE FROM ConfigurationDataEntity WHERE 1=1") }) public class ConfigurationDataEntity implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="configurationDataId") - @JsonBackReference - private long configurationDataId; - - @Column(name="configurationName", nullable=false, length=255) - private String configurationName = ""; - - @Version - @Column(name="version") - private int version; - - @Column(name="configType", nullable=false, length=255) - private String configType = "NoType"; - - @Lob - @Column(name="configBody", nullable=false, columnDefinition="TEXT") - private String configBody = "NoBody"; - - @Column(name="created_by", nullable=false, length=255) - private String createdBy = "guest"; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="configurationDataId") + @JsonBackReference + private long configurationDataId; - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; + @Column(name="configurationName", nullable=false, length=255) + private String configurationName = ""; - @Column(name="description", nullable=false, length=2048) - private String description = "NoDescription"; + @Version + @Column(name="version") + private int version; - @Column(name="modified_by", nullable=false, length=255) - private String modifiedBy = "guest"; + @Column(name="configType", nullable=false, length=255) + private String configType = "NoType"; - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @Column(name="deleted", nullable=false) - private boolean deleted = false; + @Lob + @Column(name="configBody", nullable=false, columnDefinition="TEXT") + private String configBody = "NoBody"; - public ConfigurationDataEntity() { - //An empty constructor - } + @Column(name="created_by", nullable=false, length=255) + private String createdBy = "guest"; - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - /** - * @return the configurationDataId - */ - public long getConfigurationDataId() { - return configurationDataId; - } - /** - * @param configurationDataId the configurationDataId to set - */ - public void setConfigurationName(String configurationName) { - this.configurationName = configurationName; - } - public String getConfigurationName(){ - return this.configurationName; - } - /** - * @return the configType - */ - public String getConfigType() { - return configType; - } - /** - * @param configType the configType to set - */ - public void setConfigType(String configType) { - this.configType = configType; - } - /** - * @return the configBody - */ - public String getConfigBody() { - return configBody; - } - /** - * @param configBody the configBody to set - */ - public void setConfigBody(String configBody) { - this.configBody = configBody; - } - /** - * @return the createdBy - */ - public String getCreatedBy() { - return createdBy; - } - /** - * @param createdBy the createdBy to set - */ - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - /** - * @return the description - */ - public String getDescription() { - return description; - } - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - /** - * @return the modifiedBy - */ - public String getModifiedBy() { - return modifiedBy; - } - /** - * @param modifiedBy the modifiedBy to set - */ - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } - /** - * @return the modifiedDate - */ - public Date getModifiedDate() { - return modifiedDate; - } - /** - * @param modifiedDate the modifiedDate to set - */ - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - /** - * @return the version - */ - public int getVersion() { - return version; - } - /** - * @return the createdDate - */ - public Date getCreatedDate() { - return createdDate; - } + @Column(name="description", nullable=false, length=2048) + private String description = "NoDescription"; - /** - * @return the deleted - */ - public boolean isDeleted() { - return deleted; - } + @Column(name="modified_by", nullable=false, length=255) + private String modifiedBy = "guest"; - /** - * @param deleted the deleted to set - */ - public void setDeleted(boolean deleted) { - this.deleted = deleted; - } - - @Override - public int hashCode() { - return Objects.hash(configurationDataId, configurationName, version, configType, - configBody, createdBy, createdDate, description, modifiedBy, modifiedDate, deleted); - } + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; - @Override - public boolean equals(Object obj) { - if(obj == null){ - return false; - } - if(obj == this){ - return true; - } - if(!(obj instanceof ConfigurationDataEntity)){ - return false; - } - - return configurationDataId == ((ConfigurationDataEntity) obj).configurationDataId && - configurationName.equals(((ConfigurationDataEntity) obj).configurationName) && - version == ((ConfigurationDataEntity) obj).version && - configType.equals(((ConfigurationDataEntity) obj).configType) && - configBody.equals(((ConfigurationDataEntity) obj).configBody) && - createdBy.equals(((ConfigurationDataEntity) obj).createdBy) && - createdDate.equals(((ConfigurationDataEntity) obj).createdDate) && - description.equals(((ConfigurationDataEntity) obj).description) && - modifiedBy.equals(((ConfigurationDataEntity) obj).modifiedBy) && - modifiedDate.equals(((ConfigurationDataEntity) obj).modifiedDate) && - deleted == ((ConfigurationDataEntity) obj).deleted; - } + @Column(name="deleted", nullable=false) + private boolean deleted = false; + + public ConfigurationDataEntity() { + //An empty constructor + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + /** + * @return the configurationDataId + */ + public long getConfigurationDataId() { + return configurationDataId; + } + /** + * @param configurationDataId the configurationDataId to set + */ + public void setConfigurationName(String configurationName) { + this.configurationName = configurationName; + } + public String getConfigurationName(){ + return this.configurationName; + } + /** + * @return the configType + */ + public String getConfigType() { + return configType; + } + /** + * @param configType the configType to set + */ + public void setConfigType(String configType) { + this.configType = configType; + } + /** + * @return the configBody + */ + public String getConfigBody() { + return configBody; + } + /** + * @param configBody the configBody to set + */ + public void setConfigBody(String configBody) { + this.configBody = configBody; + } + /** + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + /** + * @param createdBy the createdBy to set + */ + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + /** + * @return the description + */ + public String getDescription() { + return description; + } + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + /** + * @return the modifiedBy + */ + public String getModifiedBy() { + return modifiedBy; + } + /** + * @param modifiedBy the modifiedBy to set + */ + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + /** + * @return the modifiedDate + */ + public Date getModifiedDate() { + return modifiedDate; + } + /** + * @param modifiedDate the modifiedDate to set + */ + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + /** + * @return the version + */ + public int getVersion() { + return version; + } + /** + * @return the createdDate + */ + public Date getCreatedDate() { + return createdDate; + } + + /** + * @return the deleted + */ + public boolean isDeleted() { + return deleted; + } + + /** + * @param deleted the deleted to set + */ + public void setDeleted(boolean deleted) { + this.deleted = deleted; + } + + @Override + public int hashCode() { + return Objects.hash(configurationDataId, configurationName, version, configType, + configBody, createdBy, createdDate, description, modifiedBy, modifiedDate, deleted); + } + + @Override + public boolean equals(Object obj) { + if(obj == null){ + return false; + } + if(obj == this){ + return true; + } + if(!(obj instanceof ConfigurationDataEntity)){ + return false; + } + + return configurationDataId == ((ConfigurationDataEntity) obj).configurationDataId && + configurationName.equals(((ConfigurationDataEntity) obj).configurationName) && + version == ((ConfigurationDataEntity) obj).version && + configType.equals(((ConfigurationDataEntity) obj).configType) && + configBody.equals(((ConfigurationDataEntity) obj).configBody) && + createdBy.equals(((ConfigurationDataEntity) obj).createdBy) && + createdDate.equals(((ConfigurationDataEntity) obj).createdDate) && + description.equals(((ConfigurationDataEntity) obj).description) && + modifiedBy.equals(((ConfigurationDataEntity) obj).modifiedBy) && + modifiedDate.equals(((ConfigurationDataEntity) obj).modifiedDate) && + deleted == ((ConfigurationDataEntity) obj).deleted; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java index 77e883907..606403318 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java @@ -39,83 +39,83 @@ import javax.persistence.Table; @Table(name="ConstraintType") @NamedQuery(name="ConstraintType.findAll", query="SELECT a FROM ConstraintType a") public class ConstraintType implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String ENUMERATION_TYPE = "Enumeration"; - public static final String RANGE_TYPE = "Range"; - public static final String REGEXP_TYPE = "Regular Expression"; - - protected static final Map<String, String> defaults = new HashMap<>(); - static { - defaults.put(ENUMERATION_TYPE, "Enumerate a set of values that the attribute may be set to during policy creation."); - defaults.put(RANGE_TYPE, "Set a range of min and/or max integer/double values the attribute can be set to during policy creation."); - defaults.put(REGEXP_TYPE, "Define a regular expression the attribute must match against during policy creation."); - } - private static final String[] RANGE_TYPES = {"minExclusive", "minInclusive", "maxExclusive", "maxInclusive"}; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="constraint_type", nullable=false, length=64) - private String constraintType; - - @Column(name="description", nullable=false, length=255) - private String description; - - //bi-directional many-to-one association to Attribute - @OneToMany(mappedBy="constraintType") - private Set<Attribute> attributes = new HashSet<>(); - - public ConstraintType() { - //An empty constructor - } - - public ConstraintType(String constraintType) { - this(); - this.constraintType = constraintType; - } - - public ConstraintType(String constraintType, String description) { - this(constraintType); - this.description = description; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getConstraintType() { - return constraintType; - } - - public void setConstraintType(String constraintType) { - this.constraintType = constraintType; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Set<Attribute> getAttributes() { - return attributes; - } - - public void setAttributes(Set<Attribute> attributes) { - this.attributes = attributes; - } - - public static String[] getRangeTypes() { - return RANGE_TYPES; - } + private static final long serialVersionUID = 1L; + + public static final String ENUMERATION_TYPE = "Enumeration"; + public static final String RANGE_TYPE = "Range"; + public static final String REGEXP_TYPE = "Regular Expression"; + + protected static final Map<String, String> defaults = new HashMap<>(); + static { + defaults.put(ENUMERATION_TYPE, "Enumerate a set of values that the attribute may be set to during policy creation."); + defaults.put(RANGE_TYPE, "Set a range of min and/or max integer/double values the attribute can be set to during policy creation."); + defaults.put(REGEXP_TYPE, "Define a regular expression the attribute must match against during policy creation."); + } + private static final String[] RANGE_TYPES = {"minExclusive", "minInclusive", "maxExclusive", "maxInclusive"}; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="constraint_type", nullable=false, length=64) + private String constraintType; + + @Column(name="description", nullable=false, length=255) + private String description; + + //bi-directional many-to-one association to Attribute + @OneToMany(mappedBy="constraintType") + private Set<Attribute> attributes = new HashSet<>(); + + public ConstraintType() { + //An empty constructor + } + + public ConstraintType(String constraintType) { + this(); + this.constraintType = constraintType; + } + + public ConstraintType(String constraintType, String description) { + this(constraintType); + this.description = description; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getConstraintType() { + return constraintType; + } + + public void setConstraintType(String constraintType) { + this.constraintType = constraintType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Set<Attribute> getAttributes() { + return attributes; + } + + public void setAttributes(Set<Attribute> attributes) { + this.attributes = attributes; + } + + public static String[] getRangeTypes() { + return RANGE_TYPES; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java index f2cdbf179..4c3bf6609 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java @@ -41,78 +41,78 @@ import javax.persistence.Table; @Table(name="ConstraintValues") @NamedQuery(name="ConstraintValue.findAll", query="SELECT c FROM ConstraintValue c") public class ConstraintValue implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="property") - private String property; - - @Column(name="value") - private String value; - - //bi-directional many-to-one association to Attribute - @ManyToOne - @JoinColumn(name="attribute_id") - private Attribute attribute; - - public ConstraintValue() { - //An empty constructor - } - - public ConstraintValue(String property, String value) { - this.property = property; - this.value = value; - } - - public ConstraintValue(ConstraintValue value) { - this.property = value.getProperty(); - this.value = value.getValue(); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getProperty() { - return this.property; - } - - public void setProperty(String property) { - this.property = property; - } - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - this.value = value; - } - - public Attribute getAttribute() { - return this.attribute; - } - - public void setAttribute(Attribute attribute) { - this.attribute = attribute; - } - - @Override - public ConstraintValue clone() { - ConstraintValue constraint = new ConstraintValue(); - - constraint.property = this.property; - constraint.value = this.value; - constraint.attribute = this.attribute; - - return constraint; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="property") + private String property; + + @Column(name="value") + private String value; + + //bi-directional many-to-one association to Attribute + @ManyToOne + @JoinColumn(name="attribute_id") + private Attribute attribute; + + public ConstraintValue() { + //An empty constructor + } + + public ConstraintValue(String property, String value) { + this.property = property; + this.value = value; + } + + public ConstraintValue(ConstraintValue value) { + this.property = value.getProperty(); + this.value = value.getValue(); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getProperty() { + return this.property; + } + + public void setProperty(String property) { + this.property = property; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + public Attribute getAttribute() { + return this.attribute; + } + + public void setAttribute(Attribute attribute) { + this.attribute = attribute; + } + + @Override + public ConstraintValue clone() { + ConstraintValue constraint = new ConstraintValue(); + + constraint.property = this.property; + constraint.value = this.value; + constraint.attribute = this.attribute; + + return constraint; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java index baf3cbe49..31dd66056 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java @@ -37,41 +37,41 @@ import javax.persistence.Table; @Table(name="DCAEUsers") @NamedQuery(name="DCAEUsers.findAll", query="SELECT e FROM DCAEUsers e ") public class DCAEUsers implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="description ") - private String description ; - - public int getId() { - return this.id; - } + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public void setName(String name) { - this.name = name; + @Column(name="description ") + private String description ; - } - public String getDescriptionValue() { - return this.description ; - } + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + + } + public String getDescriptionValue() { + return this.description ; + } + + public void setDescriptionValue(String description ) { + this.description = description ; + } - public void setDescriptionValue(String description ) { - this.description = description ; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java index eb07943f3..5194093d1 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java @@ -37,42 +37,42 @@ import javax.persistence.Table; @Table(name="DCAEuuid") @NamedQuery(name="DCAEuuid.findAll", query="SELECT e FROM DCAEuuid e ") public class DCAEuuid implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - @Column(name="description") - private String description; + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public int getId() { - return this.id; - } + @Column(name="description") + private String description; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + public String getDescription() { + return description; + } - public void setName(String name) { - this.name = name; + public void setDescription(String description) { + this.description = description; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + + } - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java index 42418883b..b82ec4882 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java @@ -30,18 +30,18 @@ import javax.persistence.Table; @Entity @Table(name="DatabaseLockEntity") public class DatabaseLockEntity implements Serializable { - private static final long serialVersionUID = 1L; - @Id - @Column(name="lock_key") - private int lock_key = 1; - public DatabaseLockEntity(){ - //An empty constructor - } - public int getKey(){ - return lock_key; - } - public void setKey(int key){ - this.lock_key = key; - } - + private static final long serialVersionUID = 1L; + @Id + @Column(name="lock_key") + private int lock_key = 1; + public DatabaseLockEntity(){ + //An empty constructor + } + public int getKey(){ + return lock_key; + } + public void setKey(int key){ + this.lock_key = key; + } + } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java index 15948bd6d..4ab577976 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java @@ -49,194 +49,194 @@ import com.fasterxml.jackson.annotation.JsonIgnore; @Table(name="Datatype") @NamedQuery(name="Datatype.findAll", query="SELECT d FROM Datatype d") public class Datatype implements Serializable { - private static final long serialVersionUID = 1L; - - public static final char STANDARD = 'S'; - public static final char CUSTOM = 'C'; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="is_standard", nullable=false) - private char isStandard; - - @Column(name="xacml_id", nullable=false, unique=true, length=255) - private String xacmlId; - - @Column(name="short_name", nullable=false, length=64) - private String shortName; - - //bi-directional many-to-one association to Attribute - @OneToMany(mappedBy="datatypeBean") - @JsonBackReference - private Set<Attribute> attributes = new HashSet<>(); - - //bi-directional many-to-one association to Attribute - @OneToMany(mappedBy="datatypeBean") - @JsonIgnore - private Set<FunctionDefinition> functions = new HashSet<>(); - - //bi-directional many-to-one association to Attribute - @OneToMany(mappedBy="datatypeBean") - @JsonIgnore - private Set<FunctionArgument> arguments = new HashSet<>(); - - public Datatype() { - this.xacmlId = XACML3.ID_DATATYPE_STRING.stringValue(); - this.isStandard = Datatype.STANDARD; - } - - - public Datatype(int id, Datatype dt) { - this.id = id; - this.isStandard = dt.isStandard; - this.xacmlId = dt.xacmlId; - this.shortName = dt.shortName; - // - // Make a copy? - // - this.attributes = new HashSet<>(); - } - - public Datatype(Identifier identifier, char standard) { - if (identifier != null) { - this.xacmlId = identifier.stringValue(); - - } - this.isStandard = standard; - } - - public Datatype(Identifier identifier) { - this(identifier, Datatype.STANDARD); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public char getIsStandard() { - return this.isStandard; - } - - public void setIsStandard(char isStandard) { - this.isStandard = isStandard; - } - - public String getXacmlId() { - return this.xacmlId; - } - - public void setXacmlId(String xacmlId) { - this.xacmlId = xacmlId; - } - - public String getShortName() { - return shortName; - } - - public void setShortName(String shortName) { - this.shortName = shortName; - } - - public Set<Attribute> getAttributes() { - return this.attributes; - } - - public void setAttributes(Set<Attribute> attributes) { - this.attributes = attributes; - } - - public Attribute addAttribute(Attribute attribute) { - getAttributes().add(attribute); - attribute.setDatatypeBean(this); - - return attribute; - } - - public Attribute removeAttribute(Attribute attribute) { - getAttributes().remove(attribute); - attribute.setDatatypeBean(null); - - return attribute; - } - - public Set<FunctionDefinition> getFunctions() { - return this.functions; - } - - public void setFunctions(Set<FunctionDefinition> functions) { - this.functions = functions; - } - - public FunctionDefinition addFunction(FunctionDefinition function) { - getFunctions().add(function); - function.setDatatypeBean(this); - - return function; - } - - public FunctionDefinition removeAttribute(FunctionDefinition function) { - getFunctions().remove(function); - function.setDatatypeBean(null); - - return function; - } - - public Set<FunctionArgument> getArguments() { - return this.arguments; - } - - public void setArguments(Set<FunctionArgument> argument) { - this.arguments = argument; - } - - public FunctionArgument addArgument(FunctionArgument argument) { - getArguments().add(argument); - argument.setDatatypeBean(this); - - return argument; - } - - public FunctionArgument removeArgument(FunctionArgument argument) { - getArguments().remove(argument); - argument.setDatatypeBean(null); - - return argument; - } - - @Transient - public Identifier getIdentifer() { - return new IdentifierImpl(this.xacmlId); - } - - @Transient - public Identifier getIdentiferByShortName() { - return new IdentifierImpl(this.shortName); - } - - @Transient - public boolean isStandard() { - return this.isStandard == Datatype.STANDARD; - } - - @Transient - public boolean isCustom() { - return this.isStandard == Datatype.CUSTOM; - } - - @Transient - @Override - public String toString() { - return "Datatype [id=" + id + ", isStandard=" + isStandard - + ", xacmlId=" + xacmlId + ", shortName=" + shortName - + ", attributes=" + attributes + ", functions=" + functions - + ", arguments=" + arguments + "]"; - } + private static final long serialVersionUID = 1L; + + public static final char STANDARD = 'S'; + public static final char CUSTOM = 'C'; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="is_standard", nullable=false) + private char isStandard; + + @Column(name="xacml_id", nullable=false, unique=true, length=255) + private String xacmlId; + + @Column(name="short_name", nullable=false, length=64) + private String shortName; + + //bi-directional many-to-one association to Attribute + @OneToMany(mappedBy="datatypeBean") + @JsonBackReference + private Set<Attribute> attributes = new HashSet<>(); + + //bi-directional many-to-one association to Attribute + @OneToMany(mappedBy="datatypeBean") + @JsonIgnore + private Set<FunctionDefinition> functions = new HashSet<>(); + + //bi-directional many-to-one association to Attribute + @OneToMany(mappedBy="datatypeBean") + @JsonIgnore + private Set<FunctionArgument> arguments = new HashSet<>(); + + public Datatype() { + this.xacmlId = XACML3.ID_DATATYPE_STRING.stringValue(); + this.isStandard = Datatype.STANDARD; + } + + + public Datatype(int id, Datatype dt) { + this.id = id; + this.isStandard = dt.isStandard; + this.xacmlId = dt.xacmlId; + this.shortName = dt.shortName; + // + // Make a copy? + // + this.attributes = new HashSet<>(); + } + + public Datatype(Identifier identifier, char standard) { + if (identifier != null) { + this.xacmlId = identifier.stringValue(); + + } + this.isStandard = standard; + } + + public Datatype(Identifier identifier) { + this(identifier, Datatype.STANDARD); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public char getIsStandard() { + return this.isStandard; + } + + public void setIsStandard(char isStandard) { + this.isStandard = isStandard; + } + + public String getXacmlId() { + return this.xacmlId; + } + + public void setXacmlId(String xacmlId) { + this.xacmlId = xacmlId; + } + + public String getShortName() { + return shortName; + } + + public void setShortName(String shortName) { + this.shortName = shortName; + } + + public Set<Attribute> getAttributes() { + return this.attributes; + } + + public void setAttributes(Set<Attribute> attributes) { + this.attributes = attributes; + } + + public Attribute addAttribute(Attribute attribute) { + getAttributes().add(attribute); + attribute.setDatatypeBean(this); + + return attribute; + } + + public Attribute removeAttribute(Attribute attribute) { + getAttributes().remove(attribute); + attribute.setDatatypeBean(null); + + return attribute; + } + + public Set<FunctionDefinition> getFunctions() { + return this.functions; + } + + public void setFunctions(Set<FunctionDefinition> functions) { + this.functions = functions; + } + + public FunctionDefinition addFunction(FunctionDefinition function) { + getFunctions().add(function); + function.setDatatypeBean(this); + + return function; + } + + public FunctionDefinition removeAttribute(FunctionDefinition function) { + getFunctions().remove(function); + function.setDatatypeBean(null); + + return function; + } + + public Set<FunctionArgument> getArguments() { + return this.arguments; + } + + public void setArguments(Set<FunctionArgument> argument) { + this.arguments = argument; + } + + public FunctionArgument addArgument(FunctionArgument argument) { + getArguments().add(argument); + argument.setDatatypeBean(this); + + return argument; + } + + public FunctionArgument removeArgument(FunctionArgument argument) { + getArguments().remove(argument); + argument.setDatatypeBean(null); + + return argument; + } + + @Transient + public Identifier getIdentifer() { + return new IdentifierImpl(this.xacmlId); + } + + @Transient + public Identifier getIdentiferByShortName() { + return new IdentifierImpl(this.shortName); + } + + @Transient + public boolean isStandard() { + return this.isStandard == Datatype.STANDARD; + } + + @Transient + public boolean isCustom() { + return this.isStandard == Datatype.CUSTOM; + } + + @Transient + @Override + public String toString() { + return "Datatype [id=" + id + ", isStandard=" + isStandard + + ", xacmlId=" + xacmlId + ", shortName=" + shortName + + ", attributes=" + attributes + ", functions=" + functions + + ", arguments=" + arguments + "]"; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java index ccd1052f0..e469c0b4f 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java @@ -44,154 +44,154 @@ import javax.persistence.Transient; @Table(name="DecisionSettings") @NamedQuery(name="DecisionSettings.findAll", query="SELECT a FROM DecisionSettings a order by a.priority asc, a.xacmlId asc") public class DecisionSettings implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @Column(name="PRIORITY", nullable=true) - @OrderBy("asc") - private String priority; - - @Column(name="xacml_id", unique = true, nullable=false) - @OrderBy("asc") - private String xacmlId = "urn"; - - //bi-directional many-to-one association to Datatype - @ManyToOne - @JoinColumn(name="datatype") - private Datatype datatypeBean; - - @Transient - private String issuer = null; - - @Transient - private boolean mustBePresent = false; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - public String getXacmlId() { - return this.xacmlId; - } - - public void setXacmlId(String xacmlId) { - this.xacmlId = xacmlId; - } - - public Datatype getDatatypeBean() { - return this.datatypeBean; - } - - public void setDatatypeBean(Datatype datatypeBean) { - this.datatypeBean = datatypeBean; - } - - @Transient - public String getIssuer() { - return issuer; - } - - @Transient - public void setIssuer(String issuer) { - this.issuer = issuer; - } - - @Transient - public boolean isMustBePresent() { - return mustBePresent; - } - - @Transient - public void setMustBePresent(boolean mustBePresent) { - this.mustBePresent = mustBePresent; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @Column(name="PRIORITY", nullable=true) + @OrderBy("asc") + private String priority; + + @Column(name="xacml_id", unique = true, nullable=false) + @OrderBy("asc") + private String xacmlId = "urn"; + + //bi-directional many-to-one association to Datatype + @ManyToOne + @JoinColumn(name="datatype") + private Datatype datatypeBean; + + @Transient + private String issuer = null; + + @Transient + private boolean mustBePresent = false; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public String getXacmlId() { + return this.xacmlId; + } + + public void setXacmlId(String xacmlId) { + this.xacmlId = xacmlId; + } + + public Datatype getDatatypeBean() { + return this.datatypeBean; + } + + public void setDatatypeBean(Datatype datatypeBean) { + this.datatypeBean = datatypeBean; + } + + @Transient + public String getIssuer() { + return issuer; + } + + @Transient + public void setIssuer(String issuer) { + this.issuer = issuer; + } + + @Transient + public boolean isMustBePresent() { + return mustBePresent; + } + + @Transient + public void setMustBePresent(boolean mustBePresent) { + this.mustBePresent = mustBePresent; + } + + public String getPriority() { + return priority; + } + + public void setPriority(String priority) { + this.priority = priority; + } } - + diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java index d67a5849b..aab9126e2 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java @@ -43,112 +43,112 @@ import javax.persistence.TemporalType; @Table(name = "DescriptiveScope") @NamedQuery(name = "DescriptiveScope.findAll", query= "Select p from DescriptiveScope p") public class DescriptiveScope implements Serializable { - private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "Id") - private int id; - - @Column(name="scopename", nullable=false) - @OrderBy("asc") - private String descriptiveScopeName; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Column(name="search", nullable=true) - @OrderBy("asc") - private String search; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - public void setId(int id) { - this.id = id; - } - - public String getScopeName() { - return descriptiveScopeName; - } - - public void setScopeName(String descriptiveScopeName) { - this.descriptiveScopeName = descriptiveScopeName; - } - - public String getSearch() { - return search; - } - - public void setSearch(String search) { - this.search = search; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "Id") + private int id; + + @Column(name="scopename", nullable=false) + @OrderBy("asc") + private String descriptiveScopeName; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Column(name="search", nullable=true) + @OrderBy("asc") + private String search; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + public void setId(int id) { + this.id = id; + } + + public String getScopeName() { + return descriptiveScopeName; + } + + public void setScopeName(String descriptiveScopeName) { + this.descriptiveScopeName = descriptiveScopeName; + } + + public String getSearch() { + return search; + } + + public void setSearch(String search) { + this.search = search; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java index c606dd996..75710d5b6 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java @@ -42,113 +42,113 @@ import javax.persistence.TemporalType; @Table(name = "FWTag") @NamedQuery(name = "FWTag.findAll", query= "Select p from FWTag p") public class FWTag implements Serializable { - private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "Id") - private int id; - - @Column(name="tagName", nullable=false) - @OrderBy("asc") - private String fwTagName; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Column(name="tagValues", nullable=true) - @OrderBy("asc") - private String tagValues; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - public void setId(int id) { - this.id = id; - } - - public String getFwTagName() { - return fwTagName; - } - - public void setFwTagName(String fwTagName) { - this.fwTagName = fwTagName; - } - - public String getTagValues() { - return tagValues; - } - - public void setTagValues(String tagValues) { - this.tagValues = tagValues; - } - - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "Id") + private int id; + + @Column(name="tagName", nullable=false) + @OrderBy("asc") + private String fwTagName; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Column(name="tagValues", nullable=true) + @OrderBy("asc") + private String tagValues; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + public void setId(int id) { + this.id = id; + } + + public String getFwTagName() { + return fwTagName; + } + + public void setFwTagName(String fwTagName) { + this.fwTagName = fwTagName; + } + + public String getTagValues() { + return tagValues; + } + + public void setTagValues(String tagValues) { + this.tagValues = tagValues; + } + + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java index 314a4ee9b..0910d60d7 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java @@ -41,123 +41,123 @@ import javax.persistence.TemporalType; @Table(name = "FWTagPicker") @NamedQuery(name = "FWTagPicker.findAll", query= "Select p from FWTagPicker p") public class FWTagPicker implements Serializable { - private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "Id") - private int id; - - @Column(name="tagPickerName", nullable=false) - @OrderBy("asc") - private String tagPickerName; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Column(name="networkRole", nullable=true) - private String networkRole; - - @Column(name="tags", nullable=true) - @OrderBy("asc") - private String tagValues; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - public void setId(int id) { - this.id = id; - } - - public String getTagPickerName() { - return tagPickerName; - } - - public void setTagPickerName(String tagPickerName) { - this.tagPickerName = tagPickerName; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getNetworkRole() { - return networkRole; - } - - public void setNetworkRole(String networkRole) { - this.networkRole = networkRole; - } - - public String getTagValues() { - return tagValues; - } - - public void setTagValues(String tagValues) { - this.tagValues = tagValues; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "Id") + private int id; + + @Column(name="tagPickerName", nullable=false) + @OrderBy("asc") + private String tagPickerName; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Column(name="networkRole", nullable=true) + private String networkRole; + + @Column(name="tags", nullable=true) + @OrderBy("asc") + private String tagValues; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + public void setId(int id) { + this.id = id; + } + + public String getTagPickerName() { + return tagPickerName; + } + + public void setTagPickerName(String tagPickerName) { + this.tagPickerName = tagPickerName; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getNetworkRole() { + return networkRole; + } + + public void setNetworkRole(String networkRole) { + this.networkRole = networkRole; + } + + public String getTagValues() { + return tagValues; + } + + public void setTagValues(String tagValues) { + this.tagValues = tagValues; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java index 8e1a83d5d..6ef5f60e0 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java @@ -36,63 +36,63 @@ import javax.persistence.Table; @Table(name="parentdictionaryitems") @NamedQuery(name="FirewallDictionaryList.findAll", query="SELECT e FROM FirewallDictionaryList e") public class FirewallDictionaryList implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="parentItemName", nullable=false) - @OrderBy("asc") - private String parentItemName; - - @Column(name="description") - private String description; - - @Column(name="addressList") - private String addressList; - - @Column(name="serviceList") - private String serviceList; - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getParentItemName() { - return parentItemName; - } - - public String getDescription() { - return description; - } - - public String getAddressList() { - return addressList; - } - - public String getServiceList() { - return serviceList; - } - - public void setParentItemName(String parentItemName) { - this.parentItemName = parentItemName; - } - - public void setDescription(String description) { - this.description = description; - } - - public void setAddressList(String addressList) { - this.addressList = addressList; - } - - public void setServiceList(String serviceList) { - this.serviceList = serviceList; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="parentItemName", nullable=false) + @OrderBy("asc") + private String parentItemName; + + @Column(name="description") + private String description; + + @Column(name="addressList") + private String addressList; + + @Column(name="serviceList") + private String serviceList; + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getParentItemName() { + return parentItemName; + } + + public String getDescription() { + return description; + } + + public String getAddressList() { + return addressList; + } + + public String getServiceList() { + return serviceList; + } + + public void setParentItemName(String parentItemName) { + this.parentItemName = parentItemName; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setAddressList(String addressList) { + this.addressList = addressList; + } + + public void setServiceList(String serviceList) { + this.serviceList = serviceList; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java index dd4535674..a0d14e66b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java @@ -33,91 +33,91 @@ import javax.persistence.*; @Table(name="FunctionArguments") @NamedQuery(name="FunctionArgument.findAll", query="SELECT f FROM FunctionArgument f") public class FunctionArgument implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="is_bag", nullable=false) - private int isBag; - - //bi-directional many-to-one association to FunctionDefinition - @ManyToOne - @JoinColumn(name="function_id") - private FunctionDefinition functionDefinition; - - @Column(name="arg_index", nullable=false) - private int argIndex; - - //bi-directional many-to-one association to Datatype - @ManyToOne - @JoinColumn(name="datatype_id") - private Datatype datatypeBean; - - public FunctionArgument() { - //An empty constructor - } - - public FunctionArgument(final FunctionArgument argument) { - this.argIndex = argument.argIndex; - this.datatypeBean = argument.datatypeBean; - this.isBag = argument.isBag; - this.functionDefinition = argument.functionDefinition; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public int getArgIndex() { - return this.argIndex; - } - - public void setArgIndex(int argIndex) { - this.argIndex = argIndex; - } - - public Datatype getDatatypeBean() { - return this.datatypeBean; - } - - public void setDatatypeBean(Datatype datatypeBean) { - this.datatypeBean = datatypeBean; - } - - public FunctionDefinition getFunctionDefinition() { - return this.functionDefinition; - } - - public int getIsBag() { - return isBag; - } - - public void setIsBag(int isBag) { - this.isBag = isBag; - } - - public void setFunctionDefinition(FunctionDefinition functionDefinition) { - this.functionDefinition = functionDefinition; - } - - @Transient - @Override - public String toString() { - return "FunctionArgument [id=" + id + ", argIndex=" + argIndex - + ", datatypeBean=" + datatypeBean + ", isBag=" + isBag - + ", functionDefinition=" + functionDefinition + "]"; - } - - @Transient - public boolean isBag() { - return this.isBag == 1; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="is_bag", nullable=false) + private int isBag; + + //bi-directional many-to-one association to FunctionDefinition + @ManyToOne + @JoinColumn(name="function_id") + private FunctionDefinition functionDefinition; + + @Column(name="arg_index", nullable=false) + private int argIndex; + + //bi-directional many-to-one association to Datatype + @ManyToOne + @JoinColumn(name="datatype_id") + private Datatype datatypeBean; + + public FunctionArgument() { + //An empty constructor + } + + public FunctionArgument(final FunctionArgument argument) { + this.argIndex = argument.argIndex; + this.datatypeBean = argument.datatypeBean; + this.isBag = argument.isBag; + this.functionDefinition = argument.functionDefinition; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public int getArgIndex() { + return this.argIndex; + } + + public void setArgIndex(int argIndex) { + this.argIndex = argIndex; + } + + public Datatype getDatatypeBean() { + return this.datatypeBean; + } + + public void setDatatypeBean(Datatype datatypeBean) { + this.datatypeBean = datatypeBean; + } + + public FunctionDefinition getFunctionDefinition() { + return this.functionDefinition; + } + + public int getIsBag() { + return isBag; + } + + public void setIsBag(int isBag) { + this.isBag = isBag; + } + + public void setFunctionDefinition(FunctionDefinition functionDefinition) { + this.functionDefinition = functionDefinition; + } + + @Transient + @Override + public String toString() { + return "FunctionArgument [id=" + id + ", argIndex=" + argIndex + + ", datatypeBean=" + datatypeBean + ", isBag=" + isBag + + ", functionDefinition=" + functionDefinition + "]"; + } + + @Transient + public boolean isBag() { + return this.isBag == 1; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java index d2fa034f1..80c9beb2c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java @@ -34,187 +34,187 @@ import java.util.List; @Entity @Table(name="FunctionDefinition") @NamedQueries({ - @NamedQuery(name="FunctionDefinition.findAll", query="SELECT f FROM FunctionDefinition f") + @NamedQuery(name="FunctionDefinition.findAll", query="SELECT f FROM FunctionDefinition f") }) public class FunctionDefinition implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="short_name", nullable=false, length=64) - private String shortname; - - @Column(name="xacml_id", nullable=false, length=255) - private String xacmlid; - - //bi-directional many-to-one association to Datatype - @ManyToOne - @JoinColumn(name="return_datatype", nullable=true) - private Datatype datatypeBean; - - @Column(name="is_bag_return", nullable=false) - private Integer isBagReturn; - - @Column(name="is_higher_order", nullable=false) - private Integer isHigherOrder; - - @Column(name="arg_lb", nullable=false) - private Integer argLb; - - @Column(name="arg_ub", nullable=false) - private Integer argUb; - - @Column(name="ho_arg_lb", nullable=true) - private Integer higherOrderArg_LB; - - @Column(name="ho_arg_ub", nullable=true) - private Integer higherOrderArg_UB; - - @Column(name="ho_primitive", nullable=true) - private Character higherOrderIsPrimitive; - - //bi-directional many-to-one association to FunctionArgument - @OneToMany(mappedBy="functionDefinition") - private List<FunctionArgument> functionArguments; - - public FunctionDefinition() { - //An empty constructor - } - - public int getId() { - return this.id; - } - - public void setId(Integer id) { - this.id = id; - } - - public int getArgLb() { - return this.argLb; - } - - public void setArgLb(Integer argLb) { - this.argLb = argLb; - } - - public int getArgUb() { - return this.argUb; - } - - public void setArgUb(Integer argUb) { - this.argUb = argUb; - } - - public int getIsBagReturn() { - return isBagReturn; - } - - public void setIsBagReturn(Integer isBagReturn) { - this.isBagReturn = isBagReturn; - } - - public int getIsHigherOrder() { - return isHigherOrder; - } - - public void setIsHigherOrder(Integer isHigherOrder) { - this.isHigherOrder = isHigherOrder; - } - - public Datatype getDatatypeBean() { - return this.datatypeBean; - } - - public void setDatatypeBean(Datatype datatypeBean) { - this.datatypeBean = datatypeBean; - } - - public String getShortname() { - return this.shortname; - } - - public void setShortname(String shortname) { - this.shortname = shortname; - } - - public String getXacmlid() { - return this.xacmlid; - } - - public void setXacmlid(String xacmlid) { - this.xacmlid = xacmlid; - } - - public int getHigherOrderArg_LB() { - return higherOrderArg_LB; - } - - public void setHigherOrderArg_LB(Integer higherOrderArg_LB) { - this.higherOrderArg_LB = higherOrderArg_LB; - } - - public int getHigherOrderArg_UB() { - return higherOrderArg_UB; - } - - public void setHigherOrderArg_UB(Integer higherOrderArg_UB) { - this.higherOrderArg_UB = higherOrderArg_UB; - } - - public Character getHigherOrderIsPrimitive() { - return higherOrderIsPrimitive; - } - - public void setHigherOrderIsPrimitive(Character higherOrderIsPrimitive) { - this.higherOrderIsPrimitive = higherOrderIsPrimitive; - } - - public List<FunctionArgument> getFunctionArguments() { - return this.functionArguments; - } - - public void setFunctionArguments(List<FunctionArgument> functionArguments) { - this.functionArguments = functionArguments; - } - - public FunctionArgument addFunctionArgument(FunctionArgument functionArgument) { - getFunctionArguments().add(functionArgument); - functionArgument.setFunctionDefinition(this); - - return functionArgument; - } - - public FunctionArgument removeFunctionArgument(FunctionArgument functionArgument) { - getFunctionArguments().remove(functionArgument); - functionArgument.setFunctionDefinition(null); - - return functionArgument; - } - - @Transient - @Override - public String toString() { - return "FunctionDefinition [id=" + id + ", argLb=" + argLb + ", argUb=" - + argUb + ", isBagReturn=" + isBagReturn + ", isHigherOrder=" - + isHigherOrder + ", datatypeBean=" + datatypeBean - + ", shortname=" + shortname + ", xacmlid=" + xacmlid - + ", higherOrderArg_LB=" + higherOrderArg_LB - + ", higherOrderArg_UB=" + higherOrderArg_UB - + ", higherOrderIsPrimitive=" + higherOrderIsPrimitive - + ", functionArguments=" + functionArguments + "]"; - } - - @Transient - public boolean isBagReturn() { - return this.isBagReturn == 1; - } - - @Transient - public boolean isHigherOrder() { - return this.isHigherOrder == 1; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="short_name", nullable=false, length=64) + private String shortname; + + @Column(name="xacml_id", nullable=false, length=255) + private String xacmlid; + + //bi-directional many-to-one association to Datatype + @ManyToOne + @JoinColumn(name="return_datatype", nullable=true) + private Datatype datatypeBean; + + @Column(name="is_bag_return", nullable=false) + private Integer isBagReturn; + + @Column(name="is_higher_order", nullable=false) + private Integer isHigherOrder; + + @Column(name="arg_lb", nullable=false) + private Integer argLb; + + @Column(name="arg_ub", nullable=false) + private Integer argUb; + + @Column(name="ho_arg_lb", nullable=true) + private Integer higherOrderArg_LB; + + @Column(name="ho_arg_ub", nullable=true) + private Integer higherOrderArg_UB; + + @Column(name="ho_primitive", nullable=true) + private Character higherOrderIsPrimitive; + + //bi-directional many-to-one association to FunctionArgument + @OneToMany(mappedBy="functionDefinition") + private List<FunctionArgument> functionArguments; + + public FunctionDefinition() { + //An empty constructor + } + + public int getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public int getArgLb() { + return this.argLb; + } + + public void setArgLb(Integer argLb) { + this.argLb = argLb; + } + + public int getArgUb() { + return this.argUb; + } + + public void setArgUb(Integer argUb) { + this.argUb = argUb; + } + + public int getIsBagReturn() { + return isBagReturn; + } + + public void setIsBagReturn(Integer isBagReturn) { + this.isBagReturn = isBagReturn; + } + + public int getIsHigherOrder() { + return isHigherOrder; + } + + public void setIsHigherOrder(Integer isHigherOrder) { + this.isHigherOrder = isHigherOrder; + } + + public Datatype getDatatypeBean() { + return this.datatypeBean; + } + + public void setDatatypeBean(Datatype datatypeBean) { + this.datatypeBean = datatypeBean; + } + + public String getShortname() { + return this.shortname; + } + + public void setShortname(String shortname) { + this.shortname = shortname; + } + + public String getXacmlid() { + return this.xacmlid; + } + + public void setXacmlid(String xacmlid) { + this.xacmlid = xacmlid; + } + + public int getHigherOrderArg_LB() { + return higherOrderArg_LB; + } + + public void setHigherOrderArg_LB(Integer higherOrderArg_LB) { + this.higherOrderArg_LB = higherOrderArg_LB; + } + + public int getHigherOrderArg_UB() { + return higherOrderArg_UB; + } + + public void setHigherOrderArg_UB(Integer higherOrderArg_UB) { + this.higherOrderArg_UB = higherOrderArg_UB; + } + + public Character getHigherOrderIsPrimitive() { + return higherOrderIsPrimitive; + } + + public void setHigherOrderIsPrimitive(Character higherOrderIsPrimitive) { + this.higherOrderIsPrimitive = higherOrderIsPrimitive; + } + + public List<FunctionArgument> getFunctionArguments() { + return this.functionArguments; + } + + public void setFunctionArguments(List<FunctionArgument> functionArguments) { + this.functionArguments = functionArguments; + } + + public FunctionArgument addFunctionArgument(FunctionArgument functionArgument) { + getFunctionArguments().add(functionArgument); + functionArgument.setFunctionDefinition(this); + + return functionArgument; + } + + public FunctionArgument removeFunctionArgument(FunctionArgument functionArgument) { + getFunctionArguments().remove(functionArgument); + functionArgument.setFunctionDefinition(null); + + return functionArgument; + } + + @Transient + @Override + public String toString() { + return "FunctionDefinition [id=" + id + ", argLb=" + argLb + ", argUb=" + + argUb + ", isBagReturn=" + isBagReturn + ", isHigherOrder=" + + isHigherOrder + ", datatypeBean=" + datatypeBean + + ", shortname=" + shortname + ", xacmlid=" + xacmlid + + ", higherOrderArg_LB=" + higherOrderArg_LB + + ", higherOrderArg_UB=" + higherOrderArg_UB + + ", higherOrderIsPrimitive=" + higherOrderIsPrimitive + + ", functionArguments=" + functionArguments + "]"; + } + + @Transient + public boolean isBagReturn() { + return this.isBagReturn == 1; + } + + @Transient + public boolean isHigherOrder() { + return this.isHigherOrder == 1; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java index 357906d4f..1b871d183 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java @@ -37,57 +37,57 @@ import javax.persistence.Table; @Table(name="GlobalRoleSettings") @NamedQuery(name="GlobalRoleSettings.findAll", query="SELECT g FROM GlobalRoleSettings g") public class GlobalRoleSettings implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @Column(name="role", length=45) - private String role; + private static final long serialVersionUID = 1L; - @Column(name="lockdown") - private boolean lockdown; + @Id + @Column(name="role", length=45) + private String role; - public GlobalRoleSettings() { - super(); - } - - public GlobalRoleSettings(boolean lockdown) { - this.role = org.onap.policy.rest.XacmlAdminAuthorization.Role.ROLE_SUPERADMIN.toString(); - this.lockdown = lockdown; - } - - /** - * return the role - * - * @return the role - */ - public String getRole() { - return role; - } + @Column(name="lockdown") + private boolean lockdown; - /** - * set role - * - * @param role the role to set - */ - public void setRole(String role) { - this.role = role; - } + public GlobalRoleSettings() { + super(); + } - /** - * is the system locked down - * - * @return - */ - public boolean isLockdown() { - return lockdown; - } + public GlobalRoleSettings(boolean lockdown) { + this.role = org.onap.policy.rest.XacmlAdminAuthorization.Role.ROLE_SUPERADMIN.toString(); + this.lockdown = lockdown; + } - /** - * sets lockdown configuration - * - * @param lockdown - */ - public void setLockdown(boolean lockdown) { - this.lockdown = lockdown; - } + /** + * return the role + * + * @return the role + */ + public String getRole() { + return role; + } + + /** + * set role + * + * @param role the role to set + */ + public void setRole(String role) { + this.role = role; + } + + /** + * is the system locked down + * + * @return + */ + public boolean isLockdown() { + return lockdown; + } + + /** + * sets lockdown configuration + * + * @param lockdown + */ + public void setLockdown(boolean lockdown) { + this.lockdown = lockdown; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java index 7bb9c54fc..e43135854 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java @@ -56,204 +56,204 @@ import com.fasterxml.jackson.annotation.JsonManagedReference; @Table(name="GroupEntity") @NamedQueries({ - @NamedQuery(name="GroupEntity.findAll", query="SELECT e FROM GroupEntity e "), - @NamedQuery(name="GroupEntity.deleteAll", query="DELETE FROM GroupEntity WHERE 1=1") + @NamedQuery(name="GroupEntity.findAll", query="SELECT e FROM GroupEntity e "), + @NamedQuery(name="GroupEntity.deleteAll", query="DELETE FROM GroupEntity WHERE 1=1") }) public class GroupEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @Column (name="groupKey", nullable=false) - @GeneratedValue(strategy = GenerationType.AUTO) - private long groupKey; - - @Column (name="groupId", nullable=false) - private String groupId; - - @Column(name="groupName", nullable=false, unique=false, length=255) - private String groupName; - - @Version - @Column(name="version") - private int version; - - @ManyToMany(cascade = CascadeType.ALL) - @JoinTable(name="PolicyGroupEntity",joinColumns={@JoinColumn(name="groupKey")}, inverseJoinColumns={@JoinColumn(name="policyId")}) - @JsonManagedReference - private List<PolicyEntity> policies; - - @Column(name="created_by", nullable=false, length=255) - private String createdBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Column(name="description", nullable=false, length=2048) - private String description = "NoDescription"; - - @Column(name="modified_by", nullable=false, length=255) - private String modifiedBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @Column(name="defaultGroup", nullable=false) - private boolean defaultGroup = false; - @Column(name="deleted", nullable=false) - private boolean deleted = false; - - public GroupEntity() { - super(); - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - /** - * @return the policyId - */ - public String getGroupId() { - return groupId; - } - public long getGroupKey(){ - return groupKey; - } - - public void setGroupId(String groupId){ - this.groupId = groupId; - } - - /** - * @param policyId cannot be set - */ - - public String getgroupName() { - return groupName; - } - - public void setGroupName(String groupName) { - this.groupName = groupName; - } - - public boolean isDefaultGroup(){ - return defaultGroup; - } - - public void setDefaultGroup(boolean isDefaultGroup){ - this.defaultGroup = isDefaultGroup; - } - - - - /** - * @return the configurationDataEntity - */ - public List<PolicyEntity> getPolicies() { - return policies; - } - - /** - * @param configurationDataEntity the configurationDataEntity to set - */ - public void addPolicyToGroup(PolicyEntity policy) { - if(!this.policies.contains(policy)){ - this.policies.add(policy); - } - } - public void removePolicyFromGroup(PolicyEntity policy){ - this.policies.remove(policy); - } - - - - /** - * @return the createdBy - */ - public String getCreatedBy() { - return createdBy; - } - - /** - * @param createdBy the createdBy to set - */ - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the modifiedBy - */ - public String getModifiedBy() { - return modifiedBy; - } - - /** - * @param modifiedBy the modifiedBy to set - */ - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } - - /** - * @return the version - */ - public int getVersion() { - return version; - } - - /** - * @return the createdDate - */ - public Date getCreatedDate() { - return createdDate; - } - - /** - * @return the modifiedDate - */ - public Date getModifiedDate() { - return modifiedDate; - } - - /** - * @return the deleted - */ - public boolean isDeleted() { - return deleted; - } - - /** - * @param deleted the deleted to set - */ - public void setDeleted(boolean deleted) { - this.deleted = deleted; - } + private static final long serialVersionUID = 1L; + + @Id + @Column (name="groupKey", nullable=false) + @GeneratedValue(strategy = GenerationType.AUTO) + private long groupKey; + + @Column (name="groupId", nullable=false) + private String groupId; + + @Column(name="groupName", nullable=false, unique=false, length=255) + private String groupName; + + @Version + @Column(name="version") + private int version; + + @ManyToMany(cascade = CascadeType.ALL) + @JoinTable(name="PolicyGroupEntity",joinColumns={@JoinColumn(name="groupKey")}, inverseJoinColumns={@JoinColumn(name="policyId")}) + @JsonManagedReference + private List<PolicyEntity> policies; + + @Column(name="created_by", nullable=false, length=255) + private String createdBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Column(name="description", nullable=false, length=2048) + private String description = "NoDescription"; + + @Column(name="modified_by", nullable=false, length=255) + private String modifiedBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @Column(name="defaultGroup", nullable=false) + private boolean defaultGroup = false; + @Column(name="deleted", nullable=false) + private boolean deleted = false; + + public GroupEntity() { + super(); + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + /** + * @return the policyId + */ + public String getGroupId() { + return groupId; + } + public long getGroupKey(){ + return groupKey; + } + + public void setGroupId(String groupId){ + this.groupId = groupId; + } + + /** + * @param policyId cannot be set + */ + + public String getgroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + public boolean isDefaultGroup(){ + return defaultGroup; + } + + public void setDefaultGroup(boolean isDefaultGroup){ + this.defaultGroup = isDefaultGroup; + } + + + + /** + * @return the configurationDataEntity + */ + public List<PolicyEntity> getPolicies() { + return policies; + } + + /** + * @param configurationDataEntity the configurationDataEntity to set + */ + public void addPolicyToGroup(PolicyEntity policy) { + if(!this.policies.contains(policy)){ + this.policies.add(policy); + } + } + public void removePolicyFromGroup(PolicyEntity policy){ + this.policies.remove(policy); + } + + + + /** + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + + /** + * @param createdBy the createdBy to set + */ + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the modifiedBy + */ + public String getModifiedBy() { + return modifiedBy; + } + + /** + * @param modifiedBy the modifiedBy to set + */ + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + /** + * @return the version + */ + public int getVersion() { + return version; + } + + /** + * @return the createdDate + */ + public Date getCreatedDate() { + return createdDate; + } + + /** + * @return the modifiedDate + */ + public Date getModifiedDate() { + return modifiedDate; + } + + /** + * @return the deleted + */ + public boolean isDeleted() { + return deleted; + } + + /** + * @param deleted the deleted to set + */ + public void setDeleted(boolean deleted) { + this.deleted = deleted; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java index 51b321e32..8b10083d8 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java @@ -37,51 +37,51 @@ import javax.persistence.Table; @Table(name="GroupPolicyScopeList") @NamedQuery(name="GroupPolicyScopeList.findAll", query="SELECT e FROM GroupPolicyScopeList e ") public class GroupPolicyScopeList implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="groupList") - private String groupList; - - @Column(name="description") - private String description; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public int getId() { - return this.id; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public void setId(int id) { - this.id = id; - } - public String getGroupName() { - return this.name; - } + @Column(name="groupList") + private String groupList; - public void setGroupName(String serviceName) { - this.name = serviceName; + @Column(name="description") + private String description; - } - - public String getGroupList() { - return this.groupList; - } + public int getId() { + return this.id; + } - public void setGroupList(String groupList) { - this.groupList = groupList; + public void setId(int id) { + this.id = id; + } + public String getGroupName() { + return this.name; + } - } - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } + public void setGroupName(String serviceName) { + this.name = serviceName; + + } + + public String getGroupList() { + return this.groupList; + } + + public void setGroupList(String groupList) { + this.groupList = groupList; + + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java index 71df0391a..63f673f59 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java @@ -37,43 +37,43 @@ import javax.persistence.Table; @Table(name="GroupServiceList") @NamedQuery(name="GroupServiceList.findAll", query="SELECT e FROM GroupServiceList e ") public class GroupServiceList implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="serviceList ") - private String serviceList; - - public int getId() { - return this.id; - } + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public void setId(int id) { - this.id = id; - } - public String getGroupName() { - return this.name; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public void setGroupName(String serviceName) { - this.name = serviceName; + @Column(name="serviceList ") + private String serviceList; - } - - public String getServiceList() { - return this.serviceList; - } + public int getId() { + return this.id; + } - public void setServiceList(String serviceList) { - this.serviceList = serviceList; + public void setId(int id) { + this.id = id; + } + public String getGroupName() { + return this.name; + } - } + public void setGroupName(String serviceName) { + this.name = serviceName; + + } + + public String getServiceList() { + return this.serviceList; + } + + public void setServiceList(String serviceList) { + this.serviceList = serviceList; + + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java index 816b9d010..574212097 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java @@ -35,50 +35,50 @@ import javax.persistence.Table; @Table(name="MicroServiceAttribute") @NamedQuery(name="MicroServiceAttribute.findAll", query="SELECT e FROM MicroServiceAttribute e ") public class MicroServiceAttribute implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="value") - private String value ; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - @Column(name="modelName") - private String modelName; - - public int getId() { - return this.id; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + @Column(name="value") + private String value ; - public void setName(String name) { - this.name = name; + @Column(name="modelName") + private String modelName; - } - public String getValue() { - return this.value ; - } + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + + } + public String getValue() { + return this.value ; + } + + public void setValue(String value ) { + this.value = value ; + } + public String getModelName() { + return modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } - public void setValue(String value ) { - this.value = value ; - } - public String getModelName() { - return modelName; - } - public void setModelName(String modelName) { - this.modelName = modelName; - } - }
\ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java index f404af153..9719abbed 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java @@ -37,41 +37,41 @@ import javax.persistence.Table; @Table(name="MicroServiceConfigName") @NamedQuery(name="MicroServiceConfigName.findAll", query="SELECT e FROM MicroServiceConfigName e ") public class MicroServiceConfigName implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="description ") - private String description ; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public int getId() { - return this.id; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + @Column(name="description ") + private String description ; - public void setName(String name) { - this.name = name; + public int getId() { + return this.id; + } - } - public String getDescriptionValue() { - return this.description ; - } + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + + } + public String getDescriptionValue() { + return this.description ; + } + + public void setDescriptionValue(String description ) { + this.description = description ; + } - public void setDescriptionValue(String description ) { - this.description = description ; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java index da7227511..669b191e7 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java @@ -37,41 +37,41 @@ import javax.persistence.Table; @Table(name="MicroServiceLocation") @NamedQuery(name="MicroServiceLocation.findAll", query="SELECT e FROM MicroServiceLocation e ") public class MicroServiceLocation implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="description ") - private String description ; - - public int getId() { - return this.id; - } + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public void setName(String name) { - this.name = name; + @Column(name="description ") + private String description ; - } - public String getDescriptionValue() { - return this.description ; - } + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + + } + public String getDescriptionValue() { + return this.description ; + } + + public void setDescriptionValue(String description ) { + this.description = description ; + } - public void setDescriptionValue(String description ) { - this.description = description ; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java index 4029ad5fb..955e7ffda 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java @@ -42,141 +42,141 @@ import javax.persistence.Table; @Table(name="MicroServiceModels") @NamedQuery(name="MicroServiceModels.findAll", query="SELECT b FROM MicroServiceModels b ") public class MicroServiceModels implements Serializable{ - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="modelName", nullable=false, unique=true) - @OrderBy("asc") - private String modelName; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Column(name="dependency", nullable=true, length=2048) - private String dependency; - - @Column(name="attributes", nullable=false, length=255) - private String attributes; - - @Column(name="ref_attributes", nullable=false, length=255) - private String ref_attributes; - - @Column (name="sub_attributes", nullable=false, length=2000) - private String sub_attributes; - - @Column (name="dataOrderInfo", nullable=true, length=2000) - private String dataOrderInfo; - - @Column (name="version", nullable=false, length=2000) - private String version; - - @Column (name="enumValues", nullable=false, length=2000) - private String enumValues; - - @Column (name="annotation", nullable=false, length=2000) - private String annotation; - - public String getSub_attributes() { - return sub_attributes; - } - - public void setSub_attributes(String sub_attributes) { - this.sub_attributes = sub_attributes; - } - - public String getDataOrderInfo() { - return dataOrderInfo; - } - - public void setDataOrderInfo(String dataOrderInfo) { - this.dataOrderInfo = dataOrderInfo; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - @ManyToOne - @JoinColumn(name="imported_by") - private UserInfo userCreatedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public String getAttributes() { - return attributes; - } - - public void setAttributes(String attributes) { - this.attributes = attributes; - } - - public String getRef_attributes() { - return ref_attributes; - } - - public void setRef_attributes(String ref_attributes) { - this.ref_attributes = ref_attributes; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getDependency() { - return dependency; - } - - public void setDependency(String dependency) { - this.dependency = dependency; - } - - public String getModelName(){ - return this.modelName; - } - - public void setModelName(String modelName){ - this.modelName = modelName; - } - - public String getEnumValues() { - return enumValues; - } - - public void setEnumValues(String enumValues) { - this.enumValues = enumValues; - } - - public String getAnnotation() { - return annotation; - } - - public void setAnnotation(String annotation) { - this.annotation = annotation; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="modelName", nullable=false, unique=true) + @OrderBy("asc") + private String modelName; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Column(name="dependency", nullable=true, length=2048) + private String dependency; + + @Column(name="attributes", nullable=false, length=255) + private String attributes; + + @Column(name="ref_attributes", nullable=false, length=255) + private String ref_attributes; + + @Column (name="sub_attributes", nullable=false, length=2000) + private String sub_attributes; + + @Column (name="dataOrderInfo", nullable=true, length=2000) + private String dataOrderInfo; + + @Column (name="version", nullable=false, length=2000) + private String version; + + @Column (name="enumValues", nullable=false, length=2000) + private String enumValues; + + @Column (name="annotation", nullable=false, length=2000) + private String annotation; + + public String getSub_attributes() { + return sub_attributes; + } + + public void setSub_attributes(String sub_attributes) { + this.sub_attributes = sub_attributes; + } + + public String getDataOrderInfo() { + return dataOrderInfo; + } + + public void setDataOrderInfo(String dataOrderInfo) { + this.dataOrderInfo = dataOrderInfo; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + @ManyToOne + @JoinColumn(name="imported_by") + private UserInfo userCreatedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public String getAttributes() { + return attributes; + } + + public void setAttributes(String attributes) { + this.attributes = attributes; + } + + public String getRef_attributes() { + return ref_attributes; + } + + public void setRef_attributes(String ref_attributes) { + this.ref_attributes = ref_attributes; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getDependency() { + return dependency; + } + + public void setDependency(String dependency) { + this.dependency = dependency; + } + + public String getModelName(){ + return this.modelName; + } + + public void setModelName(String modelName){ + this.modelName = modelName; + } + + public String getEnumValues() { + return enumValues; + } + + public void setEnumValues(String enumValues) { + this.enumValues = enumValues; + } + + public String getAnnotation() { + return annotation; + } + + public void setAnnotation(String annotation) { + this.annotation = annotation; + } }
\ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroserviceHeaderdeFaults.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroserviceHeaderdeFaults.java index b876484de..905555120 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroserviceHeaderdeFaults.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroserviceHeaderdeFaults.java @@ -37,87 +37,87 @@ import javax.persistence.Table; @Table(name="MicroserviceHeaderdeFaults") @NamedQuery(name="MicroserviceHeaderdeFaults.findAll", query="SELECT e FROM MicroserviceHeaderdeFaults e ") public class MicroserviceHeaderdeFaults implements Serializable { - private static final long serialVersionUID = 1L; - - private static String domain; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="onapName") - private String onapName; - - @Column(name="guard") - private String guard ; - - @Column(name="priority") - private String priority; - - @Column(name="riskType") - private String riskType ; - - @Column(name="riskLevel") - - private String riskLevel; - - @Column(name="modelName", nullable=false) - @OrderBy("asc") - private String modelName; - - @PrePersist - public void prePersist() { - - } - @PreUpdate - public void preUpdate() { - } - - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getModelName() { - return modelName; - } - public void setModelName(String modelName) { - this.modelName = modelName; - } - public String getOnapName() { - return onapName; - } - public void setOnapName(String onapName) { - this.onapName = onapName; - } - public String getGuard() { - return guard; - } - public void setGuard(String guard) { - this.guard = guard; - } - public String getPriority() { - return priority; - } - public void setPriority(String priority) { - this.priority = priority; - } - public String getRiskType() { - return riskType; - } - public void setRiskType(String riskType) { - this.riskType = riskType; - } - public String getRiskLevel() { - return riskLevel; - } - public void setRiskLevel(String riskLevel) { - this.riskLevel = riskLevel; - } - + private static final long serialVersionUID = 1L; + + private static String domain; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="onapName") + private String onapName; + + @Column(name="guard") + private String guard ; + + @Column(name="priority") + private String priority; + + @Column(name="riskType") + private String riskType ; + + @Column(name="riskLevel") + + private String riskLevel; + + @Column(name="modelName", nullable=false) + @OrderBy("asc") + private String modelName; + + @PrePersist + public void prePersist() { + + } + @PreUpdate + public void preUpdate() { + } + + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getModelName() { + return modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + public String getOnapName() { + return onapName; + } + public void setOnapName(String onapName) { + this.onapName = onapName; + } + public String getGuard() { + return guard; + } + public void setGuard(String guard) { + this.guard = guard; + } + public String getPriority() { + return priority; + } + public void setPriority(String priority) { + this.priority = priority; + } + public String getRiskType() { + return riskType; + } + public void setRiskType(String riskType) { + this.riskType = riskType; + } + public String getRiskLevel() { + return riskLevel; + } + public void setRiskLevel(String riskLevel) { + this.riskLevel = riskLevel; + } + }
\ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Obadvice.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Obadvice.java index 1b2fc3ada..1c6b75d25 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Obadvice.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Obadvice.java @@ -50,179 +50,179 @@ import com.att.research.xacml.api.Identifier; @Table(name="Obadvice") @NamedQuery(name="Obadvice.findAll", query="SELECT o FROM Obadvice o") public class Obadvice implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String OBLIGATION = "Obligation"; - public static final String ADVICE = "Advice"; - public static final String EFFECT_PERMIT = "Permit"; - public static final String EFFECT_DENY = "Deny"; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="type", nullable=false) - private String type; - - @Column(name="xacml_id", nullable=false, length=255) - private String xacmlId; - - @Column(name="fulfill_on", nullable=true, length=32) - private String fulfillOn; - - @Column(name="description", nullable=true, length=2048) - private String description; - - //bi-directional one-to-many association to Attribute Assignment - @OneToMany(mappedBy="obadvice", orphanRemoval=true, cascade=CascadeType.REMOVE) - private Set<ObadviceExpression> obadviceExpressions = new HashSet<>(2); - - @Column(name="created_by", nullable=false, length=255) - private String createdBy; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", nullable=false, updatable=false) - private Date createdDate; - - @Column(name="modified_by", nullable=false, length=255) - private String modifiedBy; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - public Obadvice() { - this.type = Obadvice.OBLIGATION; - this.fulfillOn = Obadvice.EFFECT_PERMIT; - } - - public Obadvice(String domain, String userid) { - this.xacmlId = domain; - this.type = Obadvice.OBLIGATION; - this.fulfillOn = Obadvice.EFFECT_PERMIT; - this.createdBy = userid; - this.modifiedBy = userid; - } - - public Obadvice(Identifier id, String userid) { - this(id.stringValue(), userid); - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getCreatedBy() { - return this.createdBy; - } - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getFulfillOn() { - return this.fulfillOn; - } - - public void setFulfillOn(String fulfillOn) { - this.fulfillOn = fulfillOn; - } - - public String getModifiedBy() { - return this.modifiedBy; - } - - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } - - public String getType() { - return this.type; - } - - public void setType(String type) { - this.type = type; - } - - public String getXacmlId() { - return this.xacmlId; - } - - public void setXacmlId(String xacmlId) { - this.xacmlId = xacmlId; - } - - public Set<ObadviceExpression> getObadviceExpressions() { - return this.obadviceExpressions; - } - - public void setObadviceExpressions(Set<ObadviceExpression> obadviceExpressions) { - this.obadviceExpressions = obadviceExpressions; - } - - public ObadviceExpression addObadviceExpression(ObadviceExpression obadviceExpression) { - this.obadviceExpressions.add(obadviceExpression); - obadviceExpression.setObadvice(this); - - return obadviceExpression; - } - - public ObadviceExpression removeObadviceExpression(ObadviceExpression obadviceExpression) { - this.obadviceExpressions.remove(obadviceExpression); - obadviceExpression.setObadvice(null); - - return obadviceExpression; - } - - public void removeAllExpressions() { - if (this.obadviceExpressions == null) { - return; - } - for (ObadviceExpression expression : this.obadviceExpressions) { - expression.setObadvice(null); - } - this.obadviceExpressions.clear(); - } - - @Transient - @Override - public Obadvice clone() { - Obadvice obadvice = new Obadvice(); - - obadvice.type = this.type; - obadvice.xacmlId = this.xacmlId; - obadvice.fulfillOn = this.fulfillOn; - obadvice.description = this.description; - obadvice.createdBy = this.createdBy; - obadvice.modifiedBy = this.modifiedBy; - for (ObadviceExpression exp: this.obadviceExpressions) { - obadvice.addObadviceExpression(exp.clone()); - } - - return obadvice; - } + private static final long serialVersionUID = 1L; + + public static final String OBLIGATION = "Obligation"; + public static final String ADVICE = "Advice"; + public static final String EFFECT_PERMIT = "Permit"; + public static final String EFFECT_DENY = "Deny"; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="type", nullable=false) + private String type; + + @Column(name="xacml_id", nullable=false, length=255) + private String xacmlId; + + @Column(name="fulfill_on", nullable=true, length=32) + private String fulfillOn; + + @Column(name="description", nullable=true, length=2048) + private String description; + + //bi-directional one-to-many association to Attribute Assignment + @OneToMany(mappedBy="obadvice", orphanRemoval=true, cascade=CascadeType.REMOVE) + private Set<ObadviceExpression> obadviceExpressions = new HashSet<>(2); + + @Column(name="created_by", nullable=false, length=255) + private String createdBy; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", nullable=false, updatable=false) + private Date createdDate; + + @Column(name="modified_by", nullable=false, length=255) + private String modifiedBy; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + public Obadvice() { + this.type = Obadvice.OBLIGATION; + this.fulfillOn = Obadvice.EFFECT_PERMIT; + } + + public Obadvice(String domain, String userid) { + this.xacmlId = domain; + this.type = Obadvice.OBLIGATION; + this.fulfillOn = Obadvice.EFFECT_PERMIT; + this.createdBy = userid; + this.modifiedBy = userid; + } + + public Obadvice(Identifier id, String userid) { + this(id.stringValue(), userid); + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getFulfillOn() { + return this.fulfillOn; + } + + public void setFulfillOn(String fulfillOn) { + this.fulfillOn = fulfillOn; + } + + public String getModifiedBy() { + return this.modifiedBy; + } + + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + } + + public String getXacmlId() { + return this.xacmlId; + } + + public void setXacmlId(String xacmlId) { + this.xacmlId = xacmlId; + } + + public Set<ObadviceExpression> getObadviceExpressions() { + return this.obadviceExpressions; + } + + public void setObadviceExpressions(Set<ObadviceExpression> obadviceExpressions) { + this.obadviceExpressions = obadviceExpressions; + } + + public ObadviceExpression addObadviceExpression(ObadviceExpression obadviceExpression) { + this.obadviceExpressions.add(obadviceExpression); + obadviceExpression.setObadvice(this); + + return obadviceExpression; + } + + public ObadviceExpression removeObadviceExpression(ObadviceExpression obadviceExpression) { + this.obadviceExpressions.remove(obadviceExpression); + obadviceExpression.setObadvice(null); + + return obadviceExpression; + } + + public void removeAllExpressions() { + if (this.obadviceExpressions == null) { + return; + } + for (ObadviceExpression expression : this.obadviceExpressions) { + expression.setObadvice(null); + } + this.obadviceExpressions.clear(); + } + + @Transient + @Override + public Obadvice clone() { + Obadvice obadvice = new Obadvice(); + + obadvice.type = this.type; + obadvice.xacmlId = this.xacmlId; + obadvice.fulfillOn = this.fulfillOn; + obadvice.description = this.description; + obadvice.createdBy = this.createdBy; + obadvice.modifiedBy = this.modifiedBy; + for (ObadviceExpression exp: this.obadviceExpressions) { + obadvice.addObadviceExpression(exp.clone()); + } + + return obadvice; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ObadviceExpression.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ObadviceExpression.java index 6992843db..9d82b7325 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ObadviceExpression.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ObadviceExpression.java @@ -42,77 +42,77 @@ import javax.persistence.Table; @Table(name="ObadviceExpressions") @NamedQuery(name="ObadviceExpression.findAll", query="SELECT o FROM ObadviceExpression o") public class ObadviceExpression implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String EXPRESSION_APPLY = "Apply"; - public static final String EXPRESSION_SELECTOR = "Attribute Selector"; - public static final String EXPRESSION_VALUE = "Attribute Value"; - public static final String EXPRESSION_FUNCTION = "Function"; - public static final String EXPRESSION_REFERENCE = "Varable Reference"; - public static final String EXPRESSION_DESIGNATOR = "Attribute Designator"; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - //unidirectional one-to-one association to Attribute - @OneToOne - @JoinColumn(name="attribute_id") - private Attribute attribute; - - @Column(name="type", nullable=false) - private String type; - - //bi-directional many-to-one association to Obadvice - @ManyToOne - @JoinColumn(name="obadvice_id") - private Obadvice obadvice; - - public ObadviceExpression() { - type = EXPRESSION_VALUE; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public Attribute getAttribute() { - return this.attribute; - } - - public void setAttribute(Attribute attribute) { - this.attribute = attribute; - } - - public String getType() { - return this.type; - } - - public void setType(String type) { - this.type = type; - } - - public Obadvice getObadvice() { - return this.obadvice; - } - - public void setObadvice(Obadvice obadvice) { - this.obadvice = obadvice; - } - - @Override - public ObadviceExpression clone() { - ObadviceExpression expression = new ObadviceExpression(); - - expression.attribute = this.attribute; - expression.type = this.type; - expression.obadvice = this.obadvice; - - return expression; - } + private static final long serialVersionUID = 1L; + + public static final String EXPRESSION_APPLY = "Apply"; + public static final String EXPRESSION_SELECTOR = "Attribute Selector"; + public static final String EXPRESSION_VALUE = "Attribute Value"; + public static final String EXPRESSION_FUNCTION = "Function"; + public static final String EXPRESSION_REFERENCE = "Varable Reference"; + public static final String EXPRESSION_DESIGNATOR = "Attribute Designator"; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + //unidirectional one-to-one association to Attribute + @OneToOne + @JoinColumn(name="attribute_id") + private Attribute attribute; + + @Column(name="type", nullable=false) + private String type; + + //bi-directional many-to-one association to Obadvice + @ManyToOne + @JoinColumn(name="obadvice_id") + private Obadvice obadvice; + + public ObadviceExpression() { + type = EXPRESSION_VALUE; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public Attribute getAttribute() { + return this.attribute; + } + + public void setAttribute(Attribute attribute) { + this.attribute = attribute; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + } + + public Obadvice getObadvice() { + return this.obadvice; + } + + public void setObadvice(Obadvice obadvice) { + this.obadvice = obadvice; + } + + @Override + public ObadviceExpression clone() { + ObadviceExpression expression = new ObadviceExpression(); + + expression.attribute = this.attribute; + expression.type = this.type; + expression.obadvice = this.obadvice; + + return expression; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java index d817f2078..0b39129a8 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java @@ -44,101 +44,101 @@ import javax.persistence.TemporalType; @Table(name="OnapName") @NamedQuery(name="OnapName.findAll", query="SELECT e FROM OnapName e ") public class OnapName implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="onap_Name", nullable=false, unique=true) - @OrderBy("asc") - private String onapName; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - public String getOnapName() { - return this.onapName; - } - - public void setOnapName(String onapName) { - this.onapName = onapName; - - } - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="onap_Name", nullable=false, unique=true) + @OrderBy("asc") + private String onapName; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + public String getOnapName() { + return this.onapName; + } + + public void setOnapName(String onapName) { + this.onapName = onapName; + + } + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OptimizationModels.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OptimizationModels.java index 1accc9968..60b360029 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OptimizationModels.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OptimizationModels.java @@ -42,141 +42,141 @@ import javax.persistence.Table; @Table(name="OptimizationModels") @NamedQuery(name="OptimizationModels.findAll", query="SELECT b FROM OptimizationModels b ") public class OptimizationModels implements Serializable{ - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="modelName", nullable=false, unique=true) - @OrderBy("asc") - private String modelName; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Column(name="dependency", nullable=true, length=2048) - private String dependency; - - @Column(name="attributes", nullable=false, length=255) - private String attributes; - - @Column(name="ref_attributes", nullable=false, length=255) - private String refattributes; - - @Column (name="sub_attributes", nullable=false, length=2000) - private String subattributes; - - @Column (name="dataOrderInfo", nullable=true, length=2000) - private String dataOrderInfo; - - @Column (name="version", nullable=false, length=2000) - private String version; - - @Column (name="enumValues", nullable=false, length=2000) - private String enumValues; - - @Column (name="annotation", nullable=false, length=2000) - private String annotation; - - public String getSubattributes() { - return subattributes; - } - - public void setSubattributes(String subattributes) { - this.subattributes = subattributes; - } - - public String getDataOrderInfo() { - return dataOrderInfo; - } - - public void setDataOrderInfo(String dataOrderInfo) { - this.dataOrderInfo = dataOrderInfo; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - @ManyToOne - @JoinColumn(name="imported_by") - private UserInfo userCreatedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public String getAttributes() { - return attributes; - } - - public void setAttributes(String attributes) { - this.attributes = attributes; - } - - public String getRefattributes() { - return refattributes; - } - - public void setRefattributes(String refattributes) { - this.refattributes = refattributes; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getDependency() { - return dependency; - } - - public void setDependency(String dependency) { - this.dependency = dependency; - } - - public String getModelName(){ - return this.modelName; - } - - public void setModelName(String modelName){ - this.modelName = modelName; - } - - public String getEnumValues() { - return enumValues; - } - - public void setEnumValues(String enumValues) { - this.enumValues = enumValues; - } - - public String getAnnotation() { - return annotation; - } - - public void setAnnotation(String annotation) { - this.annotation = annotation; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="modelName", nullable=false, unique=true) + @OrderBy("asc") + private String modelName; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Column(name="dependency", nullable=true, length=2048) + private String dependency; + + @Column(name="attributes", nullable=false, length=255) + private String attributes; + + @Column(name="ref_attributes", nullable=false, length=255) + private String refattributes; + + @Column (name="sub_attributes", nullable=false, length=2000) + private String subattributes; + + @Column (name="dataOrderInfo", nullable=true, length=2000) + private String dataOrderInfo; + + @Column (name="version", nullable=false, length=2000) + private String version; + + @Column (name="enumValues", nullable=false, length=2000) + private String enumValues; + + @Column (name="annotation", nullable=false, length=2000) + private String annotation; + + public String getSubattributes() { + return subattributes; + } + + public void setSubattributes(String subattributes) { + this.subattributes = subattributes; + } + + public String getDataOrderInfo() { + return dataOrderInfo; + } + + public void setDataOrderInfo(String dataOrderInfo) { + this.dataOrderInfo = dataOrderInfo; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + @ManyToOne + @JoinColumn(name="imported_by") + private UserInfo userCreatedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public String getAttributes() { + return attributes; + } + + public void setAttributes(String attributes) { + this.attributes = attributes; + } + + public String getRefattributes() { + return refattributes; + } + + public void setRefattributes(String refattributes) { + this.refattributes = refattributes; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getDependency() { + return dependency; + } + + public void setDependency(String dependency) { + this.dependency = dependency; + } + + public String getModelName(){ + return this.modelName; + } + + public void setModelName(String modelName){ + this.modelName = modelName; + } + + public String getEnumValues() { + return enumValues; + } + + public void setEnumValues(String enumValues) { + this.enumValues = enumValues; + } + + public String getAnnotation() { + return annotation; + } + + public void setAnnotation(String annotation) { + this.annotation = annotation; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java index ae01999a3..3abc01267 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java @@ -45,113 +45,113 @@ import javax.persistence.TemporalType; @Table(name = "PEPOptions") @NamedQuery(name = "PEPOptions.findAll", query= "Select p from PEPOptions p") public class PEPOptions implements Serializable { - private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "Id") - private int id; - - @Column(name="PEP_NAME", nullable=false) - @OrderBy("asc") - private String pepName; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Column(name="Actions", nullable=true) - @OrderBy("asc") - private String actions; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - public void setId(int id) { - this.id = id; - } - - public String getPepName() { - return pepName; - } - - public void setPepName(String pepName) { - this.pepName = pepName; - } - - public String getActions() { - return actions; - } - - public void setActions(String actions) { - this.actions = actions; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "Id") + private int id; + + @Column(name="PEP_NAME", nullable=false) + @OrderBy("asc") + private String pepName; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Column(name="Actions", nullable=true) + @OrderBy("asc") + private String actions; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + public void setId(int id) { + this.id = id; + } + + public String getPepName() { + return pepName; + } + + public void setPepName(String pepName) { + this.pepName = pepName; + } + + public String getActions() { + return actions; + } + + public void setActions(String actions) { + this.actions = actions; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfigParam.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfigParam.java index fb18f7062..0f32de6d3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfigParam.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfigParam.java @@ -33,116 +33,116 @@ import javax.persistence.*; @Table(name="PIPConfigParams") @NamedQuery(name="PIPConfigParam.findAll", query="SELECT p FROM PIPConfigParam p") public class PIPConfigParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="PARAM_NAME", nullable=false, length=1024) - private String paramName; - - @Column(name="PARAM_VALUE", nullable=false, length=2048) - private String paramValue; - - @Column(name="PARAM_DEFAULT", nullable=true, length=2048) - private String paramDefault = null; - - @Column(name="REQUIRED", nullable=false) - private char required = '0'; - - //bi-directional many-to-one association to PIPConfiguration - @ManyToOne - @JoinColumn(name="PIP_ID") - private PIPConfiguration pipconfiguration; - - public PIPConfigParam() { - //An empty constructor - } - - public PIPConfigParam(String param) { - this.paramName = param; - } - - public PIPConfigParam(String param, String value) { - this(param); - this.paramValue = value; - } - - public PIPConfigParam(PIPConfigParam param) { - this(param.getParamName(), param.getParamValue()); - this.paramDefault = param.getParamDefault(); - this.required = param.required; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getParamName() { - return this.paramName; - } - - public void setParamName(String paramName) { - this.paramName = paramName; - } - - public String getParamValue() { - return this.paramValue; - } - - public void setParamValue(String paramValue) { - this.paramValue = paramValue; - } - - public String getParamDefault() { - return paramDefault; - } - - public void setParamDefault(String paramDefault) { - this.paramDefault = paramDefault; - } - - public char getRequired() { - return required; - } - - public void setRequired(char required) { - this.required = required; - } - - public PIPConfiguration getPipconfiguration() { - return this.pipconfiguration; - } - - public void setPipconfiguration(PIPConfiguration pipconfiguration) { - this.pipconfiguration = pipconfiguration; - } - - @Transient - public boolean isRequired() { - return this.required == '1'; - } - - @Transient - public void setRequired(boolean required) { - if (required) { - this.setRequired('1'); - } else { - this.setRequired('0'); - } - } - - @Transient - @Override - public String toString() { - return "PIPConfigParam [id=" + id + ", paramName=" + paramName - + ", paramValue=" + paramValue + ", required=" + required + "]"; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="PARAM_NAME", nullable=false, length=1024) + private String paramName; + + @Column(name="PARAM_VALUE", nullable=false, length=2048) + private String paramValue; + + @Column(name="PARAM_DEFAULT", nullable=true, length=2048) + private String paramDefault = null; + + @Column(name="REQUIRED", nullable=false) + private char required = '0'; + + //bi-directional many-to-one association to PIPConfiguration + @ManyToOne + @JoinColumn(name="PIP_ID") + private PIPConfiguration pipconfiguration; + + public PIPConfigParam() { + //An empty constructor + } + + public PIPConfigParam(String param) { + this.paramName = param; + } + + public PIPConfigParam(String param, String value) { + this(param); + this.paramValue = value; + } + + public PIPConfigParam(PIPConfigParam param) { + this(param.getParamName(), param.getParamValue()); + this.paramDefault = param.getParamDefault(); + this.required = param.required; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getParamName() { + return this.paramName; + } + + public void setParamName(String paramName) { + this.paramName = paramName; + } + + public String getParamValue() { + return this.paramValue; + } + + public void setParamValue(String paramValue) { + this.paramValue = paramValue; + } + + public String getParamDefault() { + return paramDefault; + } + + public void setParamDefault(String paramDefault) { + this.paramDefault = paramDefault; + } + + public char getRequired() { + return required; + } + + public void setRequired(char required) { + this.required = required; + } + + public PIPConfiguration getPipconfiguration() { + return this.pipconfiguration; + } + + public void setPipconfiguration(PIPConfiguration pipconfiguration) { + this.pipconfiguration = pipconfiguration; + } + + @Transient + public boolean isRequired() { + return this.required == '1'; + } + + @Transient + public void setRequired(boolean required) { + if (required) { + this.setRequired('1'); + } else { + this.setRequired('0'); + } + } + + @Transient + @Override + public String toString() { + return "PIPConfigParam [id=" + id + ", paramName=" + paramName + + ", paramValue=" + paramValue + ", required=" + required + "]"; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java index a921a0c35..d34c4bd0b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java @@ -70,469 +70,469 @@ import com.google.common.base.Splitter; @Table(name="PIPConfiguration") @NamedQuery(name="PIPConfiguration.findAll", query="SELECT p FROM PIPConfiguration p") public class PIPConfiguration implements Serializable { - private static final long serialVersionUID = 1L; - private static final Log logger = LogFactory.getLog(PIPConfiguration.class); - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="DESCRIPTION", nullable=true, length=2048) - private String description; - - @Column(name="NAME", nullable=false, length=255) - private String name; - - @Column(name="CLASSNAME", nullable=false, length=2048) - private String classname; - - @Column(name="ISSUER", nullable=true, length=1024) - private String issuer; - - @Column(name="READ_ONLY", nullable=false) - private char readOnly = '0'; - - @Column(name="REQUIRES_RESOLVER", nullable=false) - private char requiresResolvers; - - @Column(name="CREATED_BY", nullable=false, length=255) - private String createdBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="CREATED_DATE", nullable=false, updatable=false) - private Date createdDate; - - @Column(name="MODIFIED_BY", nullable=false, length=255) - private String modifiedBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="MODIFIED_DATE", nullable=false) - private Date modifiedDate; - - //bi-directional many-to-one association to PIPConfigParam - @OneToMany(mappedBy="pipconfiguration", orphanRemoval=true, cascade=CascadeType.REMOVE) - private Set<PIPConfigParam> pipconfigParams = new HashSet<>(); - - //bi-directional many-to-one association to PIPType - @ManyToOne - @JoinColumn(name="TYPE") - private PIPType piptype; - - //bi-directional many-to-one association to PIPResolver - @OneToMany(mappedBy="pipconfiguration", orphanRemoval=true, cascade=CascadeType.REMOVE) - private Set<PIPResolver> pipresolvers = new HashSet<>(); - - public PIPConfiguration() { - //An empty constructor - } - - public PIPConfiguration(PIPConfiguration config, String user) { - this.description = config.description; - this.name = config.name; - this.classname = config.classname; - this.issuer = config.issuer; - this.requiresResolvers = config.requiresResolvers; - this.readOnly = config.readOnly; - this.piptype = config.piptype; - for (PIPConfigParam param : config.pipconfigParams) { - this.addPipconfigParam(new PIPConfigParam(param)); - } - for (PIPResolver resolver : config.pipresolvers) { - this.addPipresolver(new PIPResolver(resolver)); - } - } - - public PIPConfiguration(String id, Properties properties) throws PIPException { - this.readProperties(id, properties); - } - - public PIPConfiguration(String id, Properties properties, String user) throws PIPException { - this.createdBy = user; - this.modifiedBy = user; - this.readProperties(id, properties); - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public String getClassname() { - return classname; - } - - public void setClassname(String classname) { - this.classname = classname; - } - - public String getIssuer() { - return issuer; - } - - public void setIssuer(String issuer) { - this.issuer = issuer; - } - - public char getReadOnly() { - return readOnly; - } - - public void setReadOnly(char readOnly) { - this.readOnly = readOnly; - } - - public char getRequiresResolvers() { - return requiresResolvers; - } - - public void setRequiresResolvers(char requireResolvers) { - this.requiresResolvers = requireResolvers; - } - - public Set<PIPConfigParam> getPipconfigParams() { - return this.pipconfigParams; - } - - public void setPipconfigParams(Set<PIPConfigParam> pipconfigParams) { - this.pipconfigParams = pipconfigParams; - } - - public PIPConfigParam addPipconfigParam(PIPConfigParam pipconfigParam) { - getPipconfigParams().add(pipconfigParam); - pipconfigParam.setPipconfiguration(this); - - return pipconfigParam; - } - - public PIPConfigParam removePipconfigParam(PIPConfigParam pipconfigParam) { - if (pipconfigParam == null) { - return pipconfigParam; - } - getPipconfigParams().remove(pipconfigParam); - pipconfigParam.setPipconfiguration(null); - - return pipconfigParam; - } - - @Transient - public void clearConfigParams() { - while (!this.pipconfigParams.isEmpty()) { - this.removePipconfigParam(this.pipconfigParams.iterator().next()); - } - } - - public PIPType getPiptype() { - return this.piptype; - } - - public void setPiptype(PIPType piptype) { - this.piptype = piptype; - } - - public Set<PIPResolver> getPipresolvers() { - return this.pipresolvers; - } - - public void setPipresolvers(Set<PIPResolver> pipresolvers) { - this.pipresolvers = pipresolvers; - } - - public PIPResolver addPipresolver(PIPResolver pipresolver) { - getPipresolvers().add(pipresolver); - pipresolver.setPipconfiguration(this); - - return pipresolver; - } - - public PIPResolver removePipresolver(PIPResolver pipresolver) { - getPipresolvers().remove(pipresolver); - pipresolver.setPipconfiguration(null); - - return pipresolver; - } - - public String getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - public Date getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getModifiedBy() { - return modifiedBy; - } - - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } - - public Date getModifiedDate() { - return modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - @Transient - public boolean isReadOnly() { - return this.readOnly == '1'; - } - - @Transient - public void setReadOnly(boolean readOnly) { - if (readOnly) { - this.readOnly = '1'; - } else { - this.readOnly = '0'; - } - } - - @Transient - public boolean requiresResolvers() { - return this.requiresResolvers == '1'; - } - - @Transient - public void setRequiresResolvers(boolean requires) { - if (requires) { - this.requiresResolvers = '1'; - } else { - this.requiresResolvers = '0'; - } - } - - @Transient - public static Collection<PIPConfiguration> importPIPConfigurations(Properties properties) { - Collection<PIPConfiguration> configurations = new ArrayList<>(); - String engines = properties.getProperty(XACMLProperties.PROP_PIP_ENGINES); - if (engines == null || engines.isEmpty()) { - return configurations; - } - for (String id : Splitter.on(',').trimResults().omitEmptyStrings().split(engines)) { - PIPConfiguration configuration; - try { - String user = "super-admin"; - configuration = new PIPConfiguration(id, properties, user); - configuration.setCreatedBy(user); - configuration.setModifiedBy(user); - configurations.add(configuration); - } catch (PIPException e) { - logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Import failed: " + e.getLocalizedMessage()); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PIPConfiguration", "Import failed"); - } - } - - return configurations; - } - - @Transient - protected void readProperties(String id, Properties properties) throws PIPException { - // - // Save the id if we don't have one already - // - - if (this.id == 0) { - try { - this.id = Integer.parseInt(id); - } catch (NumberFormatException e) { - logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Convert id to integer failed: " + id); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PIPConfiguration", "Convert id to integer failed"); - } - } - // - // Get its classname, this MUST exist. - // - this.classname = properties.getProperty(id + ".classname"); - if (this.classname == null) { - throw new PIPException("PIP Engine defined without a classname"); - } - // - // Go through each property - // - for (Object nme : properties.keySet()) { - if (!nme.toString().startsWith(id)) { - continue; - } - if (nme.equals(id + ".classname")) { - // - // We already saved this - // - } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_NAME)) { - this.name = properties.getProperty(nme.toString()); - } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_DESCRIPTION)) { - this.description = properties.getProperty(nme.toString()); - } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_ISSUER)) { - this.issuer = properties.getProperty(nme.toString()); - } else if (nme.equals(id + ".resolvers")) { - // - // It has resolvers, make sure this is set to true if - // it has been already. - // - this.setRequiresResolvers(true); - // - // Parse the resolvers - // - Collection<PIPResolver> resolvers = PIPResolver.importResolvers(id + ".resolver", - properties.getProperty(nme.toString()), - properties,"super-admin" - ); - for (PIPResolver resolver : resolvers) { - this.addPipresolver(resolver); - } - } else if (nme.toString().startsWith(id + ".resolver")) { - // - // Ignore, the PIPResolver will parse these values - // - } else { - // - // Config Parameter - // - this.addPipconfigParam(new PIPConfigParam(nme.toString().substring(id.length() + 1), - properties.getProperty(nme.toString()))); - } - } - // - // Make sure we have a name at least - // - if (this.name == null) { - this.name = id; - } - } - - - @Transient - public Map<String, String> getConfiguration(String name) { - String prefix; - if (name == null) { - prefix = Integer.toString(this.id); - } else { - prefix = name; - } - if (!prefix.endsWith(".")) { - prefix = prefix + "."; - } - Map<String, String> map = new HashMap<>(); - map.put(prefix + "classname", this.classname); - map.put(prefix + "name", this.name); - if (this.description != null) { - map.put(prefix + "description", this.description); - } - if (this.issuer != null) { - map.put(prefix + "issuer", this.issuer); - } - - for (PIPConfigParam param : this.pipconfigParams) { - map.put(prefix + param.getParamName(), param.getParamValue()); - } - - List<String> ids = new ArrayList<>(); - Iterator<PIPResolver> iter = this.pipresolvers.iterator(); - while (iter.hasNext()) { - PIPResolver resolver = iter.next(); - String idd = Integer.toString(resolver.getId()); - Map<String, String> resolverMap = resolver.getConfiguration(prefix + "resolver." + idd); - map.putAll(resolverMap); - ids.add(idd); - } - if (!ids.isEmpty()) { - map.put(prefix + "resolvers", Joiner.on(',').join(ids)); - } - return map; - } - - @Transient - public Properties generateProperties(String name) { - String prefix; - if (name == null) { - prefix = Integer.toString(this.id); - } else { - if (name.endsWith(".")) { - prefix = name; - } else { - prefix = name + "."; - } - } - Properties props = new Properties(); - props.setProperty("xacml.pip.engines", name); - props.setProperty(prefix + "classname", this.classname); - props.setProperty(prefix + "name", this.name); - if (this.description != null) { - props.setProperty(prefix + "description", this.description); - } - if (this.issuer != null && !this.issuer.isEmpty()) { - props.setProperty(prefix + "issuer", this.issuer); - } - - for (PIPConfigParam param : this.pipconfigParams) { - props.setProperty(prefix + param.getParamName(), param.getParamValue()); - } - - List<String> ids = new ArrayList<>(); - Iterator<PIPResolver> iter = this.pipresolvers.iterator(); - while (iter.hasNext()) { - PIPResolver resolver = iter.next(); - String idd = Integer.toString(resolver.getId()); - resolver.generateProperties(props, prefix + "resolver." + idd); - ids.add(idd); - } - if (!ids.isEmpty()) { - props.setProperty(prefix + "resolvers", Joiner.on(',').join(ids)); - } - return props; - } - - @Transient - @Override - public String toString() { - return "PIPConfiguration [id=" + id + ", piptype=" + piptype - + ", classname=" + classname + ", name=" + name - + ", description=" + description + ", issuer=" + issuer - + ", readOnly=" + readOnly + ", requiresResolvers=" - + requiresResolvers + ", createdBy=" + createdBy - + ", createdDate=" + createdDate + ", modifiedBy=" + modifiedBy - + ", modifiedDate=" + modifiedDate + ", pipconfigParams=" - + pipconfigParams + ", pipresolvers=" + pipresolvers + "]"; - } + private static final long serialVersionUID = 1L; + private static final Log logger = LogFactory.getLog(PIPConfiguration.class); + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="DESCRIPTION", nullable=true, length=2048) + private String description; + + @Column(name="NAME", nullable=false, length=255) + private String name; + + @Column(name="CLASSNAME", nullable=false, length=2048) + private String classname; + + @Column(name="ISSUER", nullable=true, length=1024) + private String issuer; + + @Column(name="READ_ONLY", nullable=false) + private char readOnly = '0'; + + @Column(name="REQUIRES_RESOLVER", nullable=false) + private char requiresResolvers; + + @Column(name="CREATED_BY", nullable=false, length=255) + private String createdBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="CREATED_DATE", nullable=false, updatable=false) + private Date createdDate; + + @Column(name="MODIFIED_BY", nullable=false, length=255) + private String modifiedBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="MODIFIED_DATE", nullable=false) + private Date modifiedDate; + + //bi-directional many-to-one association to PIPConfigParam + @OneToMany(mappedBy="pipconfiguration", orphanRemoval=true, cascade=CascadeType.REMOVE) + private Set<PIPConfigParam> pipconfigParams = new HashSet<>(); + + //bi-directional many-to-one association to PIPType + @ManyToOne + @JoinColumn(name="TYPE") + private PIPType piptype; + + //bi-directional many-to-one association to PIPResolver + @OneToMany(mappedBy="pipconfiguration", orphanRemoval=true, cascade=CascadeType.REMOVE) + private Set<PIPResolver> pipresolvers = new HashSet<>(); + + public PIPConfiguration() { + //An empty constructor + } + + public PIPConfiguration(PIPConfiguration config, String user) { + this.description = config.description; + this.name = config.name; + this.classname = config.classname; + this.issuer = config.issuer; + this.requiresResolvers = config.requiresResolvers; + this.readOnly = config.readOnly; + this.piptype = config.piptype; + for (PIPConfigParam param : config.pipconfigParams) { + this.addPipconfigParam(new PIPConfigParam(param)); + } + for (PIPResolver resolver : config.pipresolvers) { + this.addPipresolver(new PIPResolver(resolver)); + } + } + + public PIPConfiguration(String id, Properties properties) throws PIPException { + this.readProperties(id, properties); + } + + public PIPConfiguration(String id, Properties properties, String user) throws PIPException { + this.createdBy = user; + this.modifiedBy = user; + this.readProperties(id, properties); + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getClassname() { + return classname; + } + + public void setClassname(String classname) { + this.classname = classname; + } + + public String getIssuer() { + return issuer; + } + + public void setIssuer(String issuer) { + this.issuer = issuer; + } + + public char getReadOnly() { + return readOnly; + } + + public void setReadOnly(char readOnly) { + this.readOnly = readOnly; + } + + public char getRequiresResolvers() { + return requiresResolvers; + } + + public void setRequiresResolvers(char requireResolvers) { + this.requiresResolvers = requireResolvers; + } + + public Set<PIPConfigParam> getPipconfigParams() { + return this.pipconfigParams; + } + + public void setPipconfigParams(Set<PIPConfigParam> pipconfigParams) { + this.pipconfigParams = pipconfigParams; + } + + public PIPConfigParam addPipconfigParam(PIPConfigParam pipconfigParam) { + getPipconfigParams().add(pipconfigParam); + pipconfigParam.setPipconfiguration(this); + + return pipconfigParam; + } + + public PIPConfigParam removePipconfigParam(PIPConfigParam pipconfigParam) { + if (pipconfigParam == null) { + return pipconfigParam; + } + getPipconfigParams().remove(pipconfigParam); + pipconfigParam.setPipconfiguration(null); + + return pipconfigParam; + } + + @Transient + public void clearConfigParams() { + while (!this.pipconfigParams.isEmpty()) { + this.removePipconfigParam(this.pipconfigParams.iterator().next()); + } + } + + public PIPType getPiptype() { + return this.piptype; + } + + public void setPiptype(PIPType piptype) { + this.piptype = piptype; + } + + public Set<PIPResolver> getPipresolvers() { + return this.pipresolvers; + } + + public void setPipresolvers(Set<PIPResolver> pipresolvers) { + this.pipresolvers = pipresolvers; + } + + public PIPResolver addPipresolver(PIPResolver pipresolver) { + getPipresolvers().add(pipresolver); + pipresolver.setPipconfiguration(this); + + return pipresolver; + } + + public PIPResolver removePipresolver(PIPResolver pipresolver) { + getPipresolvers().remove(pipresolver); + pipresolver.setPipconfiguration(null); + + return pipresolver; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Date getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getModifiedBy() { + return modifiedBy; + } + + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + public Date getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + + @Transient + public boolean isReadOnly() { + return this.readOnly == '1'; + } + + @Transient + public void setReadOnly(boolean readOnly) { + if (readOnly) { + this.readOnly = '1'; + } else { + this.readOnly = '0'; + } + } + + @Transient + public boolean requiresResolvers() { + return this.requiresResolvers == '1'; + } + + @Transient + public void setRequiresResolvers(boolean requires) { + if (requires) { + this.requiresResolvers = '1'; + } else { + this.requiresResolvers = '0'; + } + } + + @Transient + public static Collection<PIPConfiguration> importPIPConfigurations(Properties properties) { + Collection<PIPConfiguration> configurations = new ArrayList<>(); + String engines = properties.getProperty(XACMLProperties.PROP_PIP_ENGINES); + if (engines == null || engines.isEmpty()) { + return configurations; + } + for (String id : Splitter.on(',').trimResults().omitEmptyStrings().split(engines)) { + PIPConfiguration configuration; + try { + String user = "super-admin"; + configuration = new PIPConfiguration(id, properties, user); + configuration.setCreatedBy(user); + configuration.setModifiedBy(user); + configurations.add(configuration); + } catch (PIPException e) { + logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Import failed: " + e.getLocalizedMessage()); + PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PIPConfiguration", "Import failed"); + } + } + + return configurations; + } + + @Transient + protected void readProperties(String id, Properties properties) throws PIPException { + // + // Save the id if we don't have one already + // + + if (this.id == 0) { + try { + this.id = Integer.parseInt(id); + } catch (NumberFormatException e) { + logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Convert id to integer failed: " + id); + PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PIPConfiguration", "Convert id to integer failed"); + } + } + // + // Get its classname, this MUST exist. + // + this.classname = properties.getProperty(id + ".classname"); + if (this.classname == null) { + throw new PIPException("PIP Engine defined without a classname"); + } + // + // Go through each property + // + for (Object nme : properties.keySet()) { + if (!nme.toString().startsWith(id)) { + continue; + } + if (nme.equals(id + ".classname")) { + // + // We already saved this + // + } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_NAME)) { + this.name = properties.getProperty(nme.toString()); + } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_DESCRIPTION)) { + this.description = properties.getProperty(nme.toString()); + } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_ISSUER)) { + this.issuer = properties.getProperty(nme.toString()); + } else if (nme.equals(id + ".resolvers")) { + // + // It has resolvers, make sure this is set to true if + // it has been already. + // + this.setRequiresResolvers(true); + // + // Parse the resolvers + // + Collection<PIPResolver> resolvers = PIPResolver.importResolvers(id + ".resolver", + properties.getProperty(nme.toString()), + properties,"super-admin" + ); + for (PIPResolver resolver : resolvers) { + this.addPipresolver(resolver); + } + } else if (nme.toString().startsWith(id + ".resolver")) { + // + // Ignore, the PIPResolver will parse these values + // + } else { + // + // Config Parameter + // + this.addPipconfigParam(new PIPConfigParam(nme.toString().substring(id.length() + 1), + properties.getProperty(nme.toString()))); + } + } + // + // Make sure we have a name at least + // + if (this.name == null) { + this.name = id; + } + } + + + @Transient + public Map<String, String> getConfiguration(String name) { + String prefix; + if (name == null) { + prefix = Integer.toString(this.id); + } else { + prefix = name; + } + if (!prefix.endsWith(".")) { + prefix = prefix + "."; + } + Map<String, String> map = new HashMap<>(); + map.put(prefix + "classname", this.classname); + map.put(prefix + "name", this.name); + if (this.description != null) { + map.put(prefix + "description", this.description); + } + if (this.issuer != null) { + map.put(prefix + "issuer", this.issuer); + } + + for (PIPConfigParam param : this.pipconfigParams) { + map.put(prefix + param.getParamName(), param.getParamValue()); + } + + List<String> ids = new ArrayList<>(); + Iterator<PIPResolver> iter = this.pipresolvers.iterator(); + while (iter.hasNext()) { + PIPResolver resolver = iter.next(); + String idd = Integer.toString(resolver.getId()); + Map<String, String> resolverMap = resolver.getConfiguration(prefix + "resolver." + idd); + map.putAll(resolverMap); + ids.add(idd); + } + if (!ids.isEmpty()) { + map.put(prefix + "resolvers", Joiner.on(',').join(ids)); + } + return map; + } + + @Transient + public Properties generateProperties(String name) { + String prefix; + if (name == null) { + prefix = Integer.toString(this.id); + } else { + if (name.endsWith(".")) { + prefix = name; + } else { + prefix = name + "."; + } + } + Properties props = new Properties(); + props.setProperty("xacml.pip.engines", name); + props.setProperty(prefix + "classname", this.classname); + props.setProperty(prefix + "name", this.name); + if (this.description != null) { + props.setProperty(prefix + "description", this.description); + } + if (this.issuer != null && !this.issuer.isEmpty()) { + props.setProperty(prefix + "issuer", this.issuer); + } + + for (PIPConfigParam param : this.pipconfigParams) { + props.setProperty(prefix + param.getParamName(), param.getParamValue()); + } + + List<String> ids = new ArrayList<>(); + Iterator<PIPResolver> iter = this.pipresolvers.iterator(); + while (iter.hasNext()) { + PIPResolver resolver = iter.next(); + String idd = Integer.toString(resolver.getId()); + resolver.generateProperties(props, prefix + "resolver." + idd); + ids.add(idd); + } + if (!ids.isEmpty()) { + props.setProperty(prefix + "resolvers", Joiner.on(',').join(ids)); + } + return props; + } + + @Transient + @Override + public String toString() { + return "PIPConfiguration [id=" + id + ", piptype=" + piptype + + ", classname=" + classname + ", name=" + name + + ", description=" + description + ", issuer=" + issuer + + ", readOnly=" + readOnly + ", requiresResolvers=" + + requiresResolvers + ", createdBy=" + createdBy + + ", createdDate=" + createdDate + ", modifiedBy=" + modifiedBy + + ", modifiedDate=" + modifiedDate + ", pipconfigParams=" + + pipconfigParams + ", pipresolvers=" + pipresolvers + "]"; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java index a5e9ef824..a8b02580d 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java @@ -60,309 +60,309 @@ import com.google.common.base.Splitter; @Table(name="PIPResolver") @NamedQuery(name="PIPResolver.findAll", query="SELECT p FROM PIPResolver p") public class PIPResolver implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="DESCRIPTION", nullable=true, length=2048) - private String description; - - @Column(name="NAME", nullable=false, length=255) - private String name; - - @Column(name="ISSUER", nullable=true, length=1024) - private String issuer; - - @Column(name="CLASSNAME", nullable=false, length=2048) - private String classname; - - @Column(name="READ_ONLY", nullable=false) - private char readOnly = '0'; - - @Column(name="CREATED_BY", nullable=false, length=255) - private String createdBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="CREATED_DATE", nullable=false, updatable=false) - private Date createdDate; - - @Column(name="MODIFIED_BY", nullable=false, length=255) - private String modifiedBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="MODIFIED_DATE", nullable=false) - private Date modifiedDate; - - //bi-directional many-to-one association to PIPConfiguration - @ManyToOne - @JoinColumn(name="PIP_ID") - private PIPConfiguration pipconfiguration; - - //bi-directional many-to-one association to PIPResolverParam - @OneToMany(mappedBy="pipresolver", orphanRemoval=true, cascade=CascadeType.REMOVE) - private Set<PIPResolverParam> pipresolverParams = new HashSet<>(); - - public PIPResolver() { - //An empty constructor - } - - public PIPResolver(String prefix, Properties properties, String user) throws PIPException { - this.createdBy = user; - this.modifiedBy = user; - this.readOnly = '0'; - this.readProperties(prefix, properties); - } - - public PIPResolver(PIPResolver resolver) { - this.name = resolver.name; - this.description = resolver.description; - this.issuer = resolver.issuer; - this.classname = resolver.classname; - this.readOnly = resolver.readOnly; - for (PIPResolverParam param : this.pipresolverParams) { - this.addPipresolverParam(new PIPResolverParam(param)); - } - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public String getIssuer() { - return issuer; - } - - public void setIssuer(String issuer) { - this.issuer = issuer; - } - - public String getClassname() { - return classname; - } - - public void setClassname(String classname) { - this.classname = classname; - } - - public char getReadOnly() { - return readOnly; - } - - public void setReadOnly(char readOnly) { - this.readOnly = readOnly; - } - - public String getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - public Date getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getModifiedBy() { - return modifiedBy; - } - - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } - - public Date getModifiedDate() { - return modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - public PIPConfiguration getPipconfiguration() { - return this.pipconfiguration; - } - - public void setPipconfiguration(PIPConfiguration pipconfiguration) { - this.pipconfiguration = pipconfiguration; - } - - public Set<PIPResolverParam> getPipresolverParams() { - return this.pipresolverParams; - } - - public void setPipresolverParams(Set<PIPResolverParam> pipresolverParams) { - this.pipresolverParams = pipresolverParams; - } - - public PIPResolverParam addPipresolverParam(PIPResolverParam pipresolverParam) { - getPipresolverParams().add(pipresolverParam); - pipresolverParam.setPipresolver(this); - - return pipresolverParam; - } - - public PIPResolverParam removePipresolverParam(PIPResolverParam pipresolverParam) { - if (pipresolverParam == null) { - return pipresolverParam; - } - getPipresolverParams().remove(pipresolverParam); - pipresolverParam.setPipresolver(null); - - return pipresolverParam; - } - - @Transient - public void clearParams() { - while (!this.pipresolverParams.isEmpty()) { - this.removePipresolverParam(this.pipresolverParams.iterator().next()); - } - } - - @Transient - public boolean isReadOnly() { - return this.readOnly == '1'; - } - - @Transient - public void setReadOnly(boolean readOnly) { - if (readOnly) { - this.readOnly = '1'; - } else { - this.readOnly = '0'; - } - } - - @Transient - public static Collection<PIPResolver> importResolvers(String prefix, String list, Properties properties, String user) throws PIPException { - Collection<PIPResolver> resolvers = new ArrayList<>(); - for (String id : Splitter.on(',').trimResults().omitEmptyStrings().split(list)) { - resolvers.add(new PIPResolver(prefix + "." + id, properties, user)); - } - return resolvers; - } - - @Transient - protected void readProperties(String prefix, Properties properties) throws PIPException { - // - // Get its classname, this MUST exist. - // - this.classname = properties.getProperty(prefix + ".classname"); - if (this.classname == null) { - throw new PIPException("PIP Engine defined without a classname"); - } - // - // Go through each property - // - for (Object nme : properties.keySet()) { - if (!nme.toString().startsWith(prefix)) { - continue; - } - if (nme.equals(prefix + ".classname")) { - // - // We already saved this - // - } else if (nme.equals(prefix + "." + StdConfigurableEngine.PROP_NAME)) { - this.name = properties.getProperty(nme.toString()); - } else if (nme.equals(prefix + "." + StdConfigurableEngine.PROP_DESCRIPTION)) { - this.description = properties.getProperty(nme.toString()); - } else if (nme.equals(prefix + "." + StdConfigurableEngine.PROP_ISSUER)) { - this.issuer = properties.getProperty(nme.toString()); - } else { - this.addPipresolverParam(new PIPResolverParam(nme.toString().substring(prefix.length() + 1), - properties.getProperty(nme.toString()))); - } - } - } - - @Transient - public Map<String, String> getConfiguration(String prefix) { - String pref = prefix; - Map<String, String> map = new HashMap<>(); - if (!prefix.endsWith(".")) { - pref = prefix + "."; - } - map.put(pref + "classname", this.classname); - map.put(pref + "name", this.name); - if (this.description != null) { - map.put(pref + "description", this.description); - } - if (this.issuer != null && this.issuer.isEmpty()) { - map.put(pref + "issuer", this.issuer); - } - for (PIPResolverParam param : this.pipresolverParams) { - map.put(pref + param.getParamName(), param.getParamValue()); - } - return map; - } - - @Transient - public void generateProperties(Properties props, String prefix) { - String pref = prefix; - if (!prefix.endsWith(".")) { - pref = prefix + "."; - } - props.setProperty(pref + "classname", this.classname); - props.setProperty(pref + "name", this.name); - if (this.description != null) { - props.setProperty(pref + "description", this.description); - } - if (this.issuer != null && this.issuer.isEmpty()) { - props.setProperty(pref + "issuer", this.issuer); - } - for (PIPResolverParam param : this.pipresolverParams) { - props.setProperty(pref + param.getParamName(), param.getParamValue()); - } - } - - @Transient - @Override - public String toString() { - return "PIPResolver [id=" + id + ", classname=" + classname + ", name=" - + name + ", description=" + description + ", issuer=" + issuer - + ", readOnly=" + readOnly + ", createdBy=" + createdBy - + ", createdDate=" + createdDate + ", modifiedBy=" + modifiedBy - + ", modifiedDate=" + modifiedDate + ", pipresolverParams=" - + pipresolverParams + "]"; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="DESCRIPTION", nullable=true, length=2048) + private String description; + + @Column(name="NAME", nullable=false, length=255) + private String name; + + @Column(name="ISSUER", nullable=true, length=1024) + private String issuer; + + @Column(name="CLASSNAME", nullable=false, length=2048) + private String classname; + + @Column(name="READ_ONLY", nullable=false) + private char readOnly = '0'; + + @Column(name="CREATED_BY", nullable=false, length=255) + private String createdBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="CREATED_DATE", nullable=false, updatable=false) + private Date createdDate; + + @Column(name="MODIFIED_BY", nullable=false, length=255) + private String modifiedBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="MODIFIED_DATE", nullable=false) + private Date modifiedDate; + + //bi-directional many-to-one association to PIPConfiguration + @ManyToOne + @JoinColumn(name="PIP_ID") + private PIPConfiguration pipconfiguration; + + //bi-directional many-to-one association to PIPResolverParam + @OneToMany(mappedBy="pipresolver", orphanRemoval=true, cascade=CascadeType.REMOVE) + private Set<PIPResolverParam> pipresolverParams = new HashSet<>(); + + public PIPResolver() { + //An empty constructor + } + + public PIPResolver(String prefix, Properties properties, String user) throws PIPException { + this.createdBy = user; + this.modifiedBy = user; + this.readOnly = '0'; + this.readProperties(prefix, properties); + } + + public PIPResolver(PIPResolver resolver) { + this.name = resolver.name; + this.description = resolver.description; + this.issuer = resolver.issuer; + this.classname = resolver.classname; + this.readOnly = resolver.readOnly; + for (PIPResolverParam param : this.pipresolverParams) { + this.addPipresolverParam(new PIPResolverParam(param)); + } + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIssuer() { + return issuer; + } + + public void setIssuer(String issuer) { + this.issuer = issuer; + } + + public String getClassname() { + return classname; + } + + public void setClassname(String classname) { + this.classname = classname; + } + + public char getReadOnly() { + return readOnly; + } + + public void setReadOnly(char readOnly) { + this.readOnly = readOnly; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Date getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getModifiedBy() { + return modifiedBy; + } + + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + public Date getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public PIPConfiguration getPipconfiguration() { + return this.pipconfiguration; + } + + public void setPipconfiguration(PIPConfiguration pipconfiguration) { + this.pipconfiguration = pipconfiguration; + } + + public Set<PIPResolverParam> getPipresolverParams() { + return this.pipresolverParams; + } + + public void setPipresolverParams(Set<PIPResolverParam> pipresolverParams) { + this.pipresolverParams = pipresolverParams; + } + + public PIPResolverParam addPipresolverParam(PIPResolverParam pipresolverParam) { + getPipresolverParams().add(pipresolverParam); + pipresolverParam.setPipresolver(this); + + return pipresolverParam; + } + + public PIPResolverParam removePipresolverParam(PIPResolverParam pipresolverParam) { + if (pipresolverParam == null) { + return pipresolverParam; + } + getPipresolverParams().remove(pipresolverParam); + pipresolverParam.setPipresolver(null); + + return pipresolverParam; + } + + @Transient + public void clearParams() { + while (!this.pipresolverParams.isEmpty()) { + this.removePipresolverParam(this.pipresolverParams.iterator().next()); + } + } + + @Transient + public boolean isReadOnly() { + return this.readOnly == '1'; + } + + @Transient + public void setReadOnly(boolean readOnly) { + if (readOnly) { + this.readOnly = '1'; + } else { + this.readOnly = '0'; + } + } + + @Transient + public static Collection<PIPResolver> importResolvers(String prefix, String list, Properties properties, String user) throws PIPException { + Collection<PIPResolver> resolvers = new ArrayList<>(); + for (String id : Splitter.on(',').trimResults().omitEmptyStrings().split(list)) { + resolvers.add(new PIPResolver(prefix + "." + id, properties, user)); + } + return resolvers; + } + + @Transient + protected void readProperties(String prefix, Properties properties) throws PIPException { + // + // Get its classname, this MUST exist. + // + this.classname = properties.getProperty(prefix + ".classname"); + if (this.classname == null) { + throw new PIPException("PIP Engine defined without a classname"); + } + // + // Go through each property + // + for (Object nme : properties.keySet()) { + if (!nme.toString().startsWith(prefix)) { + continue; + } + if (nme.equals(prefix + ".classname")) { + // + // We already saved this + // + } else if (nme.equals(prefix + "." + StdConfigurableEngine.PROP_NAME)) { + this.name = properties.getProperty(nme.toString()); + } else if (nme.equals(prefix + "." + StdConfigurableEngine.PROP_DESCRIPTION)) { + this.description = properties.getProperty(nme.toString()); + } else if (nme.equals(prefix + "." + StdConfigurableEngine.PROP_ISSUER)) { + this.issuer = properties.getProperty(nme.toString()); + } else { + this.addPipresolverParam(new PIPResolverParam(nme.toString().substring(prefix.length() + 1), + properties.getProperty(nme.toString()))); + } + } + } + + @Transient + public Map<String, String> getConfiguration(String prefix) { + String pref = prefix; + Map<String, String> map = new HashMap<>(); + if (!prefix.endsWith(".")) { + pref = prefix + "."; + } + map.put(pref + "classname", this.classname); + map.put(pref + "name", this.name); + if (this.description != null) { + map.put(pref + "description", this.description); + } + if (this.issuer != null && this.issuer.isEmpty()) { + map.put(pref + "issuer", this.issuer); + } + for (PIPResolverParam param : this.pipresolverParams) { + map.put(pref + param.getParamName(), param.getParamValue()); + } + return map; + } + + @Transient + public void generateProperties(Properties props, String prefix) { + String pref = prefix; + if (!prefix.endsWith(".")) { + pref = prefix + "."; + } + props.setProperty(pref + "classname", this.classname); + props.setProperty(pref + "name", this.name); + if (this.description != null) { + props.setProperty(pref + "description", this.description); + } + if (this.issuer != null && this.issuer.isEmpty()) { + props.setProperty(pref + "issuer", this.issuer); + } + for (PIPResolverParam param : this.pipresolverParams) { + props.setProperty(pref + param.getParamName(), param.getParamValue()); + } + } + + @Transient + @Override + public String toString() { + return "PIPResolver [id=" + id + ", classname=" + classname + ", name=" + + name + ", description=" + description + ", issuer=" + issuer + + ", readOnly=" + readOnly + ", createdBy=" + createdBy + + ", createdDate=" + createdDate + ", modifiedBy=" + modifiedBy + + ", modifiedDate=" + modifiedDate + ", pipresolverParams=" + + pipresolverParams + "]"; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolverParam.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolverParam.java index 3db0e0f0d..7356eebf8 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolverParam.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolverParam.java @@ -33,116 +33,116 @@ import javax.persistence.*; @Table(name="PIPResolverParams") @NamedQuery(name="PIPResolverParam.findAll", query="SELECT p FROM PIPResolverParam p") public class PIPResolverParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="PARAM_NAME", nullable=false, length=1024) - private String paramName; - - @Column(name="PARAM_VALUE", nullable=false, length=2048) - private String paramValue; - - @Column(name="PARAM_DEFAULT", nullable=true, length=2048) - private String paramDefault; - - @Column(name="REQUIRED", nullable=false) - private char required = '0'; - - //bi-directional many-to-one association to PIPResolver - @ManyToOne - @JoinColumn(name="ID_RESOLVER") - private PIPResolver pipresolver; - - public PIPResolverParam() { - // Empty constructor - } - - public PIPResolverParam(String name) { - this.paramName = name; - } - - public PIPResolverParam(String name, String value) { - this(name); - this.paramValue = value; - } - - public PIPResolverParam(PIPResolverParam param) { - this(param.getParamName(), param.getParamValue()); - this.paramDefault = param.getParamDefault(); - this.required = param.required; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getParamName() { - return this.paramName; - } - - public void setParamName(String paramName) { - this.paramName = paramName; - } - - public String getParamValue() { - return this.paramValue; - } - - public void setParamValue(String paramValue) { - this.paramValue = paramValue; - } - - public String getParamDefault() { - return paramDefault; - } - - public void setParamDefault(String paramDefault) { - this.paramDefault = paramDefault; - } - - public char getRequired() { - return required; - } - - public void setRequired(char required) { - this.required = required; - } - - public PIPResolver getPipresolver() { - return this.pipresolver; - } - - public void setPipresolver(PIPResolver pipresolver) { - this.pipresolver = pipresolver; - } - - @Transient - public boolean isRequired() { - return this.required == '1'; - } - - @Transient - public void setRequired(boolean required) { - if (required) { - this.required = '1'; - } else { - this.required = '0'; - } - } - - @Transient - @Override - public String toString() { - return "PIPResolverParam [id=" + id + ", paramName=" + paramName - + ", paramValue=" + paramValue + ", required=" + required + "]"; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="PARAM_NAME", nullable=false, length=1024) + private String paramName; + + @Column(name="PARAM_VALUE", nullable=false, length=2048) + private String paramValue; + + @Column(name="PARAM_DEFAULT", nullable=true, length=2048) + private String paramDefault; + + @Column(name="REQUIRED", nullable=false) + private char required = '0'; + + //bi-directional many-to-one association to PIPResolver + @ManyToOne + @JoinColumn(name="ID_RESOLVER") + private PIPResolver pipresolver; + + public PIPResolverParam() { + // Empty constructor + } + + public PIPResolverParam(String name) { + this.paramName = name; + } + + public PIPResolverParam(String name, String value) { + this(name); + this.paramValue = value; + } + + public PIPResolverParam(PIPResolverParam param) { + this(param.getParamName(), param.getParamValue()); + this.paramDefault = param.getParamDefault(); + this.required = param.required; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getParamName() { + return this.paramName; + } + + public void setParamName(String paramName) { + this.paramName = paramName; + } + + public String getParamValue() { + return this.paramValue; + } + + public void setParamValue(String paramValue) { + this.paramValue = paramValue; + } + + public String getParamDefault() { + return paramDefault; + } + + public void setParamDefault(String paramDefault) { + this.paramDefault = paramDefault; + } + + public char getRequired() { + return required; + } + + public void setRequired(char required) { + this.required = required; + } + + public PIPResolver getPipresolver() { + return this.pipresolver; + } + + public void setPipresolver(PIPResolver pipresolver) { + this.pipresolver = pipresolver; + } + + @Transient + public boolean isRequired() { + return this.required == '1'; + } + + @Transient + public void setRequired(boolean required) { + if (required) { + this.required = '1'; + } else { + this.required = '0'; + } + } + + @Transient + @Override + public String toString() { + return "PIPResolverParam [id=" + id + ", paramName=" + paramName + + ", paramValue=" + paramValue + ", required=" + required + "]"; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPType.java index 61ab9ffca..aa8c45ef2 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPType.java @@ -42,91 +42,91 @@ import javax.persistence.Transient; @Table(name="PIPType") @NamedQuery(name="PIPType.findAll", query="SELECT p FROM PIPType p") public class PIPType implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String TYPE_SQL = "SQL"; - public static final String TYPE_LDAP = "LDAP"; - public static final String TYPE_CSV = "CSV"; - public static final String TYPE_HYPERCSV = "Hyper-CSV"; - public static final String TYPE_CUSTOM = "Custom"; - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="type", nullable=false, length=45) - private String type; - - //bi-directional many-to-one association to PIPConfiguration - @OneToMany(mappedBy="piptype") - private Set<PIPConfiguration> pipconfigurations; - - public PIPType() { - // Empty constructor - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getType() { - return this.type; - } - - public void setType(String type) { - this.type = type; - } - - public Set<PIPConfiguration> getPipconfigurations() { - return this.pipconfigurations; - } - - public void setPipconfigurations(Set<PIPConfiguration> pipconfigurations) { - this.pipconfigurations = pipconfigurations; - } - - public PIPConfiguration addPipconfiguration(PIPConfiguration pipconfiguration) { - getPipconfigurations().add(pipconfiguration); - pipconfiguration.setPiptype(this); - - return pipconfiguration; - } - - public PIPConfiguration removePipconfiguration(PIPConfiguration pipconfiguration) { - getPipconfigurations().remove(pipconfiguration); - pipconfiguration.setPiptype(null); - - return pipconfiguration; - } - - @Transient - public boolean isSQL() { - return this.type.equals(TYPE_SQL); - } - - @Transient - public boolean isLDAP() { - return this.type.equals(TYPE_LDAP); - } - - @Transient - public boolean isCSV() { - return this.type.equals(TYPE_CSV); - } - - @Transient - public boolean isHyperCSV() { - return this.type.equals(TYPE_HYPERCSV); - } - - @Transient - public boolean isCustom() { - return this.type.equals(TYPE_CUSTOM); - } + private static final long serialVersionUID = 1L; + + public static final String TYPE_SQL = "SQL"; + public static final String TYPE_LDAP = "LDAP"; + public static final String TYPE_CSV = "CSV"; + public static final String TYPE_HYPERCSV = "Hyper-CSV"; + public static final String TYPE_CUSTOM = "Custom"; + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="type", nullable=false, length=45) + private String type; + + //bi-directional many-to-one association to PIPConfiguration + @OneToMany(mappedBy="piptype") + private Set<PIPConfiguration> pipconfigurations; + + public PIPType() { + // Empty constructor + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + } + + public Set<PIPConfiguration> getPipconfigurations() { + return this.pipconfigurations; + } + + public void setPipconfigurations(Set<PIPConfiguration> pipconfigurations) { + this.pipconfigurations = pipconfigurations; + } + + public PIPConfiguration addPipconfiguration(PIPConfiguration pipconfiguration) { + getPipconfigurations().add(pipconfiguration); + pipconfiguration.setPiptype(this); + + return pipconfiguration; + } + + public PIPConfiguration removePipconfiguration(PIPConfiguration pipconfiguration) { + getPipconfigurations().remove(pipconfiguration); + pipconfiguration.setPiptype(null); + + return pipconfiguration; + } + + @Transient + public boolean isSQL() { + return this.type.equals(TYPE_SQL); + } + + @Transient + public boolean isLDAP() { + return this.type.equals(TYPE_LDAP); + } + + @Transient + public boolean isCSV() { + return this.type.equals(TYPE_CSV); + } + + @Transient + public boolean isHyperCSV() { + return this.type.equals(TYPE_HYPERCSV); + } + + @Transient + public boolean isCustom() { + return this.type.equals(TYPE_CUSTOM); + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PdpEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PdpEntity.java index a76bd624a..92c0c9dbe 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PdpEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PdpEntity.java @@ -50,192 +50,192 @@ import javax.persistence.TemporalType; //Add a non-unique index and a constraint that says the combo of policyName and scopeId must be unique @Table(name="PdpEntity") @NamedQueries({ - @NamedQuery(name="PdpEntity.findAll", query="SELECT e FROM PdpEntity e "), - @NamedQuery(name="PdpEntity.deleteAll", query="DELETE FROM PdpEntity WHERE 1=1") + @NamedQuery(name="PdpEntity.findAll", query="SELECT e FROM PdpEntity e "), + @NamedQuery(name="PdpEntity.deleteAll", query="DELETE FROM PdpEntity WHERE 1=1") }) public class PdpEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqPdp") - @GeneratedValue(strategy = GenerationType.AUTO) - @Column (name="pdpKey") - private long pdpKey; - - @Column (name="pdpId", nullable=false, unique=false, length=255) - private String pdpId; - - @Column(name="pdpName", nullable=false, unique=false, length=255) - private String pdpName; - - @Column(name="jmxPort", nullable=false, unique=false) - private int jmxPort; - - - @ManyToOne(optional=false) - @JoinColumn(name="groupKey", referencedColumnName="groupKey") - private GroupEntity groupEntity; - - @Column(name="created_by", nullable=false, length=255) - private String createdBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Column(name="description", nullable=false, length=2048) - private String description = "NoDescription"; - - @Column(name="modified_by", nullable=false, length=255) - private String modifiedBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @Column(name="deleted", nullable=false) - private boolean deleted = false; - - public PdpEntity() { - super(); - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public long getPdpKey(){ - return pdpKey; - } - /** - * @return the policyId - */ - public String getPdpId() { - return pdpId; - } - - public void setPdpId(String id){ - pdpId = id; - } - /** - * @param policyId cannot be set - */ - - public String getPdpName() { - return pdpName; - } - - public void setPdpName(String groupName) { - this.pdpName = groupName; - } - - - - /** - * @return the configurationDataEntity - */ - public GroupEntity getGroup() { - return groupEntity; - } - - /** - * @param configurationDataEntity the configurationDataEntity to set - */ - public void setGroup(GroupEntity group) { - this.groupEntity = group; - } - - - - /** - * @return the createdBy - */ - public String getCreatedBy() { - return createdBy; - } - - /** - * @param createdBy the createdBy to set - */ - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the modifiedBy - */ - public String getModifiedBy() { - return modifiedBy; - } - - /** - * @param modifiedBy the modifiedBy to set - */ - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } - - /** - * @return the version - */ - public int getJmxPort() { - return jmxPort; - } - - public void setJmxPort(int jmxPort){ - this.jmxPort = jmxPort; - } - - /** - * @return the createdDate - */ - public Date getCreatedDate() { - return createdDate; - } - - /** - * @return the modifiedDate - */ - public Date getModifiedDate() { - return modifiedDate; - } - - /** - * @return the deleted - */ - public boolean isDeleted() { - return deleted; - } - - /** - * @param deleted the deleted to set - */ - public void setDeleted(boolean deleted) { - this.deleted = deleted; - } + private static final long serialVersionUID = 1L; + + @Id + //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqPdp") + @GeneratedValue(strategy = GenerationType.AUTO) + @Column (name="pdpKey") + private long pdpKey; + + @Column (name="pdpId", nullable=false, unique=false, length=255) + private String pdpId; + + @Column(name="pdpName", nullable=false, unique=false, length=255) + private String pdpName; + + @Column(name="jmxPort", nullable=false, unique=false) + private int jmxPort; + + + @ManyToOne(optional=false) + @JoinColumn(name="groupKey", referencedColumnName="groupKey") + private GroupEntity groupEntity; + + @Column(name="created_by", nullable=false, length=255) + private String createdBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Column(name="description", nullable=false, length=2048) + private String description = "NoDescription"; + + @Column(name="modified_by", nullable=false, length=255) + private String modifiedBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @Column(name="deleted", nullable=false) + private boolean deleted = false; + + public PdpEntity() { + super(); + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public long getPdpKey(){ + return pdpKey; + } + /** + * @return the policyId + */ + public String getPdpId() { + return pdpId; + } + + public void setPdpId(String id){ + pdpId = id; + } + /** + * @param policyId cannot be set + */ + + public String getPdpName() { + return pdpName; + } + + public void setPdpName(String groupName) { + this.pdpName = groupName; + } + + + + /** + * @return the configurationDataEntity + */ + public GroupEntity getGroup() { + return groupEntity; + } + + /** + * @param configurationDataEntity the configurationDataEntity to set + */ + public void setGroup(GroupEntity group) { + this.groupEntity = group; + } + + + + /** + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + + /** + * @param createdBy the createdBy to set + */ + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the modifiedBy + */ + public String getModifiedBy() { + return modifiedBy; + } + + /** + * @param modifiedBy the modifiedBy to set + */ + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + /** + * @return the version + */ + public int getJmxPort() { + return jmxPort; + } + + public void setJmxPort(int jmxPort){ + this.jmxPort = jmxPort; + } + + /** + * @return the createdDate + */ + public Date getCreatedDate() { + return createdDate; + } + + /** + * @return the modifiedDate + */ + public Date getModifiedDate() { + return modifiedDate; + } + + /** + * @return the deleted + */ + public boolean isDeleted() { + return deleted; + } + + /** + * @param deleted the deleted to set + */ + public void setDeleted(boolean deleted) { + this.deleted = deleted; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyAlgorithms.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyAlgorithms.java index c21b832b6..ba1097500 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyAlgorithms.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyAlgorithms.java @@ -37,80 +37,80 @@ import com.att.research.xacml.api.Identifier; @Table(name="PolicyAlgorithms") @NamedQuery(name="PolicyAlgorithms.findAll", query="SELECT d FROM PolicyAlgorithms d") public class PolicyAlgorithms implements Serializable { - private static final long serialVersionUID = 1L; - - public static final char STANDARD = 'S'; - public static final char CUSTOM = 'C'; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="is_standard", nullable=false) - private char isStandard; - - @Column(name="xacml_id", nullable=false, unique=true, length=255) - private String xacmlId; - - @Column(name="short_name", nullable=false, length=64) - private String shortName; - - public PolicyAlgorithms(Identifier identifier, char standard) { - this.isStandard = standard; - if (identifier != null) { - this.xacmlId = identifier.stringValue(); - } - } - - public PolicyAlgorithms(Identifier identifier) { - this(identifier, PolicyAlgorithms.STANDARD); - } - - public PolicyAlgorithms() { - this(null, PolicyAlgorithms.STANDARD); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public char getIsStandard() { - return this.isStandard; - } - - public void setIsStandard(char isStandard) { - this.isStandard = isStandard; - } - - @Transient - public boolean isStandard() { - return this.isStandard == PolicyAlgorithms.STANDARD; - } - - @Transient - public boolean isCustom() { - return this.isStandard == PolicyAlgorithms.CUSTOM; - } - - public String getXacmlId() { - return this.xacmlId; - } - - public void setXacmlId(String xacmlId) { - this.xacmlId = xacmlId; - } - - public String getShortName() { - return shortName; - } - - public void setShortName(String shortName) { - this.shortName = shortName; - } + private static final long serialVersionUID = 1L; + + public static final char STANDARD = 'S'; + public static final char CUSTOM = 'C'; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="is_standard", nullable=false) + private char isStandard; + + @Column(name="xacml_id", nullable=false, unique=true, length=255) + private String xacmlId; + + @Column(name="short_name", nullable=false, length=64) + private String shortName; + + public PolicyAlgorithms(Identifier identifier, char standard) { + this.isStandard = standard; + if (identifier != null) { + this.xacmlId = identifier.stringValue(); + } + } + + public PolicyAlgorithms(Identifier identifier) { + this(identifier, PolicyAlgorithms.STANDARD); + } + + public PolicyAlgorithms() { + this(null, PolicyAlgorithms.STANDARD); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public char getIsStandard() { + return this.isStandard; + } + + public void setIsStandard(char isStandard) { + this.isStandard = isStandard; + } + + @Transient + public boolean isStandard() { + return this.isStandard == PolicyAlgorithms.STANDARD; + } + + @Transient + public boolean isCustom() { + return this.isStandard == PolicyAlgorithms.CUSTOM; + } + + public String getXacmlId() { + return this.xacmlId; + } + + public void setXacmlId(String xacmlId) { + this.xacmlId = xacmlId; + } + + public String getShortName() { + return shortName; + } + + public void setShortName(String shortName) { + this.shortName = shortName; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyDBDaoEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyDBDaoEntity.java index 8b0843ed0..7a0c2fe2f 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyDBDaoEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyDBDaoEntity.java @@ -46,105 +46,105 @@ import javax.persistence.TemporalType; @Table(name="PolicyDBDaoEntity") @NamedQueries({ - @NamedQuery(name="PolicyDBDaoEntity.findAll", query="SELECT e FROM PolicyDBDaoEntity e "), - @NamedQuery(name="PolicyDBDaoEntity.deleteAll", query="DELETE FROM PolicyDBDaoEntity WHERE 1=1") + @NamedQuery(name="PolicyDBDaoEntity.findAll", query="SELECT e FROM PolicyDBDaoEntity e "), + @NamedQuery(name="PolicyDBDaoEntity.deleteAll", query="DELETE FROM PolicyDBDaoEntity WHERE 1=1") }) public class PolicyDBDaoEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @Column(name="policyDBDaoUrl", nullable=false, unique=true) - private String policyDBDaoUrl; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - //username for the pap server that registered this PolicyDBDaoEntity - @Column(name="username") - private String username; - - //AES encrypted password for the pap server that registered this PolicyDBDaoEntity - @Column(name="password") - private String password; - - //A column to allow some descriptive text. For example: Atlanta data center - @Column(name="description", nullable=false, length=2048) - private String description = "NoDescription"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - public PolicyDBDaoEntity() { - super(); - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - /** - * @return the policyDBDaoUrl - */ - public String getPolicyDBDaoUrl() { - return policyDBDaoUrl; - } - - /** - * @param url the policyDBDaoUrl to set - */ - public void setPolicyDBDaoUrl(String url) { - this.policyDBDaoUrl = url; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the createdDate - */ - public Date getCreatedDate() { - return createdDate; - } - - /** - * @return the modifiedDate - */ - public Date getModifiedDate() { - return modifiedDate; - } - - public String getUsername(){ - return this.username; - } - public void setUsername(String username){ - this.username = username; - } - public String getPassword(){ - return this.password; - } - public void setPassword(String password){ - this.password = password; - } + private static final long serialVersionUID = 1L; + + @Id + @Column(name="policyDBDaoUrl", nullable=false, unique=true) + private String policyDBDaoUrl; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + //username for the pap server that registered this PolicyDBDaoEntity + @Column(name="username") + private String username; + + //AES encrypted password for the pap server that registered this PolicyDBDaoEntity + @Column(name="password") + private String password; + + //A column to allow some descriptive text. For example: Atlanta data center + @Column(name="description", nullable=false, length=2048) + private String description = "NoDescription"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + public PolicyDBDaoEntity() { + super(); + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + /** + * @return the policyDBDaoUrl + */ + public String getPolicyDBDaoUrl() { + return policyDBDaoUrl; + } + + /** + * @param url the policyDBDaoUrl to set + */ + public void setPolicyDBDaoUrl(String url) { + this.policyDBDaoUrl = url; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the createdDate + */ + public Date getCreatedDate() { + return createdDate; + } + + /** + * @return the modifiedDate + */ + public Date getModifiedDate() { + return modifiedDate; + } + + public String getUsername(){ + return this.username; + } + public void setUsername(String username){ + this.username = username; + } + public String getPassword(){ + return this.password; + } + public void setPassword(String password){ + this.password = password; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java index 923f5ec6f..1bfa46bf9 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java @@ -42,91 +42,91 @@ import javax.persistence.TemporalType; @Table(name="PolicyEditorScopes") @NamedQuery(name="PolicyEditorScopes.findAll", query="SELECT p FROM PolicyEditorScopes p ") public class PolicyEditorScopes implements Serializable{ - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="scopeName", nullable=false, unique=true) - @OrderBy("asc") - private String scopeName; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getScopeName() { - return scopeName; - } - - public void setScopeName(String scopeName) { - this.scopeName = scopeName; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="scopeName", nullable=false, unique=true) + @OrderBy("asc") + private String scopeName; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getScopeName() { + return scopeName; + } + + public void setScopeName(String scopeName) { + this.scopeName = scopeName; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java index c262aec4e..f28a607af 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java @@ -57,274 +57,274 @@ import com.fasterxml.jackson.annotation.JsonManagedReference; @Table(name="PolicyEntity") @NamedQueries({ - @NamedQuery(name="PolicyEntity.findAll", query="SELECT e FROM PolicyEntity e "), - @NamedQuery(name="PolicyEntity.findAllByDeletedFlag", query="SELECT e FROM PolicyEntity e WHERE e.deleted = :deleted"), - @NamedQuery(name="PolicyEntity.FindById", query="SELECT e FROM PolicyEntity e WHERE e.policyId = :id"), - @NamedQuery(name="PolicyEntity.deleteAll", query="DELETE FROM PolicyEntity WHERE 1=1"), - @NamedQuery(name="PolicyEntity.findByNameAndScope", query="SELECT e FROM PolicyEntity e WHERE e.policyName = :name AND e.scope = :scope") + @NamedQuery(name="PolicyEntity.findAll", query="SELECT e FROM PolicyEntity e "), + @NamedQuery(name="PolicyEntity.findAllByDeletedFlag", query="SELECT e FROM PolicyEntity e WHERE e.deleted = :deleted"), + @NamedQuery(name="PolicyEntity.FindById", query="SELECT e FROM PolicyEntity e WHERE e.policyId = :id"), + @NamedQuery(name="PolicyEntity.deleteAll", query="DELETE FROM PolicyEntity WHERE 1=1"), + @NamedQuery(name="PolicyEntity.findByNameAndScope", query="SELECT e FROM PolicyEntity e WHERE e.policyName = :name AND e.scope = :scope") }) public class PolicyEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column (name="policyId") - @JsonBackReference - private long policyId; - - @Column(name="policyName", nullable=false, unique=false, length=255) - private String policyName; - - //The scope is the directory structure in dot notation. For example: org.onap.myproject - @Column(name="scope", nullable=false, unique=false, length=255) - private String scope; - - @Version - @Column(name="version") - private int version; - - //not going to be used - @Column(name="policyVersion") - private int policyVersion = 0; - - @Lob - @Column(name="policyData", nullable=false, columnDefinition="TEXT") - private String policyData = "NoData"; - - @OneToOne(optional=true, orphanRemoval=true) - @JoinColumn(name="configurationDataId") - @JsonManagedReference - private ConfigurationDataEntity configurationDataEntity; - - @OneToOne(optional=true, orphanRemoval=true) - @JoinColumn(name="actionBodyId") - @JsonManagedReference - private ActionBodyEntity actionBodyEntity; - - @Column(name="created_by", nullable=false, length=255) - private String createdBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Column(name="description", nullable=false, length=2048) - private String description = "NoDescription"; - - @Column(name="modified_by", nullable=false, length=255) - private String modifiedBy = "guest"; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @Column(name="deleted", nullable=false) - private boolean deleted = false; - - public PolicyEntity() { - super(); - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - /** - * @return the policyId - */ - public long getPolicyId() { - return policyId; - } - - /** - * @param policyId cannot be set - */ - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - /** - * @return the policyData - */ - public String getPolicyData() { - return policyData; - } - - /** - * @param policyData the policyData to set - */ - public void setPolicyData(String policyData) { - this.policyData = policyData; - } - - /** - * @return the configurationDataEntity - */ - public ConfigurationDataEntity getConfigurationData() { - return configurationDataEntity; - } - - /** - * @param configurationDataEntity the configurationDataEntity to set - */ - public void setConfigurationData(ConfigurationDataEntity configurationDataEntity) { - this.configurationDataEntity = configurationDataEntity; - } - - /** - * @return the actionBodyEntity - */ - public ActionBodyEntity getActionBodyEntity() { - return actionBodyEntity; - } - - /** - * @param actionBodyEntity the actionBodyEntity to set - */ - public void setActionBodyEntity(ActionBodyEntity actionBodyEntity) { - this.actionBodyEntity = actionBodyEntity; - } - - /** - * @return the scope - */ - public String getScope() { - return scope; - } - - /** - * @param scope the scope to set - */ - public void setScope(String scope) { - this.scope = scope; - } - - /** - * @return the createdBy - */ - public String getCreatedBy() { - return createdBy; - } - - /** - * @param createdBy the createdBy to set - */ - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the modifiedBy - */ - public String getModifiedBy() { - return modifiedBy; - } - - /** - * @param modifiedBy the modifiedBy to set - */ - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } - - /** - * @return the version - */ - public int getVersion() { - return version; - } - - /** - * @return the createdDate - */ - public Date getCreatedDate() { - return createdDate; - } - - /** - * @return the modifiedDate - */ - public Date getModifiedDate() { - return modifiedDate; - } - - /** - * @return the deleted - */ - public boolean isDeleted() { - return deleted; - } - - /** - * @param deleted the deleted to set - */ - public void setDeleted(boolean deleted) { - this.deleted = deleted; - } - - @Override - public int hashCode() { - return Objects.hash(policyId, policyName, scope, version, policyVersion, policyData, configurationDataEntity, - actionBodyEntity, createdBy, createdDate, description, modifiedBy, modifiedDate, deleted); - } - - @Override - public boolean equals(Object obj) { - if(obj == null){ - return false; - } - if(obj == this){ - return true; - } - if(!(obj instanceof PolicyEntity)){ - return false; - } - - PolicyEntity p = (PolicyEntity) obj; - - return policyId == p.policyId && - policyName.equals(p.policyName) && - scope.equals(p.scope) && - version == p.version && - policyVersion == p.policyVersion && - policyData.equals(p.policyData) && - ((configurationDataEntity == null && p.configurationDataEntity == null) || (configurationDataEntity!=null && configurationDataEntity.equals(p.configurationDataEntity))) && - ((actionBodyEntity == null && p.actionBodyEntity == null) || (actionBodyEntity!=null && actionBodyEntity.equals(p.actionBodyEntity))) && - createdBy.equals(p.createdBy) && - createdDate.equals(p.createdDate) && - description.equals(p.description) && - modifiedBy.equals(p.modifiedBy) && - modifiedDate.equals(p.modifiedDate) && - deleted == p.deleted; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column (name="policyId") + @JsonBackReference + private long policyId; + + @Column(name="policyName", nullable=false, unique=false, length=255) + private String policyName; + + //The scope is the directory structure in dot notation. For example: org.onap.myproject + @Column(name="scope", nullable=false, unique=false, length=255) + private String scope; + + @Version + @Column(name="version") + private int version; + + //not going to be used + @Column(name="policyVersion") + private int policyVersion = 0; + + @Lob + @Column(name="policyData", nullable=false, columnDefinition="TEXT") + private String policyData = "NoData"; + + @OneToOne(optional=true, orphanRemoval=true) + @JoinColumn(name="configurationDataId") + @JsonManagedReference + private ConfigurationDataEntity configurationDataEntity; + + @OneToOne(optional=true, orphanRemoval=true) + @JoinColumn(name="actionBodyId") + @JsonManagedReference + private ActionBodyEntity actionBodyEntity; + + @Column(name="created_by", nullable=false, length=255) + private String createdBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Column(name="description", nullable=false, length=2048) + private String description = "NoDescription"; + + @Column(name="modified_by", nullable=false, length=255) + private String modifiedBy = "guest"; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @Column(name="deleted", nullable=false) + private boolean deleted = false; + + public PolicyEntity() { + super(); + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + /** + * @return the policyId + */ + public long getPolicyId() { + return policyId; + } + + /** + * @param policyId cannot be set + */ + + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + /** + * @return the policyData + */ + public String getPolicyData() { + return policyData; + } + + /** + * @param policyData the policyData to set + */ + public void setPolicyData(String policyData) { + this.policyData = policyData; + } + + /** + * @return the configurationDataEntity + */ + public ConfigurationDataEntity getConfigurationData() { + return configurationDataEntity; + } + + /** + * @param configurationDataEntity the configurationDataEntity to set + */ + public void setConfigurationData(ConfigurationDataEntity configurationDataEntity) { + this.configurationDataEntity = configurationDataEntity; + } + + /** + * @return the actionBodyEntity + */ + public ActionBodyEntity getActionBodyEntity() { + return actionBodyEntity; + } + + /** + * @param actionBodyEntity the actionBodyEntity to set + */ + public void setActionBodyEntity(ActionBodyEntity actionBodyEntity) { + this.actionBodyEntity = actionBodyEntity; + } + + /** + * @return the scope + */ + public String getScope() { + return scope; + } + + /** + * @param scope the scope to set + */ + public void setScope(String scope) { + this.scope = scope; + } + + /** + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + + /** + * @param createdBy the createdBy to set + */ + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the modifiedBy + */ + public String getModifiedBy() { + return modifiedBy; + } + + /** + * @param modifiedBy the modifiedBy to set + */ + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + /** + * @return the version + */ + public int getVersion() { + return version; + } + + /** + * @return the createdDate + */ + public Date getCreatedDate() { + return createdDate; + } + + /** + * @return the modifiedDate + */ + public Date getModifiedDate() { + return modifiedDate; + } + + /** + * @return the deleted + */ + public boolean isDeleted() { + return deleted; + } + + /** + * @param deleted the deleted to set + */ + public void setDeleted(boolean deleted) { + this.deleted = deleted; + } + + @Override + public int hashCode() { + return Objects.hash(policyId, policyName, scope, version, policyVersion, policyData, configurationDataEntity, + actionBodyEntity, createdBy, createdDate, description, modifiedBy, modifiedDate, deleted); + } + + @Override + public boolean equals(Object obj) { + if(obj == null){ + return false; + } + if(obj == this){ + return true; + } + if(!(obj instanceof PolicyEntity)){ + return false; + } + + PolicyEntity p = (PolicyEntity) obj; + + return policyId == p.policyId && + policyName.equals(p.policyName) && + scope.equals(p.scope) && + version == p.version && + policyVersion == p.policyVersion && + policyData.equals(p.policyData) && + ((configurationDataEntity == null && p.configurationDataEntity == null) || (configurationDataEntity!=null && configurationDataEntity.equals(p.configurationDataEntity))) && + ((actionBodyEntity == null && p.actionBodyEntity == null) || (actionBodyEntity!=null && actionBodyEntity.equals(p.actionBodyEntity))) && + createdBy.equals(p.createdBy) && + createdDate.equals(p.createdDate) && + description.equals(p.description) && + modifiedBy.equals(p.modifiedBy) && + modifiedDate.equals(p.modifiedDate) && + deleted == p.deleted; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyGroupEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyGroupEntity.java index ef2ff6e56..52f8177f3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyGroupEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyGroupEntity.java @@ -32,29 +32,29 @@ import javax.persistence.Table; @NamedQuery(name="PolicyGroupEntity.findAll", query="SELECT p FROM PolicyGroupEntity p ") public class PolicyGroupEntity implements Serializable{ - private static final long serialVersionUID = 1L; - - @Id - @Column(name="groupKey") - private int groupKey; - - @Id - @Column(name="policyid") - private int policyid; - - public int getGroupKey() { - return groupKey; - } - - public void setGroupKey(int groupKey) { - this.groupKey = groupKey; - } - - public int getPolicyid() { - return policyid; - } - - public void setPolicyid(int policyid) { - this.policyid = policyid; - } + private static final long serialVersionUID = 1L; + + @Id + @Column(name="groupKey") + private int groupKey; + + @Id + @Column(name="policyid") + private int policyid; + + public int getGroupKey() { + return groupKey; + } + + public void setGroupKey(int groupKey) { + this.groupKey = groupKey; + } + + public int getPolicyid() { + return policyid; + } + + public void setPolicyid(int policyid) { + this.policyid = policyid; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyRoles.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyRoles.java index e7230d694..f220570bd 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyRoles.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyRoles.java @@ -45,59 +45,59 @@ import org.onap.policy.rest.jpa.UserInfo; @Table(name="roles") @NamedQuery(name="PolicyRoles.findAll", query="SELECT r FROM PolicyRoles r ") public class PolicyRoles implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - - @Column(name="id") - private int id; - - @ManyToOne - @JoinColumn(name="loginid") - @OrderBy("asc") - private UserInfo loginId; - - public UserInfo getLoginId() { - return loginId; - } - - public void setLoginId(UserInfo loginId) { - this.loginId = loginId; - } - - @Column(name="scope", nullable=true, length=45) - private String scope; - - @Column(name="role", nullable=false, length=45) - private String role; - - public PolicyRoles() { - // Empty constructor - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getScope() { - return this.scope; - } - - public void setScope(String scope) { - this.scope = scope; - - } - public String getRole() { - return this.role; - } - - public void setRole(String role) { - this.role = role; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + + @Column(name="id") + private int id; + + @ManyToOne + @JoinColumn(name="loginid") + @OrderBy("asc") + private UserInfo loginId; + + public UserInfo getLoginId() { + return loginId; + } + + public void setLoginId(UserInfo loginId) { + this.loginId = loginId; + } + + @Column(name="scope", nullable=true, length=45) + private String scope; + + @Column(name="role", nullable=false, length=45) + private String role; + + public PolicyRoles() { + // Empty constructor + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getScope() { + return this.scope; + } + + public void setScope(String scope) { + this.scope = scope; + + } + public String getRole() { + return this.role; + } + + public void setRole(String role) { + this.role = role; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java index 32dd112f7..c1597741e 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java @@ -37,41 +37,41 @@ import javax.persistence.Table; @Table(name="PolicyScopeClosedLoop") @NamedQuery(name="PolicyScopeClosedLoop.findAll", query="SELECT e FROM PolicyScopeClosedLoop e ") public class PolicyScopeClosedLoop implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="description ") - private String description ; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public int getId() { - return this.id; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + @Column(name="description ") + private String description ; - public void setName(String name) { - this.name = name; + public int getId() { + return this.id; + } - } - public String getDescriptionValue() { - return this.description ; - } + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } - public void setDescriptionValue(String description ) { - this.description = description ; - } + public void setName(String name) { + this.name = name; + + } + public String getDescriptionValue() { + return this.description ; + } + + public void setDescriptionValue(String description ) { + this.description = description ; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java index 10c3c74fd..323275624 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java @@ -37,40 +37,40 @@ import javax.persistence.Table; @Table(name="PolicyScopeResource") @NamedQuery(name="PolicyScopeResource.findAll", query="SELECT e FROM PolicyScopeResource e ") public class PolicyScopeResource implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="description ") - private String description ; - - public int getId() { - return this.id; - } + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public void setName(String name) { - this.name = name; + @Column(name="description ") + private String description ; - } - public String getDescriptionValue() { - return this.description ; - } + public int getId() { + return this.id; + } - public void setDescriptionValue(String description ) { - this.description = description ; - } + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + + } + public String getDescriptionValue() { + return this.description ; + } + + public void setDescriptionValue(String description ) { + this.description = description ; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java index 9d89b98b1..8238110f0 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java @@ -37,41 +37,41 @@ import javax.persistence.Table; @Table(name="PolicyScopeService") @NamedQuery(name="PolicyScopeService.findAll", query="SELECT e FROM PolicyScopeService e ") public class PolicyScopeService implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="description ") - private String description ; - - public int getId() { - return this.id; - } + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public void setName(String name) { - this.name = name; + @Column(name="description ") + private String description ; - } - public String getDescriptionValue() { - return this.description ; - } + public int getId() { + return this.id; + } - public void setDescriptionValue(String description ) { - this.description = description ; - } + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + + } + public String getDescriptionValue() { + return this.description ; + } + + public void setDescriptionValue(String description ) { + this.description = description ; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java index 0367b0149..04f20c330 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java @@ -37,40 +37,40 @@ import javax.persistence.Table; @Table(name="PolicyScopeType") @NamedQuery(name="PolicyScopeType.findAll", query="SELECT e FROM PolicyScopeType e ") public class PolicyScopeType implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="description ") - private String description ; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public int getId() { - return this.id; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + @Column(name="description ") + private String description ; - public void setName(String name) { - this.name = name; + public int getId() { + return this.id; + } - } - public String getDescriptionValue() { - return this.description ; - } + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } - public void setDescriptionValue(String description ) { - this.description = description ; - } + public void setName(String name) { + this.name = name; + + } + public String getDescriptionValue() { + return this.description ; + } + + public void setDescriptionValue(String description ) { + this.description = description ; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java index dba7299bb..3bb0919b7 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java @@ -35,56 +35,56 @@ import javax.persistence.Table; @Entity @Table(name="POLICYSCORE") @NamedQueries({ - @NamedQuery(name="POLICYSCORE.findAll", query="SELECT p FROM PolicyScore p"), - @NamedQuery(name="POLICYSCORE.deleteAll", query="DELETE FROM PolicyScore WHERE 1=1"), - @NamedQuery(name="POLICYSCORE.findByPolicyName", query="Select p from PolicyScore p where p.PolicyName=:pname") + @NamedQuery(name="POLICYSCORE.findAll", query="SELECT p FROM PolicyScore p"), + @NamedQuery(name="POLICYSCORE.deleteAll", query="DELETE FROM PolicyScore WHERE 1=1"), + @NamedQuery(name="POLICYSCORE.findByPolicyName", query="Select p from PolicyScore p where p.PolicyName=:pname") }) public class PolicyScore implements Serializable { - - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="POLICY_NAME", nullable=false) - @OrderBy("asc") - private String PolicyName; - - @Column(name="VERSIONEXTENSION", nullable=false) - @OrderBy("asc") - private String VersionExtension; - - @Column(name="POLICY_SCORE", nullable=true) - private String PolicyScore; - - public int getId() { - return id; - } - public void setId(int id) { - this.id = id; - } - public String getPolicyName() { - return PolicyName; - } - public void setPolicyName(String policyName) { - PolicyName = policyName; - } - public String getVersionExtension() { - return VersionExtension; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="POLICY_NAME", nullable=false) + @OrderBy("asc") + private String PolicyName; + + @Column(name="VERSIONEXTENSION", nullable=false) + @OrderBy("asc") + private String VersionExtension; + + @Column(name="POLICY_SCORE", nullable=true) + private String PolicyScore; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + public String getPolicyName() { + return PolicyName; + } + public void setPolicyName(String policyName) { + PolicyName = policyName; + } + public String getVersionExtension() { + return VersionExtension; + } + + public void setVersionExtension(String versionExtension) { + VersionExtension = versionExtension; + } + public String getPolicyScore() { + return PolicyScore; + } + public void setPolicyScore(String policyScore) { + PolicyScore = policyScore; + } - public void setVersionExtension(String versionExtension) { - VersionExtension = versionExtension; - } - public String getPolicyScore() { - return PolicyScore; - } - public void setPolicyScore(String policyScore) { - PolicyScore = policyScore; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java index 6af607f0c..677046326 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java @@ -41,164 +41,164 @@ import javax.persistence.TemporalType; @Entity @Table(name="PolicyVersion") @NamedQueries({ - @NamedQuery(name="PolicyVersion.findAll", query="SELECT p FROM PolicyVersion p"), - @NamedQuery(name="PolicyVersion.deleteAll", query="DELETE FROM PolicyVersion WHERE 1=1"), - @NamedQuery(name="PolicyVersion.findByPolicyName", query="Select p from PolicyVersion p where p.policyName=:pname"), - @NamedQuery(name="PolicyVersion.findAllCount", query="SELECT COUNT(p) FROM PolicyVersion p") + @NamedQuery(name="PolicyVersion.findAll", query="SELECT p FROM PolicyVersion p"), + @NamedQuery(name="PolicyVersion.deleteAll", query="DELETE FROM PolicyVersion WHERE 1=1"), + @NamedQuery(name="PolicyVersion.findByPolicyName", query="Select p from PolicyVersion p where p.policyName=:pname"), + @NamedQuery(name="PolicyVersion.findAllCount", query="SELECT COUNT(p) FROM PolicyVersion p") }) public class PolicyVersion implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - - @Column(name="id") - private int id; - - @Column(name="POLICY_NAME", nullable=false, length=255) - private String policyName; - - @Column(name="ACTIVE_VERSION") - private int activeVersion; - - @Column(name="HIGHEST_VERSION") - private int higherVersion; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", nullable=false) - private Date createdDate; - - - public int getActiveVersion() { - return activeVersion; - } - - public void setActiveVersion(int activeVersion) { - this.activeVersion = activeVersion; - } - - public int getHigherVersion() { - return higherVersion; - } - - public void setHigherVersion(int higherVersion) { - this.higherVersion = higherVersion; - } - - @Column(name="CREATED_BY", nullable=false, length=45) - private String createdBy; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - - @Column(name="modified_by", nullable=false, length=45) - private String modifiedBy; - - public PolicyVersion(String domain, String loginUserId) { - this(domain); - this.createdBy = loginUserId; - this.modifiedBy = loginUserId; - } - - public PolicyVersion(String domain) { - this.policyName = domain; - } - - public PolicyVersion(){ - // Empty constructor - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public Date getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - public Date getModifiedDate() { - return modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - public String getModifiedBy() { - return modifiedBy; - } - - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } - - @Override - public int hashCode() { - return Objects.hash(id, policyName, activeVersion, higherVersion, createdDate, - createdBy, modifiedDate, modifiedBy); - } - - @Override - public boolean equals(Object obj) { - if(obj == null){ - return false; - } - if(obj == this){ - return true; - } - if(!(obj instanceof PolicyVersion)){ - return false; - } - - PolicyVersion p = (PolicyVersion) obj; - - return id == p.id && - policyName.equals(p.policyName) && - activeVersion == p.activeVersion && - higherVersion == p.higherVersion && - createdDate.equals(p.createdDate) && - createdBy.equals(p.createdBy) && - modifiedDate.equals(p.modifiedDate) && - modifiedBy.equals(p.modifiedBy); - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + + @Column(name="id") + private int id; + + @Column(name="POLICY_NAME", nullable=false, length=255) + private String policyName; + + @Column(name="ACTIVE_VERSION") + private int activeVersion; + + @Column(name="HIGHEST_VERSION") + private int higherVersion; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", nullable=false) + private Date createdDate; + + + public int getActiveVersion() { + return activeVersion; + } + + public void setActiveVersion(int activeVersion) { + this.activeVersion = activeVersion; + } + + public int getHigherVersion() { + return higherVersion; + } + + public void setHigherVersion(int higherVersion) { + this.higherVersion = higherVersion; + } + + @Column(name="CREATED_BY", nullable=false, length=45) + private String createdBy; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + + @Column(name="modified_by", nullable=false, length=45) + private String modifiedBy; + + public PolicyVersion(String domain, String loginUserId) { + this(domain); + this.createdBy = loginUserId; + this.modifiedBy = loginUserId; + } + + public PolicyVersion(String domain) { + this.policyName = domain; + } + + public PolicyVersion(){ + // Empty constructor + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + public Date getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Date getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public String getModifiedBy() { + return modifiedBy; + } + + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + @Override + public int hashCode() { + return Objects.hash(id, policyName, activeVersion, higherVersion, createdDate, + createdBy, modifiedDate, modifiedBy); + } + + @Override + public boolean equals(Object obj) { + if(obj == null){ + return false; + } + if(obj == this){ + return true; + } + if(!(obj instanceof PolicyVersion)){ + return false; + } + + PolicyVersion p = (PolicyVersion) obj; + + return id == p.id && + policyName.equals(p.policyName) && + activeVersion == p.activeVersion && + higherVersion == p.higherVersion && + createdDate.equals(p.createdDate) && + createdBy.equals(p.createdBy) && + modifiedDate.equals(p.modifiedDate) && + modifiedBy.equals(p.modifiedBy); + } } - + diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java index 64c892921..93732ffcd 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java @@ -36,41 +36,41 @@ import javax.persistence.Table; @Table(name="portlist") @NamedQuery(name="PortList.findAll", query="SELECT e FROM PortList e ") public class PortList implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="portname", nullable=false) - @OrderBy("asc") - private String portName; - - @Column(name="description") - private String description; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public int getId() { - return this.id; - } + @Column(name="portname", nullable=false) + @OrderBy("asc") + private String portName; - public void setId(int id) { - this.id = id; - } - public String getPortName() { - return this.portName; - } + @Column(name="description") + private String description; - public void setPortName(String portName) { - this.portName = portName; + public int getId() { + return this.id; + } - } - public String getDescription() { - return this.description; - } + public void setId(int id) { + this.id = id; + } + public String getPortName() { + return this.portName; + } + + public void setPortName(String portName) { + this.portName = portName; + + } + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } - public void setDescription(String description) { - this.description = description; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java index 4047143a1..9a0e8aec0 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java @@ -36,53 +36,53 @@ import javax.persistence.Table; @Table(name="PrefixList") @NamedQuery(name="PrefixList.findAll", query="SELECT e FROM PrefixList e ") public class PrefixList implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="pl_name", nullable=false) - @OrderBy("asc") - private String prefixListName; - - @Column(name="description", nullable=false) - private String description; - - @Column(name="pl_value", nullable=false) - private String prefixListValue; - - public String getPrefixListName() { - return this.prefixListName; - } - - public void setPrefixListName(String prefixListName) { - this.prefixListName = prefixListName; - - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - - } - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getPrefixListValue() { - return this.prefixListValue; - } - - public void setPrefixListValue(String prefixListValue) { - this.prefixListValue = prefixListValue; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="pl_name", nullable=false) + @OrderBy("asc") + private String prefixListName; + + @Column(name="description", nullable=false) + private String description; + + @Column(name="pl_value", nullable=false) + private String prefixListValue; + + public String getPrefixListName() { + return this.prefixListName; + } + + public void setPrefixListName(String prefixListName) { + this.prefixListName = prefixListName; + + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + + } + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getPrefixListValue() { + return this.prefixListValue; + } + + public void setPrefixListValue(String prefixListValue) { + this.prefixListValue = prefixListValue; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java index 7e96c4053..5e79e6785 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java @@ -36,44 +36,44 @@ import javax.persistence.Table; @Table(name="protocollist") @NamedQuery(name="ProtocolList.findAll", query="SELECT e FROM ProtocolList e ") public class ProtocolList implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="protocolname", nullable=false) - @OrderBy("asc") - private String protocolName; - - @Column(name="description") - private String description; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public String getProtocolName() { - return this.protocolName; - } + @Column(name="protocolname", nullable=false) + @OrderBy("asc") + private String protocolName; - public void setProtocolName(String protocolName) { - this.protocolName = protocolName; + @Column(name="description") + private String description; - } - - public String getDescription() { - return this.description; - } + public String getProtocolName() { + return this.protocolName; + } - public void setDescription(String description) { - this.description = description; + public void setProtocolName(String protocolName) { + this.protocolName = protocolName; - } - - public int getId() { - return this.id; - } + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } - public void setId(int id) { - this.id = id; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java index 6761fe963..fd1a6b73b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java @@ -40,79 +40,79 @@ import java.io.Serializable; @Table(name="RainyDayTreatments") @NamedQuery(name="RainyDayTreatments.findAll", query="SELECT e FROM RainyDayTreatments e") public class RainyDayTreatments implements Serializable { - /** - * - */ - private static final long serialVersionUID = -2491410352490381323L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="bbid", nullable=false, length=255) - @OrderBy("asc") - private String bbid; - - @Column(name="workstep", nullable=true, length=255) - private String workstep; - - @Column(name="treatments", nullable=true, length=1028) - private String treatments; - - public RainyDayTreatments() { - // Empty constructor - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - /** - * @return the bbid - */ - public String getBbid() { - return bbid; - } - - /** - * @param bbid the bbid to set - */ - public void setBbid(String bbid) { - this.bbid = bbid; - } - - /** - * @return the workstep - */ - public String getWorkstep() { - return workstep; - } - - /** - * @param workstep the workstep to set - */ - public void setWorkstep(String workstep) { - this.workstep = workstep; - } - - /** - * @return the treatments - */ - public String getTreatments() { - return treatments; - } - - /** - * @param treatments the treatments to set - */ - public void setTreatments(String treatments) { - this.treatments = treatments; - } - - + /** + * + */ + private static final long serialVersionUID = -2491410352490381323L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="bbid", nullable=false, length=255) + @OrderBy("asc") + private String bbid; + + @Column(name="workstep", nullable=true, length=255) + private String workstep; + + @Column(name="treatments", nullable=true, length=1028) + private String treatments; + + public RainyDayTreatments() { + // Empty constructor + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + /** + * @return the bbid + */ + public String getBbid() { + return bbid; + } + + /** + * @param bbid the bbid to set + */ + public void setBbid(String bbid) { + this.bbid = bbid; + } + + /** + * @return the workstep + */ + public String getWorkstep() { + return workstep; + } + + /** + * @param workstep the workstep to set + */ + public void setWorkstep(String workstep) { + this.workstep = workstep; + } + + /** + * @return the treatments + */ + public String getTreatments() { + return treatments; + } + + /** + * @param treatments the treatments to set + */ + public void setTreatments(String treatments) { + this.treatments = treatments; + } + + }
\ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java index b338b186c..0cb339adf 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java @@ -37,42 +37,42 @@ import javax.persistence.Table; @Table(name="RemoteCatalogValues") @NamedQuery(name="RemoteCatalogValues.findAll", query="SELECT e FROM RemoteCatalogValues e ") public class RemoteCatalogValues implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - @Column(name="value") - private String value; + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public int getId() { - return this.id; - } + @Column(name="value") + private String value; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + public String getValue() { + return value; + } - public void setName(String name) { - this.name = name; + public void setValue(String value) { + this.value = value; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + + } - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java index 5e6981590..8239d4ef8 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java @@ -44,101 +44,101 @@ import javax.persistence.TemporalType; @Table(name="RiskType") @NamedQuery(name="RiskType.findAll", query="SELECT e FROM RiskType e ") public class RiskType implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false, unique=true) - @OrderBy("asc") - private String name; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - public String getRiskName() { - return this.name; - } - - public void setRiskName(String riskName) { - this.name = riskName; - - } - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="name", nullable=false, unique=true) + @OrderBy("asc") + private String name; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + public String getRiskName() { + return this.name; + } + + public void setRiskName(String riskName) { + this.name = riskName; + + } + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java index ae73fd71e..905648d5c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java @@ -36,79 +36,79 @@ import com.att.research.xacml.api.Identifier; @Table(name="RuleAlgorithms") @NamedQuery(name="RuleAlgorithms.findAll", query="SELECT d FROM RuleAlgorithms d") public class RuleAlgorithms implements Serializable { - private static final long serialVersionUID = 1L; - - public static final char STANDARD = 'S'; - public static final char CUSTOM = 'C'; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="is_standard", nullable=false) - private char isStandard; - - @Column(name="xacml_id", nullable=false, unique=true, length=255) - private String xacmlId; - - @Column(name="short_name", nullable=false, length=64) - private String shortName; - - public RuleAlgorithms(Identifier id, char standard) { - if (id != null) { - this.xacmlId = id.stringValue(); - } - this.isStandard = standard; - } - public RuleAlgorithms(Identifier id) { - this(id, RuleAlgorithms.STANDARD); - } - - public RuleAlgorithms() { - this(null, RuleAlgorithms.STANDARD); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public char getIsStandard() { - return this.isStandard; - } - - public void setIsStandard(char isStandard) { - this.isStandard = isStandard; - } - - @Transient - public boolean isStandard() { - return this.isStandard == RuleAlgorithms.STANDARD; - } - - @Transient - public boolean isCustom() { - return this.isStandard == RuleAlgorithms.CUSTOM; - } - - public String getXacmlId() { - return this.xacmlId; - } - - public void setXacmlId(String xacmlId) { - this.xacmlId = xacmlId; - } - - public String getShortName() { - return shortName; - } - - public void setShortName(String shortName) { - this.shortName = shortName; - } + private static final long serialVersionUID = 1L; + + public static final char STANDARD = 'S'; + public static final char CUSTOM = 'C'; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="is_standard", nullable=false) + private char isStandard; + + @Column(name="xacml_id", nullable=false, unique=true, length=255) + private String xacmlId; + + @Column(name="short_name", nullable=false, length=64) + private String shortName; + + public RuleAlgorithms(Identifier id, char standard) { + if (id != null) { + this.xacmlId = id.stringValue(); + } + this.isStandard = standard; + } + public RuleAlgorithms(Identifier id) { + this(id, RuleAlgorithms.STANDARD); + } + + public RuleAlgorithms() { + this(null, RuleAlgorithms.STANDARD); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public char getIsStandard() { + return this.isStandard; + } + + public void setIsStandard(char isStandard) { + this.isStandard = isStandard; + } + + @Transient + public boolean isStandard() { + return this.isStandard == RuleAlgorithms.STANDARD; + } + + @Transient + public boolean isCustom() { + return this.isStandard == RuleAlgorithms.CUSTOM; + } + + public String getXacmlId() { + return this.xacmlId; + } + + public void setXacmlId(String xacmlId) { + this.xacmlId = xacmlId; + } + + public String getShortName() { + return shortName; + } + + public void setShortName(String shortName) { + this.shortName = shortName; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java index 4426cac60..adc61506b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java @@ -37,50 +37,50 @@ import javax.persistence.Table; @Table(name="SafePolicyWarning") @NamedQuery(name="SafePolicyWarning.findAll", query="SELECT e FROM SafePolicyWarning e ") public class SafePolicyWarning implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; - - @Column(name="message") - private String message ; - - @Column(name="riskType") - private String riskType ; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public String getRiskType() { - return riskType; - } - public void setRiskType(String riskType) { - this.riskType = riskType; - } - - public int getId() { - return this.id; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + @Column(name="message") + private String message ; - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - public void setName(String name) { - this.name = name; + @Column(name="riskType") + private String riskType ; - } + public String getRiskType() { + return riskType; + } + public void setRiskType(String riskType) { + this.riskType = riskType; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } + + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + public void setName(String name) { + this.name = name; + + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java index 30881337a..c1d6c0174 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java @@ -36,41 +36,41 @@ import javax.persistence.Table; @Table(name="securityzone") @NamedQuery(name="SecurityZone.findAll", query="SELECT e FROM SecurityZone e ") public class SecurityZone implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String zoneName; - - @Column(name="value") - private String zoneValue; - - public int getId() { - return this.id; - } + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public void setId(int id) { - this.id = id; - } - public String getZoneName() { - return this.zoneName; - } + @Column(name="name", nullable=false) + @OrderBy("asc") + private String zoneName; - public void setZoneName(String zoneName) { - this.zoneName = zoneName; + @Column(name="value") + private String zoneValue; - } - public String getZoneValue() { - return this.zoneValue; - } + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getZoneName() { + return this.zoneName; + } + + public void setZoneName(String zoneName) { + this.zoneName = zoneName; + + } + public String getZoneValue() { + return this.zoneValue; + } + + public void setZoneValue(String zoneValue) { + this.zoneValue = zoneValue; + } - public void setZoneValue(String zoneValue) { - this.zoneValue = zoneValue; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java index e09dff07a..33243b0a5 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java @@ -36,88 +36,88 @@ import javax.persistence.Table; @Table(name="servicegroup") @NamedQuery(name="ServiceList.findAll", query="SELECT e FROM ServiceList e ") public class ServiceList implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String serviceName; - - @Column(name="description") - private String serviceDesc; - - @Column(name="type") - private String serviceType; - - @Column(name="transportprotocol") - private String serviceTrasProtocol; - - @Column(name="appprotocol ") - private String serviceAppProtocol; - - @Column(name="ports") - private String servicePorts; - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getServiceName() { - return this.serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - - } - - public String getServiceDescription() { - return this.serviceDesc; - } - - public void setServiceDescription(String serviceDesc) { - this.serviceDesc = serviceDesc; - - } - - public String getServiceType() { - return this.serviceType; - } - - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - public String getServiceTransProtocol() { - return this.serviceTrasProtocol; - } - - public void setServiceTransProtocol(String serviceTrasProtocol) { - this.serviceTrasProtocol = serviceTrasProtocol; - - } - - public String getServiceAppProtocol() { - return this.serviceAppProtocol; - } - - public void setServiceAppProtocol(String serviceAppProtocol) { - this.serviceAppProtocol = serviceAppProtocol; - - } - public String getServicePorts() { - return this.servicePorts; - } - - public void setServicePorts(String servicePorts) { - this.servicePorts = servicePorts; - - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="name", nullable=false) + @OrderBy("asc") + private String serviceName; + + @Column(name="description") + private String serviceDesc; + + @Column(name="type") + private String serviceType; + + @Column(name="transportprotocol") + private String serviceTrasProtocol; + + @Column(name="appprotocol ") + private String serviceAppProtocol; + + @Column(name="ports") + private String servicePorts; + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getServiceName() { + return this.serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + + } + + public String getServiceDescription() { + return this.serviceDesc; + } + + public void setServiceDescription(String serviceDesc) { + this.serviceDesc = serviceDesc; + + } + + public String getServiceType() { + return this.serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getServiceTransProtocol() { + return this.serviceTrasProtocol; + } + + public void setServiceTransProtocol(String serviceTrasProtocol) { + this.serviceTrasProtocol = serviceTrasProtocol; + + } + + public String getServiceAppProtocol() { + return this.serviceAppProtocol; + } + + public void setServiceAppProtocol(String serviceAppProtocol) { + this.serviceAppProtocol = serviceAppProtocol; + + } + public String getServicePorts() { + return this.servicePorts; + } + + public void setServicePorts(String servicePorts) { + this.servicePorts = servicePorts; + + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java index 45e20d632..9dbfc52ee 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java @@ -40,102 +40,102 @@ import javax.persistence.TemporalType; @Table(name="SystemLogDB") @NamedQuery(name="SystemLogDB.findAll", query="SELECT o FROM SystemLogDB o") public class SystemLogDB implements Serializable { - private static final long serialVersionUID = 1L; - - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="type", nullable=false) - private String type; - - @Column(name="system", nullable=false, length=255) - private String system; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Column(name="remote", nullable=false, length=255) - private String remote; - - @Column(name="logtype", nullable=false, length=255) - private String logtype; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="date", nullable=false, updatable=false) - private Date date; - - public SystemLogDB() { - super(); - } - - public SystemLogDB(int id, String system, String description, String remote, - String type, String logtype) { - this.id = id; - this.system = system; - this.description = description; - this.remote = remote; - this.type = type; - this.logtype = logtype; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public Date getDate(){ - return this.date; - } - - public void setDate(Date date){ - this.date = date; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getType() { - return this.type; - } - - public void setType(String type) { - this.type = type; - - } - - public String getSystem() { - return this.system; - } - - public void setSystem(String system) { - this.system = system; - } - - public String getRemote() { - return this.remote; - } - - public void setRemote(String remote) { - this.remote = remote; - - } - public String getLogtype() { - return this.logtype; - } - - public void setLogtype(String logtype) { - this.logtype = logtype; - - } + private static final long serialVersionUID = 1L; + + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="type", nullable=false) + private String type; + + @Column(name="system", nullable=false, length=255) + private String system; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Column(name="remote", nullable=false, length=255) + private String remote; + + @Column(name="logtype", nullable=false, length=255) + private String logtype; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="date", nullable=false, updatable=false) + private Date date; + + public SystemLogDB() { + super(); + } + + public SystemLogDB(int id, String system, String description, String remote, + String type, String logtype) { + this.id = id; + this.system = system; + this.description = description; + this.remote = remote; + this.type = type; + this.logtype = logtype; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public Date getDate(){ + return this.date; + } + + public void setDate(Date date){ + this.date = date; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + + } + + public String getSystem() { + return this.system; + } + + public void setSystem(String system) { + this.system = system; + } + + public String getRemote() { + return this.remote; + } + + public void setRemote(String remote) { + this.remote = remote; + + } + public String getLogtype() { + return this.logtype; + } + + public void setLogtype(String logtype) { + this.logtype = logtype; + + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java index 1b7186105..95d2ae5de 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java @@ -43,200 +43,200 @@ import javax.persistence.TemporalType; @Table(name="TERM") @NamedQuery(name="TermList.findAll", query="SELECT e FROM TermList e") public class TermList implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="termName", nullable=false) - @OrderBy("asc") - private String termName; - - @Column(name="description") - private String termDescription; - - @Column(name="fromzone") - private String fromZone; - - @Column(name="tozone") - private String toZone; - - @Column(name="srcIPList") - private String srcIPList; - - @Column(name="destIPList") - private String destIPList; - - @Column(name="protocolList") - private String protocolList; - - @Column(name="portList") - private String portList; - - @Column(name="srcPortList") - private String srcPortList; - - @Column(name="destPortList") - private String destPortList; - - @Column(name="action") - private String action; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public Date getCreatedDate() { - return this.createdDate; - } - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTermName() { - return this.termName; - } - - public void setTermName(String termName) { - this.termName = termName; - } - - public String getTermDescription() { - return this.termDescription; - } - - public void setDescription(String termDescription) { - this.termDescription = termDescription; - } - - public String getFromZone() { - return this.fromZone; - } - - public void setFromZones(String fromZone) { - this.fromZone = fromZone; - } - - public String getToZone() { - return this.toZone; - } - - public void setToZones(String toZone) { - this.toZone = toZone; - } - - public String getSrcIPList() { - return this.srcIPList; - } - - public void setSrcIPList(String srcIPList) { - this.srcIPList = srcIPList; - } - - public String getDestIPList() { - return this.destIPList; - } - - public void setDestIPList(String destIPList) { - this.destIPList = destIPList; - } - - public String getProtocolList() { - return this.protocolList; - } - - public void setProtocolList(String protocolList) { - this.protocolList = protocolList; - } - - public String getPortList() { - return this.portList; - } - - public void setPortList(String portList) { - this.portList = portList; - } - - public String getSrcPortList() { - return this.srcPortList; - } - - public void setSrcPortList(String srcPortList) { - this.srcPortList = srcPortList; - } - - public String getDestPortList() { - return this.destPortList; - } - - public void setDestPortList(String destPortList) { - this.destPortList = destPortList; - } - - - public String getAction() { - return this.action; - } - - public void setAction(String action) { - this.action = action; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="termName", nullable=false) + @OrderBy("asc") + private String termName; + + @Column(name="description") + private String termDescription; + + @Column(name="fromzone") + private String fromZone; + + @Column(name="tozone") + private String toZone; + + @Column(name="srcIPList") + private String srcIPList; + + @Column(name="destIPList") + private String destIPList; + + @Column(name="protocolList") + private String protocolList; + + @Column(name="portList") + private String portList; + + @Column(name="srcPortList") + private String srcPortList; + + @Column(name="destPortList") + private String destPortList; + + @Column(name="action") + private String action; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public Date getCreatedDate() { + return this.createdDate; + } + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getTermName() { + return this.termName; + } + + public void setTermName(String termName) { + this.termName = termName; + } + + public String getTermDescription() { + return this.termDescription; + } + + public void setDescription(String termDescription) { + this.termDescription = termDescription; + } + + public String getFromZone() { + return this.fromZone; + } + + public void setFromZones(String fromZone) { + this.fromZone = fromZone; + } + + public String getToZone() { + return this.toZone; + } + + public void setToZones(String toZone) { + this.toZone = toZone; + } + + public String getSrcIPList() { + return this.srcIPList; + } + + public void setSrcIPList(String srcIPList) { + this.srcIPList = srcIPList; + } + + public String getDestIPList() { + return this.destIPList; + } + + public void setDestIPList(String destIPList) { + this.destIPList = destIPList; + } + + public String getProtocolList() { + return this.protocolList; + } + + public void setProtocolList(String protocolList) { + this.protocolList = protocolList; + } + + public String getPortList() { + return this.portList; + } + + public void setPortList(String portList) { + this.portList = portList; + } + + public String getSrcPortList() { + return this.srcPortList; + } + + public void setSrcPortList(String srcPortList) { + this.srcPortList = srcPortList; + } + + public String getDestPortList() { + return this.destPortList; + } + + public void setDestPortList(String destPortList) { + this.destPortList = destPortList; + } + + + public String getAction() { + return this.action; + } + + public void setAction(String action) { + this.action = action; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java index d2185c27b..da1438010 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java @@ -37,40 +37,40 @@ import com.fasterxml.jackson.annotation.JsonBackReference; @Table(name = "UserInfo") @NamedQuery(name="UserInfo.findAll", query="SELECT u FROM UserInfo u ") public class UserInfo implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @Column(name="loginid", nullable=false, length=45) - private String userLoginId; - - @Column(name = "name", nullable = false, unique = true) - private String userName; + private static final long serialVersionUID = 1L; - public UserInfo(){ - this.userLoginId = userName; - - } + @Id + @Column(name="loginid", nullable=false, length=45) + private String userLoginId; - public String getUserLoginId() { - return userLoginId; - } + @Column(name = "name", nullable = false, unique = true) + private String userName; - public void setUserLoginId(String loginid) { - this.userLoginId = loginid; - } + public UserInfo(){ + this.userLoginId = userName; - public String getUserName() { - return userName; - } + } - public void setUserName(String userName) { - this.userName = userName; - } - - @Transient - @JsonBackReference - public Identifier getIdentiferByUserId() { - return new IdentifierImpl(this.userName); - } + public String getUserLoginId() { + return userLoginId; + } + + public void setUserLoginId(String loginid) { + this.userLoginId = loginid; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + @Transient + @JsonBackReference + public Identifier getIdentiferByUserId() { + return new IdentifierImpl(this.userName); + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java index 98a4e58e7..463e51709 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java @@ -37,42 +37,42 @@ import javax.persistence.Table; @Table(name="VMType") @NamedQuery(name="VMType.findAll", query="SELECT e FROM VMType e ") public class VMType implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="name", nullable=false) - @OrderBy("asc") - private String name; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - @Column(name="description") - private String description; + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public int getId() { - return this.id; - } + @Column(name="description") + private String description; - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } + public String getDescription() { + return description; + } - public void setName(String name) { - this.name = name; + public void setDescription(String description) { + this.description = description; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + + } - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java index bffdce094..bf4284a1d 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java @@ -44,101 +44,101 @@ import javax.persistence.TemporalType; @Table(name="VNFType") @NamedQuery(name="VNFType.findAll", query="SELECT v FROM VNFType v ") public class VNFType implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="vnf_type", nullable=false, unique=true) - @OrderBy("asc") - private String vnftype; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - public String getVnftype() { - return vnftype; - } - - public void setVnftype(String vnftype) { - this.vnftype = vnftype; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="vnf_type", nullable=false, unique=true) + @OrderBy("asc") + private String vnftype; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + public String getVnftype() { + return vnftype; + } + + public void setVnftype(String vnftype) { + this.vnftype = vnftype; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java index 62c36e572..cd0c46da7 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java @@ -43,102 +43,102 @@ import javax.persistence.TemporalType; @Table(name="VSCLAction") @NamedQuery(name="VSCLAction.findAll", query="SELECT v FROM VSCLAction v ") public class VSCLAction implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="vscl_action", nullable=false, unique=true) - @OrderBy("asc") - private String vsclaction; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Column(name="description", nullable=true, length=2048) - private String description; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getVsclaction() { - return vsclaction; - } - - public void setVsclaction(String vsclaction) { - this.vsclaction = vsclaction; - } - - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="vscl_action", nullable=false, unique=true) + @OrderBy("asc") + private String vsclaction; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getVsclaction() { + return vsclaction; + } + + public void setVsclaction(String vsclaction) { + this.vsclaction = vsclaction; + } + + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java index fba4b611a..b123511f3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java @@ -42,114 +42,114 @@ import javax.persistence.TemporalType; @Table(name="VarbindDictionary") @NamedQuery(name = "VarbindDictionary.findAll", query = "Select v FROM VarbindDictionary v") public class VarbindDictionary implements Serializable{ - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "Id") - private int id; - - @Column(name ="varbind_Name", nullable = false, unique = true) - @OrderBy("asc") - private String varbindName; - - @Column(name = "varbind_Description", nullable = true, length = 2048) - private String varbindDescription; - - @Column(name = "varbind_oid", nullable = false) - private String varbindOID; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) - private Date createdDate; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate; - - @ManyToOne(optional = false) - @JoinColumn(name="created_by") - private UserInfo userCreatedBy; - - @ManyToOne(optional = false) - @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - @PrePersist - public void prePersist() { - Date date = new Date(); - this.createdDate = date; - this.modifiedDate = date; - } - - @PreUpdate - public void preUpdate() { - this.modifiedDate = new Date(); - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getVarbindName() { - return varbindName; - } - - public void setVarbindName(String varbindName) { - this.varbindName = varbindName; - } - - public String getVarbindDescription() { - return varbindDescription; - } - - public void setVarbindDescription(String varbindDescription) { - this.varbindDescription = varbindDescription; - } - - public String getVarbindOID() { - return varbindOID; - } - - public void setVarbindOID(String varbindOID) { - this.varbindOID = varbindOID; - } - - public Date getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public Date getModifiedDate() { - return modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "Id") + private int id; + + @Column(name ="varbind_Name", nullable = false, unique = true) + @OrderBy("asc") + private String varbindName; + + @Column(name = "varbind_Description", nullable = true, length = 2048) + private String varbindDescription; + + @Column(name = "varbind_oid", nullable = false) + private String varbindOID; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getVarbindName() { + return varbindName; + } + + public void setVarbindName(String varbindName) { + this.varbindName = varbindName; + } + + public String getVarbindDescription() { + return varbindDescription; + } + + public void setVarbindDescription(String varbindDescription) { + this.varbindDescription = varbindDescription; + } + + public String getVarbindOID() { + return varbindOID; + } + + public void setVarbindOID(String varbindOID) { + this.varbindOID = varbindOID; + } + + public Date getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public Date getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java index 7586dd8bf..9f2cbfdf1 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java @@ -40,66 +40,66 @@ import javax.persistence.Table; @Table(name = "WatchPolicyNotificationTable") @NamedQuery(name="WatchPolicyNotificationTable.findAll", query="SELECT e FROM WatchPolicyNotificationTable e ") public class WatchPolicyNotificationTable implements Serializable{ - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="policyName", nullable=false, unique=true) - @OrderBy("asc") - private String policyName; - - @Column(name="loginIds", nullable=false, unique=true) - @OrderBy("asc") - private String loginIds; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getLoginIds() { - return loginIds; - } - - public void setLoginIds(String loginIds) { - this.loginIds = loginIds; - } - - @Override - public int hashCode() { - return Objects.hash(id, policyName, loginIds); - } - - @Override - public boolean equals(Object obj) { - if(obj == null){ - return false; - } - if(obj == this){ - return true; - } - if(!(obj instanceof WatchPolicyNotificationTable)){ - return false; - } - - return id == ((WatchPolicyNotificationTable)obj).id && - policyName.equals(((WatchPolicyNotificationTable)obj).policyName) && - loginIds.equals(((WatchPolicyNotificationTable)obj).loginIds); - } - - + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="policyName", nullable=false, unique=true) + @OrderBy("asc") + private String policyName; + + @Column(name="loginIds", nullable=false, unique=true) + @OrderBy("asc") + private String loginIds; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + public String getLoginIds() { + return loginIds; + } + + public void setLoginIds(String loginIds) { + this.loginIds = loginIds; + } + + @Override + public int hashCode() { + return Objects.hash(id, policyName, loginIds); + } + + @Override + public boolean equals(Object obj) { + if(obj == null){ + return false; + } + if(obj == this){ + return true; + } + if(!(obj instanceof WatchPolicyNotificationTable)){ + return false; + } + + return id == ((WatchPolicyNotificationTable)obj).id && + policyName.equals(((WatchPolicyNotificationTable)obj).policyName) && + loginIds.equals(((WatchPolicyNotificationTable)obj).loginIds); + } + + } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java index c8759acb7..58c1a275a 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java @@ -36,41 +36,41 @@ import javax.persistence.Table; @Table(name="zone") @NamedQuery(name="Zone.findAll", query="SELECT e FROM Zone e ") public class Zone implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") - private int id; - - @Column(name="zonename", nullable=false) - @OrderBy("asc") - private String zoneName; - - @Column(name="zonevalue") - private String zoneValue; - - public int getId() { - return this.id; - } + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; - public void setId(int id) { - this.id = id; - } - public String getZoneName() { - return this.zoneName; - } + @Column(name="zonename", nullable=false) + @OrderBy("asc") + private String zoneName; - public void setZoneName(String zoneName) { - this.zoneName = zoneName; + @Column(name="zonevalue") + private String zoneValue; - } - public String getZoneValue() { - return this.zoneValue; - } + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getZoneName() { + return this.zoneName; + } + + public void setZoneName(String zoneName) { + this.zoneName = zoneName; + + } + public String getZoneValue() { + return this.zoneValue; + } + + public void setZoneValue(String zoneValue) { + this.zoneValue = zoneValue; + } - public void setZoneValue(String zoneValue) { - this.zoneValue = zoneValue; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/LockdownListener.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/LockdownListener.java index 8e06656a3..1111609d8 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/LockdownListener.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/LockdownListener.java @@ -24,13 +24,13 @@ package org.onap.policy.rest.util; public interface LockdownListener { - /** - * lockdown has been set in database - */ - public void lockdownSet(); - - /** - * lockdown has been unset in the database - */ - public void lockdownUnset(); + /** + * lockdown has been set in database + */ + public void lockdownSet(); + + /** + * lockdown has been unset in the database + */ + public void lockdownUnset(); } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeObject.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeObject.java index 3410dd7f6..d9240a25c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeObject.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeObject.java @@ -25,85 +25,85 @@ import java.util.Map; public class MSAttributeObject { - private String className; - private Map<String, String> attribute = new HashMap<>(); - private Map<String, String> refAttribute = new HashMap<>(); - private Map<String, Object> subClass = new HashMap<>(); - private String dependency; - private Map<String, String> enumType = new HashMap<>(); - private Map<String, String> matchingSet = new HashMap<>(); - private boolean policyTempalate; - - public Map<String, String> getRefAttribute() { - return refAttribute; - } - public void setRefAttribute(Map<String, String> refAttribute) { - this.refAttribute = refAttribute; - } - public String getClassName() { - return className; - } - public void setClassName(String className) { - this.className = className; - } - public Map<String, String> getAttribute() { - return attribute; - } - public void setAttribute(Map<String, String> attribute) { - this.attribute = attribute; - } - public Map<String, String> getEnumType() { - return enumType; - } - public void setEnumType(Map<String, String> enumType) { - this.enumType = enumType; - } - public void addAttribute(String key, String value){ - this.attribute.put(key, value); - } - public void addRefAttribute(String key, String value){ - this.refAttribute.put(key, value); - } - public void addAllAttribute(Map<String, String> map){ - this.attribute.putAll(map); - } - public void addAllRefAttribute(Map<String, String> map){ - this.refAttribute.putAll(map); - } - public Map<String, Object> getSubClass() { - return subClass; - } - public void setSubClass(Map<String, Object> subClass) { - this.subClass = subClass; - } - public void addAllSubClass(Map<String, Object> subClass){ - this.subClass.putAll(subClass); - } - public String getDependency() { - return dependency; - } - public void setDependency(String dependency) { - this.dependency = dependency; - } - public void addSingleEnum(String key, String value){ - this.enumType.put(key, value); - } - public Map<String, String> getMatchingSet() { - return matchingSet; - } - public void setMatchingSet(Map<String, String> matchingSet) { - this.matchingSet = matchingSet; - } - public void addMatchingSet(String key, String value){ - this.matchingSet.put(key, value); - } - public void addMatchingSet(Map<String, String> matchingSet){ - this.matchingSet.putAll(matchingSet); - } - public boolean isPolicyTempalate() { - return policyTempalate; - } - public void setPolicyTempalate(boolean policyTempalate) { - this.policyTempalate = policyTempalate; - } + private String className; + private Map<String, String> attribute = new HashMap<>(); + private Map<String, String> refAttribute = new HashMap<>(); + private Map<String, Object> subClass = new HashMap<>(); + private String dependency; + private Map<String, String> enumType = new HashMap<>(); + private Map<String, String> matchingSet = new HashMap<>(); + private boolean policyTempalate; + + public Map<String, String> getRefAttribute() { + return refAttribute; + } + public void setRefAttribute(Map<String, String> refAttribute) { + this.refAttribute = refAttribute; + } + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + public Map<String, String> getAttribute() { + return attribute; + } + public void setAttribute(Map<String, String> attribute) { + this.attribute = attribute; + } + public Map<String, String> getEnumType() { + return enumType; + } + public void setEnumType(Map<String, String> enumType) { + this.enumType = enumType; + } + public void addAttribute(String key, String value){ + this.attribute.put(key, value); + } + public void addRefAttribute(String key, String value){ + this.refAttribute.put(key, value); + } + public void addAllAttribute(Map<String, String> map){ + this.attribute.putAll(map); + } + public void addAllRefAttribute(Map<String, String> map){ + this.refAttribute.putAll(map); + } + public Map<String, Object> getSubClass() { + return subClass; + } + public void setSubClass(Map<String, Object> subClass) { + this.subClass = subClass; + } + public void addAllSubClass(Map<String, Object> subClass){ + this.subClass.putAll(subClass); + } + public String getDependency() { + return dependency; + } + public void setDependency(String dependency) { + this.dependency = dependency; + } + public void addSingleEnum(String key, String value){ + this.enumType.put(key, value); + } + public Map<String, String> getMatchingSet() { + return matchingSet; + } + public void setMatchingSet(Map<String, String> matchingSet) { + this.matchingSet = matchingSet; + } + public void addMatchingSet(String key, String value){ + this.matchingSet.put(key, value); + } + public void addMatchingSet(Map<String, String> matchingSet){ + this.matchingSet.putAll(matchingSet); + } + public boolean isPolicyTempalate() { + return policyTempalate; + } + public void setPolicyTempalate(boolean policyTempalate) { + this.policyTempalate = policyTempalate; + } }
\ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeValue.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeValue.java index 23b5f8658..c8a217d9f 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeValue.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeValue.java @@ -21,40 +21,40 @@ package org.onap.policy.rest.util; public class MSAttributeValue{ - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - public Boolean getRequired() { - return required; - } - public void setRequired(Boolean required) { - this.required = required; - } - public Boolean getArrayValue() { - return arrayValue; - } - public void setArrayValue(Boolean arrayValue) { - this.arrayValue = arrayValue; - } - public String getDefaultValue() { - return defaultValue; - } - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - private String name; - private String type; - private Boolean required; - private Boolean arrayValue; - private String defaultValue; + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public Boolean getRequired() { + return required; + } + public void setRequired(Boolean required) { + this.required = required; + } + public Boolean getArrayValue() { + return arrayValue; + } + public void setArrayValue(Boolean arrayValue) { + this.arrayValue = arrayValue; + } + public String getDefaultValue() { + return defaultValue; + } + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + private String name; + private String type; + private Boolean required; + private Boolean arrayValue; + private String defaultValue; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PDPPolicyContainer.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PDPPolicyContainer.java index 3f17f2e86..f5c4c3b38 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PDPPolicyContainer.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PDPPolicyContainer.java @@ -39,150 +39,150 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; public class PDPPolicyContainer extends PolicyItemSetChangeNotifier implements PolicyContainer.Indexed { - private static final long serialVersionUID = 1L; - private static final Logger LOGGER = FlexLogger.getLogger(PDPPolicyContainer.class); - - /** + private static final long serialVersionUID = 1L; + private static final Logger LOGGER = FlexLogger.getLogger(PDPPolicyContainer.class); + + /** * String identifier of a file's "Id" property. */ - private static final String PROPERTY_ID = "Id"; + private static final String PROPERTY_ID = "Id"; /** * String identifier of a file's "name" property. */ - private static final String PROPERTY_NAME = "Name"; + private static final String PROPERTY_NAME = "Name"; /** * String identifier of a file's "name" property. */ - private static final String PROPERTY_VERSION = "Version"; + private static final String PROPERTY_VERSION = "Version"; /** * String identifier of a file's "Description" property. */ - private static final String PROPERTY_DESCRIPTION = "Description"; + private static final String PROPERTY_DESCRIPTION = "Description"; /** * String identifier of a file's "IsRoot" property. */ - private static final String PROPERTY_ISROOT = "Root"; + private static final String PROPERTY_ISROOT = "Root"; /** * List of the string identifiers for the available properties. */ - private static Collection<String> pDPPolicyProperties; + private static Collection<String> pDPPolicyProperties; private final transient Object data; private transient List<PDPPolicy> policies; - @SuppressWarnings("unchecked") - public PDPPolicyContainer(Object data) { - super(); - this.data = data; - if (this.data instanceof PDPGroup) { - policies = new ArrayList<> (((PDPGroup) this.data).getPolicies()); - } - if (this.data instanceof PDP) { - policies = new ArrayList<> (((PDP) this.data).getPolicies()); - } - if (this.data instanceof Set) { - policies = new ArrayList<> ((Set<PDPPolicy>)data); - } - if (this.policies == null) { - LOGGER.info("NULL policies"); - throw new NullPointerException("PDPPolicyContainer created with unexpected Object type '" + data.getClass().getName() + "'"); - } - this.setContainer(this); - } - - @Override - public Object nextItemId(Object itemId) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("nextItemId: " + itemId); - } - int index = this.policies.indexOf(itemId); - if (index == -1 || ((index + 1) >= this.policies.size())) { - return null; - } - return new PDPPolicyItem(this.policies.get(index + 1)); - } - - @Override - public Object prevItemId(Object itemId) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("prevItemId: " + itemId); - } - int index = this.policies.indexOf(itemId); - if (index <= 0) { - return null; - } - return new PDPPolicyItem(this.policies.get(index - 1)); - } - - @Override - public Object firstItemId() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("firstItemId: "); - } - if (this.policies.isEmpty()) { - return null; - } - return new PDPPolicyItem(this.policies.get(0)); - } - - @Override - public Object lastItemId() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("lastItemid: "); - } - if (this.policies.isEmpty()) { - return null; - } - return new PDPPolicyItem(this.policies.get(this.policies.size() - 1)); - } - - @Override - public boolean isFirstId(Object itemId) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("isFirstId: " + itemId); - } - if (this.policies.isEmpty()) { - return false; - } - return itemId.equals(this.policies.get(0)); - } - - @Override - public boolean isLastId(Object itemId) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("isLastId: " + itemId); - } - if (this.policies.isEmpty()) { - return false; - } - return itemId.equals(this.policies.get(this.policies.size() - 1)); - } - - @Override - public Object addItemAfter(Object previousItemId) { - return null; - } - - @Override - public Collection<?> getContainerPropertyIds() { - return pDPPolicyProperties; - } - - @Override - public Collection<?> getItemIds() { - final Collection<Object> items = new ArrayList<>(); - items.addAll(this.policies); - return Collections.unmodifiableCollection(items); - } - - - @Override - public Class<?> getType(Object propertyId) { + @SuppressWarnings("unchecked") + public PDPPolicyContainer(Object data) { + super(); + this.data = data; + if (this.data instanceof PDPGroup) { + policies = new ArrayList<> (((PDPGroup) this.data).getPolicies()); + } + if (this.data instanceof PDP) { + policies = new ArrayList<> (((PDP) this.data).getPolicies()); + } + if (this.data instanceof Set) { + policies = new ArrayList<> ((Set<PDPPolicy>)data); + } + if (this.policies == null) { + LOGGER.info("NULL policies"); + throw new NullPointerException("PDPPolicyContainer created with unexpected Object type '" + data.getClass().getName() + "'"); + } + this.setContainer(this); + } + + @Override + public Object nextItemId(Object itemId) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("nextItemId: " + itemId); + } + int index = this.policies.indexOf(itemId); + if (index == -1 || ((index + 1) >= this.policies.size())) { + return null; + } + return new PDPPolicyItem(this.policies.get(index + 1)); + } + + @Override + public Object prevItemId(Object itemId) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("prevItemId: " + itemId); + } + int index = this.policies.indexOf(itemId); + if (index <= 0) { + return null; + } + return new PDPPolicyItem(this.policies.get(index - 1)); + } + + @Override + public Object firstItemId() { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("firstItemId: "); + } + if (this.policies.isEmpty()) { + return null; + } + return new PDPPolicyItem(this.policies.get(0)); + } + + @Override + public Object lastItemId() { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("lastItemid: "); + } + if (this.policies.isEmpty()) { + return null; + } + return new PDPPolicyItem(this.policies.get(this.policies.size() - 1)); + } + + @Override + public boolean isFirstId(Object itemId) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("isFirstId: " + itemId); + } + if (this.policies.isEmpty()) { + return false; + } + return itemId.equals(this.policies.get(0)); + } + + @Override + public boolean isLastId(Object itemId) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("isLastId: " + itemId); + } + if (this.policies.isEmpty()) { + return false; + } + return itemId.equals(this.policies.get(this.policies.size() - 1)); + } + + @Override + public Object addItemAfter(Object previousItemId) { + return null; + } + + @Override + public Collection<?> getContainerPropertyIds() { + return pDPPolicyProperties; + } + + @Override + public Collection<?> getItemIds() { + final Collection<Object> items = new ArrayList<>(); + items.addAll(this.policies); + return Collections.unmodifiableCollection(items); + } + + + @Override + public Class<?> getType(Object propertyId) { if (propertyId.equals(PROPERTY_ID)) { return String.class; } @@ -198,147 +198,147 @@ public class PDPPolicyContainer extends PolicyItemSetChangeNotifier implements P if (propertyId.equals(PROPERTY_ISROOT)) { return Boolean.class; } - return null; - } - - @Override - public int size() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("size: " + this.policies.size()); - } - return this.policies.size(); - } - - @Override - public boolean containsId(Object itemId) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("containsId: " + itemId); - } - return this.policies.contains(itemId); - } - - @Override - public Object addItem() { - throw new UnsupportedOperationException("Cannot add an empty policy."); - } - - @Override - public boolean removeItem(Object itemId) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("removeItem: " + itemId); - } - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - StdPDPPolicy pdpPolicy = null; - try { - pdpPolicy = mapper.readValue(itemId.toString() , StdPDPPolicy.class); - for(int i = 0; i< policies.size(); i++){ - if(policies.get(i).getId().equalsIgnoreCase(pdpPolicy.getId())){ - return this.policies.remove(this.policies.get(i)); - } - } - } catch (Exception e) { - LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Exception Occured While Mapping the Removing Policy from PDP Group to Std Policy"+e); - } - return this.policies.remove(itemId); - } - - @Override - public boolean addContainerProperty(Object propertyId, Class<?> type, - Object defaultValue) { - return false; - } - - @Override - public boolean removeContainerProperty(Object propertyId) { - return false; - } - - @Override - public boolean removeAllItems() { - return false; - } - - @Override - public int indexOfId(Object itemId) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("indexOfId: " + itemId); - } - return this.policies.indexOf(itemId); - } - - @Override - public Object getIdByIndex(int index) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getIdByIndex: " + index); - } - return this.policies.get(index); - } - - @Override - public List<?> getItemIds(int startIndex, int numberOfItems) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getItemIds: " + startIndex + " " + numberOfItems); - } - if (numberOfItems < 0) { - throw new IllegalArgumentException(); - } - return this.policies.subList(startIndex, startIndex + numberOfItems); - } - - @Override - public Object addItemAt(int index) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("addItemAt: " + index); - } - return null; - } - - public class PDPPolicyItem { - private final PDPPolicy policy; - - public PDPPolicyItem(PDPPolicy itemId) { - this.policy = itemId; - } - - public String getId() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getId: " + this.policy); - } - return this.policy.getId(); - } - - public String getName() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getName: " + this.policy); - } - return this.policy.getName(); - } - - public String getVersion() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getVersion: " + this.policy); - } - return this.policy.getVersion(); - } - - public String getDescription() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getDescription: " + this.policy); - } - return this.policy.getDescription(); - } - - public boolean getRoot() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("isRoot: " + this.policy); - } - return this.policy.isRoot(); - } - - public void setRoot(Boolean root) { - ((StdPDPPolicy)this.policy).setRoot(root); - } - - } + return null; + } + + @Override + public int size() { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("size: " + this.policies.size()); + } + return this.policies.size(); + } + + @Override + public boolean containsId(Object itemId) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("containsId: " + itemId); + } + return this.policies.contains(itemId); + } + + @Override + public Object addItem() { + throw new UnsupportedOperationException("Cannot add an empty policy."); + } + + @Override + public boolean removeItem(Object itemId) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("removeItem: " + itemId); + } + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + StdPDPPolicy pdpPolicy = null; + try { + pdpPolicy = mapper.readValue(itemId.toString() , StdPDPPolicy.class); + for(int i = 0; i< policies.size(); i++){ + if(policies.get(i).getId().equalsIgnoreCase(pdpPolicy.getId())){ + return this.policies.remove(this.policies.get(i)); + } + } + } catch (Exception e) { + LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Exception Occured While Mapping the Removing Policy from PDP Group to Std Policy"+e); + } + return this.policies.remove(itemId); + } + + @Override + public boolean addContainerProperty(Object propertyId, Class<?> type, + Object defaultValue) { + return false; + } + + @Override + public boolean removeContainerProperty(Object propertyId) { + return false; + } + + @Override + public boolean removeAllItems() { + return false; + } + + @Override + public int indexOfId(Object itemId) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("indexOfId: " + itemId); + } + return this.policies.indexOf(itemId); + } + + @Override + public Object getIdByIndex(int index) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("getIdByIndex: " + index); + } + return this.policies.get(index); + } + + @Override + public List<?> getItemIds(int startIndex, int numberOfItems) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("getItemIds: " + startIndex + " " + numberOfItems); + } + if (numberOfItems < 0) { + throw new IllegalArgumentException(); + } + return this.policies.subList(startIndex, startIndex + numberOfItems); + } + + @Override + public Object addItemAt(int index) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("addItemAt: " + index); + } + return null; + } + + public class PDPPolicyItem { + private final PDPPolicy policy; + + public PDPPolicyItem(PDPPolicy itemId) { + this.policy = itemId; + } + + public String getId() { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("getId: " + this.policy); + } + return this.policy.getId(); + } + + public String getName() { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("getName: " + this.policy); + } + return this.policy.getName(); + } + + public String getVersion() { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("getVersion: " + this.policy); + } + return this.policy.getVersion(); + } + + public String getDescription() { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("getDescription: " + this.policy); + } + return this.policy.getDescription(); + } + + public boolean getRoot() { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("isRoot: " + this.policy); + } + return this.policy.isRoot(); + } + + public void setRoot(Boolean root) { + ((StdPDPPolicy)this.policy).setRoot(root); + } + + } }
\ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/ParserException.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/ParserException.java index be7acb4f2..50e30f05b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/ParserException.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/ParserException.java @@ -20,11 +20,11 @@ package org.onap.policy.rest.util; public class ParserException extends Exception{ - String message; - ParserException(String message) { - this.message = message; - } - public String getMessage(){ - return message ; - } + String message; + ParserException(String message) { + this.message = message; + } + public String getMessage(){ + return message ; + } }
\ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyContainer.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyContainer.java index 164f958d9..80bb16d54 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyContainer.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyContainer.java @@ -26,7 +26,7 @@ import java.util.List; public interface PolicyContainer extends Serializable{ - + public Collection<?> getContainerPropertyIds(); public Collection<?> getItemIds(); diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyItemSetChangeNotifier.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyItemSetChangeNotifier.java index b5f04cf3a..16e467041 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyItemSetChangeNotifier.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyItemSetChangeNotifier.java @@ -32,45 +32,45 @@ import org.onap.policy.rest.util.PolicyContainer.ItemSetChangeListener; public class PolicyItemSetChangeNotifier implements PolicyContainer.ItemSetChangeNotifier { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; private Collection<PolicyContainer.ItemSetChangeListener> itemSetChangeListeners = null; private PolicyContainer container = null; public PolicyItemSetChangeNotifier() { - // Empty constructor + // Empty constructor } protected void setContainer(PolicyContainer c) { - this.container = c; + this.container = c; } - @Override - public void addItemSetChangeListener(ItemSetChangeListener listener) { + @Override + public void addItemSetChangeListener(ItemSetChangeListener listener) { if (getItemSetChangeListeners() == null) { setItemSetChangeListeners(new LinkedList<PolicyContainer.ItemSetChangeListener>()); } getItemSetChangeListeners().add(listener); } - @Override - public void removeItemSetChangeListener(ItemSetChangeListener listener) { + @Override + public void removeItemSetChangeListener(ItemSetChangeListener listener) { if (getItemSetChangeListeners() != null) { getItemSetChangeListeners().remove(listener); } } - - protected static class BaseItemSetChangeEvent extends EventObject implements - PolicyContainer.ItemSetChangeEvent, Serializable { - private static final long serialVersionUID = 1L; - protected BaseItemSetChangeEvent(PolicyContainer source) { - super(source); - } - - @Override - public PolicyContainer getContainer() { - return (PolicyContainer) getSource(); - } - } + protected static class BaseItemSetChangeEvent extends EventObject implements + PolicyContainer.ItemSetChangeEvent, Serializable { + private static final long serialVersionUID = 1L; + + protected BaseItemSetChangeEvent(PolicyContainer source) { + super(source); + } + + @Override + public PolicyContainer getContainer() { + return (PolicyContainer) getSource(); + } + } protected void setItemSetChangeListeners( Collection<PolicyContainer.ItemSetChangeListener> itemSetChangeListeners) { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java index 0478f5f95..42f94cfa7 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java @@ -58,72 +58,72 @@ import com.google.common.base.Strings; @Service public class PolicyValidation { - - private static final Logger LOGGER = FlexLogger.getLogger(PolicyValidation.class); - - public static final String CONFIG_POLICY = "Config"; - public static final String ACTION_POLICY = "Action"; - public static final String DECISION_POLICY = "Decision"; - public static final String CLOSEDLOOP_POLICY = "ClosedLoop_Fault"; - public static final String CLOSEDLOOP_PM = "ClosedLoop_PM"; - public static final String ENFORCER_CONFIG_POLICY = "Enforcer Config"; - public static final String MICROSERVICES = "Micro Service"; - public static final String FIREWALL = "Firewall Config"; - public static final String OPTIMIZATION="Optimization"; - public static final String BRMSPARAM = "BRMS_Param"; - public static final String BRMSRAW = "BRMS_Raw"; - public static final String HTML_ITALICS_LNBREAK = "</i><br>"; - public static final String SUCCESS = "success"; - public static final String EMPTY_COMPONENT_ATTR = "Component Attributes: One or more Fields in Component Attributes is Empty."; - public static final String ISREQUIRED = " is required"; - public static final String SPACESINVALIDCHARS = " : value has spaces or invalid characters</i><br>"; - public static final String RULEALGORITHMS = "<b>Rule Algorithms</b>:<i>"; - public static final String VALUE = "value"; - - private static Map<String, String> mapAttribute = new HashMap<>(); - private static Map<String, String> jsonRequestMap = new HashMap<>(); - private static List<String> modelRequiredFieldsList = new ArrayList<>(); - - private static CommonClassDao commonClassDao; - - @Autowired - public PolicyValidation(CommonClassDao commonClassDao){ - PolicyValidation.commonClassDao = commonClassDao; - } - - /* - * This is an empty constructor - */ - public PolicyValidation(){ - // Empty constructor - } - - - public StringBuilder validatePolicy(PolicyRestAdapter policyData) throws IOException{ - try{ - boolean valid = true; - StringBuilder responseString = new StringBuilder(); - ObjectMapper mapper = new ObjectMapper(); - - if(policyData.getPolicyName() != null){ - String policyNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getPolicyName()); - if(!policyNameValidate.contains(SUCCESS)){ - responseString.append("<b>PolicyName</b>:<i>" + policyNameValidate + HTML_ITALICS_LNBREAK); - valid = false; - } - }else{ - responseString.append( "<b>PolicyName</b>: PolicyName Should not be empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(policyData.getPolicyDescription() != null){ - String descriptionValidate = PolicyUtils.descriptionValidator(policyData.getPolicyDescription()); - if(!descriptionValidate.contains(SUCCESS)){ - responseString.append("<b>Description</b>:<i>" + descriptionValidate + HTML_ITALICS_LNBREAK); - valid = false; - } - } - - if(!"API".equals(policyData.getApiflag()) && policyData.getAttributes() != null && !policyData.getAttributes().isEmpty()){ + + private static final Logger LOGGER = FlexLogger.getLogger(PolicyValidation.class); + + public static final String CONFIG_POLICY = "Config"; + public static final String ACTION_POLICY = "Action"; + public static final String DECISION_POLICY = "Decision"; + public static final String CLOSEDLOOP_POLICY = "ClosedLoop_Fault"; + public static final String CLOSEDLOOP_PM = "ClosedLoop_PM"; + public static final String ENFORCER_CONFIG_POLICY = "Enforcer Config"; + public static final String MICROSERVICES = "Micro Service"; + public static final String FIREWALL = "Firewall Config"; + public static final String OPTIMIZATION="Optimization"; + public static final String BRMSPARAM = "BRMS_Param"; + public static final String BRMSRAW = "BRMS_Raw"; + public static final String HTML_ITALICS_LNBREAK = "</i><br>"; + public static final String SUCCESS = "success"; + public static final String EMPTY_COMPONENT_ATTR = "Component Attributes: One or more Fields in Component Attributes is Empty."; + public static final String ISREQUIRED = " is required"; + public static final String SPACESINVALIDCHARS = " : value has spaces or invalid characters</i><br>"; + public static final String RULEALGORITHMS = "<b>Rule Algorithms</b>:<i>"; + public static final String VALUE = "value"; + + private static Map<String, String> mapAttribute = new HashMap<>(); + private static Map<String, String> jsonRequestMap = new HashMap<>(); + private static List<String> modelRequiredFieldsList = new ArrayList<>(); + + private static CommonClassDao commonClassDao; + + @Autowired + public PolicyValidation(CommonClassDao commonClassDao){ + PolicyValidation.commonClassDao = commonClassDao; + } + + /* + * This is an empty constructor + */ + public PolicyValidation(){ + // Empty constructor + } + + + public StringBuilder validatePolicy(PolicyRestAdapter policyData) throws IOException{ + try{ + boolean valid = true; + StringBuilder responseString = new StringBuilder(); + ObjectMapper mapper = new ObjectMapper(); + + if(policyData.getPolicyName() != null){ + String policyNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getPolicyName()); + if(!policyNameValidate.contains(SUCCESS)){ + responseString.append("<b>PolicyName</b>:<i>" + policyNameValidate + HTML_ITALICS_LNBREAK); + valid = false; + } + }else{ + responseString.append( "<b>PolicyName</b>: PolicyName Should not be empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(policyData.getPolicyDescription() != null){ + String descriptionValidate = PolicyUtils.descriptionValidator(policyData.getPolicyDescription()); + if(!descriptionValidate.contains(SUCCESS)){ + responseString.append("<b>Description</b>:<i>" + descriptionValidate + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + if(!"API".equals(policyData.getApiflag()) && policyData.getAttributes() != null && !policyData.getAttributes().isEmpty()){ for(Object attribute : policyData.getAttributes()){ if(attribute instanceof LinkedHashMap<?, ?>){ String value = null; @@ -178,7 +178,7 @@ public class PolicyValidation { } } } - + //Decision Policy Attributes Validation if(!"API".equals(policyData.getApiflag()) && policyData.getSettings() != null && !policyData.getSettings().isEmpty()){ for(Object attribute : policyData.getAttributes()){ @@ -228,719 +228,719 @@ public class PolicyValidation { } } - if(CONFIG_POLICY.equalsIgnoreCase(policyData.getPolicyType())){ - if ("Base".equals(policyData.getConfigPolicyType()) || CLOSEDLOOP_POLICY.equals(policyData.getConfigPolicyType()) - || CLOSEDLOOP_PM.equals(policyData.getConfigPolicyType()) || ENFORCER_CONFIG_POLICY.equals(policyData.getConfigPolicyType()) - || MICROSERVICES.equals(policyData.getConfigPolicyType()) || OPTIMIZATION.equals(policyData.getConfigPolicyType())) { - - if(!Strings.isNullOrEmpty(policyData.getOnapName())) { - String onapNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getOnapName()); - if(!onapNameValidate.contains(SUCCESS)){ - responseString.append("<b>OnapName</b>:<i>" + onapNameValidate + HTML_ITALICS_LNBREAK); - valid = false; - } - }else{ - responseString.append("<b>Onap Name</b>: Onap Name Should not be empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - - if(!Strings.isNullOrEmpty(policyData.getRiskType())) { - String riskTypeValidate = PolicyUtils.policySpecialCharValidator(policyData.getRiskType()); - if(!riskTypeValidate.contains(SUCCESS)){ - responseString.append("<b>RiskType</b>:<i>" + riskTypeValidate + HTML_ITALICS_LNBREAK); - valid = false; - } - }else { - responseString.append("<b>RiskType</b>: Risk Type Should not be Empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - - if(!Strings.isNullOrEmpty(policyData.getRiskLevel())) { - String validateRiskLevel = PolicyUtils.policySpecialCharValidator(policyData.getRiskLevel()); - if(!validateRiskLevel.contains(SUCCESS)){ - responseString.append("<b>RiskLevel</b>:<i>" + validateRiskLevel + HTML_ITALICS_LNBREAK); - valid = false; - } - }else { - responseString.append("<b>RiskLevel</b>: Risk Level Should not be Empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - - if(!Strings.isNullOrEmpty(policyData.getGuard())) { - String validateGuard = PolicyUtils.policySpecialCharValidator(policyData.getGuard()); - if(!validateGuard.contains(SUCCESS)){ - responseString.append("<b>Guard</b>:<i>" + validateGuard + HTML_ITALICS_LNBREAK); - valid = false; - } - }else { - responseString.append("<b>Guard</b>: Guard Value Should not be Empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - - // Validate Config Base Policy Data - if("Base".equalsIgnoreCase(policyData.getConfigPolicyType())){ - if(!Strings.isNullOrEmpty(policyData.getConfigName())) { - String configNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getConfigName()); - if(!configNameValidate.contains(SUCCESS)){ - responseString.append("ConfigName:" + configNameValidate + HTML_ITALICS_LNBREAK); - valid = false; - } - }else{ - responseString.append("Config Name: Config Name Should not be Empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(!Strings.isNullOrEmpty(policyData.getConfigType())) { - String configTypeValidate = PolicyUtils.policySpecialCharValidator(policyData.getConfigType()); - if(!configTypeValidate.contains(SUCCESS)){ - responseString.append("ConfigType:" + configTypeValidate + HTML_ITALICS_LNBREAK); - valid = false; - } - }else{ - responseString.append("Config Type: Config Type Should not be Empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(!Strings.isNullOrEmpty(policyData.getConfigBodyData())) { - String configBodyData = policyData.getConfigBodyData(); - String configType = policyData.getConfigType(); - if (configType != null) { - if ("JSON".equals(configType)) { - if (!PolicyUtils.isJSONValid(configBodyData)) { - responseString.append("Config Body: JSON Content is not valid" + HTML_ITALICS_LNBREAK); - valid = false; - } - } else if ("XML".equals(configType)) { - if (!PolicyUtils.isXMLValid(configBodyData)) { - responseString.append("Config Body: XML Content data is not valid" + HTML_ITALICS_LNBREAK); - valid = false; - } - } else if ("PROPERTIES".equals(configType)) { - if (!PolicyUtils.isPropValid(configBodyData) || "".equals(configBodyData)) { - responseString.append("Config Body: Property data is not valid" + HTML_ITALICS_LNBREAK); - valid = false; - } - } else if ("OTHER".equals(configType) && ("".equals(configBodyData))) { - responseString.append("Config Body: Config Body Should not be Empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - }else{ - responseString.append("Config Body: Config Body Should not be Empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - - // Validate Config Firewall Policy Data - if(FIREWALL.equalsIgnoreCase(policyData.getConfigPolicyType())){ - if(policyData.getConfigName() != null && !policyData.getConfigName().isEmpty()){ - String configNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getConfigName()); - if(!configNameValidate.contains(SUCCESS)){ - responseString.append("<b>ConfigName</b>:<i>" + configNameValidate + HTML_ITALICS_LNBREAK); - valid = false; - } - }else{ - responseString.append("<b>Config Name</b>:<i> Config Name is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(policyData.getSecurityZone() == null || policyData.getSecurityZone().isEmpty()){ - responseString.append("<b>Security Zone</b>:<i> Security Zone is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - - // Validate BRMS_Param Policy Data - if(BRMSPARAM.equalsIgnoreCase(policyData.getConfigPolicyType()) && Strings.isNullOrEmpty(policyData.getRuleName())){ - responseString.append("<b>BRMS Template</b>:<i>BRMS Template is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - - // Validate BRMS_Raw Policy Data - if(BRMSRAW.equalsIgnoreCase(policyData.getConfigPolicyType())){ - if(policyData.getConfigBodyData() != null && !policyData.getConfigBodyData().isEmpty()){ - String message = PolicyUtils.brmsRawValidate(policyData.getConfigBodyData()); - - // If there are any error other than Annotations then this is not Valid - if(message.contains("[ERR")){ - responseString.append("<b>Raw Rule Validate</b>:<i>Raw Rule has error"+ message + HTML_ITALICS_LNBREAK); - valid = false; - } - }else{ - responseString.append("<b>Raw Rule</b>:<i>Raw Rule is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - - // Validate ClosedLoop_PM Policy Data - if(CLOSEDLOOP_PM.equalsIgnoreCase(policyData.getConfigPolicyType())){ - try{ - if(Strings.isNullOrEmpty(policyData.getServiceTypePolicyName().get("serviceTypePolicyName").toString())){ - responseString.append("<b>ServiceType PolicyName</b>:<i>ServiceType PolicyName is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - - }catch(Exception e){ - LOGGER.error("ERROR in ClosedLoop_PM PolicyName" , e); - responseString.append("<b>ServiceType PolicyName</b>:<i>ServiceType PolicyName is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - - if(policyData.getJsonBody() != null){ - - ClosedLoopPMBody pmBody = mapper.readValue(policyData.getJsonBody(), ClosedLoopPMBody.class); - if(pmBody.getEmailAddress() != null){ - String result = emailValidation(pmBody.getEmailAddress(), responseString.toString()); - if(result != SUCCESS){ - responseString.append(result + HTML_ITALICS_LNBREAK); - valid = false; - } - } - if((pmBody.isGamma() || pmBody.isMcr() || pmBody.isTrinity() || pmBody.isvDNS() || pmBody.isvUSP()) != true){ - responseString.append("<b>D2/Virtualized Services</b>: <i>Select at least one D2/Virtualized Services" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(pmBody.getGeoLink() != null && !pmBody.getGeoLink().isEmpty()){ - String result = PolicyUtils.policySpecialCharValidator(pmBody.getGeoLink()); - if(!result.contains(SUCCESS)){ - responseString.append("<b>GeoLink</b>:<i>" + result + HTML_ITALICS_LNBREAK); - valid = false; - } - } - if(pmBody.getAttributes() != null && !pmBody.getAttributes().isEmpty()){ - for(Entry<String, String> entry : pmBody.getAttributes().entrySet()){ - String key = entry.getKey(); - String value = entry.getValue(); - if(!key.contains("Message")){ - String attributeValidate = PolicyUtils.policySpecialCharValidator(value); - if(!attributeValidate.contains(SUCCESS)){ - responseString.append("<b>Attributes</b>:<i>" + key + " : value has spaces or invalid characters" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - } - } - }else{ - responseString.append("<b>D2/Virtualized Services</b>:<i>Select atleast one D2/Virtualized Services" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - - // Validate ClosedLoop_Fault Policy Data - if(CLOSEDLOOP_POLICY.equalsIgnoreCase(policyData.getConfigPolicyType())){ - if(policyData.getJsonBody() != null){ - - // For API we need to get the conditions key from the Json request and check it before deserializing to POJO due to the enum - if("API".equals(policyData.getApiflag())){ - JSONObject json = new JSONObject(policyData.getJsonBody()); - if(!json.isNull("conditions")){ - String apiCondition = (String) json.get("conditions"); - if(Strings.isNullOrEmpty(apiCondition)){ - responseString.append("<b>Conditions</b>: <i>Select At least one Condition" + HTML_ITALICS_LNBREAK); - return responseString; - } - } else { - responseString.append("<b>Conditions</b>: <i>There were no conditions provided in configBody json" + HTML_ITALICS_LNBREAK); - return responseString; - } - }else{ - if(policyData.getTrapDatas().getTrap1() != null){ - if(policyData.getClearTimeOut() == null){ - responseString.append("<b>Trigger Clear TimeOut</b>: <i>Trigger Clear TimeOut is required when atleast One Trigger Signature is enabled</i><br>"); - valid = false; - } - if(policyData.getTrapMaxAge() == null){ - responseString.append("<b>Trap Max Age</b>: <i>Trap Max Age is required when atleast One Trigger Signature is enabled</i><br>"); - valid = false; - } - } - if(policyData.getFaultDatas().getTrap1() != null && policyData.getVerificationclearTimeOut() == null){ - responseString.append("<b>Fault Clear TimeOut</b>: <i>Fault Clear TimeOut is required when atleast One Fault Signature is enabled</i><br>"); - valid = false; - } - } - - ClosedLoopFaultBody faultBody = mapper.readValue(policyData.getJsonBody(), ClosedLoopFaultBody.class); - if(faultBody.getEmailAddress() != null && !faultBody.getEmailAddress().isEmpty()){ - String result = emailValidation(faultBody.getEmailAddress(), responseString.toString()); - if(!SUCCESS.equals(result)){ - responseString.append(result+ HTML_ITALICS_LNBREAK); - valid = false; - } - } - if((faultBody.isGamma() || faultBody.isMcr() || faultBody.isTrinity() || faultBody.isvDNS() || faultBody.isvUSP()) != true){ - responseString.append("<b>D2/Virtualized Services</b>: <i>Select at least one D2/Virtualized Services" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(faultBody.getActions() == null || faultBody.getActions().isEmpty()){ - responseString.append("<b>vPRO Actions</b>: <i>vPRO Actions is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(faultBody.getClosedLoopPolicyStatus() == null || faultBody.getClosedLoopPolicyStatus().isEmpty()){ - responseString.append("<b>Policy Status</b>: <i>Policy Status is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(faultBody.getConditions() == null){ - responseString.append("<b>Conditions</b>: <i>Select At least one Condition" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(faultBody.getGeoLink() != null && !faultBody.getGeoLink().isEmpty()){ - String result = PolicyUtils.policySpecialCharWithSpaceValidator(faultBody.getGeoLink()); - if(!result.contains(SUCCESS)){ - responseString.append("<b>GeoLink</b>:<i>" + result + HTML_ITALICS_LNBREAK); - valid = false; - } - } - if(faultBody.getAgingWindow() == 0){ - responseString.append("<b>Aging Window</b>: <i>Aging Window is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(faultBody.getTimeInterval() == 0){ - responseString.append("<b>Time Interval</b>: <i>Time Interval is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(faultBody.getRetrys() == 0){ - responseString.append("<b>Number of Retries</b>: <i>Number of Retries is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(faultBody.getTimeOutvPRO() == 0){ - responseString.append("<b>APP-C Timeout</b>: <i>APP-C Timeout is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(faultBody.getTimeOutRuby() == 0){ - responseString.append("<b>TimeOutRuby</b>: <i>TimeOutRuby is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - if(faultBody.getVnfType() == null || faultBody.getVnfType().isEmpty()){ - responseString.append("<b>Vnf Type</b>: <i>Vnf Type is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - }else{ - responseString.append("<b>D2/Virtualized Services</b>: <i>Select atleast one D2/Virtualized Services" + HTML_ITALICS_LNBREAK); - responseString.append("<b>vPRO Actions</b>: <i>vPRO Actions is required" + HTML_ITALICS_LNBREAK); - responseString.append("<b>Aging Window</b>: <i>Aging Window is required" + HTML_ITALICS_LNBREAK); - responseString.append("<b>Policy Status</b>: <i>Policy Status is required" + HTML_ITALICS_LNBREAK); - responseString.append("<b>Conditions</b>: <i>Select Atleast one Condition" + HTML_ITALICS_LNBREAK); - responseString.append("<b>PEP Name</b>: <i>PEP Name is required" + HTML_ITALICS_LNBREAK); - responseString.append("<b>PEP Action</b>: <i>PEP Action is required" + HTML_ITALICS_LNBREAK); - responseString.append("<b>Time Interval</b>: <i>Time Interval is required" + HTML_ITALICS_LNBREAK); - responseString.append("<b>Number of Retries</b>: <i>Number of Retries is required" + HTML_ITALICS_LNBREAK); - responseString.append("<b>APP-C Timeout</b>: <i>APP-C Timeout is required" + HTML_ITALICS_LNBREAK); - responseString.append("<b>TimeOutRuby</b>: <i>TimeOutRuby is required" + HTML_ITALICS_LNBREAK); - responseString.append("<b>Vnf Type</b>: <i>Vnf Type is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - - // Validate MicroServices Policy Data - if (MICROSERVICES.equals(policyData.getConfigPolicyType())){ - - if(!Strings.isNullOrEmpty(policyData.getServiceType())){ - - modelRequiredFieldsList.clear(); - pullJsonKeyPairs((JsonNode) policyData.getPolicyJSON()); - - String service; - String version; - if (policyData.getServiceType().contains("-v")){ - service = policyData.getServiceType().split("-v")[0]; - version = policyData.getServiceType().split("-v")[1]; - }else { - service = policyData.getServiceType(); - version = policyData.getVersion(); - } - - if(!Strings.isNullOrEmpty(version)) { - MicroServiceModels returnModel = getMSModelData(service, version); - - if(returnModel != null) { - - String annotation = returnModel.getAnnotation(); - String refAttributes = returnModel.getRef_attributes(); - String subAttributes = returnModel.getSub_attributes(); - String modelAttributes = returnModel.getAttributes(); - - if (!Strings.isNullOrEmpty(annotation)){ - Map<String, String> rangeMap = Splitter.on(",").withKeyValueSeparator("=").split(annotation); - for (Entry<String, String> rMap : rangeMap.entrySet()){ - if (rMap.getValue().contains("range::")){ - String value = mapAttribute.get(rMap.getKey().trim()); - String[] tempString = rMap.getValue().split("::")[1].split("-"); - int startNum = Integer.parseInt(tempString[0]); - int endNum = Integer.parseInt(tempString[1]); - String returnString = "InvalidreturnModel Range:" + rMap.getKey() + " must be between " - + startNum + " - " + endNum + ","; - - if(value != null) { - if (PolicyUtils.isInteger(value.replace("\"", ""))){ - int result = Integer.parseInt(value.replace("\"", "")); - if (result < startNum || result > endNum){ - responseString.append(returnString); - valid = false; - } - }else { - responseString.append(returnString); - valid = false; - } - } else { - responseString.append("<b>"+rMap.getKey()+"</b>:<i>" + rMap.getKey() - + " is required for the MicroService model " + service + HTML_ITALICS_LNBREAK); - valid = false; - } - - } - } - } else { - // Validate for configName, location, uuid, and policyScope if no annotations exist for this model - if(Strings.isNullOrEmpty(policyData.getLocation())){ - responseString.append("<b>Micro Service Model</b>:<i> location is required for this model" + HTML_ITALICS_LNBREAK); - valid = false; - } - - if(Strings.isNullOrEmpty(policyData.getConfigName())){ - responseString.append("<b>Micro Service Model</b>:<i> configName is required for this model" + HTML_ITALICS_LNBREAK); - valid = false; - } - - if(Strings.isNullOrEmpty(policyData.getUuid())){ - responseString.append("<b>Micro Service Model</b>:<i> uuid is required for this model" + HTML_ITALICS_LNBREAK); - valid = false; - } - - if(Strings.isNullOrEmpty(policyData.getPolicyScope())){ - responseString.append("<b>Micro Service Model</b>:<i> policyScope is required for this model" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - - // If request comes from the API we need to validate required fields in the Micro Service Model - // GUI request are already validated from the SDK-APP - if("API".equals(policyData.getApiflag())){ - // get list of required fields from the sub_Attributes of the Model - if(!Strings.isNullOrEmpty(subAttributes)) { - JsonObject subAttributesJson = stringToJsonObject(subAttributes); - findRequiredFields(subAttributesJson); - } - - // get list of required fields from the attributes of the Model - if (!Strings.isNullOrEmpty(modelAttributes)) { - Map<String, String> modelAttributesMap = null; - if (",".equals(modelAttributes.substring(modelAttributes.length()-1))) { - String attributeString = modelAttributes.substring(0, modelAttributes.length()-1); - modelAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(attributeString); - } else { - modelAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(modelAttributes); - } - String json = new ObjectMapper().writeValueAsString(modelAttributesMap); - findRequiredFields(stringToJsonObject(json)); - } - - // get list of required fields from the ref_Attributes of the Model - if (!Strings.isNullOrEmpty(refAttributes)) { - Map<String, String> refAttributesMap = null; - if (",".equals(refAttributes.substring(refAttributes.length()-1))) { - String attributesString = refAttributes.substring(0, refAttributes.length()-1); - refAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(attributesString); - } else { - refAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(modelAttributes); - } - String json = new ObjectMapper().writeValueAsString(refAttributesMap); - findRequiredFields(stringToJsonObject(json)); - } - - if (modelRequiredFieldsList!=null || !modelRequiredFieldsList.isEmpty()) { - // create jsonRequestMap with all json keys and values from request - JsonNode rootNode = (JsonNode) policyData.getPolicyJSON(); - jsonRequestMap.clear(); - pullModelJsonKeyPairs(rootNode); - - // validate if the requiredFields are in the request - for(String requiredField : modelRequiredFieldsList) { - if (jsonRequestMap.containsKey(requiredField)) { - String value = jsonRequestMap.get(requiredField); - if(Strings.isNullOrEmpty(jsonRequestMap.get(requiredField)) || - "\"\"".equals(value) || - "".equals(jsonRequestMap.get(requiredField))){ - responseString.append("<b>Micro Service Model</b>:<i> " + requiredField + ISREQUIRED + HTML_ITALICS_LNBREAK); - valid = false; - } - } else { - responseString.append("<b>Micro Service Model</b>:<i> " + requiredField + ISREQUIRED + HTML_ITALICS_LNBREAK); - valid = false; - } - } - } - } - } else { - responseString.append("<b>Micro Service Model</b>:<i> Invalid Model. The model name, " + service + - " of version, " + version + " was not found in the dictionary" + HTML_ITALICS_LNBREAK); - valid = false; - } - } else { - responseString.append("<b>Micro Service Version</b>:<i> Micro Service Version is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - } else { - responseString.append("<b>Micro Service</b>:<i> Micro Service Model is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - - if(Strings.isNullOrEmpty(policyData.getPriority())){ - responseString.append("<b>Priority</b>:<i> Priority is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - - // Validate Optimization Policy Data - if (OPTIMIZATION.equals(policyData.getConfigPolicyType())){ - - if(!Strings.isNullOrEmpty(policyData.getServiceType())){ - - modelRequiredFieldsList.clear(); - pullJsonKeyPairs((JsonNode) policyData.getPolicyJSON()); - - String service; - String version; - if (policyData.getServiceType().contains("-v")){ - service = policyData.getServiceType().split("-v")[0]; - version = policyData.getServiceType().split("-v")[1]; - }else { - service = policyData.getServiceType(); - version = policyData.getVersion(); - } - - if(!Strings.isNullOrEmpty(version)) { - OptimizationModels returnModel = getOptimizationModelData(service, version); - - if(returnModel != null) { - - String annotation = returnModel.getAnnotation(); - String refAttributes = returnModel.getRefattributes(); - String subAttributes = returnModel.getSubattributes(); - String modelAttributes = returnModel.getAttributes(); - - if (!Strings.isNullOrEmpty(annotation)){ - Map<String, String> rangeMap = Splitter.on(",").withKeyValueSeparator("=").split(annotation); - for (Entry<String, String> rMap : rangeMap.entrySet()){ - if (rMap.getValue().contains("range::")){ - String value = mapAttribute.get(rMap.getKey().trim()); - String[] tempString = rMap.getValue().split("::")[1].split("-"); - int startNum = Integer.parseInt(tempString[0]); - int endNum = Integer.parseInt(tempString[1]); - String returnString = "InvalidreturnModel Range:" + rMap.getKey() + " must be between " - + startNum + " - " + endNum + ","; - - if(value != null) { - if (PolicyUtils.isInteger(value.replace("\"", ""))){ - int result = Integer.parseInt(value.replace("\"", "")); - if (result < startNum || result > endNum){ - responseString.append(returnString); - valid = false; - } - }else { - responseString.append(returnString); - valid = false; - } - } else { - responseString.append("<b>"+rMap.getKey()+"</b>:<i>" + rMap.getKey() - + " is required for the Optimization model " + service + HTML_ITALICS_LNBREAK); - valid = false; - } - - } - } - } - - // If request comes from the API we need to validate required fields in the Micro Service Model - // GUI request are already validated from the SDK-APP - if("API".equals(policyData.getApiflag())){ - // get list of required fields from the sub_Attributes of the Model - if(!Strings.isNullOrEmpty(subAttributes)) { - JsonObject subAttributesJson = stringToJsonObject(subAttributes); - findRequiredFields(subAttributesJson); - } - - // get list of required fields from the attributes of the Model - if (!Strings.isNullOrEmpty(modelAttributes)) { - Map<String, String> modelAttributesMap = null; - if (",".equals(modelAttributes.substring(modelAttributes.length()-1))) { - String attributeString = modelAttributes.substring(0, modelAttributes.length()-1); - modelAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(attributeString); - } else { - modelAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(modelAttributes); - } - String json = new ObjectMapper().writeValueAsString(modelAttributesMap); - findRequiredFields(stringToJsonObject(json)); - } - - // get list of required fields from the ref_Attributes of the Model - if (!Strings.isNullOrEmpty(refAttributes)) { - Map<String, String> refAttributesMap = null; - if (",".equals(refAttributes.substring(refAttributes.length()-1))) { - String attributesString = refAttributes.substring(0, refAttributes.length()-1); - refAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(attributesString); - } else { - refAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(modelAttributes); - } - String json = new ObjectMapper().writeValueAsString(refAttributesMap); - findRequiredFields(stringToJsonObject(json)); - } - - if (modelRequiredFieldsList!=null || !modelRequiredFieldsList.isEmpty()) { - // create jsonRequestMap with all json keys and values from request - JsonNode rootNode = (JsonNode) policyData.getPolicyJSON(); - jsonRequestMap.clear(); - pullModelJsonKeyPairs(rootNode); - - // validate if the requiredFields are in the request - for(String requiredField : modelRequiredFieldsList) { - if (jsonRequestMap.containsKey(requiredField)) { - String value = jsonRequestMap.get(requiredField); - if(Strings.isNullOrEmpty(jsonRequestMap.get(requiredField)) || - "\"\"".equals(value) || - "".equals(jsonRequestMap.get(requiredField))){ - responseString.append("<b>Optimization Service Model</b>:<i> " + requiredField + ISREQUIRED + HTML_ITALICS_LNBREAK); - valid = false; - } - } else { - responseString.append("<b>Optimization Service Model</b>:<i> " + requiredField + ISREQUIRED + HTML_ITALICS_LNBREAK); - valid = false; - } - } - } - } - } else { - responseString.append("<b>Optimization Service Model</b>:<i> Invalid Model. The model name, " + service + - " of version, " + version + " was not found in the dictionary" + HTML_ITALICS_LNBREAK); - valid = false; - } - } else { - responseString.append("<b>Optimization Service Version</b>:<i> Optimization Service Version is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - } else { - responseString.append("<b>Optimization Service</b>:<i> Optimization Service Model is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - - if(Strings.isNullOrEmpty(policyData.getPriority())){ - responseString.append("<b>Priority</b>:<i> Priority is required" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - } - if (DECISION_POLICY.equalsIgnoreCase(policyData.getPolicyType())){ - if(!Strings.isNullOrEmpty(policyData.getOnapName())){ - String onapNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getOnapName()); - if(!onapNameValidate.contains(SUCCESS)){ - responseString.append("OnapName:" + onapNameValidate + HTML_ITALICS_LNBREAK); - valid = false; - } - }else{ - responseString.append("Onap Name: Onap Name Should not be empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - - if("Rainy_Day".equals(policyData.getRuleProvider())){ - if(policyData.getRainyday()==null){ - responseString.append("<b> Rainy Day Parameters are Required </b><br>"); - valid = false; - }else{ - if(Strings.isNullOrEmpty(policyData.getRainyday().getServiceType())){ - responseString.append("Rainy Day <b>Service Type</b> is Required<br>"); - valid = false; - } - if(Strings.isNullOrEmpty(policyData.getRainyday().getVnfType())){ - responseString.append("Rainy Day <b>VNF Type</b> is Required<br>"); - valid = false; - } - if(Strings.isNullOrEmpty(policyData.getRainyday().getBbid())){ - responseString.append("Rainy Day <b>Building Block ID</b> is Required<br>"); - valid = false; - } - if(Strings.isNullOrEmpty(policyData.getRainyday().getWorkstep())){ - responseString.append("Rainy Day <b>Work Step</b> is Required<br>"); - valid = false; - } - if(!policyData.getRainyday().getTreatmentTableChoices().isEmpty() && - policyData.getRainyday().getTreatmentTableChoices() != null){ - - for(Object treatmentMap: policyData.getRainyday().getTreatmentTableChoices()){ - String errorCode = null; - String treatment = null; - if(treatmentMap instanceof LinkedHashMap<?, ?>){ - - if(((LinkedHashMap<?, ?>) treatmentMap).containsKey("errorcode")){ - errorCode = ((LinkedHashMap<?, ?>) treatmentMap).get("errorcode").toString(); - } - if(((LinkedHashMap<?, ?>) treatmentMap).containsKey("treatment")){ - treatment = ((LinkedHashMap<?, ?>) treatmentMap).get("treatment").toString(); - } - - } - if(Strings.isNullOrEmpty(errorCode) && Strings.isNullOrEmpty(treatment)){ - responseString.append("Rainy Day <b>Error Code</b> and <b>Desired Treatment</b> cannot be empty<br>"); - valid = false; - break; - } - if(Strings.isNullOrEmpty(errorCode)){ - responseString.append("Rainy Day <b>Error Code</b> is Required for each Desired Treatment<br>"); - valid = false; - break; - } - if(Strings.isNullOrEmpty(treatment)){ - responseString.append("Rainy Day <b>Desired Treatment</b> is Required for each Error Code<br>"); - valid = false; - break; - } - } - - } else { - responseString.append("Rainy Day <b>Desired Automated Treatments</b> are Required<br>"); - valid = false; - } - } - } - - if("GUARD_YAML".equals(policyData.getRuleProvider()) || "GUARD_BL_YAML".equals(policyData.getRuleProvider())){ - if(policyData.getYamlparams()==null){ - responseString.append("<b> Guard Params are Required </b>" + HTML_ITALICS_LNBREAK); - valid = false; - }else{ - if(Strings.isNullOrEmpty(policyData.getYamlparams().getActor())){ - responseString.append("Guard Params <b>Actor</b> is Required " + HTML_ITALICS_LNBREAK); - valid = false; - } - if(Strings.isNullOrEmpty(policyData.getYamlparams().getRecipe())){ - responseString.append("Guard Params <b>Recipe</b> is Required " + HTML_ITALICS_LNBREAK); - valid = false; - } - if(Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveStart())){ - responseString.append("Guard Params <b>Guard Active Start</b> is Required " + HTML_ITALICS_LNBREAK); - valid = false; - } - if(Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveEnd())){ - responseString.append("Guard Params <b>Guard Active End</b> is Required " + HTML_ITALICS_LNBREAK); - valid = false; - } - if("GUARD_YAML".equals(policyData.getRuleProvider())){ - if(Strings.isNullOrEmpty(policyData.getYamlparams().getLimit())){ - responseString.append(" Guard Params <b>Limit</b> is Required " + HTML_ITALICS_LNBREAK); - valid = false; - }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getLimit())){ - responseString.append(" Guard Params <b>Limit</b> Should be Integer " + HTML_ITALICS_LNBREAK); - valid = false; - } - if(Strings.isNullOrEmpty(policyData.getYamlparams().getTimeWindow())){ - responseString.append("Guard Params <b>Time Window</b> is Required" + HTML_ITALICS_LNBREAK); - valid = false; - }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getTimeWindow())){ - responseString.append(" Guard Params <b>Time Window</b> Should be Integer " + HTML_ITALICS_LNBREAK); - valid = false; - } - if(Strings.isNullOrEmpty(policyData.getYamlparams().getTimeUnits())){ - responseString.append("Guard Params <b>Time Units</b> is Required" + HTML_ITALICS_LNBREAK); - valid = false; - } - } else if ("GUARD_BL_YAML".equals(policyData.getRuleProvider()) + if(CONFIG_POLICY.equalsIgnoreCase(policyData.getPolicyType())){ + if ("Base".equals(policyData.getConfigPolicyType()) || CLOSEDLOOP_POLICY.equals(policyData.getConfigPolicyType()) + || CLOSEDLOOP_PM.equals(policyData.getConfigPolicyType()) || ENFORCER_CONFIG_POLICY.equals(policyData.getConfigPolicyType()) + || MICROSERVICES.equals(policyData.getConfigPolicyType()) || OPTIMIZATION.equals(policyData.getConfigPolicyType())) { + + if(!Strings.isNullOrEmpty(policyData.getOnapName())) { + String onapNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getOnapName()); + if(!onapNameValidate.contains(SUCCESS)){ + responseString.append("<b>OnapName</b>:<i>" + onapNameValidate + HTML_ITALICS_LNBREAK); + valid = false; + } + }else{ + responseString.append("<b>Onap Name</b>: Onap Name Should not be empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + if(!Strings.isNullOrEmpty(policyData.getRiskType())) { + String riskTypeValidate = PolicyUtils.policySpecialCharValidator(policyData.getRiskType()); + if(!riskTypeValidate.contains(SUCCESS)){ + responseString.append("<b>RiskType</b>:<i>" + riskTypeValidate + HTML_ITALICS_LNBREAK); + valid = false; + } + }else { + responseString.append("<b>RiskType</b>: Risk Type Should not be Empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(!Strings.isNullOrEmpty(policyData.getRiskLevel())) { + String validateRiskLevel = PolicyUtils.policySpecialCharValidator(policyData.getRiskLevel()); + if(!validateRiskLevel.contains(SUCCESS)){ + responseString.append("<b>RiskLevel</b>:<i>" + validateRiskLevel + HTML_ITALICS_LNBREAK); + valid = false; + } + }else { + responseString.append("<b>RiskLevel</b>: Risk Level Should not be Empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(!Strings.isNullOrEmpty(policyData.getGuard())) { + String validateGuard = PolicyUtils.policySpecialCharValidator(policyData.getGuard()); + if(!validateGuard.contains(SUCCESS)){ + responseString.append("<b>Guard</b>:<i>" + validateGuard + HTML_ITALICS_LNBREAK); + valid = false; + } + }else { + responseString.append("<b>Guard</b>: Guard Value Should not be Empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + + // Validate Config Base Policy Data + if("Base".equalsIgnoreCase(policyData.getConfigPolicyType())){ + if(!Strings.isNullOrEmpty(policyData.getConfigName())) { + String configNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getConfigName()); + if(!configNameValidate.contains(SUCCESS)){ + responseString.append("ConfigName:" + configNameValidate + HTML_ITALICS_LNBREAK); + valid = false; + } + }else{ + responseString.append("Config Name: Config Name Should not be Empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(!Strings.isNullOrEmpty(policyData.getConfigType())) { + String configTypeValidate = PolicyUtils.policySpecialCharValidator(policyData.getConfigType()); + if(!configTypeValidate.contains(SUCCESS)){ + responseString.append("ConfigType:" + configTypeValidate + HTML_ITALICS_LNBREAK); + valid = false; + } + }else{ + responseString.append("Config Type: Config Type Should not be Empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(!Strings.isNullOrEmpty(policyData.getConfigBodyData())) { + String configBodyData = policyData.getConfigBodyData(); + String configType = policyData.getConfigType(); + if (configType != null) { + if ("JSON".equals(configType)) { + if (!PolicyUtils.isJSONValid(configBodyData)) { + responseString.append("Config Body: JSON Content is not valid" + HTML_ITALICS_LNBREAK); + valid = false; + } + } else if ("XML".equals(configType)) { + if (!PolicyUtils.isXMLValid(configBodyData)) { + responseString.append("Config Body: XML Content data is not valid" + HTML_ITALICS_LNBREAK); + valid = false; + } + } else if ("PROPERTIES".equals(configType)) { + if (!PolicyUtils.isPropValid(configBodyData) || "".equals(configBodyData)) { + responseString.append("Config Body: Property data is not valid" + HTML_ITALICS_LNBREAK); + valid = false; + } + } else if ("OTHER".equals(configType) && ("".equals(configBodyData))) { + responseString.append("Config Body: Config Body Should not be Empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + }else{ + responseString.append("Config Body: Config Body Should not be Empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + // Validate Config Firewall Policy Data + if(FIREWALL.equalsIgnoreCase(policyData.getConfigPolicyType())){ + if(policyData.getConfigName() != null && !policyData.getConfigName().isEmpty()){ + String configNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getConfigName()); + if(!configNameValidate.contains(SUCCESS)){ + responseString.append("<b>ConfigName</b>:<i>" + configNameValidate + HTML_ITALICS_LNBREAK); + valid = false; + } + }else{ + responseString.append("<b>Config Name</b>:<i> Config Name is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(policyData.getSecurityZone() == null || policyData.getSecurityZone().isEmpty()){ + responseString.append("<b>Security Zone</b>:<i> Security Zone is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + // Validate BRMS_Param Policy Data + if(BRMSPARAM.equalsIgnoreCase(policyData.getConfigPolicyType()) && Strings.isNullOrEmpty(policyData.getRuleName())){ + responseString.append("<b>BRMS Template</b>:<i>BRMS Template is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + + // Validate BRMS_Raw Policy Data + if(BRMSRAW.equalsIgnoreCase(policyData.getConfigPolicyType())){ + if(policyData.getConfigBodyData() != null && !policyData.getConfigBodyData().isEmpty()){ + String message = PolicyUtils.brmsRawValidate(policyData.getConfigBodyData()); + + // If there are any error other than Annotations then this is not Valid + if(message.contains("[ERR")){ + responseString.append("<b>Raw Rule Validate</b>:<i>Raw Rule has error"+ message + HTML_ITALICS_LNBREAK); + valid = false; + } + }else{ + responseString.append("<b>Raw Rule</b>:<i>Raw Rule is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + // Validate ClosedLoop_PM Policy Data + if(CLOSEDLOOP_PM.equalsIgnoreCase(policyData.getConfigPolicyType())){ + try{ + if(Strings.isNullOrEmpty(policyData.getServiceTypePolicyName().get("serviceTypePolicyName").toString())){ + responseString.append("<b>ServiceType PolicyName</b>:<i>ServiceType PolicyName is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + + }catch(Exception e){ + LOGGER.error("ERROR in ClosedLoop_PM PolicyName" , e); + responseString.append("<b>ServiceType PolicyName</b>:<i>ServiceType PolicyName is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(policyData.getJsonBody() != null){ + + ClosedLoopPMBody pmBody = mapper.readValue(policyData.getJsonBody(), ClosedLoopPMBody.class); + if(pmBody.getEmailAddress() != null){ + String result = emailValidation(pmBody.getEmailAddress(), responseString.toString()); + if(result != SUCCESS){ + responseString.append(result + HTML_ITALICS_LNBREAK); + valid = false; + } + } + if((pmBody.isGamma() || pmBody.isMcr() || pmBody.isTrinity() || pmBody.isvDNS() || pmBody.isvUSP()) != true){ + responseString.append("<b>D2/Virtualized Services</b>: <i>Select at least one D2/Virtualized Services" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(pmBody.getGeoLink() != null && !pmBody.getGeoLink().isEmpty()){ + String result = PolicyUtils.policySpecialCharValidator(pmBody.getGeoLink()); + if(!result.contains(SUCCESS)){ + responseString.append("<b>GeoLink</b>:<i>" + result + HTML_ITALICS_LNBREAK); + valid = false; + } + } + if(pmBody.getAttributes() != null && !pmBody.getAttributes().isEmpty()){ + for(Entry<String, String> entry : pmBody.getAttributes().entrySet()){ + String key = entry.getKey(); + String value = entry.getValue(); + if(!key.contains("Message")){ + String attributeValidate = PolicyUtils.policySpecialCharValidator(value); + if(!attributeValidate.contains(SUCCESS)){ + responseString.append("<b>Attributes</b>:<i>" + key + " : value has spaces or invalid characters" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + } + } + }else{ + responseString.append("<b>D2/Virtualized Services</b>:<i>Select atleast one D2/Virtualized Services" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + // Validate ClosedLoop_Fault Policy Data + if(CLOSEDLOOP_POLICY.equalsIgnoreCase(policyData.getConfigPolicyType())){ + if(policyData.getJsonBody() != null){ + + // For API we need to get the conditions key from the Json request and check it before deserializing to POJO due to the enum + if("API".equals(policyData.getApiflag())){ + JSONObject json = new JSONObject(policyData.getJsonBody()); + if(!json.isNull("conditions")){ + String apiCondition = (String) json.get("conditions"); + if(Strings.isNullOrEmpty(apiCondition)){ + responseString.append("<b>Conditions</b>: <i>Select At least one Condition" + HTML_ITALICS_LNBREAK); + return responseString; + } + } else { + responseString.append("<b>Conditions</b>: <i>There were no conditions provided in configBody json" + HTML_ITALICS_LNBREAK); + return responseString; + } + }else{ + if(policyData.getTrapDatas().getTrap1() != null){ + if(policyData.getClearTimeOut() == null){ + responseString.append("<b>Trigger Clear TimeOut</b>: <i>Trigger Clear TimeOut is required when atleast One Trigger Signature is enabled</i><br>"); + valid = false; + } + if(policyData.getTrapMaxAge() == null){ + responseString.append("<b>Trap Max Age</b>: <i>Trap Max Age is required when atleast One Trigger Signature is enabled</i><br>"); + valid = false; + } + } + if(policyData.getFaultDatas().getTrap1() != null && policyData.getVerificationclearTimeOut() == null){ + responseString.append("<b>Fault Clear TimeOut</b>: <i>Fault Clear TimeOut is required when atleast One Fault Signature is enabled</i><br>"); + valid = false; + } + } + + ClosedLoopFaultBody faultBody = mapper.readValue(policyData.getJsonBody(), ClosedLoopFaultBody.class); + if(faultBody.getEmailAddress() != null && !faultBody.getEmailAddress().isEmpty()){ + String result = emailValidation(faultBody.getEmailAddress(), responseString.toString()); + if(!SUCCESS.equals(result)){ + responseString.append(result+ HTML_ITALICS_LNBREAK); + valid = false; + } + } + if((faultBody.isGamma() || faultBody.isMcr() || faultBody.isTrinity() || faultBody.isvDNS() || faultBody.isvUSP()) != true){ + responseString.append("<b>D2/Virtualized Services</b>: <i>Select at least one D2/Virtualized Services" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(faultBody.getActions() == null || faultBody.getActions().isEmpty()){ + responseString.append("<b>vPRO Actions</b>: <i>vPRO Actions is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(faultBody.getClosedLoopPolicyStatus() == null || faultBody.getClosedLoopPolicyStatus().isEmpty()){ + responseString.append("<b>Policy Status</b>: <i>Policy Status is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(faultBody.getConditions() == null){ + responseString.append("<b>Conditions</b>: <i>Select At least one Condition" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(faultBody.getGeoLink() != null && !faultBody.getGeoLink().isEmpty()){ + String result = PolicyUtils.policySpecialCharWithSpaceValidator(faultBody.getGeoLink()); + if(!result.contains(SUCCESS)){ + responseString.append("<b>GeoLink</b>:<i>" + result + HTML_ITALICS_LNBREAK); + valid = false; + } + } + if(faultBody.getAgingWindow() == 0){ + responseString.append("<b>Aging Window</b>: <i>Aging Window is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(faultBody.getTimeInterval() == 0){ + responseString.append("<b>Time Interval</b>: <i>Time Interval is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(faultBody.getRetrys() == 0){ + responseString.append("<b>Number of Retries</b>: <i>Number of Retries is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(faultBody.getTimeOutvPRO() == 0){ + responseString.append("<b>APP-C Timeout</b>: <i>APP-C Timeout is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(faultBody.getTimeOutRuby() == 0){ + responseString.append("<b>TimeOutRuby</b>: <i>TimeOutRuby is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + if(faultBody.getVnfType() == null || faultBody.getVnfType().isEmpty()){ + responseString.append("<b>Vnf Type</b>: <i>Vnf Type is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + }else{ + responseString.append("<b>D2/Virtualized Services</b>: <i>Select atleast one D2/Virtualized Services" + HTML_ITALICS_LNBREAK); + responseString.append("<b>vPRO Actions</b>: <i>vPRO Actions is required" + HTML_ITALICS_LNBREAK); + responseString.append("<b>Aging Window</b>: <i>Aging Window is required" + HTML_ITALICS_LNBREAK); + responseString.append("<b>Policy Status</b>: <i>Policy Status is required" + HTML_ITALICS_LNBREAK); + responseString.append("<b>Conditions</b>: <i>Select Atleast one Condition" + HTML_ITALICS_LNBREAK); + responseString.append("<b>PEP Name</b>: <i>PEP Name is required" + HTML_ITALICS_LNBREAK); + responseString.append("<b>PEP Action</b>: <i>PEP Action is required" + HTML_ITALICS_LNBREAK); + responseString.append("<b>Time Interval</b>: <i>Time Interval is required" + HTML_ITALICS_LNBREAK); + responseString.append("<b>Number of Retries</b>: <i>Number of Retries is required" + HTML_ITALICS_LNBREAK); + responseString.append("<b>APP-C Timeout</b>: <i>APP-C Timeout is required" + HTML_ITALICS_LNBREAK); + responseString.append("<b>TimeOutRuby</b>: <i>TimeOutRuby is required" + HTML_ITALICS_LNBREAK); + responseString.append("<b>Vnf Type</b>: <i>Vnf Type is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + // Validate MicroServices Policy Data + if (MICROSERVICES.equals(policyData.getConfigPolicyType())){ + + if(!Strings.isNullOrEmpty(policyData.getServiceType())){ + + modelRequiredFieldsList.clear(); + pullJsonKeyPairs((JsonNode) policyData.getPolicyJSON()); + + String service; + String version; + if (policyData.getServiceType().contains("-v")){ + service = policyData.getServiceType().split("-v")[0]; + version = policyData.getServiceType().split("-v")[1]; + }else { + service = policyData.getServiceType(); + version = policyData.getVersion(); + } + + if(!Strings.isNullOrEmpty(version)) { + MicroServiceModels returnModel = getMSModelData(service, version); + + if(returnModel != null) { + + String annotation = returnModel.getAnnotation(); + String refAttributes = returnModel.getRef_attributes(); + String subAttributes = returnModel.getSub_attributes(); + String modelAttributes = returnModel.getAttributes(); + + if (!Strings.isNullOrEmpty(annotation)){ + Map<String, String> rangeMap = Splitter.on(",").withKeyValueSeparator("=").split(annotation); + for (Entry<String, String> rMap : rangeMap.entrySet()){ + if (rMap.getValue().contains("range::")){ + String value = mapAttribute.get(rMap.getKey().trim()); + String[] tempString = rMap.getValue().split("::")[1].split("-"); + int startNum = Integer.parseInt(tempString[0]); + int endNum = Integer.parseInt(tempString[1]); + String returnString = "InvalidreturnModel Range:" + rMap.getKey() + " must be between " + + startNum + " - " + endNum + ","; + + if(value != null) { + if (PolicyUtils.isInteger(value.replace("\"", ""))){ + int result = Integer.parseInt(value.replace("\"", "")); + if (result < startNum || result > endNum){ + responseString.append(returnString); + valid = false; + } + }else { + responseString.append(returnString); + valid = false; + } + } else { + responseString.append("<b>"+rMap.getKey()+"</b>:<i>" + rMap.getKey() + + " is required for the MicroService model " + service + HTML_ITALICS_LNBREAK); + valid = false; + } + + } + } + } else { + // Validate for configName, location, uuid, and policyScope if no annotations exist for this model + if(Strings.isNullOrEmpty(policyData.getLocation())){ + responseString.append("<b>Micro Service Model</b>:<i> location is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(Strings.isNullOrEmpty(policyData.getConfigName())){ + responseString.append("<b>Micro Service Model</b>:<i> configName is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(Strings.isNullOrEmpty(policyData.getUuid())){ + responseString.append("<b>Micro Service Model</b>:<i> uuid is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(Strings.isNullOrEmpty(policyData.getPolicyScope())){ + responseString.append("<b>Micro Service Model</b>:<i> policyScope is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + // If request comes from the API we need to validate required fields in the Micro Service Model + // GUI request are already validated from the SDK-APP + if("API".equals(policyData.getApiflag())){ + // get list of required fields from the sub_Attributes of the Model + if(!Strings.isNullOrEmpty(subAttributes)) { + JsonObject subAttributesJson = stringToJsonObject(subAttributes); + findRequiredFields(subAttributesJson); + } + + // get list of required fields from the attributes of the Model + if (!Strings.isNullOrEmpty(modelAttributes)) { + Map<String, String> modelAttributesMap = null; + if (",".equals(modelAttributes.substring(modelAttributes.length()-1))) { + String attributeString = modelAttributes.substring(0, modelAttributes.length()-1); + modelAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(attributeString); + } else { + modelAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(modelAttributes); + } + String json = new ObjectMapper().writeValueAsString(modelAttributesMap); + findRequiredFields(stringToJsonObject(json)); + } + + // get list of required fields from the ref_Attributes of the Model + if (!Strings.isNullOrEmpty(refAttributes)) { + Map<String, String> refAttributesMap = null; + if (",".equals(refAttributes.substring(refAttributes.length()-1))) { + String attributesString = refAttributes.substring(0, refAttributes.length()-1); + refAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(attributesString); + } else { + refAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(modelAttributes); + } + String json = new ObjectMapper().writeValueAsString(refAttributesMap); + findRequiredFields(stringToJsonObject(json)); + } + + if (modelRequiredFieldsList!=null || !modelRequiredFieldsList.isEmpty()) { + // create jsonRequestMap with all json keys and values from request + JsonNode rootNode = (JsonNode) policyData.getPolicyJSON(); + jsonRequestMap.clear(); + pullModelJsonKeyPairs(rootNode); + + // validate if the requiredFields are in the request + for(String requiredField : modelRequiredFieldsList) { + if (jsonRequestMap.containsKey(requiredField)) { + String value = jsonRequestMap.get(requiredField); + if(Strings.isNullOrEmpty(jsonRequestMap.get(requiredField)) || + "\"\"".equals(value) || + "".equals(jsonRequestMap.get(requiredField))){ + responseString.append("<b>Micro Service Model</b>:<i> " + requiredField + ISREQUIRED + HTML_ITALICS_LNBREAK); + valid = false; + } + } else { + responseString.append("<b>Micro Service Model</b>:<i> " + requiredField + ISREQUIRED + HTML_ITALICS_LNBREAK); + valid = false; + } + } + } + } + } else { + responseString.append("<b>Micro Service Model</b>:<i> Invalid Model. The model name, " + service + + " of version, " + version + " was not found in the dictionary" + HTML_ITALICS_LNBREAK); + valid = false; + } + } else { + responseString.append("<b>Micro Service Version</b>:<i> Micro Service Version is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } else { + responseString.append("<b>Micro Service</b>:<i> Micro Service Model is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(Strings.isNullOrEmpty(policyData.getPriority())){ + responseString.append("<b>Priority</b>:<i> Priority is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + // Validate Optimization Policy Data + if (OPTIMIZATION.equals(policyData.getConfigPolicyType())){ + + if(!Strings.isNullOrEmpty(policyData.getServiceType())){ + + modelRequiredFieldsList.clear(); + pullJsonKeyPairs((JsonNode) policyData.getPolicyJSON()); + + String service; + String version; + if (policyData.getServiceType().contains("-v")){ + service = policyData.getServiceType().split("-v")[0]; + version = policyData.getServiceType().split("-v")[1]; + }else { + service = policyData.getServiceType(); + version = policyData.getVersion(); + } + + if(!Strings.isNullOrEmpty(version)) { + OptimizationModels returnModel = getOptimizationModelData(service, version); + + if(returnModel != null) { + + String annotation = returnModel.getAnnotation(); + String refAttributes = returnModel.getRefattributes(); + String subAttributes = returnModel.getSubattributes(); + String modelAttributes = returnModel.getAttributes(); + + if (!Strings.isNullOrEmpty(annotation)){ + Map<String, String> rangeMap = Splitter.on(",").withKeyValueSeparator("=").split(annotation); + for (Entry<String, String> rMap : rangeMap.entrySet()){ + if (rMap.getValue().contains("range::")){ + String value = mapAttribute.get(rMap.getKey().trim()); + String[] tempString = rMap.getValue().split("::")[1].split("-"); + int startNum = Integer.parseInt(tempString[0]); + int endNum = Integer.parseInt(tempString[1]); + String returnString = "InvalidreturnModel Range:" + rMap.getKey() + " must be between " + + startNum + " - " + endNum + ","; + + if(value != null) { + if (PolicyUtils.isInteger(value.replace("\"", ""))){ + int result = Integer.parseInt(value.replace("\"", "")); + if (result < startNum || result > endNum){ + responseString.append(returnString); + valid = false; + } + }else { + responseString.append(returnString); + valid = false; + } + } else { + responseString.append("<b>"+rMap.getKey()+"</b>:<i>" + rMap.getKey() + + " is required for the Optimization model " + service + HTML_ITALICS_LNBREAK); + valid = false; + } + + } + } + } + + // If request comes from the API we need to validate required fields in the Micro Service Model + // GUI request are already validated from the SDK-APP + if("API".equals(policyData.getApiflag())){ + // get list of required fields from the sub_Attributes of the Model + if(!Strings.isNullOrEmpty(subAttributes)) { + JsonObject subAttributesJson = stringToJsonObject(subAttributes); + findRequiredFields(subAttributesJson); + } + + // get list of required fields from the attributes of the Model + if (!Strings.isNullOrEmpty(modelAttributes)) { + Map<String, String> modelAttributesMap = null; + if (",".equals(modelAttributes.substring(modelAttributes.length()-1))) { + String attributeString = modelAttributes.substring(0, modelAttributes.length()-1); + modelAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(attributeString); + } else { + modelAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(modelAttributes); + } + String json = new ObjectMapper().writeValueAsString(modelAttributesMap); + findRequiredFields(stringToJsonObject(json)); + } + + // get list of required fields from the ref_Attributes of the Model + if (!Strings.isNullOrEmpty(refAttributes)) { + Map<String, String> refAttributesMap = null; + if (",".equals(refAttributes.substring(refAttributes.length()-1))) { + String attributesString = refAttributes.substring(0, refAttributes.length()-1); + refAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(attributesString); + } else { + refAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(modelAttributes); + } + String json = new ObjectMapper().writeValueAsString(refAttributesMap); + findRequiredFields(stringToJsonObject(json)); + } + + if (modelRequiredFieldsList!=null || !modelRequiredFieldsList.isEmpty()) { + // create jsonRequestMap with all json keys and values from request + JsonNode rootNode = (JsonNode) policyData.getPolicyJSON(); + jsonRequestMap.clear(); + pullModelJsonKeyPairs(rootNode); + + // validate if the requiredFields are in the request + for(String requiredField : modelRequiredFieldsList) { + if (jsonRequestMap.containsKey(requiredField)) { + String value = jsonRequestMap.get(requiredField); + if(Strings.isNullOrEmpty(jsonRequestMap.get(requiredField)) || + "\"\"".equals(value) || + "".equals(jsonRequestMap.get(requiredField))){ + responseString.append("<b>Optimization Service Model</b>:<i> " + requiredField + ISREQUIRED + HTML_ITALICS_LNBREAK); + valid = false; + } + } else { + responseString.append("<b>Optimization Service Model</b>:<i> " + requiredField + ISREQUIRED + HTML_ITALICS_LNBREAK); + valid = false; + } + } + } + } + } else { + responseString.append("<b>Optimization Service Model</b>:<i> Invalid Model. The model name, " + service + + " of version, " + version + " was not found in the dictionary" + HTML_ITALICS_LNBREAK); + valid = false; + } + } else { + responseString.append("<b>Optimization Service Version</b>:<i> Optimization Service Version is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } else { + responseString.append("<b>Optimization Service</b>:<i> Optimization Service Model is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(Strings.isNullOrEmpty(policyData.getPriority())){ + responseString.append("<b>Priority</b>:<i> Priority is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + } + if (DECISION_POLICY.equalsIgnoreCase(policyData.getPolicyType())){ + if(!Strings.isNullOrEmpty(policyData.getOnapName())){ + String onapNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getOnapName()); + if(!onapNameValidate.contains(SUCCESS)){ + responseString.append("OnapName:" + onapNameValidate + HTML_ITALICS_LNBREAK); + valid = false; + } + }else{ + responseString.append("Onap Name: Onap Name Should not be empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if("Rainy_Day".equals(policyData.getRuleProvider())){ + if(policyData.getRainyday()==null){ + responseString.append("<b> Rainy Day Parameters are Required </b><br>"); + valid = false; + }else{ + if(Strings.isNullOrEmpty(policyData.getRainyday().getServiceType())){ + responseString.append("Rainy Day <b>Service Type</b> is Required<br>"); + valid = false; + } + if(Strings.isNullOrEmpty(policyData.getRainyday().getVnfType())){ + responseString.append("Rainy Day <b>VNF Type</b> is Required<br>"); + valid = false; + } + if(Strings.isNullOrEmpty(policyData.getRainyday().getBbid())){ + responseString.append("Rainy Day <b>Building Block ID</b> is Required<br>"); + valid = false; + } + if(Strings.isNullOrEmpty(policyData.getRainyday().getWorkstep())){ + responseString.append("Rainy Day <b>Work Step</b> is Required<br>"); + valid = false; + } + if(!policyData.getRainyday().getTreatmentTableChoices().isEmpty() && + policyData.getRainyday().getTreatmentTableChoices() != null){ + + for(Object treatmentMap: policyData.getRainyday().getTreatmentTableChoices()){ + String errorCode = null; + String treatment = null; + if(treatmentMap instanceof LinkedHashMap<?, ?>){ + + if(((LinkedHashMap<?, ?>) treatmentMap).containsKey("errorcode")){ + errorCode = ((LinkedHashMap<?, ?>) treatmentMap).get("errorcode").toString(); + } + if(((LinkedHashMap<?, ?>) treatmentMap).containsKey("treatment")){ + treatment = ((LinkedHashMap<?, ?>) treatmentMap).get("treatment").toString(); + } + + } + if(Strings.isNullOrEmpty(errorCode) && Strings.isNullOrEmpty(treatment)){ + responseString.append("Rainy Day <b>Error Code</b> and <b>Desired Treatment</b> cannot be empty<br>"); + valid = false; + break; + } + if(Strings.isNullOrEmpty(errorCode)){ + responseString.append("Rainy Day <b>Error Code</b> is Required for each Desired Treatment<br>"); + valid = false; + break; + } + if(Strings.isNullOrEmpty(treatment)){ + responseString.append("Rainy Day <b>Desired Treatment</b> is Required for each Error Code<br>"); + valid = false; + break; + } + } + + } else { + responseString.append("Rainy Day <b>Desired Automated Treatments</b> are Required<br>"); + valid = false; + } + } + } + + if("GUARD_YAML".equals(policyData.getRuleProvider()) || "GUARD_BL_YAML".equals(policyData.getRuleProvider())){ + if(policyData.getYamlparams()==null){ + responseString.append("<b> Guard Params are Required </b>" + HTML_ITALICS_LNBREAK); + valid = false; + }else{ + if(Strings.isNullOrEmpty(policyData.getYamlparams().getActor())){ + responseString.append("Guard Params <b>Actor</b> is Required " + HTML_ITALICS_LNBREAK); + valid = false; + } + if(Strings.isNullOrEmpty(policyData.getYamlparams().getRecipe())){ + responseString.append("Guard Params <b>Recipe</b> is Required " + HTML_ITALICS_LNBREAK); + valid = false; + } + if(Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveStart())){ + responseString.append("Guard Params <b>Guard Active Start</b> is Required " + HTML_ITALICS_LNBREAK); + valid = false; + } + if(Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveEnd())){ + responseString.append("Guard Params <b>Guard Active End</b> is Required " + HTML_ITALICS_LNBREAK); + valid = false; + } + if("GUARD_YAML".equals(policyData.getRuleProvider())){ + if(Strings.isNullOrEmpty(policyData.getYamlparams().getLimit())){ + responseString.append(" Guard Params <b>Limit</b> is Required " + HTML_ITALICS_LNBREAK); + valid = false; + }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getLimit())){ + responseString.append(" Guard Params <b>Limit</b> Should be Integer " + HTML_ITALICS_LNBREAK); + valid = false; + } + if(Strings.isNullOrEmpty(policyData.getYamlparams().getTimeWindow())){ + responseString.append("Guard Params <b>Time Window</b> is Required" + HTML_ITALICS_LNBREAK); + valid = false; + }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getTimeWindow())){ + responseString.append(" Guard Params <b>Time Window</b> Should be Integer " + HTML_ITALICS_LNBREAK); + valid = false; + } + if(Strings.isNullOrEmpty(policyData.getYamlparams().getTimeUnits())){ + responseString.append("Guard Params <b>Time Units</b> is Required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } else if ("GUARD_BL_YAML".equals(policyData.getRuleProvider()) && "Use Manual Entry".equals(policyData.getBlackListEntryType())) { if (policyData.getYamlparams().getBlackList() == null || policyData.getYamlparams().getBlackList().isEmpty()) { @@ -959,157 +959,157 @@ public class PolicyValidation { } } } - } - } - } - - if(ACTION_POLICY.equalsIgnoreCase(policyData.getPolicyType())){ - if(!Strings.isNullOrEmpty(policyData.getActionPerformer())){ - String actionPerformer = PolicyUtils.policySpecialCharValidator(policyData.getActionPerformer()); - if(!actionPerformer.contains(SUCCESS)){ - responseString.append("<b>ActionPerformer</b>:<i>" + actionPerformer + HTML_ITALICS_LNBREAK); - valid = false; - } - }else{ - responseString.append("<b>ActionPerformer</b>:<i> ActionPerformer Should not be empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - - if(!Strings.isNullOrEmpty(policyData.getActionAttributeValue())){ - String actionAttribute = PolicyUtils.policySpecialCharValidator(policyData.getActionAttributeValue()); - if(!actionAttribute.contains(SUCCESS)){ - responseString.append("<b>ActionAttribute</b>:<i>" + actionAttribute + HTML_ITALICS_LNBREAK); - valid = false; - } - }else{ - responseString.append("<b>ActionAttribute</b>:<i> ActionAttribute Should not be empty" + HTML_ITALICS_LNBREAK); - valid = false; - } - } - - if(CONFIG_POLICY.equals(policyData.getPolicyType())){ - String value = ""; - if(valid){ - if(commonClassDao!=null){ - List<Object> spData = commonClassDao.getDataById(SafePolicyWarning.class, "riskType", policyData.getRiskType()); - if (!spData.isEmpty()){ - SafePolicyWarning safePolicyWarningData = (SafePolicyWarning) spData.get(0); - value = "<b>Message</b>:<i>" + safePolicyWarningData.getMessage() +"</i>"; - } - } - responseString.append(SUCCESS + "@#"+ value); - } - }else{ - if(valid){ - responseString.append(SUCCESS); - } - } - - return responseString; - } - catch (Exception e){ - LOGGER.error("Exception Occured during Policy Validation" +e); - return null; - } - } - - protected String emailValidation(String email, String response){ - String res = response; - if(email != null){ - String validateEmail = PolicyUtils.validateEmailAddress(email.replace("\"", "")); - if(!validateEmail.contains(SUCCESS)){ - res += "<b>Email</b>:<i>" + validateEmail + HTML_ITALICS_LNBREAK; - } - else { - return SUCCESS; - } - } - return res; - } - - private MicroServiceModels getMSModelData(String name, String version) { - MicroServiceModels workingModel = null; - try{ - List<Object> microServiceModelsData = commonClassDao.getDataById(MicroServiceModels.class, "modelName:version", name+":"+version); - if(microServiceModelsData != null){ - workingModel = (MicroServiceModels) microServiceModelsData.get(0); - } - }catch(Exception e){ - String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Template. The template name, " + } + } + } + + if(ACTION_POLICY.equalsIgnoreCase(policyData.getPolicyType())){ + if(!Strings.isNullOrEmpty(policyData.getActionPerformer())){ + String actionPerformer = PolicyUtils.policySpecialCharValidator(policyData.getActionPerformer()); + if(!actionPerformer.contains(SUCCESS)){ + responseString.append("<b>ActionPerformer</b>:<i>" + actionPerformer + HTML_ITALICS_LNBREAK); + valid = false; + } + }else{ + responseString.append("<b>ActionPerformer</b>:<i> ActionPerformer Should not be empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(!Strings.isNullOrEmpty(policyData.getActionAttributeValue())){ + String actionAttribute = PolicyUtils.policySpecialCharValidator(policyData.getActionAttributeValue()); + if(!actionAttribute.contains(SUCCESS)){ + responseString.append("<b>ActionAttribute</b>:<i>" + actionAttribute + HTML_ITALICS_LNBREAK); + valid = false; + } + }else{ + responseString.append("<b>ActionAttribute</b>:<i> ActionAttribute Should not be empty" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + if(CONFIG_POLICY.equals(policyData.getPolicyType())){ + String value = ""; + if(valid){ + if(commonClassDao!=null){ + List<Object> spData = commonClassDao.getDataById(SafePolicyWarning.class, "riskType", policyData.getRiskType()); + if (!spData.isEmpty()){ + SafePolicyWarning safePolicyWarningData = (SafePolicyWarning) spData.get(0); + value = "<b>Message</b>:<i>" + safePolicyWarningData.getMessage() +"</i>"; + } + } + responseString.append(SUCCESS + "@#"+ value); + } + }else{ + if(valid){ + responseString.append(SUCCESS); + } + } + + return responseString; + } + catch (Exception e){ + LOGGER.error("Exception Occured during Policy Validation" +e); + return null; + } + } + + protected String emailValidation(String email, String response){ + String res = response; + if(email != null){ + String validateEmail = PolicyUtils.validateEmailAddress(email.replace("\"", "")); + if(!validateEmail.contains(SUCCESS)){ + res += "<b>Email</b>:<i>" + validateEmail + HTML_ITALICS_LNBREAK; + } + else { + return SUCCESS; + } + } + return res; + } + + private MicroServiceModels getMSModelData(String name, String version) { + MicroServiceModels workingModel = null; + try{ + List<Object> microServiceModelsData = commonClassDao.getDataById(MicroServiceModels.class, "modelName:version", name+":"+version); + if(microServiceModelsData != null){ + workingModel = (MicroServiceModels) microServiceModelsData.get(0); + } + }catch(Exception e){ + String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Template. The template name, " + name + " was not found in the dictionary: "; - LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + message + e); - return null; - } - - return workingModel; - } - - private OptimizationModels getOptimizationModelData(String name, String version) { - OptimizationModels workingModel = null; - try{ - List<Object> optimizationModelsData = commonClassDao.getDataById(OptimizationModels.class, "modelName:version", name+":"+version); - if(optimizationModelsData != null){ - workingModel = (OptimizationModels) optimizationModelsData.get(0); - } - }catch(Exception e){ - String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Template. The template name, " + LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + message + e); + return null; + } + + return workingModel; + } + + private OptimizationModels getOptimizationModelData(String name, String version) { + OptimizationModels workingModel = null; + try{ + List<Object> optimizationModelsData = commonClassDao.getDataById(OptimizationModels.class, "modelName:version", name+":"+version); + if(optimizationModelsData != null){ + workingModel = (OptimizationModels) optimizationModelsData.get(0); + } + }catch(Exception e){ + String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Template. The template name, " + name + " was not found in the dictionary: "; - LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + message + e); - return null; - } - - return workingModel; - } - - private void pullJsonKeyPairs(JsonNode rootNode) { - Iterator<Map.Entry<String, JsonNode>> fieldsIterator = rootNode.fields(); - - while (fieldsIterator.hasNext()) { - Map.Entry<String, JsonNode> field = fieldsIterator.next(); - final String key = field.getKey(); - final JsonNode value = field.getValue(); - if (value.isContainerNode() && !value.isArray()) { - pullJsonKeyPairs(value); // RECURSIVE CALL - } else { - if (value.isArray()){ - String newValue = StringUtils.replaceEach(value.toString(), new String[]{"[", "]", "\""}, new String[]{"", "", ""}); - mapAttribute.put(key, newValue); - }else { - mapAttribute.put(key, value.toString().trim()); - } - } - } - } - - private void pullModelJsonKeyPairs(JsonNode rootNode) { - Iterator<Map.Entry<String, JsonNode>> fieldsIterator = rootNode.fields(); - - while (fieldsIterator.hasNext()) { - Map.Entry<String, JsonNode> field = fieldsIterator.next(); - final String key = field.getKey(); - final JsonNode value = field.getValue(); - - if (value.isContainerNode() && !value.isArray()) { - jsonRequestMap.put(key, "containerNode"); - pullModelJsonKeyPairs(value); // RECURSIVE CALL - } else if (value.isArray()) { - try { - jsonRequestMap.put(key, "array"); - String stringValue = StringUtils.replaceEach(value.toString(), new String[]{"[", "]"}, new String[]{"",""}); - ObjectMapper mapper = new ObjectMapper(); - JsonNode newValue = mapper.readTree(stringValue); - pullModelJsonKeyPairs(newValue); - } catch (IOException e) { - LOGGER.info("PolicyValidation: Exception occurred while mapping string to JsonNode " + e); - } - } else { - jsonRequestMap.put(key, value.toString().trim()); - } - } - } - + LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + message + e); + return null; + } + + return workingModel; + } + + private void pullJsonKeyPairs(JsonNode rootNode) { + Iterator<Map.Entry<String, JsonNode>> fieldsIterator = rootNode.fields(); + + while (fieldsIterator.hasNext()) { + Map.Entry<String, JsonNode> field = fieldsIterator.next(); + final String key = field.getKey(); + final JsonNode value = field.getValue(); + if (value.isContainerNode() && !value.isArray()) { + pullJsonKeyPairs(value); // RECURSIVE CALL + } else { + if (value.isArray()){ + String newValue = StringUtils.replaceEach(value.toString(), new String[]{"[", "]", "\""}, new String[]{"", "", ""}); + mapAttribute.put(key, newValue); + }else { + mapAttribute.put(key, value.toString().trim()); + } + } + } + } + + private void pullModelJsonKeyPairs(JsonNode rootNode) { + Iterator<Map.Entry<String, JsonNode>> fieldsIterator = rootNode.fields(); + + while (fieldsIterator.hasNext()) { + Map.Entry<String, JsonNode> field = fieldsIterator.next(); + final String key = field.getKey(); + final JsonNode value = field.getValue(); + + if (value.isContainerNode() && !value.isArray()) { + jsonRequestMap.put(key, "containerNode"); + pullModelJsonKeyPairs(value); // RECURSIVE CALL + } else if (value.isArray()) { + try { + jsonRequestMap.put(key, "array"); + String stringValue = StringUtils.replaceEach(value.toString(), new String[]{"[", "]"}, new String[]{"",""}); + ObjectMapper mapper = new ObjectMapper(); + JsonNode newValue = mapper.readTree(stringValue); + pullModelJsonKeyPairs(newValue); + } catch (IOException e) { + LOGGER.info("PolicyValidation: Exception occurred while mapping string to JsonNode " + e); + } + } else { + jsonRequestMap.put(key, value.toString().trim()); + } + } + } + private JsonObject stringToJsonObject(String value) { - try(JsonReader jsonReader = Json.createReader(new StringReader(value))){ + try(JsonReader jsonReader = Json.createReader(new StringReader(value))){ return jsonReader.readObject(); } catch(JsonException| IllegalStateException e){ LOGGER.info(XACMLErrorConstants.ERROR_DATA_ISSUE+ "Improper JSON format... may or may not cause issues in validating the policy: " + value, e); @@ -1119,22 +1119,22 @@ public class PolicyValidation { private void findRequiredFields(JsonObject json) { - for(Entry<String, JsonValue> keyMap : json.entrySet()){ - Object obj = keyMap.getValue(); - if(obj instanceof JsonObject){ - JsonObject jsonObj = (JsonObject)obj; - for(Entry<String, JsonValue> jsonMap : jsonObj.entrySet()){ - if(jsonMap.getValue().toString().contains("required-true")){ - modelRequiredFieldsList.add(jsonMap.getKey()); - } - } - } else { - if(keyMap.getValue().toString().contains("required-true")){ - modelRequiredFieldsList.add(keyMap.getKey()); - } - } - } - + for(Entry<String, JsonValue> keyMap : json.entrySet()){ + Object obj = keyMap.getValue(); + if(obj instanceof JsonObject){ + JsonObject jsonObj = (JsonObject)obj; + for(Entry<String, JsonValue> jsonMap : jsonObj.entrySet()){ + if(jsonMap.getValue().toString().contains("required-true")){ + modelRequiredFieldsList.add(jsonMap.getKey()); + } + } + } else { + if(keyMap.getValue().toString().contains("required-true")){ + modelRequiredFieldsList.add(keyMap.getKey()); + } + } + } + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java index c80e5bb3b..66628e2da 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java @@ -49,411 +49,411 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Strings; public class PolicyValidationRequestWrapper { - - private static final Logger LOGGER = FlexLogger.getLogger(PolicyValidationRequestWrapper.class); - public static final String CONFIG_NAME="configName"; - public static final String INVALIDJSON = " improper JSON format: "; - public static final String ONAPNAME = "onapname"; - public static final String CONTENT = "content"; - public static final String GUARD = "guard"; - public static final String LOCATION = "location"; - public static final String POLICYSCOPE = "policyScope"; - public static final String PRIORITY = "priority"; - public static final String RISKLEVEL = "riskLevel"; - public static final String RISKTYPE = "riskType"; - public static final String SERVICE = "service"; - public static final String VERSION = "version"; - - public static final String SERVICETYPE_POLICY_NAME = "serviceTypePolicyName"; - - public PolicyRestAdapter populateRequestParameters(HttpServletRequest request) { - - PolicyRestAdapter policyData = null; - ClosedLoopFaultTrapDatas trapDatas = null; - ClosedLoopFaultTrapDatas faultDatas = null; - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - JsonNode root = mapper.readTree(request.getReader()); - policyData = mapper.readValue(root.get("policyData").toString(), PolicyRestAdapter.class); - if(root.get("trapData") != null){ - trapDatas = mapper.readValue(root.get("trapData").toString(), ClosedLoopFaultTrapDatas.class); - policyData.setTrapDatas(trapDatas); - } - if(root.get("faultData") != null){ - faultDatas = mapper.readValue(root.get("faultData").toString(), ClosedLoopFaultTrapDatas.class); - policyData.setFaultDatas(faultDatas); - } - - JsonObject json; - json = stringToJsonObject(root.toString()); - - if(json != null){ - if(json.containsKey("policyJSON")){ - policyData.setPolicyJSON(root.get("policyJSON")); - }else{ - String jsonBodyData = json.getJsonObject("policyData").get("jsonBodyData").toString(); - policyData.setJsonBody(jsonBodyData); - } - } - - } catch (Exception e) { - LOGGER.error("Exception Occured while populating request parameters: " +e); - } - - return policyData; - } - - public PolicyRestAdapter populateRequestParameters(PolicyParameters parameters) { - - PolicyRestAdapter policyData = new PolicyRestAdapter(); + + private static final Logger LOGGER = FlexLogger.getLogger(PolicyValidationRequestWrapper.class); + public static final String CONFIG_NAME="configName"; + public static final String INVALIDJSON = " improper JSON format: "; + public static final String ONAPNAME = "onapname"; + public static final String CONTENT = "content"; + public static final String GUARD = "guard"; + public static final String LOCATION = "location"; + public static final String POLICYSCOPE = "policyScope"; + public static final String PRIORITY = "priority"; + public static final String RISKLEVEL = "riskLevel"; + public static final String RISKTYPE = "riskType"; + public static final String SERVICE = "service"; + public static final String VERSION = "version"; + + public static final String SERVICETYPE_POLICY_NAME = "serviceTypePolicyName"; + + public PolicyRestAdapter populateRequestParameters(HttpServletRequest request) { + + PolicyRestAdapter policyData = null; + ClosedLoopFaultTrapDatas trapDatas = null; + ClosedLoopFaultTrapDatas faultDatas = null; + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + policyData = mapper.readValue(root.get("policyData").toString(), PolicyRestAdapter.class); + if(root.get("trapData") != null){ + trapDatas = mapper.readValue(root.get("trapData").toString(), ClosedLoopFaultTrapDatas.class); + policyData.setTrapDatas(trapDatas); + } + if(root.get("faultData") != null){ + faultDatas = mapper.readValue(root.get("faultData").toString(), ClosedLoopFaultTrapDatas.class); + policyData.setFaultDatas(faultDatas); + } + + JsonObject json; + json = stringToJsonObject(root.toString()); + + if(json != null){ + if(json.containsKey("policyJSON")){ + policyData.setPolicyJSON(root.get("policyJSON")); + }else{ + String jsonBodyData = json.getJsonObject("policyData").get("jsonBodyData").toString(); + policyData.setJsonBody(jsonBodyData); + } + } + + } catch (Exception e) { + LOGGER.error("Exception Occured while populating request parameters: " +e); + } + + return policyData; + } + + public PolicyRestAdapter populateRequestParameters(PolicyParameters parameters) { + + PolicyRestAdapter policyData = new PolicyRestAdapter(); - /* - * set policy adapter values for Building JSON object containing policy data - */ - //Common Policy Fields - policyData.setPolicyName(parameters.getPolicyName()); - policyData.setOnapName(parameters.getOnapName()); - policyData.setPriority(parameters.getPriority()); //Micro Service - policyData.setConfigName(parameters.getConfigName()); //Base and Firewall - policyData.setRiskType(parameters.getRiskType()); //Safe parameters Attributes - policyData.setRiskLevel(parameters.getRiskLevel());//Safe parameters Attributes - policyData.setGuard(String.valueOf(parameters.getGuard()));//Safe parameters Attributes - policyData.setTtlDate(convertDate(parameters.getTtlDate()));//Safe parameters Attributes - policyData.setApiflag("API"); - - //Some policies require jsonObject conversion from String for configBody (i.e. MicroService and Firewall) - JsonObject json = null; + /* + * set policy adapter values for Building JSON object containing policy data + */ + //Common Policy Fields + policyData.setPolicyName(parameters.getPolicyName()); + policyData.setOnapName(parameters.getOnapName()); + policyData.setPriority(parameters.getPriority()); //Micro Service + policyData.setConfigName(parameters.getConfigName()); //Base and Firewall + policyData.setRiskType(parameters.getRiskType()); //Safe parameters Attributes + policyData.setRiskLevel(parameters.getRiskLevel());//Safe parameters Attributes + policyData.setGuard(String.valueOf(parameters.getGuard()));//Safe parameters Attributes + policyData.setTtlDate(convertDate(parameters.getTtlDate()));//Safe parameters Attributes + policyData.setApiflag("API"); + + //Some policies require jsonObject conversion from String for configBody (i.e. MicroService and Firewall) + JsonObject json = null; try{ - if(parameters.getConfigBody()!= null){ - json = stringToJsonObject(parameters.getConfigBody()); - } + if(parameters.getConfigBody()!= null){ + json = stringToJsonObject(parameters.getConfigBody()); + } } catch(JsonException| IllegalStateException e){ String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ INVALIDJSON + parameters.getConfigBody(); LOGGER.error(message, e); return null; } - if(parameters.getPolicyClass()!=null && !"Config".equals(parameters.getPolicyClass().toString())){ - - policyData.setPolicyType(parameters.getPolicyClass().toString()); - - //Get Matching attribute values - Map<AttributeType, Map<String, String>> attributes = parameters.getAttributes(); - Map<String, String> matching = null; - if(attributes != null){ - matching = attributes.get(AttributeType.MATCHING); - } - - if("Decision".equals(parameters.getPolicyClass().toString())){ - - String ruleProvider = parameters.getRuleProvider().toString(); - policyData.setRuleProvider(ruleProvider); - - if("Rainy_Day".equals(ruleProvider)){ - - // Set Matching attributes in RainyDayParams in adapter - RainyDayParams rainyday = new RainyDayParams(); - - if(matching != null) { - rainyday.setServiceType(matching.get("ServiceType")); - rainyday.setVnfType(matching.get("VNFType")); - rainyday.setBbid(matching.get("BB_ID")); - rainyday.setWorkstep(matching.get("WorkStep")); - } - - Map<String, String> treatments = parameters.getTreatments(); - ArrayList<Object> treatmentsTableChoices = new ArrayList<>(); - - for (String keyField : treatments.keySet()) { - LinkedHashMap<String, String> treatmentMap = new LinkedHashMap<>(); - String errorcode = keyField; - String treatment = treatments.get(errorcode); - treatmentMap.put("errorcode", errorcode); - treatmentMap.put("treatment", treatment); - treatmentsTableChoices.add(treatmentMap); - } - rainyday.setTreatmentTableChoices(treatmentsTableChoices); - policyData.setRainyday(rainyday); - - }else if("GUARD_YAML".equals(ruleProvider) || "GUARD_BL_YAML".equals(ruleProvider)) { - - // Set Matching attributes in YAMLParams in adapter - YAMLParams yamlparams = new YAMLParams(); - - if (matching != null) { - yamlparams.setActor(matching.get("actor")); - yamlparams.setRecipe(matching.get("recipe")); - yamlparams.setGuardActiveStart(matching.get("guardActiveStart")); - yamlparams.setGuardActiveEnd(matching.get("guardActiveEnd")); - - if("GUARD_YAML".equals(ruleProvider)){ - yamlparams.setLimit(matching.get("limit")); - yamlparams.setTimeWindow(matching.get("timeWindow")); - yamlparams.setTimeUnits(matching.get("timeUnits")); - }else{ - - List<String> blackList = new ArrayList<>(); - - if(!Strings.isNullOrEmpty(matching.get("blackList"))){ - String[] blackListArray = matching.get("blackList").split(","); - for(String element : blackListArray){ - blackList.add(element); - } - } - - yamlparams.setBlackList(blackList); - - } - } - policyData.setYamlparams(yamlparams); - } - - } else if("Action".equals(parameters.getPolicyClass().toString())){ - - ArrayList<Object> ruleAlgorithmChoices = new ArrayList<>(); - - List<String> dynamicLabelRuleAlgorithms = parameters.getDynamicRuleAlgorithmLabels(); - List<String> dynamicFieldFunctionRuleAlgorithms = parameters.getDynamicRuleAlgorithmFunctions(); - List<String> dynamicFieldOneRuleAlgorithms = parameters.getDynamicRuleAlgorithmField1(); - List<String> dyrnamicFieldTwoRuleAlgorithms = parameters.getDynamicRuleAlgorithmField2(); - - if (dynamicLabelRuleAlgorithms != null && !dynamicLabelRuleAlgorithms.isEmpty()) { - int i = dynamicLabelRuleAlgorithms.size() - 1; - - for (String labelAttr : dynamicLabelRuleAlgorithms) { - LinkedHashMap<String, String> ruleAlgorithm = new LinkedHashMap<>(); - - String id = dynamicLabelRuleAlgorithms.get(i); - String dynamicRuleAlgorithmField1 = dynamicFieldOneRuleAlgorithms.get(i); - String dynamicRuleAlgorithmCombo = dynamicFieldFunctionRuleAlgorithms.get(i); - String dynamicRuleAlgorithmField2 = dyrnamicFieldTwoRuleAlgorithms.get(i); - - ruleAlgorithm.put("id", id); - ruleAlgorithm.put("dynamicRuleAlgorithmField1", dynamicRuleAlgorithmField1); - ruleAlgorithm.put("dynamicRuleAlgorithmCombo", dynamicRuleAlgorithmCombo); - ruleAlgorithm.put("dynamicRuleAlgorithmField2", dynamicRuleAlgorithmField2); - - ruleAlgorithmChoices.add(ruleAlgorithm); - - i--; - - } - } - - policyData.setRuleAlgorithmschoices(ruleAlgorithmChoices); - - ArrayList<Object> attributeList = new ArrayList<>(); - if (matching != null) { - for (Map.Entry<String, String> entry : matching.entrySet()) { - LinkedHashMap<String, String> attributeMap = new LinkedHashMap<>(); - String key = entry.getKey(); - String value = entry.getValue(); - attributeMap.put("key", key); - attributeMap.put("value", value); - attributeList.add(attributeMap); - } - } - - policyData.setAttributes(attributeList); - policyData.setActionAttributeValue(parameters.getActionAttribute()); - policyData.setActionPerformer(parameters.getActionPerformer()); - - } - }else { - - policyData.setPolicyType("Config"); - policyData.setConfigPolicyType(parameters.getPolicyConfigType().toString()); - - //Config Specific - policyData.setConfigBodyData(parameters.getConfigBody()); //Base - policyData.setConfigType((parameters.getConfigBodyType()!=null) ? parameters.getConfigBodyType().toString().toUpperCase(): null); //Base - - if("FW".equalsIgnoreCase(parameters.getPolicyConfigType().toString())){ - - policyData.setConfigPolicyType("Firewall Config"); - - // get values and attributes from the JsonObject - if(json != null){ - if (json.get("securityZoneId")!=null){ - String securityZone = json.get("securityZoneId").toString().replace("\"", ""); - policyData.setSecurityZone(securityZone); - } - if (json.get(CONFIG_NAME)!=null){ - String configName = json.get(CONFIG_NAME).toString().replace("\"", ""); - policyData.setConfigName(configName); - } - } - - }else if("MS".equals(parameters.getPolicyConfigType().toString())){ - - policyData.setConfigPolicyType("Micro Service"); - - // get values and attributes from the JsonObject - if(json != null){ - if (json.containsKey(CONTENT)){ - String content = json.get(CONTENT).toString(); - ObjectMapper mapper = new ObjectMapper(); - JsonNode policyJSON = null; - try { - policyJSON = mapper.readTree(content); - } catch (IOException e) { - String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ INVALIDJSON + parameters.getConfigBody(); - LOGGER.error(message, e); - return null; - } - policyData.setPolicyJSON(policyJSON); - } - if (json.containsKey(SERVICE)){ - String serviceType = json.get(SERVICE).toString().replace("\"", ""); - policyData.setServiceType(serviceType); - } - if (json.containsKey("uuid")){ - String uuid = json.get("uuid").toString().replace("\"", ""); - policyData.setUuid(uuid); - } - if (json.containsKey(LOCATION)){ - String msLocation = json.get(LOCATION).toString().replace("\"", ""); - policyData.setLocation(msLocation); - } - if (json.containsKey(CONFIG_NAME)){ - String configName = json.get(CONFIG_NAME).toString().replace("\"", ""); - policyData.setConfigName(configName); - } - if(json.containsKey(PRIORITY)){ - String priority = json.get(PRIORITY).toString().replace("\"", ""); - policyData.setPriority(priority); - } - if(json.containsKey(VERSION)){ - String version = json.get(VERSION).toString().replace("\"", ""); - policyData.setVersion(version); - } - if(json.containsKey(POLICYSCOPE)){ - String policyScope = json.get(POLICYSCOPE).toString().replace("\"", ""); - policyData.setPolicyScope(policyScope); - } - if(json.containsKey(RISKTYPE)){ - String riskType = json.get(RISKTYPE).toString().replace("\"", ""); - policyData.setRiskType(riskType); - } - if(json.containsKey(RISKLEVEL)){ - String riskLevel = json.get(RISKLEVEL).toString().replace("\"", ""); - policyData.setRiskLevel(riskLevel); - } - if(json.containsKey(GUARD)){ - String guard = json.get(GUARD).toString().replace("\"", ""); - policyData.setGuard(guard); - } - } else { - String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ INVALIDJSON + parameters.getConfigBody(); - LOGGER.error(message); - return null; - } - - }else if("Optimization".equals(parameters.getPolicyConfigType().toString())){ - - policyData.setConfigPolicyType("Optimization"); - - // get values and attributes from the JsonObject - if(json != null){ - if (json.containsKey(CONTENT)){ - String content = json.get(CONTENT).toString(); - ObjectMapper mapper = new ObjectMapper(); - JsonNode policyJSON = null; - try { - policyJSON = mapper.readTree(content); - } catch (IOException e) { - String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ INVALIDJSON + parameters.getConfigBody(); - LOGGER.error(message, e); - return null; - } - policyData.setPolicyJSON(policyJSON); - } - if (json.containsKey(SERVICE)){ - String serviceType = json.get(SERVICE).toString().replace("\"", ""); - policyData.setServiceType(serviceType); - } - if (json.containsKey("uuid")){ - String uuid = json.get("uuid").toString().replace("\"", ""); - policyData.setUuid(uuid); - } - if (json.containsKey(LOCATION)){ - String msLocation = json.get(LOCATION).toString().replace("\"", ""); - policyData.setLocation(msLocation); - } - if (json.containsKey(CONFIG_NAME)){ - String configName = json.get(CONFIG_NAME).toString().replace("\"", ""); - policyData.setConfigName(configName); - } - if(json.containsKey(PRIORITY)){ - String priority = json.get(PRIORITY).toString().replace("\"", ""); - policyData.setPriority(priority); - } - if(json.containsKey(VERSION)){ - String version = json.get(VERSION).toString().replace("\"", ""); - policyData.setVersion(version); - } - if(json.containsKey(POLICYSCOPE)){ - String policyScope = json.get(POLICYSCOPE).toString().replace("\"", ""); - policyData.setPolicyScope(policyScope); - } - if(json.containsKey(RISKTYPE)){ - String riskType = json.get(RISKTYPE).toString().replace("\"", ""); - policyData.setRiskType(riskType); - } - if(json.containsKey(RISKLEVEL)){ - String riskLevel = json.get(RISKLEVEL).toString().replace("\"", ""); - policyData.setRiskLevel(riskLevel); - } - if(json.containsKey(GUARD)){ - String guard = json.get(GUARD).toString().replace("\"", ""); - policyData.setGuard(guard); - } - } - - } else if("Fault".equals(parameters.getPolicyConfigType().toString())){ - - policyData.setConfigPolicyType("ClosedLoop_Fault"); - - if(json != null){ - policyData.setJsonBody(json.toString()); - if (json.get(ONAPNAME)!=null){ - String onapName = json.get(ONAPNAME).toString().replace("\"", ""); - policyData.setOnapName(onapName); - } - } - - } else if("PM".equals(parameters.getPolicyConfigType().toString())){ - - policyData.setConfigPolicyType("ClosedLoop_PM"); - - if(json != null){ - policyData.setJsonBody(json.toString()); - if (json.get(ONAPNAME)!=null){ - String onapName = json.get(ONAPNAME).toString().replace("\"", ""); - policyData.setOnapName(onapName); - } - if (json.get(SERVICETYPE_POLICY_NAME)!=null){ - String serviceType = json.get(SERVICETYPE_POLICY_NAME).toString().replace("\"", ""); - LinkedHashMap<String, String> serviceTypePolicyName = new LinkedHashMap<>(); - serviceTypePolicyName.put(SERVICETYPE_POLICY_NAME, serviceType); - policyData.setServiceTypePolicyName(serviceTypePolicyName); - } - } - } else if("BRMS_Param".equals(parameters.getPolicyConfigType().toString())){ - Map<AttributeType, Map<String, String>> drlRuleAndUIParams = parameters.getAttributes(); - Map<String, String> rule = drlRuleAndUIParams.get(AttributeType.RULE); - policyData.setRuleName(rule.get("templateName")); - - } - } - - return policyData; - - } + if(parameters.getPolicyClass()!=null && !"Config".equals(parameters.getPolicyClass().toString())){ + + policyData.setPolicyType(parameters.getPolicyClass().toString()); + + //Get Matching attribute values + Map<AttributeType, Map<String, String>> attributes = parameters.getAttributes(); + Map<String, String> matching = null; + if(attributes != null){ + matching = attributes.get(AttributeType.MATCHING); + } + + if("Decision".equals(parameters.getPolicyClass().toString())){ + + String ruleProvider = parameters.getRuleProvider().toString(); + policyData.setRuleProvider(ruleProvider); + + if("Rainy_Day".equals(ruleProvider)){ + + // Set Matching attributes in RainyDayParams in adapter + RainyDayParams rainyday = new RainyDayParams(); + + if(matching != null) { + rainyday.setServiceType(matching.get("ServiceType")); + rainyday.setVnfType(matching.get("VNFType")); + rainyday.setBbid(matching.get("BB_ID")); + rainyday.setWorkstep(matching.get("WorkStep")); + } + + Map<String, String> treatments = parameters.getTreatments(); + ArrayList<Object> treatmentsTableChoices = new ArrayList<>(); + + for (String keyField : treatments.keySet()) { + LinkedHashMap<String, String> treatmentMap = new LinkedHashMap<>(); + String errorcode = keyField; + String treatment = treatments.get(errorcode); + treatmentMap.put("errorcode", errorcode); + treatmentMap.put("treatment", treatment); + treatmentsTableChoices.add(treatmentMap); + } + rainyday.setTreatmentTableChoices(treatmentsTableChoices); + policyData.setRainyday(rainyday); + + }else if("GUARD_YAML".equals(ruleProvider) || "GUARD_BL_YAML".equals(ruleProvider)) { + + // Set Matching attributes in YAMLParams in adapter + YAMLParams yamlparams = new YAMLParams(); + + if (matching != null) { + yamlparams.setActor(matching.get("actor")); + yamlparams.setRecipe(matching.get("recipe")); + yamlparams.setGuardActiveStart(matching.get("guardActiveStart")); + yamlparams.setGuardActiveEnd(matching.get("guardActiveEnd")); + + if("GUARD_YAML".equals(ruleProvider)){ + yamlparams.setLimit(matching.get("limit")); + yamlparams.setTimeWindow(matching.get("timeWindow")); + yamlparams.setTimeUnits(matching.get("timeUnits")); + }else{ + + List<String> blackList = new ArrayList<>(); + + if(!Strings.isNullOrEmpty(matching.get("blackList"))){ + String[] blackListArray = matching.get("blackList").split(","); + for(String element : blackListArray){ + blackList.add(element); + } + } + + yamlparams.setBlackList(blackList); + + } + } + policyData.setYamlparams(yamlparams); + } + + } else if("Action".equals(parameters.getPolicyClass().toString())){ + + ArrayList<Object> ruleAlgorithmChoices = new ArrayList<>(); + + List<String> dynamicLabelRuleAlgorithms = parameters.getDynamicRuleAlgorithmLabels(); + List<String> dynamicFieldFunctionRuleAlgorithms = parameters.getDynamicRuleAlgorithmFunctions(); + List<String> dynamicFieldOneRuleAlgorithms = parameters.getDynamicRuleAlgorithmField1(); + List<String> dyrnamicFieldTwoRuleAlgorithms = parameters.getDynamicRuleAlgorithmField2(); + + if (dynamicLabelRuleAlgorithms != null && !dynamicLabelRuleAlgorithms.isEmpty()) { + int i = dynamicLabelRuleAlgorithms.size() - 1; + + for (String labelAttr : dynamicLabelRuleAlgorithms) { + LinkedHashMap<String, String> ruleAlgorithm = new LinkedHashMap<>(); + + String id = dynamicLabelRuleAlgorithms.get(i); + String dynamicRuleAlgorithmField1 = dynamicFieldOneRuleAlgorithms.get(i); + String dynamicRuleAlgorithmCombo = dynamicFieldFunctionRuleAlgorithms.get(i); + String dynamicRuleAlgorithmField2 = dyrnamicFieldTwoRuleAlgorithms.get(i); + + ruleAlgorithm.put("id", id); + ruleAlgorithm.put("dynamicRuleAlgorithmField1", dynamicRuleAlgorithmField1); + ruleAlgorithm.put("dynamicRuleAlgorithmCombo", dynamicRuleAlgorithmCombo); + ruleAlgorithm.put("dynamicRuleAlgorithmField2", dynamicRuleAlgorithmField2); + + ruleAlgorithmChoices.add(ruleAlgorithm); + + i--; + + } + } + + policyData.setRuleAlgorithmschoices(ruleAlgorithmChoices); + + ArrayList<Object> attributeList = new ArrayList<>(); + if (matching != null) { + for (Map.Entry<String, String> entry : matching.entrySet()) { + LinkedHashMap<String, String> attributeMap = new LinkedHashMap<>(); + String key = entry.getKey(); + String value = entry.getValue(); + attributeMap.put("key", key); + attributeMap.put("value", value); + attributeList.add(attributeMap); + } + } + + policyData.setAttributes(attributeList); + policyData.setActionAttributeValue(parameters.getActionAttribute()); + policyData.setActionPerformer(parameters.getActionPerformer()); + + } + }else { + + policyData.setPolicyType("Config"); + policyData.setConfigPolicyType(parameters.getPolicyConfigType().toString()); + + //Config Specific + policyData.setConfigBodyData(parameters.getConfigBody()); //Base + policyData.setConfigType((parameters.getConfigBodyType()!=null) ? parameters.getConfigBodyType().toString().toUpperCase(): null); //Base + + if("FW".equalsIgnoreCase(parameters.getPolicyConfigType().toString())){ + + policyData.setConfigPolicyType("Firewall Config"); + + // get values and attributes from the JsonObject + if(json != null){ + if (json.get("securityZoneId")!=null){ + String securityZone = json.get("securityZoneId").toString().replace("\"", ""); + policyData.setSecurityZone(securityZone); + } + if (json.get(CONFIG_NAME)!=null){ + String configName = json.get(CONFIG_NAME).toString().replace("\"", ""); + policyData.setConfigName(configName); + } + } + + }else if("MS".equals(parameters.getPolicyConfigType().toString())){ + + policyData.setConfigPolicyType("Micro Service"); + + // get values and attributes from the JsonObject + if(json != null){ + if (json.containsKey(CONTENT)){ + String content = json.get(CONTENT).toString(); + ObjectMapper mapper = new ObjectMapper(); + JsonNode policyJSON = null; + try { + policyJSON = mapper.readTree(content); + } catch (IOException e) { + String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ INVALIDJSON + parameters.getConfigBody(); + LOGGER.error(message, e); + return null; + } + policyData.setPolicyJSON(policyJSON); + } + if (json.containsKey(SERVICE)){ + String serviceType = json.get(SERVICE).toString().replace("\"", ""); + policyData.setServiceType(serviceType); + } + if (json.containsKey("uuid")){ + String uuid = json.get("uuid").toString().replace("\"", ""); + policyData.setUuid(uuid); + } + if (json.containsKey(LOCATION)){ + String msLocation = json.get(LOCATION).toString().replace("\"", ""); + policyData.setLocation(msLocation); + } + if (json.containsKey(CONFIG_NAME)){ + String configName = json.get(CONFIG_NAME).toString().replace("\"", ""); + policyData.setConfigName(configName); + } + if(json.containsKey(PRIORITY)){ + String priority = json.get(PRIORITY).toString().replace("\"", ""); + policyData.setPriority(priority); + } + if(json.containsKey(VERSION)){ + String version = json.get(VERSION).toString().replace("\"", ""); + policyData.setVersion(version); + } + if(json.containsKey(POLICYSCOPE)){ + String policyScope = json.get(POLICYSCOPE).toString().replace("\"", ""); + policyData.setPolicyScope(policyScope); + } + if(json.containsKey(RISKTYPE)){ + String riskType = json.get(RISKTYPE).toString().replace("\"", ""); + policyData.setRiskType(riskType); + } + if(json.containsKey(RISKLEVEL)){ + String riskLevel = json.get(RISKLEVEL).toString().replace("\"", ""); + policyData.setRiskLevel(riskLevel); + } + if(json.containsKey(GUARD)){ + String guard = json.get(GUARD).toString().replace("\"", ""); + policyData.setGuard(guard); + } + } else { + String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ INVALIDJSON + parameters.getConfigBody(); + LOGGER.error(message); + return null; + } + + }else if("Optimization".equals(parameters.getPolicyConfigType().toString())){ + + policyData.setConfigPolicyType("Optimization"); + + // get values and attributes from the JsonObject + if(json != null){ + if (json.containsKey(CONTENT)){ + String content = json.get(CONTENT).toString(); + ObjectMapper mapper = new ObjectMapper(); + JsonNode policyJSON = null; + try { + policyJSON = mapper.readTree(content); + } catch (IOException e) { + String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ INVALIDJSON + parameters.getConfigBody(); + LOGGER.error(message, e); + return null; + } + policyData.setPolicyJSON(policyJSON); + } + if (json.containsKey(SERVICE)){ + String serviceType = json.get(SERVICE).toString().replace("\"", ""); + policyData.setServiceType(serviceType); + } + if (json.containsKey("uuid")){ + String uuid = json.get("uuid").toString().replace("\"", ""); + policyData.setUuid(uuid); + } + if (json.containsKey(LOCATION)){ + String msLocation = json.get(LOCATION).toString().replace("\"", ""); + policyData.setLocation(msLocation); + } + if (json.containsKey(CONFIG_NAME)){ + String configName = json.get(CONFIG_NAME).toString().replace("\"", ""); + policyData.setConfigName(configName); + } + if(json.containsKey(PRIORITY)){ + String priority = json.get(PRIORITY).toString().replace("\"", ""); + policyData.setPriority(priority); + } + if(json.containsKey(VERSION)){ + String version = json.get(VERSION).toString().replace("\"", ""); + policyData.setVersion(version); + } + if(json.containsKey(POLICYSCOPE)){ + String policyScope = json.get(POLICYSCOPE).toString().replace("\"", ""); + policyData.setPolicyScope(policyScope); + } + if(json.containsKey(RISKTYPE)){ + String riskType = json.get(RISKTYPE).toString().replace("\"", ""); + policyData.setRiskType(riskType); + } + if(json.containsKey(RISKLEVEL)){ + String riskLevel = json.get(RISKLEVEL).toString().replace("\"", ""); + policyData.setRiskLevel(riskLevel); + } + if(json.containsKey(GUARD)){ + String guard = json.get(GUARD).toString().replace("\"", ""); + policyData.setGuard(guard); + } + } + + } else if("Fault".equals(parameters.getPolicyConfigType().toString())){ + + policyData.setConfigPolicyType("ClosedLoop_Fault"); + + if(json != null){ + policyData.setJsonBody(json.toString()); + if (json.get(ONAPNAME)!=null){ + String onapName = json.get(ONAPNAME).toString().replace("\"", ""); + policyData.setOnapName(onapName); + } + } + + } else if("PM".equals(parameters.getPolicyConfigType().toString())){ + + policyData.setConfigPolicyType("ClosedLoop_PM"); + + if(json != null){ + policyData.setJsonBody(json.toString()); + if (json.get(ONAPNAME)!=null){ + String onapName = json.get(ONAPNAME).toString().replace("\"", ""); + policyData.setOnapName(onapName); + } + if (json.get(SERVICETYPE_POLICY_NAME)!=null){ + String serviceType = json.get(SERVICETYPE_POLICY_NAME).toString().replace("\"", ""); + LinkedHashMap<String, String> serviceTypePolicyName = new LinkedHashMap<>(); + serviceTypePolicyName.put(SERVICETYPE_POLICY_NAME, serviceType); + policyData.setServiceTypePolicyName(serviceTypePolicyName); + } + } + } else if("BRMS_Param".equals(parameters.getPolicyConfigType().toString())){ + Map<AttributeType, Map<String, String>> drlRuleAndUIParams = parameters.getAttributes(); + Map<String, String> rule = drlRuleAndUIParams.get(AttributeType.RULE); + policyData.setRuleName(rule.get("templateName")); + + } + } + + return policyData; + + } private JsonObject stringToJsonObject(String value) { - try(JsonReader jsonReader = Json.createReader(new StringReader(value))){ + try(JsonReader jsonReader = Json.createReader(new StringReader(value))){ return jsonReader.readObject(); } catch(JsonException| IllegalStateException e){ LOGGER.info(XACMLErrorConstants.ERROR_DATA_ISSUE+ "Improper JSON format... may or may not cause issues in validating the policy: " + value, e); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java index 9b4cc3ffb..5b8513823 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java @@ -47,65 +47,65 @@ import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletConfig; public class XACMLRestTest extends Mockito{ - private static Log logger = LogFactory.getLog(XACMLRestTest.class); - - private List<String> headers = new ArrayList<>(); - - private HttpServletRequest httpServletRequest; - private HttpServletResponse httpServletResponse; - private ServletOutputStream mockOutput; - private ServletConfig servletConfig; - - - @Before - public void setUp(){ - httpServletRequest = Mockito.mock(HttpServletRequest.class); - Mockito.when(httpServletRequest.getMethod()).thenReturn("POST"); - Mockito.when(httpServletRequest.getHeaderNames()).thenReturn(Collections.enumeration(headers)); - Mockito.when(httpServletRequest.getAttributeNames()).thenReturn(Collections.enumeration(headers)); - - mockOutput = Mockito.mock(ServletOutputStream.class); - - httpServletResponse = Mockito.mock(MockHttpServletResponse.class); - - try { - Mockito.when(httpServletResponse.getOutputStream()).thenReturn(mockOutput); - } catch (IOException e) { - fail(); - } - - servletConfig = Mockito.mock(MockServletConfig.class); - Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers)); - Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.pdp.properties"); - - System.setProperty("xacml.properties", "xacml.pdp.properties"); - System.setProperty("xacml.rest.pdp.config", "config_testing"); - System.setProperty("xacml.rest.pep.idfile", "testclient.properties"); - System.setProperty("xacml.rest.pdp.webapps", "/webapps"); - System.setProperty("xacml.rootPolicies", "test_PolicyEngine.xml"); - System.setProperty("xacml.referencedPolicies", "test_PolicyEngine.xml"); - System.setProperty("test_PolicyEngine.xml.file", "config_testing\\test_PolicyEngine.xml"); - System.setProperty("xacml.rest.pdp.register", "false"); - } - - @Test - public void testXacmlInit(){ - logger.info("XACMLRestTest - testInit"); - try { - XACMLRest.xacmlInit(servletConfig); - Logger.getRootLogger().setLevel(Level.DEBUG); - XACMLRest.dumpRequest(httpServletRequest); - XACMLRest.loadXacmlProperties(null, null); - } catch (Exception e) { - fail(); - } - } - - @Test - public void testConstructorIsPrivate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { - Constructor<XACMLRestProperties> constructor = XACMLRestProperties.class.getDeclaredConstructor(); - assertTrue(Modifier.isPrivate(constructor.getModifiers())); - constructor.setAccessible(true); - constructor.newInstance(); - } + private static Log logger = LogFactory.getLog(XACMLRestTest.class); + + private List<String> headers = new ArrayList<>(); + + private HttpServletRequest httpServletRequest; + private HttpServletResponse httpServletResponse; + private ServletOutputStream mockOutput; + private ServletConfig servletConfig; + + + @Before + public void setUp(){ + httpServletRequest = Mockito.mock(HttpServletRequest.class); + Mockito.when(httpServletRequest.getMethod()).thenReturn("POST"); + Mockito.when(httpServletRequest.getHeaderNames()).thenReturn(Collections.enumeration(headers)); + Mockito.when(httpServletRequest.getAttributeNames()).thenReturn(Collections.enumeration(headers)); + + mockOutput = Mockito.mock(ServletOutputStream.class); + + httpServletResponse = Mockito.mock(MockHttpServletResponse.class); + + try { + Mockito.when(httpServletResponse.getOutputStream()).thenReturn(mockOutput); + } catch (IOException e) { + fail(); + } + + servletConfig = Mockito.mock(MockServletConfig.class); + Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers)); + Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.pdp.properties"); + + System.setProperty("xacml.properties", "xacml.pdp.properties"); + System.setProperty("xacml.rest.pdp.config", "config_testing"); + System.setProperty("xacml.rest.pep.idfile", "testclient.properties"); + System.setProperty("xacml.rest.pdp.webapps", "/webapps"); + System.setProperty("xacml.rootPolicies", "test_PolicyEngine.xml"); + System.setProperty("xacml.referencedPolicies", "test_PolicyEngine.xml"); + System.setProperty("test_PolicyEngine.xml.file", "config_testing\\test_PolicyEngine.xml"); + System.setProperty("xacml.rest.pdp.register", "false"); + } + + @Test + public void testXacmlInit(){ + logger.info("XACMLRestTest - testInit"); + try { + XACMLRest.xacmlInit(servletConfig); + Logger.getRootLogger().setLevel(Level.DEBUG); + XACMLRest.dumpRequest(httpServletRequest); + XACMLRest.loadXacmlProperties(null, null); + } catch (Exception e) { + fail(); + } + } + + @Test + public void testConstructorIsPrivate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { + Constructor<XACMLRestProperties> constructor = XACMLRestProperties.class.getDeclaredConstructor(); + assertTrue(Modifier.isPrivate(constructor.getModifiers())); + constructor.setAccessible(true); + constructor.newInstance(); + } }
\ No newline at end of file diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/AutoPushTabAdapterTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/AutoPushTabAdapterTest.java index eb4784e29..b40b81778 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/AutoPushTabAdapterTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/AutoPushTabAdapterTest.java @@ -27,12 +27,12 @@ import org.junit.Test; public class AutoPushTabAdapterTest { - @Test - public void testAutoPushTabAdapter(){ - AutoPushTabAdapter adapter = new AutoPushTabAdapter(); - adapter.setPdpDatas(new ArrayList<>()); - assertTrue(adapter.getPdpDatas() != null); - adapter.setPolicyDatas(new ArrayList<>()); - assertTrue(adapter.getPolicyDatas() != null); - } + @Test + public void testAutoPushTabAdapter(){ + AutoPushTabAdapter adapter = new AutoPushTabAdapter(); + adapter.setPdpDatas(new ArrayList<>()); + assertTrue(adapter.getPdpDatas() != null); + adapter.setPolicyDatas(new ArrayList<>()); + assertTrue(adapter.getPolicyDatas() != null); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java index 085dde1b6..33efb19ed 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java @@ -30,139 +30,139 @@ import org.junit.Test; public class ClosedLoopPolicyAdaptersTest { - @Test - public void testClosedLoopFaultTrapDatas(){ - List<Object> trap = new ArrayList<>(); - trap.add("Test"); - ClosedLoopFaultTrapDatas closedLoopTrapData = new ClosedLoopFaultTrapDatas(); - closedLoopTrapData.setTrap1(trap); - assertTrue("Test".equals(closedLoopTrapData.getTrap1().get(0))); - closedLoopTrapData.setTrap2(trap); - assertTrue("Test".equals(closedLoopTrapData.getTrap2().get(0))); - closedLoopTrapData.setTrap3(trap); - assertTrue("Test".equals(closedLoopTrapData.getTrap3().get(0))); - closedLoopTrapData.setTrap4(trap); - assertTrue("Test".equals(closedLoopTrapData.getTrap4().get(0))); - closedLoopTrapData.setTrap5(trap); - assertTrue("Test".equals(closedLoopTrapData.getTrap5().get(0))); - closedLoopTrapData.setTrap6(trap); - assertTrue("Test".equals(closedLoopTrapData.getTrap6().get(0))); - - } - - @Test - public void testClosedLoopFaultBody(){ - ClosedLoopFaultBody faultBody = new ClosedLoopFaultBody(); - faultBody.setTrinity(true); - assertTrue(faultBody.isTrinity()); - faultBody.setvUSP(true); - assertTrue(faultBody.isvUSP()); - faultBody.setMcr(true); - assertTrue(faultBody.isMcr()); - faultBody.setGamma(true); - assertTrue(faultBody.isGamma()); - faultBody.setvDNS(true); - assertTrue(faultBody.isvDNS()); - faultBody.setVnfType("Test"); - assertTrue("Test".equals(faultBody.getVnfType())); - faultBody.setvServices("Test"); - assertTrue("Test".equals(faultBody.getvServices())); - faultBody.setONAPname("Test"); - assertTrue("Test".equals(faultBody.getONAPname())); - faultBody.setClosedLoopPolicyStatus("Active"); - assertTrue("Active".equals(faultBody.getClosedLoopPolicyStatus())); - - ClosedLoopSignatures triggerSignatures = new ClosedLoopSignatures(); - triggerSignatures.setSignatures("Test"); - triggerSignatures.setTimeWindow(1); - triggerSignatures.setTrapMaxAge(2); - assertTrue("Test".equals(triggerSignatures.getSignatures())); - assertTrue(1 == triggerSignatures.getTimeWindow()); - assertTrue(2 == triggerSignatures.getTrapMaxAge()); - - faultBody.setTriggerSignatures(triggerSignatures); - assertTrue(faultBody.getTriggerSignatures()!=null); - faultBody.setActions("Test"); - assertTrue("Test".equals(faultBody.getActions())); - faultBody.setTimeInterval(1); - assertTrue(1 == faultBody.getTimeInterval()); - faultBody.setTimeOutvPRO(2); - assertTrue(2 == faultBody.getTimeOutvPRO()); - faultBody.setTimeOutRuby(3); - assertTrue(3 == faultBody.getTimeOutRuby()); - faultBody.setRetrys(4); - assertTrue(4 == faultBody.getRetrys()); - faultBody.setAgingWindow(5); - assertTrue(5 == faultBody.getAgingWindow()); - faultBody.setGeoLink("Test"); - assertTrue("Test".equals(faultBody.getGeoLink())); - faultBody.setEmailAddress("test@test.com"); - assertTrue("test@test.com".equals(faultBody.getEmailAddress())); - faultBody.setVerificationSignatures(triggerSignatures); - assertTrue(faultBody.getVerificationSignatures()!=null); - - faultBody.setConditions(ClosedLoopPolicyConditions.SEND); - assertTrue(ClosedLoopPolicyConditions.SEND.equals(faultBody.getConditions())); - - faultBody.setConditions(ClosedLoopPolicyConditions.NOTSEND); - assertTrue(ClosedLoopPolicyConditions.NOTSEND.equals(faultBody.getConditions())); - - ClosedLoopFaultTriggerUISignatures uiSignatures = new ClosedLoopFaultTriggerUISignatures(); - uiSignatures.setConnectSignatures("Test"); - uiSignatures.setSignatures("Test"); - assertTrue("Test".equals(uiSignatures.getConnectSignatures())); - assertTrue("Test".equals(uiSignatures.getSignatures())); - - faultBody.setTriggerSignaturesUsedForUI(uiSignatures); - assertTrue(faultBody.getTriggerSignaturesUsedForUI()!=null); - faultBody.setVerificationSignaturesUsedForUI(uiSignatures); - assertTrue(faultBody.getVerificationSignaturesUsedForUI()!=null); - faultBody.setTriggerTimeWindowUsedForUI(1); - assertTrue(1 == faultBody.getTriggerTimeWindowUsedForUI()); - faultBody.setVerificationTimeWindowUsedForUI(2); - assertTrue(2 == faultBody.getVerificationTimeWindowUsedForUI()); - faultBody.setPepName("Test"); - assertTrue("Test".equals(faultBody.getPepName())); - faultBody.setPepAction("Test"); - assertTrue("Test".equals(faultBody.getPepAction())); - faultBody.setTemplateVersion("1802"); - assertTrue("1802".equals(faultBody.getTemplateVersion())); - faultBody.setTrapMaxAge(3); - assertTrue(3 == faultBody.getTrapMaxAge()); - } - - @Test - public void testClosedLoopPMBody(){ - ClosedLoopPMBody pmBody = new ClosedLoopPMBody(); - pmBody.setTrinity(true); - assertTrue(pmBody.isTrinity()); - pmBody.setvUSP(true); - assertTrue(pmBody.isvUSP()); - pmBody.setMcr(true); - assertTrue(pmBody.isMcr()); - pmBody.setGamma(true); - assertTrue(pmBody.isGamma()); - pmBody.setvDNS(true); - assertTrue(pmBody.isvDNS()); - pmBody.setvServices("Test"); - assertTrue("Test".equals(pmBody.getvServices())); - pmBody.setONAPname("Test"); - assertTrue("Test".equals(pmBody.getONAPname())); - pmBody.setEmailAddress("test@test.com"); - assertTrue("test@test.com".equals(pmBody.getEmailAddress())); - pmBody.setServiceTypePolicyName("Test"); - assertTrue("Test".equals(pmBody.getServiceTypePolicyName())); - pmBody.setTemplateVersion("1802"); - assertTrue("1802".equals(pmBody.getTemplateVersion())); - pmBody.setAttributes(new HashMap<String, String>()); - assertTrue(pmBody.getAttributes() != null); - pmBody.setGeoLink("Test"); - assertTrue("Test".equals(pmBody.getGeoLink())); - } - - @Test - public void testClosedLoopPolicyStatus() { - assertEquals(ClosedLoopPolicyStatus.ACTIVE.toString(), "active"); - assertEquals(ClosedLoopPolicyStatus.INACTIVE.toString(), "inactive"); - } + @Test + public void testClosedLoopFaultTrapDatas(){ + List<Object> trap = new ArrayList<>(); + trap.add("Test"); + ClosedLoopFaultTrapDatas closedLoopTrapData = new ClosedLoopFaultTrapDatas(); + closedLoopTrapData.setTrap1(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap1().get(0))); + closedLoopTrapData.setTrap2(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap2().get(0))); + closedLoopTrapData.setTrap3(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap3().get(0))); + closedLoopTrapData.setTrap4(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap4().get(0))); + closedLoopTrapData.setTrap5(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap5().get(0))); + closedLoopTrapData.setTrap6(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap6().get(0))); + + } + + @Test + public void testClosedLoopFaultBody(){ + ClosedLoopFaultBody faultBody = new ClosedLoopFaultBody(); + faultBody.setTrinity(true); + assertTrue(faultBody.isTrinity()); + faultBody.setvUSP(true); + assertTrue(faultBody.isvUSP()); + faultBody.setMcr(true); + assertTrue(faultBody.isMcr()); + faultBody.setGamma(true); + assertTrue(faultBody.isGamma()); + faultBody.setvDNS(true); + assertTrue(faultBody.isvDNS()); + faultBody.setVnfType("Test"); + assertTrue("Test".equals(faultBody.getVnfType())); + faultBody.setvServices("Test"); + assertTrue("Test".equals(faultBody.getvServices())); + faultBody.setONAPname("Test"); + assertTrue("Test".equals(faultBody.getONAPname())); + faultBody.setClosedLoopPolicyStatus("Active"); + assertTrue("Active".equals(faultBody.getClosedLoopPolicyStatus())); + + ClosedLoopSignatures triggerSignatures = new ClosedLoopSignatures(); + triggerSignatures.setSignatures("Test"); + triggerSignatures.setTimeWindow(1); + triggerSignatures.setTrapMaxAge(2); + assertTrue("Test".equals(triggerSignatures.getSignatures())); + assertTrue(1 == triggerSignatures.getTimeWindow()); + assertTrue(2 == triggerSignatures.getTrapMaxAge()); + + faultBody.setTriggerSignatures(triggerSignatures); + assertTrue(faultBody.getTriggerSignatures()!=null); + faultBody.setActions("Test"); + assertTrue("Test".equals(faultBody.getActions())); + faultBody.setTimeInterval(1); + assertTrue(1 == faultBody.getTimeInterval()); + faultBody.setTimeOutvPRO(2); + assertTrue(2 == faultBody.getTimeOutvPRO()); + faultBody.setTimeOutRuby(3); + assertTrue(3 == faultBody.getTimeOutRuby()); + faultBody.setRetrys(4); + assertTrue(4 == faultBody.getRetrys()); + faultBody.setAgingWindow(5); + assertTrue(5 == faultBody.getAgingWindow()); + faultBody.setGeoLink("Test"); + assertTrue("Test".equals(faultBody.getGeoLink())); + faultBody.setEmailAddress("test@test.com"); + assertTrue("test@test.com".equals(faultBody.getEmailAddress())); + faultBody.setVerificationSignatures(triggerSignatures); + assertTrue(faultBody.getVerificationSignatures()!=null); + + faultBody.setConditions(ClosedLoopPolicyConditions.SEND); + assertTrue(ClosedLoopPolicyConditions.SEND.equals(faultBody.getConditions())); + + faultBody.setConditions(ClosedLoopPolicyConditions.NOTSEND); + assertTrue(ClosedLoopPolicyConditions.NOTSEND.equals(faultBody.getConditions())); + + ClosedLoopFaultTriggerUISignatures uiSignatures = new ClosedLoopFaultTriggerUISignatures(); + uiSignatures.setConnectSignatures("Test"); + uiSignatures.setSignatures("Test"); + assertTrue("Test".equals(uiSignatures.getConnectSignatures())); + assertTrue("Test".equals(uiSignatures.getSignatures())); + + faultBody.setTriggerSignaturesUsedForUI(uiSignatures); + assertTrue(faultBody.getTriggerSignaturesUsedForUI()!=null); + faultBody.setVerificationSignaturesUsedForUI(uiSignatures); + assertTrue(faultBody.getVerificationSignaturesUsedForUI()!=null); + faultBody.setTriggerTimeWindowUsedForUI(1); + assertTrue(1 == faultBody.getTriggerTimeWindowUsedForUI()); + faultBody.setVerificationTimeWindowUsedForUI(2); + assertTrue(2 == faultBody.getVerificationTimeWindowUsedForUI()); + faultBody.setPepName("Test"); + assertTrue("Test".equals(faultBody.getPepName())); + faultBody.setPepAction("Test"); + assertTrue("Test".equals(faultBody.getPepAction())); + faultBody.setTemplateVersion("1802"); + assertTrue("1802".equals(faultBody.getTemplateVersion())); + faultBody.setTrapMaxAge(3); + assertTrue(3 == faultBody.getTrapMaxAge()); + } + + @Test + public void testClosedLoopPMBody(){ + ClosedLoopPMBody pmBody = new ClosedLoopPMBody(); + pmBody.setTrinity(true); + assertTrue(pmBody.isTrinity()); + pmBody.setvUSP(true); + assertTrue(pmBody.isvUSP()); + pmBody.setMcr(true); + assertTrue(pmBody.isMcr()); + pmBody.setGamma(true); + assertTrue(pmBody.isGamma()); + pmBody.setvDNS(true); + assertTrue(pmBody.isvDNS()); + pmBody.setvServices("Test"); + assertTrue("Test".equals(pmBody.getvServices())); + pmBody.setONAPname("Test"); + assertTrue("Test".equals(pmBody.getONAPname())); + pmBody.setEmailAddress("test@test.com"); + assertTrue("test@test.com".equals(pmBody.getEmailAddress())); + pmBody.setServiceTypePolicyName("Test"); + assertTrue("Test".equals(pmBody.getServiceTypePolicyName())); + pmBody.setTemplateVersion("1802"); + assertTrue("1802".equals(pmBody.getTemplateVersion())); + pmBody.setAttributes(new HashMap<String, String>()); + assertTrue(pmBody.getAttributes() != null); + pmBody.setGeoLink("Test"); + assertTrue("Test".equals(pmBody.getGeoLink())); + } + + @Test + public void testClosedLoopPolicyStatus() { + assertEquals(ClosedLoopPolicyStatus.ACTIVE.toString(), "active"); + assertEquals(ClosedLoopPolicyStatus.INACTIVE.toString(), "inactive"); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/DeletePolicyConditionTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/DeletePolicyConditionTest.java index 129f7237b..40421887f 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/DeletePolicyConditionTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/DeletePolicyConditionTest.java @@ -24,9 +24,9 @@ import org.junit.Test; public class DeletePolicyConditionTest { - @Test - public void testDeletePolicyCondition(){ - assertEquals(DeletePolicyCondition.ONE.toString(), "Are you sure you want to delete Current Version of policy"); - assertEquals(DeletePolicyCondition.ALL.toString(), "Are you sure you want to delete All Versions of policy"); - } + @Test + public void testDeletePolicyCondition(){ + assertEquals(DeletePolicyCondition.ONE.toString(), "Are you sure you want to delete Current Version of policy"); + assertEquals(DeletePolicyCondition.ALL.toString(), "Are you sure you want to delete All Versions of policy"); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/FirewallPolicyAdaptersTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/FirewallPolicyAdaptersTest.java index 729efa6d6..3ede40c7c 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/FirewallPolicyAdaptersTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/FirewallPolicyAdaptersTest.java @@ -28,203 +28,203 @@ import org.junit.Test; public class FirewallPolicyAdaptersTest { - @Test - public void AddressGroupJSON(){ - AddressGroupJson groupJSON = new AddressGroupJson(); - groupJSON.setName("Test"); - assertTrue("Test".equals(groupJSON.getName())); - groupJSON.setDescription("Test"); - assertTrue("Test".equals(groupJSON.getDescription())); - - AddressMembersJson membersJSON = new AddressMembersJson(); - membersJSON.setType("Test"); - assertTrue("Test".equals(membersJSON.getType())); - membersJSON.setName("Test"); - assertTrue("Test".equals(membersJSON.getName())); - - groupJSON.setMembers(null); - assertTrue(groupJSON.getMembers() != null); - } - - @Test - public void testAddressMembers(){ - AddressMembers members = new AddressMembers(); - members.setName("Test"); - assertTrue("Test".equals(members.getName())); - members.setType("Test"); - assertTrue("Test".equals(members.getType())); - members.setValue("Test"); - assertTrue("Test".equals(members.getValue())); - - PrefixIPList prefixList = new PrefixIPList(); - prefixList.setName("Test"); - assertTrue("Test".equals(prefixList.getName())); - prefixList.setDescription("Test"); - assertTrue("Test".equals(prefixList.getDescription())); - prefixList.setMembers(null); - assertTrue(prefixList.getMembers() != null); - } - - @Test - public void testAddressJSON(){ - AddressJson addressJSON = new AddressJson(); - addressJSON.setName("Test"); - assertTrue("Test".equals(addressJSON.getName())); - addressJSON.setType("Test"); - assertTrue("Test".equals(addressJSON.getType())); - } - - - @Test - public void testGridData(){ - GridData data = new GridData(); - data.setAttributes(new ArrayList<>()); - data.setAppProtocols(new ArrayList<>()); - data.setTransportProtocols(new ArrayList<>()); - assertTrue(data.getAttributes() != null); - assertTrue(data.getAppProtocols() != null); - assertTrue(data.getTransportProtocols() != null); - } - - @Test - public void testTermCollector(){ - - TermCollector termCollector = new TermCollector(); - termCollector.setServiceTypeId("Test"); - assertTrue("Test".equals(termCollector.getServiceTypeId())); - termCollector.setConfigName("Test"); - assertTrue("Test".equals(termCollector.getConfigName())); - - DeployNowJson deployNowJson = new DeployNowJson(); - deployNowJson.setDeployNow(true); - assertTrue(deployNowJson.getDeployNow()); - - termCollector.setDeploymentOption(deployNowJson); - assertTrue(termCollector.getDeploymentOption() != null); - termCollector.setSecurityZoneId("Test"); - assertTrue("Test".equals(termCollector.getSecurityZoneId())); - termCollector.setVendorServiceId("Test"); - assertTrue("Test".equals(termCollector.getVendorServiceId())); - - IdMap idMap = new IdMap(); - idMap.setAstraId("Test"); - idMap.setVendorId("Test"); - assertTrue("Test".equals(idMap.getAstraId())); - assertTrue("Test".equals(idMap.getVendorId())); - - List<IdMap> idMapList = new ArrayList<>(); - idMapList.add(idMap); - - VendorSpecificData vendorData = new VendorSpecificData(); - vendorData.setIdMap(idMapList); - assertTrue(vendorData.getIdMap() != null); - termCollector.setVendorSpecificData(vendorData); - assertTrue(termCollector.getVendorSpecificData()!=null); - - termCollector.setServiceGroups(null); - assertTrue(termCollector.getServiceGroups()!=null); - termCollector.setAddressGroups(null); - assertTrue(termCollector.getAddressGroups()!=null); - - Term term = new Term(); - term.setPosition("Test"); - assertTrue("Test".equals(term.getPosition())); - term.setRuleName("Test"); - assertTrue("Test".equals(term.getRuleName())); - term.setFromZones(null); - assertTrue(term.getFromZones() != null); - term.setToZones(null); - assertTrue(term.getToZones() != null); - term.setNegateSource(true); - assertTrue(term.getNegateSource()); - term.setNegateDestination(true); - assertTrue(term.getNegateDestination()); - term.setSourceList(null); - assertTrue(term.getSourceList() != null); - term.setDestinationList(null); - assertTrue(term.getDestinationList() != null); - term.setSourceServices(null); - assertTrue(term.getSourceServices() != null); - term.setDestServices(null); - assertTrue(term.getDestServices() != null); - term.setAction("Test"); - assertTrue("Test".equals(term.getAction())); - term.setDescription("Test"); - assertTrue("Test".equals(term.getDescription())); - term.setEnabled(true); - assertTrue(term.getEnabled()); - term.setLog(true); - assertTrue(term.getLog()); - - termCollector.setFirewallRuleList(null); - assertTrue(termCollector.getFirewallRuleList()!=null); - - Tags tags = new Tags(); - tags.setRuleName("Test"); - assertTrue("Test".equals(tags.getRuleName())); - - TagDefines tagDefines = new TagDefines(); - tagDefines.setKey("Test"); - assertTrue("Test".equals(tagDefines.getKey())); - tagDefines.setValue("Test"); - assertTrue("Test".equals(tagDefines.getValue())); - tags.setTags(new ArrayList<>()); - assertTrue(tags.getTags()!=null); - tags.setTagPickerName("Test"); - assertTrue("Test".equals(tags.getTagPickerName())); - tags.setNetworkRole("Test"); - assertTrue("Test".equals(tags.getNetworkRole())); - List<Tags> ruleToTag = new ArrayList<>(); - ruleToTag.add(tags); - - termCollector.setRuleToTag(ruleToTag); - assertTrue(termCollector.getRuleToTag()!=null); - } - - @Test - public void testServiceGroupJson(){ - ServiceGroupJson serviceGroup = new ServiceGroupJson(); - serviceGroup.setName("Test"); - assertTrue("Test".equals(serviceGroup.getName())); - serviceGroup.setDescription("Test"); - assertTrue("Test".equals(serviceGroup.getDescription())); - serviceGroup.setMembers(new ArrayList<>()); - assertTrue(serviceGroup.getMembers()!=null); - } - - @Test - public void testServiceListJson(){ - ServiceListJson serviceGroup = new ServiceListJson(); - serviceGroup.setName("Test"); - assertTrue("Test".equals(serviceGroup.getName())); - serviceGroup.setDescription("Test"); - assertTrue("Test".equals(serviceGroup.getDescription())); - serviceGroup.setType("Test"); - assertTrue("Test".equals(serviceGroup.getType())); - serviceGroup.setTransportProtocol("Test"); - assertTrue("Test".equals(serviceGroup.getTransportProtocol())); - serviceGroup.setAppProtocol("Test"); - assertTrue("Test".equals(serviceGroup.getAppProtocol())); - serviceGroup.setPorts("Test"); - assertTrue("Test".equals(serviceGroup.getPorts())); - } - - @Test - public void testServiceMembers(){ - ServiceMembers serviceGroup = new ServiceMembers(); - serviceGroup.setName("Test"); - assertTrue("Test".equals(serviceGroup.getName())); - serviceGroup.setType("Test"); - assertTrue("Test".equals(serviceGroup.getType())); - } - - @Test - public void testServiceJson(){ - ServicesJson serviceGroup = new ServicesJson(); - serviceGroup.setName("Test"); - assertTrue("Test".equals(serviceGroup.getName())); - serviceGroup.setType("Test"); - assertTrue("Test".equals(serviceGroup.getType())); - } + @Test + public void AddressGroupJSON(){ + AddressGroupJson groupJSON = new AddressGroupJson(); + groupJSON.setName("Test"); + assertTrue("Test".equals(groupJSON.getName())); + groupJSON.setDescription("Test"); + assertTrue("Test".equals(groupJSON.getDescription())); + + AddressMembersJson membersJSON = new AddressMembersJson(); + membersJSON.setType("Test"); + assertTrue("Test".equals(membersJSON.getType())); + membersJSON.setName("Test"); + assertTrue("Test".equals(membersJSON.getName())); + + groupJSON.setMembers(null); + assertTrue(groupJSON.getMembers() != null); + } + + @Test + public void testAddressMembers(){ + AddressMembers members = new AddressMembers(); + members.setName("Test"); + assertTrue("Test".equals(members.getName())); + members.setType("Test"); + assertTrue("Test".equals(members.getType())); + members.setValue("Test"); + assertTrue("Test".equals(members.getValue())); + + PrefixIPList prefixList = new PrefixIPList(); + prefixList.setName("Test"); + assertTrue("Test".equals(prefixList.getName())); + prefixList.setDescription("Test"); + assertTrue("Test".equals(prefixList.getDescription())); + prefixList.setMembers(null); + assertTrue(prefixList.getMembers() != null); + } + + @Test + public void testAddressJSON(){ + AddressJson addressJSON = new AddressJson(); + addressJSON.setName("Test"); + assertTrue("Test".equals(addressJSON.getName())); + addressJSON.setType("Test"); + assertTrue("Test".equals(addressJSON.getType())); + } + + + @Test + public void testGridData(){ + GridData data = new GridData(); + data.setAttributes(new ArrayList<>()); + data.setAppProtocols(new ArrayList<>()); + data.setTransportProtocols(new ArrayList<>()); + assertTrue(data.getAttributes() != null); + assertTrue(data.getAppProtocols() != null); + assertTrue(data.getTransportProtocols() != null); + } + + @Test + public void testTermCollector(){ + + TermCollector termCollector = new TermCollector(); + termCollector.setServiceTypeId("Test"); + assertTrue("Test".equals(termCollector.getServiceTypeId())); + termCollector.setConfigName("Test"); + assertTrue("Test".equals(termCollector.getConfigName())); + + DeployNowJson deployNowJson = new DeployNowJson(); + deployNowJson.setDeployNow(true); + assertTrue(deployNowJson.getDeployNow()); + + termCollector.setDeploymentOption(deployNowJson); + assertTrue(termCollector.getDeploymentOption() != null); + termCollector.setSecurityZoneId("Test"); + assertTrue("Test".equals(termCollector.getSecurityZoneId())); + termCollector.setVendorServiceId("Test"); + assertTrue("Test".equals(termCollector.getVendorServiceId())); + + IdMap idMap = new IdMap(); + idMap.setAstraId("Test"); + idMap.setVendorId("Test"); + assertTrue("Test".equals(idMap.getAstraId())); + assertTrue("Test".equals(idMap.getVendorId())); + + List<IdMap> idMapList = new ArrayList<>(); + idMapList.add(idMap); + + VendorSpecificData vendorData = new VendorSpecificData(); + vendorData.setIdMap(idMapList); + assertTrue(vendorData.getIdMap() != null); + termCollector.setVendorSpecificData(vendorData); + assertTrue(termCollector.getVendorSpecificData()!=null); + + termCollector.setServiceGroups(null); + assertTrue(termCollector.getServiceGroups()!=null); + termCollector.setAddressGroups(null); + assertTrue(termCollector.getAddressGroups()!=null); + + Term term = new Term(); + term.setPosition("Test"); + assertTrue("Test".equals(term.getPosition())); + term.setRuleName("Test"); + assertTrue("Test".equals(term.getRuleName())); + term.setFromZones(null); + assertTrue(term.getFromZones() != null); + term.setToZones(null); + assertTrue(term.getToZones() != null); + term.setNegateSource(true); + assertTrue(term.getNegateSource()); + term.setNegateDestination(true); + assertTrue(term.getNegateDestination()); + term.setSourceList(null); + assertTrue(term.getSourceList() != null); + term.setDestinationList(null); + assertTrue(term.getDestinationList() != null); + term.setSourceServices(null); + assertTrue(term.getSourceServices() != null); + term.setDestServices(null); + assertTrue(term.getDestServices() != null); + term.setAction("Test"); + assertTrue("Test".equals(term.getAction())); + term.setDescription("Test"); + assertTrue("Test".equals(term.getDescription())); + term.setEnabled(true); + assertTrue(term.getEnabled()); + term.setLog(true); + assertTrue(term.getLog()); + + termCollector.setFirewallRuleList(null); + assertTrue(termCollector.getFirewallRuleList()!=null); + + Tags tags = new Tags(); + tags.setRuleName("Test"); + assertTrue("Test".equals(tags.getRuleName())); + + TagDefines tagDefines = new TagDefines(); + tagDefines.setKey("Test"); + assertTrue("Test".equals(tagDefines.getKey())); + tagDefines.setValue("Test"); + assertTrue("Test".equals(tagDefines.getValue())); + tags.setTags(new ArrayList<>()); + assertTrue(tags.getTags()!=null); + tags.setTagPickerName("Test"); + assertTrue("Test".equals(tags.getTagPickerName())); + tags.setNetworkRole("Test"); + assertTrue("Test".equals(tags.getNetworkRole())); + List<Tags> ruleToTag = new ArrayList<>(); + ruleToTag.add(tags); + + termCollector.setRuleToTag(ruleToTag); + assertTrue(termCollector.getRuleToTag()!=null); + } + + @Test + public void testServiceGroupJson(){ + ServiceGroupJson serviceGroup = new ServiceGroupJson(); + serviceGroup.setName("Test"); + assertTrue("Test".equals(serviceGroup.getName())); + serviceGroup.setDescription("Test"); + assertTrue("Test".equals(serviceGroup.getDescription())); + serviceGroup.setMembers(new ArrayList<>()); + assertTrue(serviceGroup.getMembers()!=null); + } + + @Test + public void testServiceListJson(){ + ServiceListJson serviceGroup = new ServiceListJson(); + serviceGroup.setName("Test"); + assertTrue("Test".equals(serviceGroup.getName())); + serviceGroup.setDescription("Test"); + assertTrue("Test".equals(serviceGroup.getDescription())); + serviceGroup.setType("Test"); + assertTrue("Test".equals(serviceGroup.getType())); + serviceGroup.setTransportProtocol("Test"); + assertTrue("Test".equals(serviceGroup.getTransportProtocol())); + serviceGroup.setAppProtocol("Test"); + assertTrue("Test".equals(serviceGroup.getAppProtocol())); + serviceGroup.setPorts("Test"); + assertTrue("Test".equals(serviceGroup.getPorts())); + } + + @Test + public void testServiceMembers(){ + ServiceMembers serviceGroup = new ServiceMembers(); + serviceGroup.setName("Test"); + assertTrue("Test".equals(serviceGroup.getName())); + serviceGroup.setType("Test"); + assertTrue("Test".equals(serviceGroup.getType())); + } + + @Test + public void testServiceJson(){ + ServicesJson serviceGroup = new ServicesJson(); + serviceGroup.setName("Test"); + assertTrue("Test".equals(serviceGroup.getName())); + serviceGroup.setType("Test"); + assertTrue("Test".equals(serviceGroup.getType())); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/PolicyRestAdapterTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/PolicyRestAdapterTest.java index 43567674e..971614359 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/PolicyRestAdapterTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/PolicyRestAdapterTest.java @@ -30,231 +30,231 @@ import org.onap.policy.rest.jpa.OnapName; public class PolicyRestAdapterTest { - @Test - public void testPolicyExportAdapter(){ - PolicyExportAdapter adapter = new PolicyExportAdapter(); - adapter.setPolicyDatas(new ArrayList<>()); - assertTrue(adapter.getPolicyDatas() != null); - } - - @Test - public void testPolicyRestAdapter(){ - PolicyRestAdapter adapter = new PolicyRestAdapter(); - adapter.setData(new Object()); - assertTrue(adapter.getData() != null); - adapter.setPolicyName("com.Config_test.1.xml"); - assertTrue("com.Config_test.1.xml".equals(adapter.getPolicyName())); - adapter.setConfigBodyData("Test"); - assertTrue("Test".equals(adapter.getConfigBodyData())); - adapter.setConfigType("Config_PM"); - assertTrue("Config_PM".equals(adapter.getConfigType())); - adapter.setPolicyID("Test"); - assertTrue("Test".equals(adapter.getPolicyID())); - adapter.setPolicyType("Config"); - assertTrue("Config".equals(adapter.getPolicyType())); - adapter.setComboPolicyType("Test"); - assertTrue("Test".equals(adapter.getComboPolicyType())); - adapter.setConfigPolicyType("Test"); - assertTrue("Test".equals(adapter.getConfigPolicyType())); - adapter.setPolicyDescription("Test"); - assertTrue("Test".equals(adapter.getPolicyDescription())); - adapter.setOnapName("Test"); - assertTrue("Test".equals(adapter.getOnapName())); - adapter.setConfigName("Test"); - assertTrue("Test".equals(adapter.getConfigName())); - adapter.setRuleID("Test"); - assertTrue("Test".equals(adapter.getRuleID())); - adapter.setParentPath("config/webapps"); - assertTrue("config/webapps".equals(adapter.getParentPath())); - adapter.setValidData(true); - assertTrue(adapter.isValidData()); - adapter.setAdminNotification("TestNotification"); - assertTrue("TestNotification".equals(adapter.getAdminNotification())); - adapter.setEditPolicy(true); - assertTrue(adapter.isEditPolicy()); - adapter.setViewPolicy(true); - assertTrue(adapter.isViewPolicy()); - adapter.setDraft(true); - assertTrue(adapter.isDraft()); - adapter.setPolicyData("Test Policy"); - assertTrue("Test Policy".equals(adapter.getPolicyData())); - adapter.setGitPath("config/webapps"); - assertTrue("config/webapps".equals(adapter.getGitPath())); - adapter.setReadOnly(true); - assertTrue(adapter.isReadOnly()); - adapter.setConfigName("Test"); - assertTrue("Test".equals(adapter.getConfigName())); - adapter.setConfigUrl("Test"); - assertTrue("Test".equals(adapter.getConfigUrl())); - adapter.setFinalPolicyPath("config/webapps"); - assertTrue("config/webapps".equals(adapter.getFinalPolicyPath())); - adapter.setVersion("1"); - assertTrue("1".equals(adapter.getVersion())); - adapter.setJsonBody("Test"); - assertTrue("Test".equals(adapter.getJsonBody())); - adapter.setApiflag("API"); - assertTrue("API".equals(adapter.getApiflag())); - adapter.setPrevJsonBody("Test"); - assertTrue("Test".equals(adapter.getPrevJsonBody())); - adapter.setHighestVersion(1); - assertTrue(1 == adapter.getHighestVersion()); - adapter.setPolicyExists(true); - assertTrue(adapter.getPolicyExists()); - adapter.setOldPolicyFileName("Config_oldtest.1.xml"); - assertTrue("Config_oldtest.1.xml".equals(adapter.getOldPolicyFileName())); - adapter.setDomainDir("Test"); - assertTrue("Test".equals(adapter.getDomainDir())); - adapter.setUserId("Test"); - assertTrue("Test".equals(adapter.getUserId())); - adapter.setNewFileName("Test"); - assertTrue("Test".equals(adapter.getNewFileName())); - adapter.setClWarning("Test"); - assertTrue("Test".equals(adapter.getClWarning())); - adapter.setNewCLName("Test"); - assertTrue("Test".equals(adapter.getNewCLName())); - adapter.setExistingCLName("Test"); - assertTrue("Test".equals(adapter.getExistingCLName())); - adapter.setOnapNameField(new OnapName()); - assertTrue(adapter.getOnapNameField()!=null); - adapter.setJsonBodyData(new Object()); - assertTrue(adapter.getJsonBodyData()!=null); - adapter.setDirPath("Test"); - assertTrue("Test".equals(adapter.getDirPath())); - adapter.setConfigBodyPath("Test"); - assertTrue("Test".equals(adapter.getConfigBodyPath())); - adapter.setAttributes(new ArrayList<>()); - assertTrue(adapter.getAttributes()!=null); - adapter.setSettings(new ArrayList<>()); - assertTrue(adapter.getSettings()!=null); - adapter.setRuleAlgorithmschoices(new ArrayList<>()); - assertTrue(adapter.getRuleAlgorithmschoices()!=null); - adapter.setServiceTypePolicyName(new HashMap<>()); - assertTrue(adapter.getServiceTypePolicyName()!=null); - adapter.setVerticaMetrics(new HashMap<>()); - assertTrue(adapter.getVerticaMetrics()!=null); - adapter.setDescription(new LinkedHashMap<>()); - assertTrue(adapter.getVerticaMetrics()!=null); - adapter.setAttributeFields(new LinkedHashMap<>()); - assertTrue(adapter.getAttributeFields()!=null); - adapter.setClearTimeOut("Test"); - assertTrue("Test".equals(adapter.getClearTimeOut())); - adapter.setTrapMaxAge("Test"); - assertTrue("Test".equals(adapter.getTrapMaxAge())); - adapter.setVerificationclearTimeOut("Test"); - assertTrue("Test".equals(adapter.getVerificationclearTimeOut())); - adapter.setDynamicLayoutMap(new HashMap<>()); - assertTrue(adapter.getDynamicLayoutMap()!=null); - adapter.setTrapDatas(new ClosedLoopFaultTrapDatas()); - assertTrue(adapter.getTrapDatas()!=null); - adapter.setFaultDatas(new ClosedLoopFaultTrapDatas()); - assertTrue(adapter.getFaultDatas()!=null); - adapter.setFwPolicyType("Test"); - assertTrue("Test".equals(adapter.getFwPolicyType())); - adapter.setFwattributes(new ArrayList<>()); - assertTrue(adapter.getFwattributes()!=null); - adapter.setParentForChild("Test"); - assertTrue("Test".equals(adapter.getParentForChild())); - adapter.setSecurityZone("Test"); - assertTrue("Test".equals(adapter.getSecurityZone())); - adapter.setRuleCombiningAlgId("Test"); - assertTrue("Test".equals(adapter.getRuleCombiningAlgId())); - adapter.setDynamicFieldConfigAttributes(new HashMap<>()); - assertTrue(adapter.getDynamicFieldConfigAttributes()!=null); - adapter.setDynamicSettingsMap(new HashMap<>()); - assertTrue(adapter.getDynamicSettingsMap()!=null); - adapter.setDropDownMap(new HashMap<>()); - assertTrue(adapter.getDropDownMap()!=null); - adapter.setActionPerformer("Test"); - assertTrue("Test".equals(adapter.getActionPerformer())); - adapter.setActionAttribute("Test"); - assertTrue("Test".equals(adapter.getActionAttribute())); - adapter.setDynamicRuleAlgorithmLabels(new ArrayList<>()); - assertTrue(adapter.getDynamicRuleAlgorithmLabels()!=null); - adapter.setDynamicRuleAlgorithmCombo(new ArrayList<>()); - assertTrue(adapter.getDynamicRuleAlgorithmCombo()!=null); - adapter.setDynamicRuleAlgorithmField1(new ArrayList<>()); - assertTrue(adapter.getDynamicRuleAlgorithmField1()!=null); - adapter.setDynamicRuleAlgorithmField2(new ArrayList<>()); - assertTrue(adapter.getDynamicRuleAlgorithmField2()!=null); - adapter.setDynamicVariableList(new ArrayList<>()); - assertTrue(adapter.getDynamicVariableList()!=null); - adapter.setDataTypeList(new ArrayList<>()); - assertTrue(adapter.getDataTypeList()!=null); - adapter.setActionAttributeValue("Test"); - assertTrue("Test".equals(adapter.getActionAttributeValue())); - adapter.setRuleProvider("Test"); - assertTrue("Test".equals(adapter.getRuleProvider())); - adapter.setActionBody("Test"); - assertTrue("Test".equals(adapter.getActionBody())); - adapter.setActionDictHeader("Test"); - assertTrue("Test".equals(adapter.getActionDictHeader())); - adapter.setActionDictType("Test"); - assertTrue("Test".equals(adapter.getActionDictType())); - adapter.setActionDictUrl("Test"); - assertTrue("Test".equals(adapter.getActionDictUrl())); - adapter.setActionDictMethod("Test"); - assertTrue("Test".equals(adapter.getActionDictMethod())); - adapter.setYamlparams(new YAMLParams()); - assertTrue(adapter.getYamlparams()!=null); - adapter.setRainyday(new RainyDayParams()); - assertTrue(adapter.getRainyday()!=null); - adapter.setRainydayMap(new HashMap<>()); - assertTrue(adapter.getRainydayMap()!=null); - adapter.setErrorCodeList(new ArrayList<>()); - assertTrue(adapter.getErrorCodeList()!=null); - adapter.setTreatmentList(new ArrayList<>()); - assertTrue(adapter.getTreatmentList()!=null); - adapter.setServiceType("Test"); - assertTrue("Test".equals(adapter.getServiceType())); - adapter.setUuid("Test"); - assertTrue("Test".equals(adapter.getUuid())); - adapter.setLocation("Test"); - assertTrue("Test".equals(adapter.getLocation())); - adapter.setPriority("Test"); - assertTrue("Test".equals(adapter.getPriority())); - adapter.setMsLocation("Test"); - assertTrue("Test".equals(adapter.getMsLocation())); - adapter.setPolicyJSON("Test"); - assertTrue("Test".equals(adapter.getPolicyJSON())); - adapter.setRuleName("Test"); - assertTrue("Test".equals(adapter.getRuleName())); - adapter.setBrmsParamBody(new HashMap<>()); - assertTrue(adapter.getBrmsParamBody()!=null); - adapter.setBrmsController("Test"); - assertTrue("Test".equals(adapter.getBrmsController())); - adapter.setBrmsDependency(new ArrayList<>()); - assertTrue(adapter.getBrmsDependency()!=null); - adapter.setRuleData(new LinkedHashMap<>()); - assertTrue(adapter.getRuleData()!=null); - adapter.setRuleListData(new LinkedHashMap<>()); - assertTrue(adapter.getRuleListData()!=null); - adapter.setDrlRuleAndUIParams(new LinkedHashMap<>()); - assertTrue(adapter.getDrlRuleAndUIParams()!=null); - adapter.setPolicyScope("Test"); - assertTrue("Test".equals(adapter.getPolicyScope())); - adapter.setProviderComboBox("Test"); - assertTrue("Test".equals(adapter.getProviderComboBox())); - adapter.setRiskType("Test"); - assertTrue("Test".equals(adapter.getRiskType())); - adapter.setRiskLevel("Test"); - assertTrue("Test".equals(adapter.getRiskLevel())); - adapter.setGuard("Test"); - assertTrue("Test".equals(adapter.getGuard())); - adapter.setTtlDate("Test"); - assertTrue("Test".equals(adapter.getTtlDate())); - adapter.setMatching(new LinkedHashMap<>()); - assertTrue(adapter.getMatching()!=null); - adapter.setTriggerSignatures(new ArrayList<>()); - assertTrue(adapter.getTriggerSignatures()!=null); - adapter.setSymptomSignatures(new ArrayList<>()); - assertTrue(adapter.getSymptomSignatures()!=null); - adapter.setLogicalConnector("Test"); - assertTrue("Test".equals(adapter.getLogicalConnector())); - adapter.setPolicyStatus("Test"); - assertTrue("Test".equals(adapter.getPolicyStatus())); - adapter.setGocServerScope("Test"); - assertTrue("Test".equals(adapter.getGocServerScope())); - adapter.setSupressionType("Test"); - assertTrue("Test".equals(adapter.getSupressionType())); - } + @Test + public void testPolicyExportAdapter(){ + PolicyExportAdapter adapter = new PolicyExportAdapter(); + adapter.setPolicyDatas(new ArrayList<>()); + assertTrue(adapter.getPolicyDatas() != null); + } + + @Test + public void testPolicyRestAdapter(){ + PolicyRestAdapter adapter = new PolicyRestAdapter(); + adapter.setData(new Object()); + assertTrue(adapter.getData() != null); + adapter.setPolicyName("com.Config_test.1.xml"); + assertTrue("com.Config_test.1.xml".equals(adapter.getPolicyName())); + adapter.setConfigBodyData("Test"); + assertTrue("Test".equals(adapter.getConfigBodyData())); + adapter.setConfigType("Config_PM"); + assertTrue("Config_PM".equals(adapter.getConfigType())); + adapter.setPolicyID("Test"); + assertTrue("Test".equals(adapter.getPolicyID())); + adapter.setPolicyType("Config"); + assertTrue("Config".equals(adapter.getPolicyType())); + adapter.setComboPolicyType("Test"); + assertTrue("Test".equals(adapter.getComboPolicyType())); + adapter.setConfigPolicyType("Test"); + assertTrue("Test".equals(adapter.getConfigPolicyType())); + adapter.setPolicyDescription("Test"); + assertTrue("Test".equals(adapter.getPolicyDescription())); + adapter.setOnapName("Test"); + assertTrue("Test".equals(adapter.getOnapName())); + adapter.setConfigName("Test"); + assertTrue("Test".equals(adapter.getConfigName())); + adapter.setRuleID("Test"); + assertTrue("Test".equals(adapter.getRuleID())); + adapter.setParentPath("config/webapps"); + assertTrue("config/webapps".equals(adapter.getParentPath())); + adapter.setValidData(true); + assertTrue(adapter.isValidData()); + adapter.setAdminNotification("TestNotification"); + assertTrue("TestNotification".equals(adapter.getAdminNotification())); + adapter.setEditPolicy(true); + assertTrue(adapter.isEditPolicy()); + adapter.setViewPolicy(true); + assertTrue(adapter.isViewPolicy()); + adapter.setDraft(true); + assertTrue(adapter.isDraft()); + adapter.setPolicyData("Test Policy"); + assertTrue("Test Policy".equals(adapter.getPolicyData())); + adapter.setGitPath("config/webapps"); + assertTrue("config/webapps".equals(adapter.getGitPath())); + adapter.setReadOnly(true); + assertTrue(adapter.isReadOnly()); + adapter.setConfigName("Test"); + assertTrue("Test".equals(adapter.getConfigName())); + adapter.setConfigUrl("Test"); + assertTrue("Test".equals(adapter.getConfigUrl())); + adapter.setFinalPolicyPath("config/webapps"); + assertTrue("config/webapps".equals(adapter.getFinalPolicyPath())); + adapter.setVersion("1"); + assertTrue("1".equals(adapter.getVersion())); + adapter.setJsonBody("Test"); + assertTrue("Test".equals(adapter.getJsonBody())); + adapter.setApiflag("API"); + assertTrue("API".equals(adapter.getApiflag())); + adapter.setPrevJsonBody("Test"); + assertTrue("Test".equals(adapter.getPrevJsonBody())); + adapter.setHighestVersion(1); + assertTrue(1 == adapter.getHighestVersion()); + adapter.setPolicyExists(true); + assertTrue(adapter.getPolicyExists()); + adapter.setOldPolicyFileName("Config_oldtest.1.xml"); + assertTrue("Config_oldtest.1.xml".equals(adapter.getOldPolicyFileName())); + adapter.setDomainDir("Test"); + assertTrue("Test".equals(adapter.getDomainDir())); + adapter.setUserId("Test"); + assertTrue("Test".equals(adapter.getUserId())); + adapter.setNewFileName("Test"); + assertTrue("Test".equals(adapter.getNewFileName())); + adapter.setClWarning("Test"); + assertTrue("Test".equals(adapter.getClWarning())); + adapter.setNewCLName("Test"); + assertTrue("Test".equals(adapter.getNewCLName())); + adapter.setExistingCLName("Test"); + assertTrue("Test".equals(adapter.getExistingCLName())); + adapter.setOnapNameField(new OnapName()); + assertTrue(adapter.getOnapNameField()!=null); + adapter.setJsonBodyData(new Object()); + assertTrue(adapter.getJsonBodyData()!=null); + adapter.setDirPath("Test"); + assertTrue("Test".equals(adapter.getDirPath())); + adapter.setConfigBodyPath("Test"); + assertTrue("Test".equals(adapter.getConfigBodyPath())); + adapter.setAttributes(new ArrayList<>()); + assertTrue(adapter.getAttributes()!=null); + adapter.setSettings(new ArrayList<>()); + assertTrue(adapter.getSettings()!=null); + adapter.setRuleAlgorithmschoices(new ArrayList<>()); + assertTrue(adapter.getRuleAlgorithmschoices()!=null); + adapter.setServiceTypePolicyName(new HashMap<>()); + assertTrue(adapter.getServiceTypePolicyName()!=null); + adapter.setVerticaMetrics(new HashMap<>()); + assertTrue(adapter.getVerticaMetrics()!=null); + adapter.setDescription(new LinkedHashMap<>()); + assertTrue(adapter.getVerticaMetrics()!=null); + adapter.setAttributeFields(new LinkedHashMap<>()); + assertTrue(adapter.getAttributeFields()!=null); + adapter.setClearTimeOut("Test"); + assertTrue("Test".equals(adapter.getClearTimeOut())); + adapter.setTrapMaxAge("Test"); + assertTrue("Test".equals(adapter.getTrapMaxAge())); + adapter.setVerificationclearTimeOut("Test"); + assertTrue("Test".equals(adapter.getVerificationclearTimeOut())); + adapter.setDynamicLayoutMap(new HashMap<>()); + assertTrue(adapter.getDynamicLayoutMap()!=null); + adapter.setTrapDatas(new ClosedLoopFaultTrapDatas()); + assertTrue(adapter.getTrapDatas()!=null); + adapter.setFaultDatas(new ClosedLoopFaultTrapDatas()); + assertTrue(adapter.getFaultDatas()!=null); + adapter.setFwPolicyType("Test"); + assertTrue("Test".equals(adapter.getFwPolicyType())); + adapter.setFwattributes(new ArrayList<>()); + assertTrue(adapter.getFwattributes()!=null); + adapter.setParentForChild("Test"); + assertTrue("Test".equals(adapter.getParentForChild())); + adapter.setSecurityZone("Test"); + assertTrue("Test".equals(adapter.getSecurityZone())); + adapter.setRuleCombiningAlgId("Test"); + assertTrue("Test".equals(adapter.getRuleCombiningAlgId())); + adapter.setDynamicFieldConfigAttributes(new HashMap<>()); + assertTrue(adapter.getDynamicFieldConfigAttributes()!=null); + adapter.setDynamicSettingsMap(new HashMap<>()); + assertTrue(adapter.getDynamicSettingsMap()!=null); + adapter.setDropDownMap(new HashMap<>()); + assertTrue(adapter.getDropDownMap()!=null); + adapter.setActionPerformer("Test"); + assertTrue("Test".equals(adapter.getActionPerformer())); + adapter.setActionAttribute("Test"); + assertTrue("Test".equals(adapter.getActionAttribute())); + adapter.setDynamicRuleAlgorithmLabels(new ArrayList<>()); + assertTrue(adapter.getDynamicRuleAlgorithmLabels()!=null); + adapter.setDynamicRuleAlgorithmCombo(new ArrayList<>()); + assertTrue(adapter.getDynamicRuleAlgorithmCombo()!=null); + adapter.setDynamicRuleAlgorithmField1(new ArrayList<>()); + assertTrue(adapter.getDynamicRuleAlgorithmField1()!=null); + adapter.setDynamicRuleAlgorithmField2(new ArrayList<>()); + assertTrue(adapter.getDynamicRuleAlgorithmField2()!=null); + adapter.setDynamicVariableList(new ArrayList<>()); + assertTrue(adapter.getDynamicVariableList()!=null); + adapter.setDataTypeList(new ArrayList<>()); + assertTrue(adapter.getDataTypeList()!=null); + adapter.setActionAttributeValue("Test"); + assertTrue("Test".equals(adapter.getActionAttributeValue())); + adapter.setRuleProvider("Test"); + assertTrue("Test".equals(adapter.getRuleProvider())); + adapter.setActionBody("Test"); + assertTrue("Test".equals(adapter.getActionBody())); + adapter.setActionDictHeader("Test"); + assertTrue("Test".equals(adapter.getActionDictHeader())); + adapter.setActionDictType("Test"); + assertTrue("Test".equals(adapter.getActionDictType())); + adapter.setActionDictUrl("Test"); + assertTrue("Test".equals(adapter.getActionDictUrl())); + adapter.setActionDictMethod("Test"); + assertTrue("Test".equals(adapter.getActionDictMethod())); + adapter.setYamlparams(new YAMLParams()); + assertTrue(adapter.getYamlparams()!=null); + adapter.setRainyday(new RainyDayParams()); + assertTrue(adapter.getRainyday()!=null); + adapter.setRainydayMap(new HashMap<>()); + assertTrue(adapter.getRainydayMap()!=null); + adapter.setErrorCodeList(new ArrayList<>()); + assertTrue(adapter.getErrorCodeList()!=null); + adapter.setTreatmentList(new ArrayList<>()); + assertTrue(adapter.getTreatmentList()!=null); + adapter.setServiceType("Test"); + assertTrue("Test".equals(adapter.getServiceType())); + adapter.setUuid("Test"); + assertTrue("Test".equals(adapter.getUuid())); + adapter.setLocation("Test"); + assertTrue("Test".equals(adapter.getLocation())); + adapter.setPriority("Test"); + assertTrue("Test".equals(adapter.getPriority())); + adapter.setMsLocation("Test"); + assertTrue("Test".equals(adapter.getMsLocation())); + adapter.setPolicyJSON("Test"); + assertTrue("Test".equals(adapter.getPolicyJSON())); + adapter.setRuleName("Test"); + assertTrue("Test".equals(adapter.getRuleName())); + adapter.setBrmsParamBody(new HashMap<>()); + assertTrue(adapter.getBrmsParamBody()!=null); + adapter.setBrmsController("Test"); + assertTrue("Test".equals(adapter.getBrmsController())); + adapter.setBrmsDependency(new ArrayList<>()); + assertTrue(adapter.getBrmsDependency()!=null); + adapter.setRuleData(new LinkedHashMap<>()); + assertTrue(adapter.getRuleData()!=null); + adapter.setRuleListData(new LinkedHashMap<>()); + assertTrue(adapter.getRuleListData()!=null); + adapter.setDrlRuleAndUIParams(new LinkedHashMap<>()); + assertTrue(adapter.getDrlRuleAndUIParams()!=null); + adapter.setPolicyScope("Test"); + assertTrue("Test".equals(adapter.getPolicyScope())); + adapter.setProviderComboBox("Test"); + assertTrue("Test".equals(adapter.getProviderComboBox())); + adapter.setRiskType("Test"); + assertTrue("Test".equals(adapter.getRiskType())); + adapter.setRiskLevel("Test"); + assertTrue("Test".equals(adapter.getRiskLevel())); + adapter.setGuard("Test"); + assertTrue("Test".equals(adapter.getGuard())); + adapter.setTtlDate("Test"); + assertTrue("Test".equals(adapter.getTtlDate())); + adapter.setMatching(new LinkedHashMap<>()); + assertTrue(adapter.getMatching()!=null); + adapter.setTriggerSignatures(new ArrayList<>()); + assertTrue(adapter.getTriggerSignatures()!=null); + adapter.setSymptomSignatures(new ArrayList<>()); + assertTrue(adapter.getSymptomSignatures()!=null); + adapter.setLogicalConnector("Test"); + assertTrue("Test".equals(adapter.getLogicalConnector())); + adapter.setPolicyStatus("Test"); + assertTrue("Test".equals(adapter.getPolicyStatus())); + adapter.setGocServerScope("Test"); + assertTrue("Test".equals(adapter.getGocServerScope())); + adapter.setSupressionType("Test"); + assertTrue("Test".equals(adapter.getSupressionType())); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/RainyDayParamsTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/RainyDayParamsTest.java index 521eafdf9..210c5cd08 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/RainyDayParamsTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/RainyDayParamsTest.java @@ -27,22 +27,22 @@ import org.junit.Test; public class RainyDayParamsTest { - @Test - public void testRainyDayParams(){ - RainyDayParams params = new RainyDayParams(); - params.setServiceType("Test"); - assertTrue("Test".equals(params.getServiceType())); - params.setVnfType("Test"); - assertTrue("Test".equals(params.getVnfType())); - params.setBbid("Test"); - assertTrue("Test".equals(params.getBbid())); - params.setWorkstep("Test"); - assertTrue("Test".equals(params.getWorkstep())); - params.setTreatmentTableChoices(new ArrayList<>()); - assertTrue(params.getTreatmentTableChoices() != null); - params.setErrorcode(new ArrayList<>()); - assertTrue(params.getErrorcode() != null); - params.setTreatment(new ArrayList<>()); - assertTrue(params.getTreatment() != null); - } + @Test + public void testRainyDayParams(){ + RainyDayParams params = new RainyDayParams(); + params.setServiceType("Test"); + assertTrue("Test".equals(params.getServiceType())); + params.setVnfType("Test"); + assertTrue("Test".equals(params.getVnfType())); + params.setBbid("Test"); + assertTrue("Test".equals(params.getBbid())); + params.setWorkstep("Test"); + assertTrue("Test".equals(params.getWorkstep())); + params.setTreatmentTableChoices(new ArrayList<>()); + assertTrue(params.getTreatmentTableChoices() != null); + params.setErrorcode(new ArrayList<>()); + assertTrue(params.getErrorcode() != null); + params.setTreatment(new ArrayList<>()); + assertTrue(params.getTreatment() != null); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/YAMLParamsTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/YAMLParamsTest.java index 007141f41..ea8839e19 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/YAMLParamsTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/YAMLParamsTest.java @@ -26,30 +26,30 @@ import java.util.ArrayList; import org.junit.Test; public class YAMLParamsTest { - - @Test - public void testYAMLParams(){ - YAMLParams yamlParams = new YAMLParams(); - yamlParams.setActor("Test"); - assertTrue("Test".equals(yamlParams.getActor())); - yamlParams.setRecipe("Test"); - assertTrue("Test".equals(yamlParams.getRecipe())); - yamlParams.setClname("Test"); - assertTrue("Test".equals(yamlParams.getClname())); - yamlParams.setGuardActiveEnd("Test"); - assertTrue("Test".equals(yamlParams.getGuardActiveEnd())); - yamlParams.setGuardActiveStart("Test"); - assertTrue("Test".equals(yamlParams.getGuardActiveStart())); - yamlParams.setLimit("Test"); - assertTrue("Test".equals(yamlParams.getLimit())); - yamlParams.setBlackList(new ArrayList<>()); - assertTrue(yamlParams.getBlackList() != null); - yamlParams.setTargets(new ArrayList<>()); - assertTrue(yamlParams.getTargets() != null); - yamlParams.setTimeUnits("Test"); - assertTrue("Test".equals(yamlParams.getTimeUnits())); - yamlParams.setTimeWindow("Test"); - assertTrue("Test".equals(yamlParams.getTimeWindow())); - } + + @Test + public void testYAMLParams(){ + YAMLParams yamlParams = new YAMLParams(); + yamlParams.setActor("Test"); + assertTrue("Test".equals(yamlParams.getActor())); + yamlParams.setRecipe("Test"); + assertTrue("Test".equals(yamlParams.getRecipe())); + yamlParams.setClname("Test"); + assertTrue("Test".equals(yamlParams.getClname())); + yamlParams.setGuardActiveEnd("Test"); + assertTrue("Test".equals(yamlParams.getGuardActiveEnd())); + yamlParams.setGuardActiveStart("Test"); + assertTrue("Test".equals(yamlParams.getGuardActiveStart())); + yamlParams.setLimit("Test"); + assertTrue("Test".equals(yamlParams.getLimit())); + yamlParams.setBlackList(new ArrayList<>()); + assertTrue(yamlParams.getBlackList() != null); + yamlParams.setTargets(new ArrayList<>()); + assertTrue(yamlParams.getTargets() != null); + yamlParams.setTimeUnits("Test"); + assertTrue("Test".equals(yamlParams.getTimeUnits())); + yamlParams.setTimeWindow("Test"); + assertTrue("Test".equals(yamlParams.getTimeWindow())); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java index 7467d4dfe..f5d968b14 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java @@ -53,389 +53,389 @@ import org.springframework.test.annotation.Rollback; public class PolicyValidationDaoImplTest { - private static Logger logger = FlexLogger.getLogger(PolicyValidationDaoImplTest.class); - - SessionFactory sessionFactory; - Server server; - PolicyValidationDaoImpl commonClassDao; - - @Before - public void setUp() throws Exception{ - try{ - BasicDataSource dataSource = new BasicDataSource(); - dataSource.setDriverClassName("org.h2.Driver"); - // In-memory DB for testing - dataSource.setUrl("jdbc:h2:mem:test"); - dataSource.setUsername("sa"); - dataSource.setPassword(""); - LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(dataSource); - sessionBuilder.scanPackages("org.onap.*", "com.*"); - - Properties properties = new Properties(); - properties.put("hibernate.show_sql", "false"); - properties.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect"); - properties.put("hibernate.hbm2ddl.auto", "drop"); - properties.put("hibernate.hbm2ddl.auto", "create"); - - sessionBuilder.addProperties(properties); - sessionFactory = sessionBuilder.buildSessionFactory(); - - // Set up dao with SessionFactory - commonClassDao = new PolicyValidationDaoImpl(); - PolicyValidationDaoImpl.setSessionfactory(sessionFactory); - //PolicyController.setLogTableLimit("1"); - //HibernateSession.setSession(sessionFactory); - SystemLogDB data1 = new SystemLogDB(); - data1.setDate(new Date()); - data1.setLogtype("INFO"); - data1.setRemote("Test"); - data1.setSystem("Test"); - data1.setType("Test"); - SystemLogDB data2 = new SystemLogDB(); - data2.setDate(new Date()); - data2.setLogtype("error"); - data2.setRemote("Test"); - data2.setSystem("Test"); - data2.setType("Test"); - //HibernateSession.getSession().save(data1); - //HibernateSession.getSession().save(data2); - - // Create TCP server for troubleshooting - server = Server.createTcpServer("-tcpAllowOthers").start(); - System.out.println("URL: jdbc:h2:" + server.getURL() + "/mem:test"); - - }catch(Exception e){ - System.err.println(e); - fail(); - } - } - - @Test - @Transactional + private static Logger logger = FlexLogger.getLogger(PolicyValidationDaoImplTest.class); + + SessionFactory sessionFactory; + Server server; + PolicyValidationDaoImpl commonClassDao; + + @Before + public void setUp() throws Exception{ + try{ + BasicDataSource dataSource = new BasicDataSource(); + dataSource.setDriverClassName("org.h2.Driver"); + // In-memory DB for testing + dataSource.setUrl("jdbc:h2:mem:test"); + dataSource.setUsername("sa"); + dataSource.setPassword(""); + LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(dataSource); + sessionBuilder.scanPackages("org.onap.*", "com.*"); + + Properties properties = new Properties(); + properties.put("hibernate.show_sql", "false"); + properties.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect"); + properties.put("hibernate.hbm2ddl.auto", "drop"); + properties.put("hibernate.hbm2ddl.auto", "create"); + + sessionBuilder.addProperties(properties); + sessionFactory = sessionBuilder.buildSessionFactory(); + + // Set up dao with SessionFactory + commonClassDao = new PolicyValidationDaoImpl(); + PolicyValidationDaoImpl.setSessionfactory(sessionFactory); + //PolicyController.setLogTableLimit("1"); + //HibernateSession.setSession(sessionFactory); + SystemLogDB data1 = new SystemLogDB(); + data1.setDate(new Date()); + data1.setLogtype("INFO"); + data1.setRemote("Test"); + data1.setSystem("Test"); + data1.setType("Test"); + SystemLogDB data2 = new SystemLogDB(); + data2.setDate(new Date()); + data2.setLogtype("error"); + data2.setRemote("Test"); + data2.setSystem("Test"); + data2.setType("Test"); + //HibernateSession.getSession().save(data1); + //HibernateSession.getSession().save(data2); + + // Create TCP server for troubleshooting + server = Server.createTcpServer("-tcpAllowOthers").start(); + System.out.println("URL: jdbc:h2:" + server.getURL() + "/mem:test"); + + }catch(Exception e){ + System.err.println(e); + fail(); + } + } + + @Test + @Transactional @Rollback(true) - public void testDB(){ - try{ - // Add data - UserInfo userinfo = new UserInfo(); - userinfo.setUserLoginId("Test"); - userinfo.setUserName("Test"); - commonClassDao.save(userinfo); - OnapName onapName = new OnapName(); - onapName.setOnapName("Test"); - onapName.setUserCreatedBy(userinfo); - onapName.setUserModifiedBy(userinfo); - onapName.setModifiedDate(new Date()); - commonClassDao.save(onapName); - - - List<Object> list = commonClassDao.getData(OnapName.class); - assertTrue(list.size() == 1); - logger.debug(list.size()); - logger.debug(list.get(0)); - }catch(Exception e){ - logger.debug("Exception Occured"+e); - fail(); - } - } - - @Test - @Transactional + public void testDB(){ + try{ + // Add data + UserInfo userinfo = new UserInfo(); + userinfo.setUserLoginId("Test"); + userinfo.setUserName("Test"); + commonClassDao.save(userinfo); + OnapName onapName = new OnapName(); + onapName.setOnapName("Test"); + onapName.setUserCreatedBy(userinfo); + onapName.setUserModifiedBy(userinfo); + onapName.setModifiedDate(new Date()); + commonClassDao.save(onapName); + + + List<Object> list = commonClassDao.getData(OnapName.class); + assertTrue(list.size() == 1); + logger.debug(list.size()); + logger.debug(list.get(0)); + }catch(Exception e){ + logger.debug("Exception Occured"+e); + fail(); + } + } + + @Test + @Transactional @Rollback(true) - public void testUser(){ - try{ - // Add data - UserInfo userinfo = new UserInfo(); - String loginId_userName = "Test"; - userinfo.setUserLoginId(loginId_userName); - userinfo.setUserName(loginId_userName); - commonClassDao.save(userinfo); + public void testUser(){ + try{ + // Add data + UserInfo userinfo = new UserInfo(); + String loginId_userName = "Test"; + userinfo.setUserLoginId(loginId_userName); + userinfo.setUserName(loginId_userName); + commonClassDao.save(userinfo); - List<Object> dataCur = commonClassDao.getDataByQuery("from UserInfo", new SimpleBindings()); + List<Object> dataCur = commonClassDao.getDataByQuery("from UserInfo", new SimpleBindings()); - assertEquals(1, dataCur.size()); - UserInfo cur = (UserInfo) dataCur.get(0); - assertEquals(loginId_userName, cur.getUserLoginId()); - assertEquals(loginId_userName, cur.getUserName()); + assertEquals(1, dataCur.size()); + UserInfo cur = (UserInfo) dataCur.get(0); + assertEquals(loginId_userName, cur.getUserLoginId()); + assertEquals(loginId_userName, cur.getUserName()); - assertFalse(dataCur.isEmpty()); + assertFalse(dataCur.isEmpty()); - }catch(Exception e){ - logger.debug("Exception Occured"+e); - fail(); - } - } + }catch(Exception e){ + logger.debug("Exception Occured"+e); + fail(); + } + } - @Test - @Transactional + @Test + @Transactional @Rollback(true) - public void getDataByQuery_DashboardController(){ - try{ - // Add data - PolicyEntity pe = new PolicyEntity(); - String name = "TestPolicy"; - pe.setPolicyName(name); - pe.setPolicyData("dummyData"); - pe.prePersist(); - pe.setScope("dummyScope"); - pe.setDescription("descr"); - pe.setDeleted(false); - pe.setCreatedBy("Test"); - commonClassDao.save(pe); - - List<Object> dataCur = commonClassDao.getDataByQuery("from PolicyEntity", new SimpleBindings()); - - assertTrue(1 == dataCur.size()); - assertTrue( dataCur.get(0) instanceof PolicyEntity); - assertEquals( name, ((PolicyEntity)dataCur.get(0)).getPolicyName()); - assertEquals( pe, ((PolicyEntity)dataCur.get(0))); - - - }catch(Exception e){ - logger.debug("Exception Occured"+e); - fail(); - } - } - - @Test - @Transactional + public void getDataByQuery_DashboardController(){ + try{ + // Add data + PolicyEntity pe = new PolicyEntity(); + String name = "TestPolicy"; + pe.setPolicyName(name); + pe.setPolicyData("dummyData"); + pe.prePersist(); + pe.setScope("dummyScope"); + pe.setDescription("descr"); + pe.setDeleted(false); + pe.setCreatedBy("Test"); + commonClassDao.save(pe); + + List<Object> dataCur = commonClassDao.getDataByQuery("from PolicyEntity", new SimpleBindings()); + + assertTrue(1 == dataCur.size()); + assertTrue( dataCur.get(0) instanceof PolicyEntity); + assertEquals( name, ((PolicyEntity)dataCur.get(0)).getPolicyName()); + assertEquals( pe, ((PolicyEntity)dataCur.get(0))); + + + }catch(Exception e){ + logger.debug("Exception Occured"+e); + fail(); + } + } + + @Test + @Transactional @Rollback(true) - public void getDataByQuery_AutoPushController(){ - try{ - // Add data - PolicyVersion pv = new PolicyVersion(); - pv.setActiveVersion(2); - pv.setPolicyName("myPname"); - pv.prePersist(); - pv.setCreatedBy("Test"); - pv.setModifiedBy("Test"); - - PolicyVersion pv2 = new PolicyVersion(); - pv2.setActiveVersion(1); - pv2.setPolicyName("test"); - pv2.prePersist(); - pv2.setCreatedBy("Test"); - pv2.setModifiedBy("Test"); - - commonClassDao.save(pv); - commonClassDao.save(pv2); - - String scope = "my"; - scope += "%"; - String query = "From PolicyVersion where policy_name like :scope and id > 0"; - SimpleBindings params = new SimpleBindings(); - params.put("scope", scope); - List<Object> dataCur = commonClassDao.getDataByQuery(query, params); - - - assertTrue(1 == dataCur.size()); - assertEquals(pv, (PolicyVersion) dataCur.get(0)); - - }catch(Exception e){ - logger.debug("Exception Occured"+e); - fail(); - } - } - - @Test - @Transactional + public void getDataByQuery_AutoPushController(){ + try{ + // Add data + PolicyVersion pv = new PolicyVersion(); + pv.setActiveVersion(2); + pv.setPolicyName("myPname"); + pv.prePersist(); + pv.setCreatedBy("Test"); + pv.setModifiedBy("Test"); + + PolicyVersion pv2 = new PolicyVersion(); + pv2.setActiveVersion(1); + pv2.setPolicyName("test"); + pv2.prePersist(); + pv2.setCreatedBy("Test"); + pv2.setModifiedBy("Test"); + + commonClassDao.save(pv); + commonClassDao.save(pv2); + + String scope = "my"; + scope += "%"; + String query = "From PolicyVersion where policy_name like :scope and id > 0"; + SimpleBindings params = new SimpleBindings(); + params.put("scope", scope); + List<Object> dataCur = commonClassDao.getDataByQuery(query, params); + + + assertTrue(1 == dataCur.size()); + assertEquals(pv, (PolicyVersion) dataCur.get(0)); + + }catch(Exception e){ + logger.debug("Exception Occured"+e); + fail(); + } + } + + @Test + @Transactional @Rollback(true) - public void getDataByQuery_PolicyNotificationMail(){ - try{ - // Add data - WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable(); - String policyFileName = "banana"; - watch.setLoginIds("Test"); - watch.setPolicyName("bananaWatch"); - commonClassDao.save(watch); - - if(policyFileName.contains("/")){ - policyFileName = policyFileName.substring(0, policyFileName.indexOf("/")); - policyFileName = policyFileName.replace("/", File.separator); - } - if(policyFileName.contains("\\")){ - policyFileName = policyFileName.substring(0, policyFileName.indexOf("\\")); - policyFileName = policyFileName.replace("\\", "\\\\"); - } - - - // Current Implementation - policyFileName += "%"; - String query = "from WatchPolicyNotificationTable where policyName like:policyFileName"; - SimpleBindings params = new SimpleBindings(); - params.put("policyFileName", policyFileName); - List<Object> dataCur = commonClassDao.getDataByQuery(query, params); - - // Assertions - assertTrue(dataCur.size() == 1); - assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable); - assertEquals(watch, (WatchPolicyNotificationTable) dataCur.get(0)); - - }catch(Exception e){ - logger.debug("Exception Occured"+e); - fail(); - } - } - - - @Test - @Transactional + public void getDataByQuery_PolicyNotificationMail(){ + try{ + // Add data + WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable(); + String policyFileName = "banana"; + watch.setLoginIds("Test"); + watch.setPolicyName("bananaWatch"); + commonClassDao.save(watch); + + if(policyFileName.contains("/")){ + policyFileName = policyFileName.substring(0, policyFileName.indexOf("/")); + policyFileName = policyFileName.replace("/", File.separator); + } + if(policyFileName.contains("\\")){ + policyFileName = policyFileName.substring(0, policyFileName.indexOf("\\")); + policyFileName = policyFileName.replace("\\", "\\\\"); + } + + + // Current Implementation + policyFileName += "%"; + String query = "from WatchPolicyNotificationTable where policyName like:policyFileName"; + SimpleBindings params = new SimpleBindings(); + params.put("policyFileName", policyFileName); + List<Object> dataCur = commonClassDao.getDataByQuery(query, params); + + // Assertions + assertTrue(dataCur.size() == 1); + assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable); + assertEquals(watch, (WatchPolicyNotificationTable) dataCur.get(0)); + + }catch(Exception e){ + logger.debug("Exception Occured"+e); + fail(); + } + } + + + @Test + @Transactional @Rollback(true) - public void getDataByQuery_PolicyController(){ - try{ - // Add data - PolicyEntity pe = new PolicyEntity(); - String name = "actionDummy"; - pe.setPolicyName(name); - pe.setPolicyData("dummyData"); - pe.prePersist(); - pe.setScope("dummyScope"); - pe.setDescription("descr"); - pe.setDeleted(false); - pe.setCreatedBy("Test"); - commonClassDao.save(pe); - - String dbCheckName = "dummyScope:action"; - String[] splitDBCheckName = dbCheckName.split(":"); - - - // Current Implementation - String query = "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0"; - SimpleBindings params = new SimpleBindings(); - params.put("splitDBCheckName1", splitDBCheckName[1] + "%"); - params.put("splitDBCheckName0", splitDBCheckName[0]); - List<Object> dataCur = commonClassDao.getDataByQuery(query, params); - - // Assertions - assertTrue(dataCur.size() == 1); - assertTrue(dataCur.get(0) instanceof PolicyEntity); - assertEquals(pe, (PolicyEntity) dataCur.get(0)); - - }catch(Exception e){ - logger.debug("Exception Occured"+e); - fail(); - } - } - - @Test - @Transactional + public void getDataByQuery_PolicyController(){ + try{ + // Add data + PolicyEntity pe = new PolicyEntity(); + String name = "actionDummy"; + pe.setPolicyName(name); + pe.setPolicyData("dummyData"); + pe.prePersist(); + pe.setScope("dummyScope"); + pe.setDescription("descr"); + pe.setDeleted(false); + pe.setCreatedBy("Test"); + commonClassDao.save(pe); + + String dbCheckName = "dummyScope:action"; + String[] splitDBCheckName = dbCheckName.split(":"); + + + // Current Implementation + String query = "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0"; + SimpleBindings params = new SimpleBindings(); + params.put("splitDBCheckName1", splitDBCheckName[1] + "%"); + params.put("splitDBCheckName0", splitDBCheckName[0]); + List<Object> dataCur = commonClassDao.getDataByQuery(query, params); + + // Assertions + assertTrue(dataCur.size() == 1); + assertTrue(dataCur.get(0) instanceof PolicyEntity); + assertEquals(pe, (PolicyEntity) dataCur.get(0)); + + }catch(Exception e){ + logger.debug("Exception Occured"+e); + fail(); + } + } + + @Test + @Transactional @Rollback(true) - public void getDataByQuery_PolicyNotificationController(){ - try{ - // Add data - WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable(); - String finalName = "banana"; // Policy File Name - String userId = "Test"; - watch.setLoginIds(userId); - watch.setPolicyName(finalName); - commonClassDao.save(watch); - - - // Current Implementation - String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId"; - SimpleBindings params = new SimpleBindings(); - params.put("finalName", finalName); - params.put("userId", userId); - List<Object> dataCur = commonClassDao.getDataByQuery(query, params); - - // Assertions - assertTrue(dataCur.size() == 1); - assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable); - assertEquals(watch, (WatchPolicyNotificationTable) dataCur.get(0) ); - - }catch(Exception e){ - logger.debug("Exception Occured"+e); - fail(); - } - } - - - /* Test for SQL Injection Protection - */ - - @Test - @Transactional + public void getDataByQuery_PolicyNotificationController(){ + try{ + // Add data + WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable(); + String finalName = "banana"; // Policy File Name + String userId = "Test"; + watch.setLoginIds(userId); + watch.setPolicyName(finalName); + commonClassDao.save(watch); + + + // Current Implementation + String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId"; + SimpleBindings params = new SimpleBindings(); + params.put("finalName", finalName); + params.put("userId", userId); + List<Object> dataCur = commonClassDao.getDataByQuery(query, params); + + // Assertions + assertTrue(dataCur.size() == 1); + assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable); + assertEquals(watch, (WatchPolicyNotificationTable) dataCur.get(0) ); + + }catch(Exception e){ + logger.debug("Exception Occured"+e); + fail(); + } + } + + + /* Test for SQL Injection Protection + */ + + @Test + @Transactional @Rollback(true) - public void getDataByQuery_PolicyNotificationController_Injection(){ - try{ - // Add data - WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable(); - String userId = "Test"; - watch.setLoginIds(userId); - watch.setPolicyName("banana"); - commonClassDao.save(watch); - - WatchPolicyNotificationTable watch2 = new WatchPolicyNotificationTable(); - watch2.setLoginIds(userId); - watch2.setPolicyName("banana2"); - commonClassDao.save(watch2); - - // SQL Injection attempt - String finalName = "banana' OR '1'='1"; - - - // Current Implementation - String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId"; - SimpleBindings params = new SimpleBindings(); - params.put("finalName", finalName); - params.put("userId", userId); - List<Object> dataCur = commonClassDao.getDataByQuery(query, params); - - // Assertions - assertTrue(dataCur.size() <= 1); - - if(dataCur.size() >= 1){ - assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable); - assertFalse(watch.equals((WatchPolicyNotificationTable) dataCur.get(0))); - assertFalse(watch.equals((WatchPolicyNotificationTable) dataCur.get(0))); - } - }catch(Exception e){ - logger.debug("Exception Occured"+e); - fail(); - } - } - - @Test - public void testCommonClassDaoImplMethods(){ - try{ - UserInfo userInfo = new UserInfo(); - userInfo.setUserLoginId("TestID"); - userInfo.setUserName("Test"); - commonClassDao.save(userInfo); - List<Object> data = commonClassDao.getDataById(UserInfo.class, "userLoginId:userName", "TestID:Test"); - assertTrue(data.size() == 1); - UserInfo userInfoUpdate = (UserInfo) data.get(0); - userInfoUpdate.setUserName("Test1"); - commonClassDao.update(userInfoUpdate); - List<String> data1 = commonClassDao.getDataByColumn(UserInfo.class, "userLoginId"); - assertTrue(data1.size() == 1); - UserInfo data2 = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId:userName", "TestID:Test1"); - assertTrue("TestID".equals(data2.getUserLoginId())); - List<Object> data3 = commonClassDao.checkDuplicateEntry("TestID:Test1", "userLoginId:userName", UserInfo.class); - assertTrue(data3.size() == 1); - PolicyRoles roles = new PolicyRoles(); - roles.setRole("admin"); - roles.setLoginId(userInfo); - roles.setScope("test"); - commonClassDao.save(roles); - List<PolicyRoles> roles1 = commonClassDao.getUserRoles(); - assertTrue(roles1.size() == 1); - List<String> multipleData = new ArrayList<>(); - multipleData.add("TestID:Test1"); - List<Object> data4 = commonClassDao.getMultipleDataOnAddingConjunction(UserInfo.class, "userLoginId:userName", multipleData); - assertTrue(data4.size() == 1); - commonClassDao.delete(data2); - }catch(Exception e){ - logger.debug("Exception Occured"+e); - fail(); - } - } - - @After - public void deleteDB(){ - sessionFactory.close(); - server.stop(); - - } + public void getDataByQuery_PolicyNotificationController_Injection(){ + try{ + // Add data + WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable(); + String userId = "Test"; + watch.setLoginIds(userId); + watch.setPolicyName("banana"); + commonClassDao.save(watch); + + WatchPolicyNotificationTable watch2 = new WatchPolicyNotificationTable(); + watch2.setLoginIds(userId); + watch2.setPolicyName("banana2"); + commonClassDao.save(watch2); + + // SQL Injection attempt + String finalName = "banana' OR '1'='1"; + + + // Current Implementation + String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId"; + SimpleBindings params = new SimpleBindings(); + params.put("finalName", finalName); + params.put("userId", userId); + List<Object> dataCur = commonClassDao.getDataByQuery(query, params); + + // Assertions + assertTrue(dataCur.size() <= 1); + + if(dataCur.size() >= 1){ + assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable); + assertFalse(watch.equals((WatchPolicyNotificationTable) dataCur.get(0))); + assertFalse(watch.equals((WatchPolicyNotificationTable) dataCur.get(0))); + } + }catch(Exception e){ + logger.debug("Exception Occured"+e); + fail(); + } + } + + @Test + public void testCommonClassDaoImplMethods(){ + try{ + UserInfo userInfo = new UserInfo(); + userInfo.setUserLoginId("TestID"); + userInfo.setUserName("Test"); + commonClassDao.save(userInfo); + List<Object> data = commonClassDao.getDataById(UserInfo.class, "userLoginId:userName", "TestID:Test"); + assertTrue(data.size() == 1); + UserInfo userInfoUpdate = (UserInfo) data.get(0); + userInfoUpdate.setUserName("Test1"); + commonClassDao.update(userInfoUpdate); + List<String> data1 = commonClassDao.getDataByColumn(UserInfo.class, "userLoginId"); + assertTrue(data1.size() == 1); + UserInfo data2 = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId:userName", "TestID:Test1"); + assertTrue("TestID".equals(data2.getUserLoginId())); + List<Object> data3 = commonClassDao.checkDuplicateEntry("TestID:Test1", "userLoginId:userName", UserInfo.class); + assertTrue(data3.size() == 1); + PolicyRoles roles = new PolicyRoles(); + roles.setRole("admin"); + roles.setLoginId(userInfo); + roles.setScope("test"); + commonClassDao.save(roles); + List<PolicyRoles> roles1 = commonClassDao.getUserRoles(); + assertTrue(roles1.size() == 1); + List<String> multipleData = new ArrayList<>(); + multipleData.add("TestID:Test1"); + List<Object> data4 = commonClassDao.getMultipleDataOnAddingConjunction(UserInfo.class, "userLoginId:userName", multipleData); + assertTrue(data4.size() == 1); + commonClassDao.delete(data2); + }catch(Exception e){ + logger.debug("Exception Occured"+e); + fail(); + } + } + + @After + public void deleteDB(){ + sessionFactory.close(); + server.stop(); + + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPATest.java index 61f44bdbf..580b3e35d 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPATest.java @@ -32,262 +32,262 @@ import org.onap.policy.common.logging.flexlogger.Logger; public class ActionDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(ActionDictionaryJPATest.class); - private UserInfo userInfo; - - @Before - public void setUp() throws Exception { - logger.info("setUp: Entering"); - userInfo = new UserInfo(); - userInfo.setUserLoginId("Test"); - userInfo.setUserName("Test"); - logger.info("setUp: exit"); - } - - @Test - public void testActionDictionary(){ - ActionPolicyDict data = new ActionPolicyDict(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setAttributeName("Test"); - assertTrue("Test".equals(data.getAttributeName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setBody("Test"); - assertTrue("Test".equals(data.getBody())); - data.setHeader("Test"); - assertTrue("Test".equals(data.getHeader())); - data.setMethod("GET"); - assertTrue("GET".equals(data.getMethod())); - data.setType("JSON"); - assertTrue("JSON".equals(data.getType())); - data.setUrl("http://test.com"); - assertTrue("http://test.com".equals(data.getUrl())); - data.prePersist(); - data.preUpdate(); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - - @Test - public void testFunctionArgument(){ - FunctionArgument data = new FunctionArgument(); - data.setArgIndex(1); - assertTrue(1 == data.getArgIndex()); - data.setDatatypeBean(new Datatype()); - assertTrue(data.getDatatypeBean()!=null); - data.setFunctionDefinition(new FunctionDefinition()); - assertTrue(data.getFunctionDefinition()!=null); - data.setId(1); - assertTrue(1 == data.getId()); - data.isBag(); - data.toString(); - data.setIsBag(1); - assertTrue(1 == data.getIsBag()); - new FunctionArgument(data); - } - - @Test - public void testFunctionDefinition(){ - FunctionDefinition data = new FunctionDefinition(); - data.setArgLb(1); - assertTrue(1 == data.getArgLb()); - data.setArgUb(1); - assertTrue(1 == data.getArgUb()); - data.setDatatypeBean(new Datatype()); - assertTrue(data.getDatatypeBean()!=null); - data.setFunctionArguments(new ArrayList<>()); - assertTrue(data.getFunctionArguments()!=null); - data.setHigherOrderArg_LB(1); - assertTrue(1 == data.getHigherOrderArg_LB()); - data.setHigherOrderArg_UB(1); - assertTrue(1 == data.getHigherOrderArg_UB()); - data.setId(1); - assertTrue(1 == data.getId()); - data.setIsBagReturn(1); - assertTrue(1 == data.getIsBagReturn()); - data.setIsHigherOrder(1); - assertTrue(1 == data.getIsHigherOrder()); - data.setShortname("Test"); - assertTrue("Test".equals(data.getShortname())); - data.setXacmlid("Test"); - assertTrue("Test".equals(data.getXacmlid())); - data.toString(); - data.isBagReturn(); - data.isHigherOrder(); - data.addFunctionArgument(new FunctionArgument()); - data.removeFunctionArgument(new FunctionArgument()); - } - - @Test - public void testCategory(){ - Category data = new Category(); - new Category(null); - data.setAttributes(new HashSet<>()); - data.addAttribute(new Attribute()); - data.removeAttribute(new Attribute()); - data.isStandard(); - data.isCustom(); - Category.extractGrouping("urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject"); - data.getIdentifer(); - data.toString(); - assertTrue(data.getAttributes()!=null); - data.setGrouping("Test"); - assertTrue("Test".equals(data.getGrouping())); - data.setId(1); - assertTrue(1 == data.getId()); - data.setShortName("Test"); - assertTrue("Test".equals(data.getShortName())); - data.setXacmlId("Test"); - assertTrue("Test".equals(data.getXacmlId())); - } - - @Test - public void testConstraintType(){ - ConstraintType data = new ConstraintType(); - new ConstraintType("Test", "Test"); - ConstraintType.getRangeTypes(); - data.setAttributes(new HashSet<>()); - assertTrue(data.getAttributes()!=null); - data.setConstraintType("Test"); - assertTrue("Test".equals(data.getConstraintType())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setId(1); - assertTrue(1 == data.getId()); - } - - @Test - public void testConstraintValue(){ - ConstraintValue data = new ConstraintValue(); - data.clone(); - new ConstraintValue(new ConstraintValue()); - new ConstraintValue("Test","Test"); - data.setAttribute(new Attribute()); - assertTrue(data.getAttribute()!=null); - data.setId(1); - assertTrue(1 == data.getId()); - data.setProperty("Test"); - assertTrue("Test".equals(data.getProperty())); - data.setValue("Test"); - assertTrue("Test".equals(data.getValue())); - } - - @Test - public void testObadvice(){ - Obadvice data = new Obadvice(); - new Obadvice(); - new Obadvice("Test", "Test"); - data.clone(); - data.addObadviceExpression(new ObadviceExpression()); - data.removeObadviceExpression(new ObadviceExpression()); - data.removeAllExpressions(); - data.prePersist(); - data.preUpdate(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setCreatedBy("Test"); - assertTrue("Test".equals(data.getCreatedBy())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setFulfillOn("Test"); - assertTrue("Test".equals(data.getFulfillOn())); - data.setModifiedBy("Test"); - assertTrue("Test".equals(data.getModifiedBy())); - data.setObadviceExpressions(new HashSet<>()); - assertTrue(data.getObadviceExpressions()!=null); - data.setType("Test"); - assertTrue("Test".equals(data.getType())); - data.setXacmlId("Test"); - assertTrue("Test".equals(data.getXacmlId())); - } - - @Test - public void testObadviceExpression(){ - ObadviceExpression data = new ObadviceExpression(); - data.clone(); - data.setAttribute(new Attribute()); - assertTrue(data.getAttribute()!=null); - data.setId(1); - assertTrue(1 == data.getId()); - data.setObadvice(new Obadvice()); - assertTrue(data.getObadvice()!=null); - data.setType("Test"); - assertTrue("Test".equals(data.getType())); - } - - @Test - public void testRuleAlgorithms(){ - RuleAlgorithms data = new RuleAlgorithms(); - data.isCustom(); - data.isStandard(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setShortName("Test"); - assertTrue("Test".equals(data.getShortName())); - data.setXacmlId("Test"); - assertTrue("Test".equals(data.getXacmlId())); - data.toString(); - } - - @Test - public void testAttributeAssignment(){ - AttributeAssignment data = new AttributeAssignment(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setAttributeId(1); - assertTrue(1 == data.getAttributeId()); - data.setExpression("Test"); - assertTrue("Test".equals(data.getExpression())); - } - - @Test - public void testDatatype(){ - Datatype data = new Datatype(); - new Datatype(null); - new Datatype(1, new Datatype()); - data.setArguments(new HashSet<>()); - assertTrue(data.getArguments()!=null); - data.setAttributes(new HashSet<>()); - assertTrue(data.getAttributes()!=null); - data.setFunctions(new HashSet<>()); - assertTrue(data.getFunctions()!=null); - data.setId(1); - assertTrue(1 == data.getId()); - data.setShortName("Test"); - assertTrue("Test".equals(data.getShortName())); - data.setXacmlId("Test"); - assertTrue("Test".equals(data.getXacmlId())); - data.addArgument(new FunctionArgument()); - data.addAttribute(new Attribute()); - data.addFunction(new FunctionDefinition()); - data.removeArgument(new FunctionArgument()); - data.removeAttribute(new Attribute()); - data.removeAttribute(new FunctionDefinition()); - assertTrue(data.getIdentifer()!=null); - assertTrue(data.getIdentiferByShortName()!=null); - data.setIsStandard(Datatype.STANDARD); - assertTrue(data.isStandard()); - data.setIsStandard(Datatype.CUSTOM); - assertTrue(data.isCustom()); - } - - @Test - public void testPolicyAlgorithms(){ - PolicyAlgorithms data = new PolicyAlgorithms(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setShortName("Test"); - assertTrue("Test".equals(data.getShortName())); - data.setXacmlId("Test"); - assertTrue("Test".equals(data.getXacmlId())); - data.setIsStandard(PolicyAlgorithms.STANDARD); - assertTrue(data.isStandard()); - } + private static Logger logger = FlexLogger.getLogger(ActionDictionaryJPATest.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testActionDictionary(){ + ActionPolicyDict data = new ActionPolicyDict(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setAttributeName("Test"); + assertTrue("Test".equals(data.getAttributeName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setBody("Test"); + assertTrue("Test".equals(data.getBody())); + data.setHeader("Test"); + assertTrue("Test".equals(data.getHeader())); + data.setMethod("GET"); + assertTrue("GET".equals(data.getMethod())); + data.setType("JSON"); + assertTrue("JSON".equals(data.getType())); + data.setUrl("http://test.com"); + assertTrue("http://test.com".equals(data.getUrl())); + data.prePersist(); + data.preUpdate(); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testFunctionArgument(){ + FunctionArgument data = new FunctionArgument(); + data.setArgIndex(1); + assertTrue(1 == data.getArgIndex()); + data.setDatatypeBean(new Datatype()); + assertTrue(data.getDatatypeBean()!=null); + data.setFunctionDefinition(new FunctionDefinition()); + assertTrue(data.getFunctionDefinition()!=null); + data.setId(1); + assertTrue(1 == data.getId()); + data.isBag(); + data.toString(); + data.setIsBag(1); + assertTrue(1 == data.getIsBag()); + new FunctionArgument(data); + } + + @Test + public void testFunctionDefinition(){ + FunctionDefinition data = new FunctionDefinition(); + data.setArgLb(1); + assertTrue(1 == data.getArgLb()); + data.setArgUb(1); + assertTrue(1 == data.getArgUb()); + data.setDatatypeBean(new Datatype()); + assertTrue(data.getDatatypeBean()!=null); + data.setFunctionArguments(new ArrayList<>()); + assertTrue(data.getFunctionArguments()!=null); + data.setHigherOrderArg_LB(1); + assertTrue(1 == data.getHigherOrderArg_LB()); + data.setHigherOrderArg_UB(1); + assertTrue(1 == data.getHigherOrderArg_UB()); + data.setId(1); + assertTrue(1 == data.getId()); + data.setIsBagReturn(1); + assertTrue(1 == data.getIsBagReturn()); + data.setIsHigherOrder(1); + assertTrue(1 == data.getIsHigherOrder()); + data.setShortname("Test"); + assertTrue("Test".equals(data.getShortname())); + data.setXacmlid("Test"); + assertTrue("Test".equals(data.getXacmlid())); + data.toString(); + data.isBagReturn(); + data.isHigherOrder(); + data.addFunctionArgument(new FunctionArgument()); + data.removeFunctionArgument(new FunctionArgument()); + } + + @Test + public void testCategory(){ + Category data = new Category(); + new Category(null); + data.setAttributes(new HashSet<>()); + data.addAttribute(new Attribute()); + data.removeAttribute(new Attribute()); + data.isStandard(); + data.isCustom(); + Category.extractGrouping("urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject"); + data.getIdentifer(); + data.toString(); + assertTrue(data.getAttributes()!=null); + data.setGrouping("Test"); + assertTrue("Test".equals(data.getGrouping())); + data.setId(1); + assertTrue(1 == data.getId()); + data.setShortName("Test"); + assertTrue("Test".equals(data.getShortName())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + } + + @Test + public void testConstraintType(){ + ConstraintType data = new ConstraintType(); + new ConstraintType("Test", "Test"); + ConstraintType.getRangeTypes(); + data.setAttributes(new HashSet<>()); + assertTrue(data.getAttributes()!=null); + data.setConstraintType("Test"); + assertTrue("Test".equals(data.getConstraintType())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setId(1); + assertTrue(1 == data.getId()); + } + + @Test + public void testConstraintValue(){ + ConstraintValue data = new ConstraintValue(); + data.clone(); + new ConstraintValue(new ConstraintValue()); + new ConstraintValue("Test","Test"); + data.setAttribute(new Attribute()); + assertTrue(data.getAttribute()!=null); + data.setId(1); + assertTrue(1 == data.getId()); + data.setProperty("Test"); + assertTrue("Test".equals(data.getProperty())); + data.setValue("Test"); + assertTrue("Test".equals(data.getValue())); + } + + @Test + public void testObadvice(){ + Obadvice data = new Obadvice(); + new Obadvice(); + new Obadvice("Test", "Test"); + data.clone(); + data.addObadviceExpression(new ObadviceExpression()); + data.removeObadviceExpression(new ObadviceExpression()); + data.removeAllExpressions(); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setFulfillOn("Test"); + assertTrue("Test".equals(data.getFulfillOn())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setObadviceExpressions(new HashSet<>()); + assertTrue(data.getObadviceExpressions()!=null); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + } + + @Test + public void testObadviceExpression(){ + ObadviceExpression data = new ObadviceExpression(); + data.clone(); + data.setAttribute(new Attribute()); + assertTrue(data.getAttribute()!=null); + data.setId(1); + assertTrue(1 == data.getId()); + data.setObadvice(new Obadvice()); + assertTrue(data.getObadvice()!=null); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); + } + + @Test + public void testRuleAlgorithms(){ + RuleAlgorithms data = new RuleAlgorithms(); + data.isCustom(); + data.isStandard(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setShortName("Test"); + assertTrue("Test".equals(data.getShortName())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + data.toString(); + } + + @Test + public void testAttributeAssignment(){ + AttributeAssignment data = new AttributeAssignment(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setAttributeId(1); + assertTrue(1 == data.getAttributeId()); + data.setExpression("Test"); + assertTrue("Test".equals(data.getExpression())); + } + + @Test + public void testDatatype(){ + Datatype data = new Datatype(); + new Datatype(null); + new Datatype(1, new Datatype()); + data.setArguments(new HashSet<>()); + assertTrue(data.getArguments()!=null); + data.setAttributes(new HashSet<>()); + assertTrue(data.getAttributes()!=null); + data.setFunctions(new HashSet<>()); + assertTrue(data.getFunctions()!=null); + data.setId(1); + assertTrue(1 == data.getId()); + data.setShortName("Test"); + assertTrue("Test".equals(data.getShortName())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + data.addArgument(new FunctionArgument()); + data.addAttribute(new Attribute()); + data.addFunction(new FunctionDefinition()); + data.removeArgument(new FunctionArgument()); + data.removeAttribute(new Attribute()); + data.removeAttribute(new FunctionDefinition()); + assertTrue(data.getIdentifer()!=null); + assertTrue(data.getIdentiferByShortName()!=null); + data.setIsStandard(Datatype.STANDARD); + assertTrue(data.isStandard()); + data.setIsStandard(Datatype.CUSTOM); + assertTrue(data.isCustom()); + } + + @Test + public void testPolicyAlgorithms(){ + PolicyAlgorithms data = new PolicyAlgorithms(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setShortName("Test"); + assertTrue("Test".equals(data.getShortName())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + data.setIsStandard(PolicyAlgorithms.STANDARD); + assertTrue(data.isStandard()); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPATest.java index 72c1b7dcd..9012cca28 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPATest.java @@ -30,80 +30,80 @@ import org.onap.policy.common.logging.flexlogger.Logger; public class BRMSDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(BRMSDictionaryJPATest.class); - private UserInfo userInfo; - - @Before - public void setUp() throws Exception { - logger.info("setUp: Entering"); - userInfo = new UserInfo(); - userInfo.setUserLoginId("Test"); - userInfo.setUserName("Test"); - logger.info("setUp: exit"); - } - - @Test - public void testBRMSParamTemplate(){ - BRMSParamTemplate data = new BRMSParamTemplate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setRule("Test"); - assertTrue("Test".equals(data.getRule())); - data.setRuleName("Test"); - assertTrue("Test".equals(data.getRuleName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - } - - @Test - public void testBRMSController(){ - BRMSController data = new BRMSController(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setController("Test"); - assertTrue("Test".equals(data.getController())); - data.setControllerName("Test"); - assertTrue("Test".equals(data.getControllerName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - - @Test - public void testBRMSDependency(){ - BRMSDependency data = new BRMSDependency(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setDependency("Test"); - assertTrue("Test".equals(data.getDependency())); - data.setDependencyName("Test"); - assertTrue("Test".equals(data.getDependencyName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - + private static Logger logger = FlexLogger.getLogger(BRMSDictionaryJPATest.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testBRMSParamTemplate(){ + BRMSParamTemplate data = new BRMSParamTemplate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setRule("Test"); + assertTrue("Test".equals(data.getRule())); + data.setRuleName("Test"); + assertTrue("Test".equals(data.getRuleName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + } + + @Test + public void testBRMSController(){ + BRMSController data = new BRMSController(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setController("Test"); + assertTrue("Test".equals(data.getController())); + data.setControllerName("Test"); + assertTrue("Test".equals(data.getControllerName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testBRMSDependency(){ + BRMSDependency data = new BRMSDependency(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setDependency("Test"); + assertTrue("Test".equals(data.getDependency())); + data.setDependencyName("Test"); + assertTrue("Test".equals(data.getDependencyName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java index aa93aacd6..2274855e1 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java @@ -29,144 +29,144 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; public class ClosedLoopPolicyDictionaryJPATest { - - private static Logger logger = FlexLogger.getLogger(ClosedLoopPolicyDictionaryJPATest.class); - private UserInfo userInfo; - - @Before - public void setUp() throws Exception { - logger.info("setUp: Entering"); - userInfo = new UserInfo(); - userInfo.setUserLoginId("Test"); - userInfo.setUserName("Test"); - logger.info("setUp: exit"); - } - - @Test - public void testVSCLAction(){ - VSCLAction data = new VSCLAction(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setVsclaction("Test"); - assertTrue("Test".equals(data.getVsclaction())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - } - - @Test - public void testVNFType(){ - VNFType data = new VNFType(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setVnftype("Test"); - assertTrue("Test".equals(data.getVnftype())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - } - - @Test - public void testPEPOptions(){ - PEPOptions data = new PEPOptions(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setPepName("Test"); - assertTrue("Test".equals(data.getPepName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - } - - @Test - public void testVarbindDictionary(){ - VarbindDictionary data = new VarbindDictionary(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setVarbindName("Test"); - assertTrue("Test".equals(data.getVarbindName())); - data.setVarbindDescription("Test"); - assertTrue("Test".equals(data.getVarbindDescription())); - data.setVarbindOID("Test"); - assertTrue("Test".equals(data.getVarbindOID())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - } - - @Test - public void testClosedLoopD2Services(){ - ClosedLoopD2Services data = new ClosedLoopD2Services(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setServiceName("Test"); - assertTrue("Test".equals(data.getServiceName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - } - - @Test - public void testClosedLoopSite(){ - ClosedLoopSite data = new ClosedLoopSite(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setSiteName("Test"); - assertTrue("Test".equals(data.getSiteName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - } + + private static Logger logger = FlexLogger.getLogger(ClosedLoopPolicyDictionaryJPATest.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testVSCLAction(){ + VSCLAction data = new VSCLAction(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setVsclaction("Test"); + assertTrue("Test".equals(data.getVsclaction())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!= null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!= null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!= null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!= null); + } + + @Test + public void testVNFType(){ + VNFType data = new VNFType(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setVnftype("Test"); + assertTrue("Test".equals(data.getVnftype())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!= null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!= null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!= null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!= null); + } + + @Test + public void testPEPOptions(){ + PEPOptions data = new PEPOptions(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setPepName("Test"); + assertTrue("Test".equals(data.getPepName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!= null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!= null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!= null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!= null); + } + + @Test + public void testVarbindDictionary(){ + VarbindDictionary data = new VarbindDictionary(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setVarbindName("Test"); + assertTrue("Test".equals(data.getVarbindName())); + data.setVarbindDescription("Test"); + assertTrue("Test".equals(data.getVarbindDescription())); + data.setVarbindOID("Test"); + assertTrue("Test".equals(data.getVarbindOID())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!= null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!= null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!= null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!= null); + } + + @Test + public void testClosedLoopD2Services(){ + ClosedLoopD2Services data = new ClosedLoopD2Services(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setServiceName("Test"); + assertTrue("Test".equals(data.getServiceName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!= null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!= null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!= null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!= null); + } + + @Test + public void testClosedLoopSite(){ + ClosedLoopSite data = new ClosedLoopSite(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setSiteName("Test"); + assertTrue("Test".equals(data.getSiteName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!= null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!= null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!= null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!= null); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPATest.java index afe090503..230844a64 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPATest.java @@ -30,117 +30,117 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; public class CommonDictionaryJPATest { - - private static Logger logger = FlexLogger.getLogger(CommonDictionaryJPATest.class); - private UserInfo userInfo; - - @Before - public void setUp() throws Exception { - logger.info("setUp: Entering"); - userInfo = new UserInfo(); - userInfo.setUserLoginId("Test"); - userInfo.setUserName("Test"); - logger.info("setUp: exit"); - } - - @Test - public void testAttribute(){ - Attribute data = new Attribute(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setCategoryBean(new Category()); - assertTrue(data.getCategoryBean()!=null); - data.setConstraintType(new ConstraintType()); - assertTrue(data.getConstraintType()!=null); - data.setConstraintValues(new HashSet<>()); - assertTrue(data.getConstraintValues()!=null); - data.addConstraintValue(new ConstraintValue()); - data.removeConstraintValue(new ConstraintValue()); - data.removeAllConstraintValues(); - data.preUpdate(); - data.prePersist(); - new Attribute("Test"); - new Attribute(new Attribute()); - data.setAttributeValue("Test"); - assertTrue("Test".equals(data.getAttributeValue())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setXacmlId("Test"); - assertTrue("Test".equals(data.getXacmlId())); - data.setDatatypeBean(new Datatype()); - assertTrue(data.getDatatypeBean()!=null); - data.setIsDesignator(true); - assertTrue(data.isDesignator()); - data.setIssuer("Test"); - assertTrue("Test".equals(data.getIssuer())); - data.setMustBePresent(true); - assertTrue(data.isMustBePresent()); - data.setPriority("Test"); - assertTrue("Test".equals(data.getPriority())); - data.setSelectorPath("Test"); - assertTrue("Test".equals(data.getSelectorPath())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - - @Test - public void testOnapName(){ - OnapName data = new OnapName(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setOnapName("Test"); - assertTrue("Test".equals(data.getOnapName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - - @Test - public void testRiskType(){ - RiskType data = new RiskType(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setRiskName("Test"); - assertTrue("Test".equals(data.getRiskName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - - @Test - public void testSafePolicyWarning(){ - SafePolicyWarning data = new SafePolicyWarning(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setMessage("Test"); - assertTrue("Test".equals(data.getMessage())); - data.setRiskType("Test"); - assertTrue("Test".equals(data.getRiskType())); - } + + private static Logger logger = FlexLogger.getLogger(CommonDictionaryJPATest.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testAttribute(){ + Attribute data = new Attribute(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setCategoryBean(new Category()); + assertTrue(data.getCategoryBean()!=null); + data.setConstraintType(new ConstraintType()); + assertTrue(data.getConstraintType()!=null); + data.setConstraintValues(new HashSet<>()); + assertTrue(data.getConstraintValues()!=null); + data.addConstraintValue(new ConstraintValue()); + data.removeConstraintValue(new ConstraintValue()); + data.removeAllConstraintValues(); + data.preUpdate(); + data.prePersist(); + new Attribute("Test"); + new Attribute(new Attribute()); + data.setAttributeValue("Test"); + assertTrue("Test".equals(data.getAttributeValue())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + data.setDatatypeBean(new Datatype()); + assertTrue(data.getDatatypeBean()!=null); + data.setIsDesignator(true); + assertTrue(data.isDesignator()); + data.setIssuer("Test"); + assertTrue("Test".equals(data.getIssuer())); + data.setMustBePresent(true); + assertTrue(data.isMustBePresent()); + data.setPriority("Test"); + assertTrue("Test".equals(data.getPriority())); + data.setSelectorPath("Test"); + assertTrue("Test".equals(data.getSelectorPath())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testOnapName(){ + OnapName data = new OnapName(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setOnapName("Test"); + assertTrue("Test".equals(data.getOnapName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testRiskType(){ + RiskType data = new RiskType(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setRiskName("Test"); + assertTrue("Test".equals(data.getRiskName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testSafePolicyWarning(){ + SafePolicyWarning data = new SafePolicyWarning(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setMessage("Test"); + assertTrue("Test".equals(data.getMessage())); + data.setRiskType("Test"); + assertTrue("Test".equals(data.getRiskType())); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java index 0a221b0a2..b1fc69903 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java @@ -30,58 +30,58 @@ import org.onap.policy.common.logging.flexlogger.Logger; public class DecisionDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(DecisionDictionaryJPATest.class); - private UserInfo userInfo; - - @Before - public void setUp() throws Exception { - logger.info("setUp: Entering"); - userInfo = new UserInfo(); - userInfo.setUserLoginId("Test"); - userInfo.setUserName("Test"); - logger.info("setUp: exit"); - } - - @Test - public void testDecisionSettings(){ - DecisionSettings data = new DecisionSettings(); - data.setId(1); - assertTrue(1 == data.getId()); - data.preUpdate(); - data.prePersist(); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setXacmlId("Test"); - assertTrue("Test".equals(data.getXacmlId())); - data.setDatatypeBean(new Datatype()); - assertTrue(data.getDatatypeBean()!=null); - data.setIssuer("Test"); - assertTrue("Test".equals(data.getIssuer())); - data.setMustBePresent(true); - assertTrue(data.isMustBePresent()); - data.setPriority("Test"); - assertTrue("Test".equals(data.getPriority())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - - @Test - public void testRainyDayTreatments(){ - RainyDayTreatments data = new RainyDayTreatments(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setBbid("Test"); - assertTrue("Test".equals(data.getBbid())); - data.setWorkstep("Test"); - assertTrue("Test".equals(data.getWorkstep())); - data.setTreatments("Test"); - assertTrue("Test".equals(data.getTreatments())); - } - + private static Logger logger = FlexLogger.getLogger(DecisionDictionaryJPATest.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testDecisionSettings(){ + DecisionSettings data = new DecisionSettings(); + data.setId(1); + assertTrue(1 == data.getId()); + data.preUpdate(); + data.prePersist(); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + data.setDatatypeBean(new Datatype()); + assertTrue(data.getDatatypeBean()!=null); + data.setIssuer("Test"); + assertTrue("Test".equals(data.getIssuer())); + data.setMustBePresent(true); + assertTrue(data.isMustBePresent()); + data.setPriority("Test"); + assertTrue("Test".equals(data.getPriority())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testRainyDayTreatments(){ + RainyDayTreatments data = new RainyDayTreatments(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setBbid("Test"); + assertTrue("Test".equals(data.getBbid())); + data.setWorkstep("Test"); + assertTrue("Test".equals(data.getWorkstep())); + data.setTreatments("Test"); + assertTrue("Test".equals(data.getTreatments())); + } + } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java index bec9fe042..b3b23e429 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java @@ -30,228 +30,228 @@ import org.onap.policy.common.logging.flexlogger.Logger; public class FWDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(FWDictionaryJPATest.class); - private UserInfo userInfo; - - @Before - public void setUp() throws Exception { - logger.info("setUp: Entering"); - userInfo = new UserInfo(); - userInfo.setUserLoginId("Test"); - userInfo.setUserName("Test"); - logger.info("setUp: exit"); - } - - @Test - public void testActionList(){ - ActionList data = new ActionList(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setActionName("Test"); - assertTrue("Test".equals(data.getActionName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - } - - @Test - public void testPortList(){ - PortList data = new PortList(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setPortName("Test"); - assertTrue("Test".equals(data.getPortName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - } - - @Test - public void testProtocolList(){ - ProtocolList data = new ProtocolList(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setProtocolName("Test"); - assertTrue("Test".equals(data.getProtocolName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - } - - @Test - public void testSecurityZone(){ - SecurityZone data = new SecurityZone(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setZoneName("Test"); - assertTrue("Test".equals(data.getZoneName())); - data.setZoneValue("Test"); - assertTrue("Test".equals(data.getZoneValue())); - } - - @Test - public void testZone(){ - Zone data = new Zone(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setZoneName("Test"); - assertTrue("Test".equals(data.getZoneName())); - data.setZoneValue("Test"); - assertTrue("Test".equals(data.getZoneValue())); - } - - @Test - public void testAddressGroup(){ - AddressGroup data = new AddressGroup(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setServiceList("Test"); - assertTrue("Test".equals(data.getPrefixList())); - data.setGroupName("Test"); - assertTrue("Test".equals(data.getGroupName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - } - - @Test - public void testPrefixList(){ - PrefixList data = new PrefixList(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setPrefixListName("Test"); - assertTrue("Test".equals(data.getPrefixListName())); - data.setPrefixListValue("Test"); - assertTrue("Test".equals(data.getPrefixListValue())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - } - - @Test - public void testFWDictionaryList(){ - FirewallDictionaryList data = new FirewallDictionaryList(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setParentItemName("Test"); - assertTrue("Test".equals(data.getParentItemName())); - data.setAddressList("Test"); - assertTrue("Test".equals(data.getAddressList())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setServiceList("Test"); - assertTrue("Test".equals(data.getServiceList())); - } - - @Test - public void testFWTag(){ - FWTag data = new FWTag(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setFwTagName("Test"); - assertTrue("Test".equals(data.getFwTagName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setTagValues("Test"); - assertTrue("Test".equals(data.getTagValues())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - - @Test - public void testFWTagPicker(){ - FWTagPicker data = new FWTagPicker(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setTagPickerName("Test"); - assertTrue("Test".equals(data.getTagPickerName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setNetworkRole("Test"); - assertTrue("Test".equals(data.getNetworkRole())); - data.setTagValues("Test"); - assertTrue("Test".equals(data.getTagValues())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - - @Test - public void testServiceList(){ - ServiceList data = new ServiceList(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setServiceName("Test"); - assertTrue("Test".equals(data.getServiceName())); - data.setServiceDescription("Test"); - assertTrue("Test".equals(data.getServiceDescription())); - data.setServiceType("Test"); - assertTrue("Test".equals(data.getServiceType())); - data.setServiceTransProtocol("Test"); - assertTrue("Test".equals(data.getServiceTransProtocol())); - data.setServiceAppProtocol("Test"); - assertTrue("Test".equals(data.getServiceAppProtocol())); - data.setServicePorts("Test"); - assertTrue("Test".equals(data.getServicePorts())); - } - - @Test - public void testTermList(){ - TermList data = new TermList(); - data.preUpdate(); - data.prePersist(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setTermName("Test"); - assertTrue("Test".equals(data.getTermName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getTermDescription())); - data.setFromZones("Test"); - assertTrue("Test".equals(data.getFromZone())); - data.setToZones("Test"); - assertTrue("Test".equals(data.getToZone())); - data.setSrcIPList("Test"); - assertTrue("Test".equals(data.getSrcIPList())); - data.setDestIPList("Test"); - assertTrue("Test".equals(data.getDestIPList())); - data.setProtocolList("Test"); - assertTrue("Test".equals(data.getProtocolList())); - data.setPortList("Test"); - assertTrue("Test".equals(data.getPortList())); - data.setSrcPortList("Test"); - assertTrue("Test".equals(data.getSrcPortList())); - data.setDestPortList("Test"); - assertTrue("Test".equals(data.getDestPortList())); - data.setAction("Test"); - assertTrue("Test".equals(data.getAction())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - - @Test - public void testGroupServiceList(){ - GroupServiceList data = new GroupServiceList(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setGroupName("Test"); - assertTrue("Test".equals(data.getGroupName())); - data.setServiceList("Test"); - assertTrue("Test".equals(data.getServiceList())); - } + private static Logger logger = FlexLogger.getLogger(FWDictionaryJPATest.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testActionList(){ + ActionList data = new ActionList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setActionName("Test"); + assertTrue("Test".equals(data.getActionName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testPortList(){ + PortList data = new PortList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setPortName("Test"); + assertTrue("Test".equals(data.getPortName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testProtocolList(){ + ProtocolList data = new ProtocolList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setProtocolName("Test"); + assertTrue("Test".equals(data.getProtocolName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testSecurityZone(){ + SecurityZone data = new SecurityZone(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setZoneName("Test"); + assertTrue("Test".equals(data.getZoneName())); + data.setZoneValue("Test"); + assertTrue("Test".equals(data.getZoneValue())); + } + + @Test + public void testZone(){ + Zone data = new Zone(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setZoneName("Test"); + assertTrue("Test".equals(data.getZoneName())); + data.setZoneValue("Test"); + assertTrue("Test".equals(data.getZoneValue())); + } + + @Test + public void testAddressGroup(){ + AddressGroup data = new AddressGroup(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setServiceList("Test"); + assertTrue("Test".equals(data.getPrefixList())); + data.setGroupName("Test"); + assertTrue("Test".equals(data.getGroupName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testPrefixList(){ + PrefixList data = new PrefixList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setPrefixListName("Test"); + assertTrue("Test".equals(data.getPrefixListName())); + data.setPrefixListValue("Test"); + assertTrue("Test".equals(data.getPrefixListValue())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testFWDictionaryList(){ + FirewallDictionaryList data = new FirewallDictionaryList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setParentItemName("Test"); + assertTrue("Test".equals(data.getParentItemName())); + data.setAddressList("Test"); + assertTrue("Test".equals(data.getAddressList())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setServiceList("Test"); + assertTrue("Test".equals(data.getServiceList())); + } + + @Test + public void testFWTag(){ + FWTag data = new FWTag(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setFwTagName("Test"); + assertTrue("Test".equals(data.getFwTagName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setTagValues("Test"); + assertTrue("Test".equals(data.getTagValues())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testFWTagPicker(){ + FWTagPicker data = new FWTagPicker(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setTagPickerName("Test"); + assertTrue("Test".equals(data.getTagPickerName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setNetworkRole("Test"); + assertTrue("Test".equals(data.getNetworkRole())); + data.setTagValues("Test"); + assertTrue("Test".equals(data.getTagValues())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testServiceList(){ + ServiceList data = new ServiceList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setServiceName("Test"); + assertTrue("Test".equals(data.getServiceName())); + data.setServiceDescription("Test"); + assertTrue("Test".equals(data.getServiceDescription())); + data.setServiceType("Test"); + assertTrue("Test".equals(data.getServiceType())); + data.setServiceTransProtocol("Test"); + assertTrue("Test".equals(data.getServiceTransProtocol())); + data.setServiceAppProtocol("Test"); + assertTrue("Test".equals(data.getServiceAppProtocol())); + data.setServicePorts("Test"); + assertTrue("Test".equals(data.getServicePorts())); + } + + @Test + public void testTermList(){ + TermList data = new TermList(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setTermName("Test"); + assertTrue("Test".equals(data.getTermName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getTermDescription())); + data.setFromZones("Test"); + assertTrue("Test".equals(data.getFromZone())); + data.setToZones("Test"); + assertTrue("Test".equals(data.getToZone())); + data.setSrcIPList("Test"); + assertTrue("Test".equals(data.getSrcIPList())); + data.setDestIPList("Test"); + assertTrue("Test".equals(data.getDestIPList())); + data.setProtocolList("Test"); + assertTrue("Test".equals(data.getProtocolList())); + data.setPortList("Test"); + assertTrue("Test".equals(data.getPortList())); + data.setSrcPortList("Test"); + assertTrue("Test".equals(data.getSrcPortList())); + data.setDestPortList("Test"); + assertTrue("Test".equals(data.getDestPortList())); + data.setAction("Test"); + assertTrue("Test".equals(data.getAction())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testGroupServiceList(){ + GroupServiceList data = new GroupServiceList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setGroupName("Test"); + assertTrue("Test".equals(data.getGroupName())); + data.setServiceList("Test"); + assertTrue("Test".equals(data.getServiceList())); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPATest.java index eba1c4003..548e3fc84 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPATest.java @@ -28,181 +28,181 @@ import org.onap.policy.common.logging.flexlogger.Logger; public class MicroServiceDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(MicroServiceDictionaryJPATest.class); - private UserInfo userInfo; - - @Before - public void setUp() throws Exception { - logger.info("setUp: Entering"); - userInfo = new UserInfo(); - userInfo.setUserLoginId("Test"); - userInfo.setUserName("Test"); - logger.info("setUp: exit"); - } - - @Test - public void testDCAEUsers(){ - DCAEUsers data = new DCAEUsers(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setDescriptionValue("Test"); - assertTrue("Test".equals(data.getDescriptionValue())); - } - - @Test - public void testDCAEuuid(){ - DCAEuuid data = new DCAEuuid(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - } - - @Test - public void testMSConfigName(){ - MicroServiceConfigName data = new MicroServiceConfigName(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setDescriptionValue("Test"); - assertTrue("Test".equals(data.getDescriptionValue())); - } - - @Test - public void testMSConfigLocation(){ - MicroServiceLocation data = new MicroServiceLocation(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setDescriptionValue("Test"); - assertTrue("Test".equals(data.getDescriptionValue())); - } - - @Test - public void testMSModels(){ - MicroServiceModels data = new MicroServiceModels(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setModelName("Test"); - assertTrue("Test".equals(data.getModelName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setDependency("Test"); - assertTrue("Test".equals(data.getDependency())); - data.setEnumValues("Test"); - assertTrue("Test".equals(data.getEnumValues())); - data.setAnnotation("Test"); - assertTrue("Test".equals(data.getAnnotation())); - data.setAttributes("Test"); - assertTrue("Test".equals(data.getAttributes())); - data.setRef_attributes("Test"); - assertTrue("Test".equals(data.getRef_attributes())); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setSub_attributes("Test"); - assertTrue("Test".equals(data.getSub_attributes())); - data.setVersion("Test"); - assertTrue("Test".equals(data.getVersion())); - } - - @Test - public void testMSAttributeDictionary(){ - MicroServiceAttribute data = new MicroServiceAttribute(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setValue("Test"); - assertTrue("Test".equals(data.getValue())); - data.setModelName("Test"); - assertTrue("Test".equals(data.getModelName())); - } - - @Test - public void testPolicyScopeService(){ - PolicyScopeService data = new PolicyScopeService(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setDescriptionValue("Test"); - assertTrue("Test".equals(data.getDescriptionValue())); - } - - @Test - public void testPolicyScopeResource(){ - PolicyScopeResource data = new PolicyScopeResource(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setDescriptionValue("Test"); - assertTrue("Test".equals(data.getDescriptionValue())); - } - - @Test - public void testPolicyScopeType(){ - PolicyScopeType data = new PolicyScopeType(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setDescriptionValue("Test"); - assertTrue("Test".equals(data.getDescriptionValue())); - } - - @Test - public void testPolicyScopeClosedLoop(){ - PolicyScopeClosedLoop data = new PolicyScopeClosedLoop(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setDescriptionValue("Test"); - assertTrue("Test".equals(data.getDescriptionValue())); - } - - @Test - public void testPolicyScopeGroupPolicyScopeList(){ - GroupPolicyScopeList data = new GroupPolicyScopeList(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setGroupName("Test"); - assertTrue("Test".equals(data.getGroupName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setGroupList("Test"); - assertTrue("Test".equals(data.getGroupList())); - } - - @Test - public void testClosedLoops(){ - ClosedLoops data = new ClosedLoops(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setClosedLoopControlName("Test"); - assertTrue("Test".equals(data.getClosedLoopControlName())); - data.setAlarmConditions("Test"); - assertTrue("Test".equals(data.getAlarmConditions())); - data.setYaml("Test"); - assertTrue("Test".equals(data.getYaml())); - } - - @Test - public void testVMType(){ - VMType data = new VMType(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - } - + private static Logger logger = FlexLogger.getLogger(MicroServiceDictionaryJPATest.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testDCAEUsers(){ + DCAEUsers data = new DCAEUsers(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testDCAEuuid(){ + DCAEuuid data = new DCAEuuid(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testMSConfigName(){ + MicroServiceConfigName data = new MicroServiceConfigName(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testMSConfigLocation(){ + MicroServiceLocation data = new MicroServiceLocation(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testMSModels(){ + MicroServiceModels data = new MicroServiceModels(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setModelName("Test"); + assertTrue("Test".equals(data.getModelName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setDependency("Test"); + assertTrue("Test".equals(data.getDependency())); + data.setEnumValues("Test"); + assertTrue("Test".equals(data.getEnumValues())); + data.setAnnotation("Test"); + assertTrue("Test".equals(data.getAnnotation())); + data.setAttributes("Test"); + assertTrue("Test".equals(data.getAttributes())); + data.setRef_attributes("Test"); + assertTrue("Test".equals(data.getRef_attributes())); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setSub_attributes("Test"); + assertTrue("Test".equals(data.getSub_attributes())); + data.setVersion("Test"); + assertTrue("Test".equals(data.getVersion())); + } + + @Test + public void testMSAttributeDictionary(){ + MicroServiceAttribute data = new MicroServiceAttribute(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setValue("Test"); + assertTrue("Test".equals(data.getValue())); + data.setModelName("Test"); + assertTrue("Test".equals(data.getModelName())); + } + + @Test + public void testPolicyScopeService(){ + PolicyScopeService data = new PolicyScopeService(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testPolicyScopeResource(){ + PolicyScopeResource data = new PolicyScopeResource(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testPolicyScopeType(){ + PolicyScopeType data = new PolicyScopeType(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testPolicyScopeClosedLoop(){ + PolicyScopeClosedLoop data = new PolicyScopeClosedLoop(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testPolicyScopeGroupPolicyScopeList(){ + GroupPolicyScopeList data = new GroupPolicyScopeList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setGroupName("Test"); + assertTrue("Test".equals(data.getGroupName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setGroupList("Test"); + assertTrue("Test".equals(data.getGroupList())); + } + + @Test + public void testClosedLoops(){ + ClosedLoops data = new ClosedLoops(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setClosedLoopControlName("Test"); + assertTrue("Test".equals(data.getClosedLoopControlName())); + data.setAlarmConditions("Test"); + assertTrue("Test".equals(data.getAlarmConditions())); + data.setYaml("Test"); + assertTrue("Test".equals(data.getYaml())); + } + + @Test + public void testVMType(){ + VMType data = new VMType(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/OptimizationModelsJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/OptimizationModelsJPATest.java index cd7360ca2..243cb5106 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/OptimizationModelsJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/OptimizationModelsJPATest.java @@ -28,44 +28,44 @@ import org.onap.policy.common.logging.flexlogger.Logger; public class OptimizationModelsJPATest { - private static Logger logger = FlexLogger.getLogger(OptimizationModelsJPATest.class); - private UserInfo userInfo; - - @Before - public void setUp() throws Exception { - logger.info("setUp: Entering"); - userInfo = new UserInfo(); - userInfo.setUserLoginId("Test"); - userInfo.setUserName("Test"); - logger.info("setUp: exit"); - } - - @Test - public void testMSModels(){ - OptimizationModels data = new OptimizationModels(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setModelName("Test"); - assertTrue("Test".equals(data.getModelName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setDependency("Test"); - assertTrue("Test".equals(data.getDependency())); - data.setEnumValues("Test"); - assertTrue("Test".equals(data.getEnumValues())); - data.setAnnotation("Test"); - assertTrue("Test".equals(data.getAnnotation())); - data.setAttributes("Test"); - assertTrue("Test".equals(data.getAttributes())); - data.setRefattributes("Test"); - assertTrue("Test".equals(data.getRefattributes())); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setSubattributes("Test"); - assertTrue("Test".equals(data.getSubattributes())); - data.setVersion("Test"); - assertTrue("Test".equals(data.getVersion())); - } - - + private static Logger logger = FlexLogger.getLogger(OptimizationModelsJPATest.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testMSModels(){ + OptimizationModels data = new OptimizationModels(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setModelName("Test"); + assertTrue("Test".equals(data.getModelName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setDependency("Test"); + assertTrue("Test".equals(data.getDependency())); + data.setEnumValues("Test"); + assertTrue("Test".equals(data.getEnumValues())); + data.setAnnotation("Test"); + assertTrue("Test".equals(data.getAnnotation())); + data.setAttributes("Test"); + assertTrue("Test".equals(data.getAttributes())); + data.setRefattributes("Test"); + assertTrue("Test".equals(data.getRefattributes())); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setSubattributes("Test"); + assertTrue("Test".equals(data.getSubattributes())); + data.setVersion("Test"); + assertTrue("Test".equals(data.getVersion())); + } + + } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java index d114a18c1..7421d79c9 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java @@ -31,153 +31,153 @@ import com.att.research.xacml.api.pip.PIPException; public class PIPJPATest { - @Test - public void testPIPConfigParam(){ - PIPConfigParam data = new PIPConfigParam(); - new PIPConfigParam("test"); - new PIPConfigParam(new PIPConfigParam()); - data.setId(1); - assertTrue(1 == data.getId()); - data.setParamName("Test"); - assertTrue("Test".equals(data.getParamName())); - data.setParamValue("Test"); - assertTrue("Test".equals(data.getParamValue())); - data.setParamDefault("Test"); - assertTrue("Test".equals(data.getParamDefault())); - data.setPipconfiguration(new PIPConfiguration()); - assertTrue(data.getPipconfiguration()!=null); - data.setRequired(true); - assertTrue(data.isRequired()); - data.toString(); - } - - @Test - public void testPIPResolverParam(){ - PIPResolverParam data = new PIPResolverParam(); - new PIPResolverParam("test"); - new PIPResolverParam(new PIPResolverParam()); - data.setId(1); - assertTrue(1 == data.getId()); - data.setParamName("Test"); - assertTrue("Test".equals(data.getParamName())); - data.setParamValue("Test"); - assertTrue("Test".equals(data.getParamValue())); - data.setParamDefault("Test"); - assertTrue("Test".equals(data.getParamDefault())); - data.setPipresolver(new PIPResolver()); - assertTrue(data.getPipresolver()!=null); - data.setRequired(true); - assertTrue(data.isRequired()); - data.toString(); - } - - @Test - public void testPIPType(){ - PIPType data = new PIPType(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setType("Test"); - assertTrue("Test".equals(data.getType())); - data.setPipconfigurations(new HashSet<>()); - assertTrue(data.getPipconfigurations()!=null); - data.addPipconfiguration(new PIPConfiguration()); - data.removePipconfiguration(new PIPConfiguration()); - data.setType("SQL"); - assertTrue(data.isSQL()); - data.setType("LDAP"); - assertTrue(data.isLDAP()); - data.setType("CSV"); - assertTrue(data.isCSV()); - data.setType("Hyper-CSV"); - assertTrue(data.isHyperCSV()); - data.setType("Custom"); - assertTrue(data.isCustom()); - } - - @Test - public void testPIPResolver(){ - PIPResolver data = new PIPResolver(); - new PIPResolver(new PIPResolver()); - data.prePersist(); - data.preUpdate(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setIssuer("Test"); - assertTrue("Test".equals(data.getIssuer())); - data.setClassname("Test"); - assertTrue("Test".equals(data.getClassname())); - data.setCreatedBy("Test"); - assertTrue("Test".equals(data.getCreatedBy())); - data.setModifiedBy("Test"); - assertTrue("Test".equals(data.getModifiedBy())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setPipconfiguration(new PIPConfiguration()); - assertTrue(data.getPipconfiguration()!=null); - data.setPipresolverParams(new HashSet<>()); - assertTrue(data.getPipresolverParams()!=null); - data.addPipresolverParam(new PIPResolverParam()); - data.removePipresolverParam(new PIPResolverParam()); - data.clearParams(); - data.getConfiguration("test"); - data.setReadOnly(true); - assertTrue(data.isReadOnly()); - data.toString(); - Properties properties = new Properties(); - data.generateProperties(properties,"test"); - try { - data.readProperties("test", properties); - } catch (PIPException e) { - fail(); - } - } - - @Test - public void testPIPConfiguration(){ - PIPConfiguration data = new PIPConfiguration(); - data.prePersist(); - data.preUpdate(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setIssuer("Test"); - assertTrue("Test".equals(data.getIssuer())); - data.setClassname("Test"); - assertTrue("Test".equals(data.getClassname())); - data.setCreatedBy("Test"); - assertTrue("Test".equals(data.getCreatedBy())); - data.setModifiedBy("Test"); - assertTrue("Test".equals(data.getModifiedBy())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - try { - data.readProperties("test", data.generateProperties("test")); - } catch (PIPException e) { - fail(); - } - data.setPiptype(new PIPType()); - assertTrue(data.getPiptype()!=null); - data.setPipresolvers(new HashSet<>()); - assertTrue(data.getPipresolvers()!=null); - data.addPipresolver(new PIPResolver()); - data.removePipresolver(new PIPResolver()); - data.getConfiguration("test"); - data.setReadOnly(true); - assertTrue(data.isReadOnly()); - data.setRequiresResolvers(true); - assertTrue(data.requiresResolvers()); - data.toString(); - } - + @Test + public void testPIPConfigParam(){ + PIPConfigParam data = new PIPConfigParam(); + new PIPConfigParam("test"); + new PIPConfigParam(new PIPConfigParam()); + data.setId(1); + assertTrue(1 == data.getId()); + data.setParamName("Test"); + assertTrue("Test".equals(data.getParamName())); + data.setParamValue("Test"); + assertTrue("Test".equals(data.getParamValue())); + data.setParamDefault("Test"); + assertTrue("Test".equals(data.getParamDefault())); + data.setPipconfiguration(new PIPConfiguration()); + assertTrue(data.getPipconfiguration()!=null); + data.setRequired(true); + assertTrue(data.isRequired()); + data.toString(); + } + + @Test + public void testPIPResolverParam(){ + PIPResolverParam data = new PIPResolverParam(); + new PIPResolverParam("test"); + new PIPResolverParam(new PIPResolverParam()); + data.setId(1); + assertTrue(1 == data.getId()); + data.setParamName("Test"); + assertTrue("Test".equals(data.getParamName())); + data.setParamValue("Test"); + assertTrue("Test".equals(data.getParamValue())); + data.setParamDefault("Test"); + assertTrue("Test".equals(data.getParamDefault())); + data.setPipresolver(new PIPResolver()); + assertTrue(data.getPipresolver()!=null); + data.setRequired(true); + assertTrue(data.isRequired()); + data.toString(); + } + + @Test + public void testPIPType(){ + PIPType data = new PIPType(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); + data.setPipconfigurations(new HashSet<>()); + assertTrue(data.getPipconfigurations()!=null); + data.addPipconfiguration(new PIPConfiguration()); + data.removePipconfiguration(new PIPConfiguration()); + data.setType("SQL"); + assertTrue(data.isSQL()); + data.setType("LDAP"); + assertTrue(data.isLDAP()); + data.setType("CSV"); + assertTrue(data.isCSV()); + data.setType("Hyper-CSV"); + assertTrue(data.isHyperCSV()); + data.setType("Custom"); + assertTrue(data.isCustom()); + } + + @Test + public void testPIPResolver(){ + PIPResolver data = new PIPResolver(); + new PIPResolver(new PIPResolver()); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setIssuer("Test"); + assertTrue("Test".equals(data.getIssuer())); + data.setClassname("Test"); + assertTrue("Test".equals(data.getClassname())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setPipconfiguration(new PIPConfiguration()); + assertTrue(data.getPipconfiguration()!=null); + data.setPipresolverParams(new HashSet<>()); + assertTrue(data.getPipresolverParams()!=null); + data.addPipresolverParam(new PIPResolverParam()); + data.removePipresolverParam(new PIPResolverParam()); + data.clearParams(); + data.getConfiguration("test"); + data.setReadOnly(true); + assertTrue(data.isReadOnly()); + data.toString(); + Properties properties = new Properties(); + data.generateProperties(properties,"test"); + try { + data.readProperties("test", properties); + } catch (PIPException e) { + fail(); + } + } + + @Test + public void testPIPConfiguration(){ + PIPConfiguration data = new PIPConfiguration(); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setIssuer("Test"); + assertTrue("Test".equals(data.getIssuer())); + data.setClassname("Test"); + assertTrue("Test".equals(data.getClassname())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + try { + data.readProperties("test", data.generateProperties("test")); + } catch (PIPException e) { + fail(); + } + data.setPiptype(new PIPType()); + assertTrue(data.getPiptype()!=null); + data.setPipresolvers(new HashSet<>()); + assertTrue(data.getPipresolvers()!=null); + data.addPipresolver(new PIPResolver()); + data.removePipresolver(new PIPResolver()); + data.getConfiguration("test"); + data.setReadOnly(true); + assertTrue(data.isReadOnly()); + data.setRequiresResolvers(true); + assertTrue(data.requiresResolvers()); + data.toString(); + } + } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java index 25ea391ca..706471281 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java @@ -30,177 +30,177 @@ import org.onap.policy.common.logging.flexlogger.Logger; public class PolicyEntityJPATest { - private static Logger logger = FlexLogger.getLogger(PolicyEntityJPATest.class); - private UserInfo userInfo; - - @Before - public void setUp() throws Exception { - logger.info("setUp: Entering"); - userInfo = new UserInfo(); - userInfo.setUserLoginId("Test"); - userInfo.setUserName("Test"); - logger.info("setUp: exit"); - } - - @Test - public void testPolicyGroupEntity(){ - PolicyGroupEntity data = new PolicyGroupEntity(); - data.setGroupKey(1); - assertTrue(1 == data.getGroupKey()); - data.setPolicyid(1); - assertTrue(1 == data.getPolicyid()); - } - - @Test - public void testPolicyDBDaoEntity(){ - PolicyDBDaoEntity data = new PolicyDBDaoEntity(); - data.prePersist(); - data.preUpdate(); - data.setPolicyDBDaoUrl("Test"); - assertTrue("Test".equals(data.getPolicyDBDaoUrl())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); - data.setUsername("Test"); - assertTrue("Test".equals(data.getUsername())); - data.setPassword("Test"); - assertTrue("Test".equals(data.getPassword())); - } - - @Test - public void testDatabaseLockEntity(){ - DatabaseLockEntity data = new DatabaseLockEntity(); - data.setKey(1); - assertTrue(1 == data.getKey()); - } - - @Test - public void testPolicyEntity(){ - PolicyEntity data = new PolicyEntity(); - data.prePersist(); - data.preUpdate(); - data.setPolicyName("Test"); - assertTrue("Test".equals(data.getPolicyName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); - data.setPolicyData("Test"); - assertTrue("Test".equals(data.getPolicyData())); - data.setConfigurationData(new ConfigurationDataEntity()); - assertTrue(data.getConfigurationData()!=null); - data.setActionBodyEntity(new ActionBodyEntity()); - assertTrue(data.getActionBodyEntity()!=null); - data.setScope("Test"); - assertTrue("Test".equals(data.getScope())); - data.setCreatedBy("Test"); - assertTrue("Test".equals(data.getCreatedBy())); - data.setModifiedBy("Test"); - assertTrue("Test".equals(data.getModifiedBy())); - data.setDeleted(true); - assertTrue(data.isDeleted()); - data.equals(new PolicyEntity()); - data.hashCode(); - } - - @Test - public void testActionBodyEntity(){ - ActionBodyEntity data = new ActionBodyEntity(); - data.prePersist(); - data.preUpdate(); - data.setActionBodyName("Test"); - assertTrue("Test".equals(data.getActionBodyName())); - data.setActionBody("Test"); - assertTrue("Test".equals(data.getActionBody())); - data.setCreatedBy("Test"); - assertTrue("Test".equals(data.getCreatedBy())); - data.setModifiedBy("Test"); - assertTrue("Test".equals(data.getModifiedBy())); - data.setModifiedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); - data.setDeleted(true); - assertTrue(data.isDeleted()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); - data.equals(new ConfigurationDataEntity()); - data.hashCode(); - } - - @Test - public void testConfigurationDataEntity(){ - ConfigurationDataEntity data = new ConfigurationDataEntity(); - data.prePersist(); - data.preUpdate(); - data.setConfigurationName("Test"); - assertTrue("Test".equals(data.getConfigurationName())); - data.setConfigType("Test"); - assertTrue("Test".equals(data.getConfigType())); - data.setConfigBody("Test"); - assertTrue("Test".equals(data.getConfigBody())); - data.setCreatedBy("Test"); - assertTrue("Test".equals(data.getCreatedBy())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setModifiedBy("Test"); - assertTrue("Test".equals(data.getModifiedBy())); - data.setModifiedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); - data.setDeleted(true); - assertTrue(data.isDeleted()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); - data.equals(new ConfigurationDataEntity()); - data.hashCode(); - } - - @Test - public void testPdpEntity(){ - PdpEntity data = new PdpEntity(); - data.prePersist(); - data.preUpdate(); - data.setPdpId("Test"); - assertTrue("Test".equals(data.getPdpId())); - data.setPdpName("Test"); - assertTrue("Test".equals(data.getPdpName())); - data.setGroup(new GroupEntity()); - assertTrue(data.getGroup()!=null); - data.setCreatedBy("Test"); - assertTrue("Test".equals(data.getCreatedBy())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setModifiedBy("Test"); - assertTrue("Test".equals(data.getModifiedBy())); - data.setJmxPort(1); - assertTrue(1 == data.getJmxPort()); - data.setDeleted(true); - assertTrue(data.isDeleted()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); - } - - @Test - public void testGroupEntity(){ - GroupEntity data = new GroupEntity(); - data.prePersist(); - data.preUpdate(); - data.setGroupId("Test"); - assertTrue("Test".equals(data.getGroupId())); - data.setGroupName("Test"); - assertTrue("Test".equals(data.getgroupName())); - data.setCreatedBy("Test"); - assertTrue("Test".equals(data.getCreatedBy())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setModifiedBy("Test"); - assertTrue("Test".equals(data.getModifiedBy())); - data.setDefaultGroup(true); - assertTrue(data.isDefaultGroup()); - data.setDeleted(true); - assertTrue(data.isDeleted()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); - } + private static Logger logger = FlexLogger.getLogger(PolicyEntityJPATest.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testPolicyGroupEntity(){ + PolicyGroupEntity data = new PolicyGroupEntity(); + data.setGroupKey(1); + assertTrue(1 == data.getGroupKey()); + data.setPolicyid(1); + assertTrue(1 == data.getPolicyid()); + } + + @Test + public void testPolicyDBDaoEntity(){ + PolicyDBDaoEntity data = new PolicyDBDaoEntity(); + data.prePersist(); + data.preUpdate(); + data.setPolicyDBDaoUrl("Test"); + assertTrue("Test".equals(data.getPolicyDBDaoUrl())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.setUsername("Test"); + assertTrue("Test".equals(data.getUsername())); + data.setPassword("Test"); + assertTrue("Test".equals(data.getPassword())); + } + + @Test + public void testDatabaseLockEntity(){ + DatabaseLockEntity data = new DatabaseLockEntity(); + data.setKey(1); + assertTrue(1 == data.getKey()); + } + + @Test + public void testPolicyEntity(){ + PolicyEntity data = new PolicyEntity(); + data.prePersist(); + data.preUpdate(); + data.setPolicyName("Test"); + assertTrue("Test".equals(data.getPolicyName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.setPolicyData("Test"); + assertTrue("Test".equals(data.getPolicyData())); + data.setConfigurationData(new ConfigurationDataEntity()); + assertTrue(data.getConfigurationData()!=null); + data.setActionBodyEntity(new ActionBodyEntity()); + assertTrue(data.getActionBodyEntity()!=null); + data.setScope("Test"); + assertTrue("Test".equals(data.getScope())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setDeleted(true); + assertTrue(data.isDeleted()); + data.equals(new PolicyEntity()); + data.hashCode(); + } + + @Test + public void testActionBodyEntity(){ + ActionBodyEntity data = new ActionBodyEntity(); + data.prePersist(); + data.preUpdate(); + data.setActionBodyName("Test"); + assertTrue("Test".equals(data.getActionBodyName())); + data.setActionBody("Test"); + assertTrue("Test".equals(data.getActionBody())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setModifiedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.setDeleted(true); + assertTrue(data.isDeleted()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.equals(new ConfigurationDataEntity()); + data.hashCode(); + } + + @Test + public void testConfigurationDataEntity(){ + ConfigurationDataEntity data = new ConfigurationDataEntity(); + data.prePersist(); + data.preUpdate(); + data.setConfigurationName("Test"); + assertTrue("Test".equals(data.getConfigurationName())); + data.setConfigType("Test"); + assertTrue("Test".equals(data.getConfigType())); + data.setConfigBody("Test"); + assertTrue("Test".equals(data.getConfigBody())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setModifiedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.setDeleted(true); + assertTrue(data.isDeleted()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.equals(new ConfigurationDataEntity()); + data.hashCode(); + } + + @Test + public void testPdpEntity(){ + PdpEntity data = new PdpEntity(); + data.prePersist(); + data.preUpdate(); + data.setPdpId("Test"); + assertTrue("Test".equals(data.getPdpId())); + data.setPdpName("Test"); + assertTrue("Test".equals(data.getPdpName())); + data.setGroup(new GroupEntity()); + assertTrue(data.getGroup()!=null); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setJmxPort(1); + assertTrue(1 == data.getJmxPort()); + data.setDeleted(true); + assertTrue(data.isDeleted()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + } + + @Test + public void testGroupEntity(){ + GroupEntity data = new GroupEntity(); + data.prePersist(); + data.preUpdate(); + data.setGroupId("Test"); + assertTrue("Test".equals(data.getGroupId())); + data.setGroupName("Test"); + assertTrue("Test".equals(data.getgroupName())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setDefaultGroup(true); + assertTrue(data.isDefaultGroup()); + data.setDeleted(true); + assertTrue(data.isDeleted()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java index 934c27ba6..3ada4dfca 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java @@ -30,161 +30,161 @@ import org.onap.policy.common.logging.flexlogger.Logger; public class PolicyUtilsJPATest { - private static Logger logger = FlexLogger.getLogger(PolicyUtilsJPATest.class); - private UserInfo userInfo; - - @Before - public void setUp() throws Exception { - logger.info("setUp: Entering"); - userInfo = new UserInfo(); - userInfo.setUserLoginId("Test"); - userInfo.setUserName("Test"); - logger.info("setUp: exit"); - } - - @Test - public void testWatchPolicyNotificationTable(){ - WatchPolicyNotificationTable data = new WatchPolicyNotificationTable(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setPolicyName("Test"); - assertTrue("Test".equals(data.getPolicyName())); - data.setLoginIds("Test"); - assertTrue("Test".equals(data.getLoginIds())); - data.equals(data); - data.hashCode(); - } - - @Test - public void testPolicyRoles(){ - PolicyRoles data = new PolicyRoles(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setScope("Test"); - assertTrue("Test".equals(data.getScope())); - data.setRole("Test"); - assertTrue("Test".equals(data.getRole())); - data.setLoginId(userInfo); - assertTrue("Test".equals(data.getLoginId().getUserLoginId())); - } - - @Test - public void testPolicyVersion(){ - PolicyVersion data = new PolicyVersion(); - new PolicyVersion("Test", "Test"); - data.prePersist(); - data.preUpdate(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setActiveVersion(1); - assertTrue(1 == data.getActiveVersion()); - data.setHigherVersion(1); - assertTrue(1 == data.getHigherVersion()); - data.setPolicyName("Test"); - assertTrue("Test".equals(data.getPolicyName())); - data.setCreatedBy("Test"); - assertTrue("Test".equals(data.getCreatedBy())); - data.setModifiedBy("Test"); - assertTrue("Test".equals(data.getModifiedBy())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.equals(data); - data.hashCode(); - } - - @Test - public void testSystemLogDB(){ - SystemLogDB data = new SystemLogDB(); - new SystemLogDB(1, "","","","",""); - data.setId(1); - assertTrue(1 == data.getId()); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setType("Test"); - assertTrue("Test".equals(data.getType())); - data.setSystem("Test"); - assertTrue("Test".equals(data.getSystem())); - data.setRemote("Test"); - assertTrue("Test".equals(data.getRemote())); - data.setLogtype("Test"); - assertTrue("Test".equals(data.getLogtype())); - data.setDate(new Date()); - assertTrue(data.getDate()!=null); - } - - @Test - public void testRemoteCatalogValues(){ - RemoteCatalogValues data = new RemoteCatalogValues(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setValue("Test"); - assertTrue("Test".equals(data.getValue())); - } - - @Test - public void testPolicyScore(){ - PolicyScore data = new PolicyScore(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setPolicyName("Test"); - assertTrue("Test".equals(data.getPolicyName())); - data.setVersionExtension("Test"); - assertTrue("Test".equals(data.getVersionExtension())); - data.setPolicyScore("Test"); - assertTrue("Test".equals(data.getPolicyScore())); - } - - @Test - public void testPolicyEditorScopes(){ - PolicyEditorScopes data = new PolicyEditorScopes(); - data.prePersist(); - data.preUpdate(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setScopeName("Test"); - assertTrue("Test".equals(data.getScopeName())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - - @Test - public void testDescriptiveScope(){ - DescriptiveScope data = new DescriptiveScope(); - data.prePersist(); - data.preUpdate(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setScopeName("Test"); - assertTrue("Test".equals(data.getScopeName())); - data.setSearch("Test"); - assertTrue("Test".equals(data.getSearch())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!=null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!=null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!=null); - } - - @Test - public void testGlobalRoleSettings(){ - GlobalRoleSettings data = new GlobalRoleSettings(); - new GlobalRoleSettings(true); - data.setRole("Test"); - assertTrue("Test".equals(data.getRole())); - data.setLockdown(true); - assertTrue(data.isLockdown()); - } + private static Logger logger = FlexLogger.getLogger(PolicyUtilsJPATest.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testWatchPolicyNotificationTable(){ + WatchPolicyNotificationTable data = new WatchPolicyNotificationTable(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setPolicyName("Test"); + assertTrue("Test".equals(data.getPolicyName())); + data.setLoginIds("Test"); + assertTrue("Test".equals(data.getLoginIds())); + data.equals(data); + data.hashCode(); + } + + @Test + public void testPolicyRoles(){ + PolicyRoles data = new PolicyRoles(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setScope("Test"); + assertTrue("Test".equals(data.getScope())); + data.setRole("Test"); + assertTrue("Test".equals(data.getRole())); + data.setLoginId(userInfo); + assertTrue("Test".equals(data.getLoginId().getUserLoginId())); + } + + @Test + public void testPolicyVersion(){ + PolicyVersion data = new PolicyVersion(); + new PolicyVersion("Test", "Test"); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setActiveVersion(1); + assertTrue(1 == data.getActiveVersion()); + data.setHigherVersion(1); + assertTrue(1 == data.getHigherVersion()); + data.setPolicyName("Test"); + assertTrue("Test".equals(data.getPolicyName())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.equals(data); + data.hashCode(); + } + + @Test + public void testSystemLogDB(){ + SystemLogDB data = new SystemLogDB(); + new SystemLogDB(1, "","","","",""); + data.setId(1); + assertTrue(1 == data.getId()); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); + data.setSystem("Test"); + assertTrue("Test".equals(data.getSystem())); + data.setRemote("Test"); + assertTrue("Test".equals(data.getRemote())); + data.setLogtype("Test"); + assertTrue("Test".equals(data.getLogtype())); + data.setDate(new Date()); + assertTrue(data.getDate()!=null); + } + + @Test + public void testRemoteCatalogValues(){ + RemoteCatalogValues data = new RemoteCatalogValues(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setValue("Test"); + assertTrue("Test".equals(data.getValue())); + } + + @Test + public void testPolicyScore(){ + PolicyScore data = new PolicyScore(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setPolicyName("Test"); + assertTrue("Test".equals(data.getPolicyName())); + data.setVersionExtension("Test"); + assertTrue("Test".equals(data.getVersionExtension())); + data.setPolicyScore("Test"); + assertTrue("Test".equals(data.getPolicyScore())); + } + + @Test + public void testPolicyEditorScopes(){ + PolicyEditorScopes data = new PolicyEditorScopes(); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setScopeName("Test"); + assertTrue("Test".equals(data.getScopeName())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testDescriptiveScope(){ + DescriptiveScope data = new DescriptiveScope(); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setScopeName("Test"); + assertTrue("Test".equals(data.getScopeName())); + data.setSearch("Test"); + assertTrue("Test".equals(data.getSearch())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testGlobalRoleSettings(){ + GlobalRoleSettings data = new GlobalRoleSettings(); + new GlobalRoleSettings(true); + data.setRole("Test"); + assertTrue("Test".equals(data.getRole())); + data.setLockdown(true); + assertTrue(data.isLockdown()); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java index 85a11d4d5..1064b240d 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java @@ -27,47 +27,47 @@ import org.junit.Test; public class MSAttributeObjectTest { - @Test - public void testMSAttributeObject(){ - MSAttributeObject data = new MSAttributeObject(); - data.setClassName("Test"); - assertTrue("Test".equals(data.getClassName())); - data.setRefAttribute(new HashMap<>()); - assertTrue(data.getRefAttribute()!=null); - data.setAttribute(new HashMap<>()); - assertTrue(data.getAttribute()!=null); - data.setEnumType(new HashMap<>()); - assertTrue(data.getEnumType()!=null); - data.addAttribute("test", "test"); - data.addRefAttribute("test", "test"); - data.addAllAttribute(new HashMap<>()); - data.addAllRefAttribute(new HashMap<>()); - data.setSubClass(new HashMap<>()); - assertTrue(data.getSubClass()!=null); - data.addAllSubClass(new HashMap<>()); - data.setDependency("Test"); - assertTrue("Test".equals(data.getDependency())); - data.addSingleEnum("test", "test"); - data.setMatchingSet(new HashMap<>()); - assertTrue(data.getMatchingSet()!=null); - data.addMatchingSet("test", "test"); - data.addMatchingSet(new HashMap<>()); - data.setPolicyTempalate(true); - assertTrue(data.isPolicyTempalate()); - } - - @Test - public void testMSAttributeValue(){ - MSAttributeValue data = new MSAttributeValue(); - data.setName("Test"); - assertTrue("Test".equals(data.getName())); - data.setType("Test"); - assertTrue("Test".equals(data.getType())); - data.setRequired(true); - assertTrue(data.getRequired()); - data.setArrayValue(true); - assertTrue(data.getArrayValue()); - data.setDefaultValue("Test"); - assertTrue("Test".equals(data.getDefaultValue())); - } + @Test + public void testMSAttributeObject(){ + MSAttributeObject data = new MSAttributeObject(); + data.setClassName("Test"); + assertTrue("Test".equals(data.getClassName())); + data.setRefAttribute(new HashMap<>()); + assertTrue(data.getRefAttribute()!=null); + data.setAttribute(new HashMap<>()); + assertTrue(data.getAttribute()!=null); + data.setEnumType(new HashMap<>()); + assertTrue(data.getEnumType()!=null); + data.addAttribute("test", "test"); + data.addRefAttribute("test", "test"); + data.addAllAttribute(new HashMap<>()); + data.addAllRefAttribute(new HashMap<>()); + data.setSubClass(new HashMap<>()); + assertTrue(data.getSubClass()!=null); + data.addAllSubClass(new HashMap<>()); + data.setDependency("Test"); + assertTrue("Test".equals(data.getDependency())); + data.addSingleEnum("test", "test"); + data.setMatchingSet(new HashMap<>()); + assertTrue(data.getMatchingSet()!=null); + data.addMatchingSet("test", "test"); + data.addMatchingSet(new HashMap<>()); + data.setPolicyTempalate(true); + assertTrue(data.isPolicyTempalate()); + } + + @Test + public void testMSAttributeValue(){ + MSAttributeValue data = new MSAttributeValue(); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); + data.setRequired(true); + assertTrue(data.getRequired()); + data.setArrayValue(true); + assertTrue(data.getArrayValue()); + data.setDefaultValue("Test"); + assertTrue("Test".equals(data.getDefaultValue())); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java index 6a9c4c4ec..e06103fcb 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java @@ -36,102 +36,102 @@ import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.rest.util.MSModelUtils.MODEL_TYPE; public class MSModelUtilsTest { - private static Logger logger = FlexLogger.getLogger(MSModelUtilsTest.class); - @Test - public void testMSModelUtils(){ - HashMap<String, MSAttributeObject> classMap = new HashMap<>(); - ClassLoader classLoader = getClass().getClassLoader(); - File file = new File(classLoader.getResource("DKaTVESPolicy-v1802.xmi").getFile()); - MSModelUtils utils = new MSModelUtils("http://org.onap", "http://org.onap.policy"); - Map<String, MSAttributeObject> tempMap = utils.processEpackage(file.getAbsolutePath().toString(), MODEL_TYPE.XMI); - classMap.putAll(tempMap); - MSAttributeObject mainClass = classMap.get("StandardDeviationThreshold"); - String dependTemp = StringUtils.replaceEach(mainClass.getDependency(), new String[]{"[", "]", " "}, new String[]{"", "", ""}); - List<String> dependency = new ArrayList<String>(Arrays.asList(dependTemp.split(","))); - dependency = utils.getFullDependencyList(dependency, classMap); - String subAttribute = utils.createSubAttributes(dependency, classMap, "StandardDeviationThreshold"); - assertTrue(subAttribute != null); - } - - - /** - * Run the void stringBetweenDots(String, String) method test - */ - - @Test - public void testStringBetweenDots() { - - //expect: uniqueKeys should contain a string value - MSModelUtils controllerA = new MSModelUtils(); - String str = "testing\\.byCorrectWay\\.OfDATA"; - assertEquals(1, controllerA.stringBetweenDots(str)); - - //expect: uniqueKeys should not contain a string value - str = "testing\byWrongtWay.\\OfDATA"; - MSModelUtils controllerB = new MSModelUtils(); - assertEquals(0, controllerB.stringBetweenDots(str)); - } - - /** - * Run the Map<String,String> load(String) method test - */ - - @Test - public void testLoad() { - - boolean isLocalTesting = true; - MSModelUtils controller = new MSModelUtils(); - String fileName = null; - Map<String,String> result = null; - try { - ClassLoader classLoader = getClass().getClassLoader(); - fileName = new File(classLoader.getResource("policy_tosca_tca-v1707.yml").getFile()).getAbsolutePath(); - } catch (Exception e1) { - logger.error("Exception Occured while loading file"+e1); - } - if(isLocalTesting){ - try { - result = controller.load(fileName); - } catch (IOException e) { - logger.error("testLoad", e); - result = null; - }catch(ParserException e){ - logger.error("testLoad", e); - } - - assertTrue(result != null && !result.isEmpty()); - logger.debug("result : " + result); - } - - logger.debug("testLoad: exit"); - } - - /** - * Run the void parseTosca(String) method test - */ - - @Test - public void testParseTosca() { - - logger.debug("testParseTosca: enter"); - boolean isLocalTesting = true; - String fileName = null; - try { - ClassLoader classLoader = getClass().getClassLoader(); - fileName = new File(classLoader.getResource("policy_tosca_tca-v1707.yml").getFile()).getAbsolutePath(); - } catch (Exception e1) { - logger.error("Exception Occured while loading file"+e1); - } - - MSModelUtils controller = new MSModelUtils(); + private static Logger logger = FlexLogger.getLogger(MSModelUtilsTest.class); + @Test + public void testMSModelUtils(){ + HashMap<String, MSAttributeObject> classMap = new HashMap<>(); + ClassLoader classLoader = getClass().getClassLoader(); + File file = new File(classLoader.getResource("DKaTVESPolicy-v1802.xmi").getFile()); + MSModelUtils utils = new MSModelUtils("http://org.onap", "http://org.onap.policy"); + Map<String, MSAttributeObject> tempMap = utils.processEpackage(file.getAbsolutePath().toString(), MODEL_TYPE.XMI); + classMap.putAll(tempMap); + MSAttributeObject mainClass = classMap.get("StandardDeviationThreshold"); + String dependTemp = StringUtils.replaceEach(mainClass.getDependency(), new String[]{"[", "]", " "}, new String[]{"", "", ""}); + List<String> dependency = new ArrayList<String>(Arrays.asList(dependTemp.split(","))); + dependency = utils.getFullDependencyList(dependency, classMap); + String subAttribute = utils.createSubAttributes(dependency, classMap, "StandardDeviationThreshold"); + assertTrue(subAttribute != null); + } + + + /** + * Run the void stringBetweenDots(String, String) method test + */ + + @Test + public void testStringBetweenDots() { + + //expect: uniqueKeys should contain a string value + MSModelUtils controllerA = new MSModelUtils(); + String str = "testing\\.byCorrectWay\\.OfDATA"; + assertEquals(1, controllerA.stringBetweenDots(str)); + + //expect: uniqueKeys should not contain a string value + str = "testing\byWrongtWay.\\OfDATA"; + MSModelUtils controllerB = new MSModelUtils(); + assertEquals(0, controllerB.stringBetweenDots(str)); + } + + /** + * Run the Map<String,String> load(String) method test + */ + + @Test + public void testLoad() { + + boolean isLocalTesting = true; + MSModelUtils controller = new MSModelUtils(); + String fileName = null; + Map<String,String> result = null; + try { + ClassLoader classLoader = getClass().getClassLoader(); + fileName = new File(classLoader.getResource("policy_tosca_tca-v1707.yml").getFile()).getAbsolutePath(); + } catch (Exception e1) { + logger.error("Exception Occured while loading file"+e1); + } + if(isLocalTesting){ + try { + result = controller.load(fileName); + } catch (IOException e) { + logger.error("testLoad", e); + result = null; + }catch(ParserException e){ + logger.error("testLoad", e); + } + + assertTrue(result != null && !result.isEmpty()); + logger.debug("result : " + result); + } + + logger.debug("testLoad: exit"); + } + + /** + * Run the void parseTosca(String) method test + */ + + @Test + public void testParseTosca() { + + logger.debug("testParseTosca: enter"); + boolean isLocalTesting = true; + String fileName = null; + try { + ClassLoader classLoader = getClass().getClassLoader(); + fileName = new File(classLoader.getResource("policy_tosca_tca-v1707.yml").getFile()).getAbsolutePath(); + } catch (Exception e1) { + logger.error("Exception Occured while loading file"+e1); + } + + MSModelUtils controller = new MSModelUtils(); if(isLocalTesting){ - try { - controller.parseTosca(fileName); - }catch (Exception e) { - fail("parseTosca caused error: " + e); - } + try { + controller.parseTosca(fileName); + }catch (Exception e) { + fail("parseTosca caused error: " + e); + } } - logger.debug("testParseTosca: exit"); - } + logger.debug("testParseTosca: exit"); + } }
\ No newline at end of file diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/util/PolicyValidationTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/util/PolicyValidationTest.java index fb51c2871..6051db4c3 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/util/PolicyValidationTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/util/PolicyValidationTest.java @@ -31,50 +31,50 @@ import org.onap.policy.api.PolicyParameters; import org.onap.policy.rest.adapter.PolicyRestAdapter; public class PolicyValidationTest { - - @Before - public void setUp() throws Exception { - } - @After - public void tearDown() throws Exception { - } - - @Test - public void microServicePolicyTests() throws Exception{ - PolicyValidation validation = new PolicyValidation(); - PolicyValidationRequestWrapper wrapper = new PolicyValidationRequestWrapper(); - PolicyParameters policyParameters = new PolicyParameters(); - - policyParameters.setPolicyConfigType(PolicyConfigType.MicroService); - policyParameters.setPolicyName("Test.junitPolicy"); - policyParameters.setPolicyDescription("This is a sample Micro Service policy Create example"); - policyParameters.setOnapName("DCAE"); - policyParameters.setPriority("1"); - String MSjsonString = "{\"service\":\"TOSCA_namingJenny\",\"location\":\"Test DictMSLoc\",\"uuid\":\"testDict DCAEUIID\",\"policyName\":\"testModelValidation\",\"description\":\"test\",\"configName\":\"testDict MSConfName\",\"templateVersion\":\"1607\",\"version\":\"gw12181031\",\"priority\":\"5\",\"policyScope\":\"resource=ResourcetypeVenktest1,service=ServiceName1707,type=Name1707,closedLoopControlName=Retest_retest1\",\"riskType\":\"Test\",\"riskLevel\":\"3\",\"guard\":\"True\",\"content\":{\"police-instance-name\":\"testing\",\"naming-models\":[{\"naming-properties\":[{\"property-value\":\"test\",\"source-endpoint\":\"test\",\"property-name\":\"testPropertyname\",\"increment-sequence\":{\"scope\":\"VNF\",\"start-value\":\"1\",\"length\":\"3\",\"increment\":\"2\"},\"source-system\":\"TOSCA\"}],\"naming-type\":\"testNamingType\",\"naming-recipe\":\"testNamingRecipe\"}]}}";; - policyParameters.setConfigBody(MSjsonString); - policyParameters.setRequestID(UUID.randomUUID()); - SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy"); - Date date = dateformat3.parse("15/10/2016"); - policyParameters.setTtlDate(date); - policyParameters.setGuard(true); - policyParameters.setRiskLevel("5"); - policyParameters.setRiskType("TEST"); - policyParameters.setRequestID(UUID.randomUUID()); + @Before + public void setUp() throws Exception { + } - - PolicyRestAdapter policyData = wrapper.populateRequestParameters(policyParameters); - StringBuilder responseString = validation.validatePolicy(policyData); - - assertNotSame("success", responseString.toString()); + @After + public void tearDown() throws Exception { + } - } + @Test + public void microServicePolicyTests() throws Exception{ + PolicyValidation validation = new PolicyValidation(); + PolicyValidationRequestWrapper wrapper = new PolicyValidationRequestWrapper(); + PolicyParameters policyParameters = new PolicyParameters(); - @Test - public final void testEmailValidation() { - PolicyValidation validation = new PolicyValidation(); - String result = validation.emailValidation("testemail@test.com", "SUCCESS"); - assertEquals("success", result); - } + policyParameters.setPolicyConfigType(PolicyConfigType.MicroService); + policyParameters.setPolicyName("Test.junitPolicy"); + policyParameters.setPolicyDescription("This is a sample Micro Service policy Create example"); + policyParameters.setOnapName("DCAE"); + policyParameters.setPriority("1"); + String MSjsonString = "{\"service\":\"TOSCA_namingJenny\",\"location\":\"Test DictMSLoc\",\"uuid\":\"testDict DCAEUIID\",\"policyName\":\"testModelValidation\",\"description\":\"test\",\"configName\":\"testDict MSConfName\",\"templateVersion\":\"1607\",\"version\":\"gw12181031\",\"priority\":\"5\",\"policyScope\":\"resource=ResourcetypeVenktest1,service=ServiceName1707,type=Name1707,closedLoopControlName=Retest_retest1\",\"riskType\":\"Test\",\"riskLevel\":\"3\",\"guard\":\"True\",\"content\":{\"police-instance-name\":\"testing\",\"naming-models\":[{\"naming-properties\":[{\"property-value\":\"test\",\"source-endpoint\":\"test\",\"property-name\":\"testPropertyname\",\"increment-sequence\":{\"scope\":\"VNF\",\"start-value\":\"1\",\"length\":\"3\",\"increment\":\"2\"},\"source-system\":\"TOSCA\"}],\"naming-type\":\"testNamingType\",\"naming-recipe\":\"testNamingRecipe\"}]}}";; + policyParameters.setConfigBody(MSjsonString); + policyParameters.setRequestID(UUID.randomUUID()); + SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy"); + Date date = dateformat3.parse("15/10/2016"); + policyParameters.setTtlDate(date); + policyParameters.setGuard(true); + policyParameters.setRiskLevel("5"); + policyParameters.setRiskType("TEST"); + policyParameters.setRequestID(UUID.randomUUID()); + + + PolicyRestAdapter policyData = wrapper.populateRequestParameters(policyParameters); + StringBuilder responseString = validation.validatePolicy(policyData); + + assertNotSame("success", responseString.toString()); + + } + + @Test + public final void testEmailValidation() { + PolicyValidation validation = new PolicyValidation(); + String result = validation.emailValidation("testemail@test.com", "SUCCESS"); + assertEquals("success", result); + } } |