--- /dev/null
+/*\r
+ * Copyright 2017 Huawei Technologies Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package org.onap.vfc.nfvo.resmanagement.service.entity;\r
+\r
+import java.io.Serializable;\r
+\r
+import org.apache.commons.lang3.StringUtils;\r
+import org.onap.vfc.nfvo.resmanagement.common.util.JsonUtil;\r
+\r
+import net.sf.json.JSONObject;\r
+\r
+/**\r
+ * <br>\r
+ * <p>\r
+ * </p>\r
+ * \r
+ * @author\r
+ * @version VFC 1.0 Sep 1, 2017\r
+ */\r
+public class NsEntity implements Serializable {\r
+\r
+ /** */\r
+ private String id;\r
+\r
+ /** */\r
+ private String name;\r
+\r
+ /** */\r
+ private String nsdId;\r
+\r
+ /** */\r
+ private String description;\r
+\r
+ /** */\r
+ private String status;\r
+\r
+ /** */\r
+ private String cteateTime;\r
+\r
+ /** */\r
+ private String lastUpdate;\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public String getId() {\r
+ return id;\r
+ }\r
+\r
+ public void setId(String id) {\r
+ this.id = id;\r
+ }\r
+\r
+ public String getName() {\r
+ return name;\r
+ }\r
+\r
+ public void setName(String name) {\r
+ this.name = name;\r
+ }\r
+\r
+ public String getNsdId() {\r
+ return nsdId;\r
+ }\r
+\r
+ public void setNsdId(String nsdId) {\r
+ this.nsdId = nsdId;\r
+ }\r
+\r
+ public String getDescription() {\r
+ return description;\r
+ }\r
+\r
+ public void setDescription(String description) {\r
+ this.description = description;\r
+ }\r
+\r
+ public String getStatus() {\r
+ return status;\r
+ }\r
+\r
+ public void setStatus(String status) {\r
+ this.status = status;\r
+ }\r
+\r
+ public String getCteateTime() {\r
+ return cteateTime;\r
+ }\r
+\r
+ public void setCteateTime(String cteateTime) {\r
+ this.cteateTime = cteateTime;\r
+ }\r
+\r
+ public String getLastUpdate() {\r
+ return lastUpdate;\r
+ }\r
+\r
+ public void setLastUpdate(String lastUpdate) {\r
+ this.lastUpdate = lastUpdate;\r
+ }\r
+\r
+ public static NsEntity toEntity(JSONObject jsonObject) {\r
+ NsEntity nsEntity = new NsEntity();\r
+ nsEntity.setId(JsonUtil.getJsonFieldStr(jsonObject, "id"));\r
+ nsEntity.setName(JsonUtil.getJsonFieldStr(jsonObject, "name"));\r
+ nsEntity.setNsdId(JsonUtil.getJsonFieldStr(jsonObject, "nsdId"));\r
+ nsEntity.setDescription(JsonUtil.getJsonFieldStr(jsonObject, "description"));\r
+ nsEntity.setStatus(JsonUtil.getJsonFieldStr(jsonObject, "status"));\r
+ nsEntity.setCteateTime(JsonUtil.getJsonFieldStr(jsonObject, "cteateTime"));\r
+ nsEntity.setLastUpdate(JsonUtil.getJsonFieldStr(jsonObject, "lastUpdate"));\r
+ return nsEntity;\r
+ }\r
+\r
+ @Override\r
+ public String toString() {\r
+ JSONObject nsResJson = new JSONObject();\r
+ nsResJson.put("id", StringUtils.trimToEmpty(this.getId()));\r
+ nsResJson.put("name", StringUtils.trimToEmpty(this.getName()));\r
+ nsResJson.put("nsdId", StringUtils.trimToEmpty(this.getNsdId()));\r
+ nsResJson.put("description", StringUtils.trimToEmpty(this.getDescription()));\r
+ nsResJson.put("status", StringUtils.trimToEmpty(this.getStatus()));\r
+ nsResJson.put("cteateTime", StringUtils.trimToEmpty(this.getCteateTime()));\r
+ nsResJson.put("lastUpdate", StringUtils.trimToEmpty(this.getLastUpdate()));\r
+ return nsResJson.toString();\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright 2017 Huawei Technologies Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package org.onap.vfc.nfvo.resmanagement.service.mapper;\r
+\r
+import java.util.List;\r
+import java.util.Map;\r
+\r
+import org.onap.vfc.nfvo.resmanagement.service.entity.NsEntity;\r
+\r
+public interface NsEntityMapper {\r
+\r
+ int deleteByPrimaryKey(String id);\r
+\r
+ int insert(NsEntity record);\r
+\r
+ int insertSelective(NsEntity record);\r
+\r
+ NsEntity selectByPrimaryKey(String id);\r
+\r
+ List<NsEntity> getAllNs(Map<String, Object> condition);\r
+\r
+ int updateByPrimaryKeySelective(NsEntity record);\r
+\r
+ int updateByPrimaryKey(NsEntity record);\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>\r
+<!--\r
+ Copyright 2017, Huawei Technologies Co., Ltd.\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+ -->\r
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >\r
+<mapper namespace="org.onap.vfc.nfvo.resmanagement.service.mapper.NsEntityMapper" >\r
+ <resultMap id="BaseResultMap" type="org.onap.vfc.nfvo.resmanagement.service.entity.NsEntity" >\r
+ <id column="ID" property="id" jdbcType="VARCHAR" />\r
+ <result column="NAME" property="name" jdbcType="VARCHAR" />\r
+ <result column="NSD_ID" property="nsdId" jdbcType="VARCHAR" />\r
+ <result column="DESCRIPTION" property="description" jdbcType="VARCHAR" />\r
+ <result column="STATUS" property="status" jdbcType="VARCHAR" />\r
+ <result column="CTEATE_TIME" property="cteateTime" jdbcType="VARCHAR" />\r
+ <result column="LAST_UPDATE" property="lastUpdate" jdbcType="VARCHAR" />\r
+ </resultMap>\r
+ \r
+ <sql id="Base_Column_List" >\r
+ ID, NAME, NSD_ID, DESCRIPTION, STATUS, CTEATE_TIME, LAST_UPDATE\r
+ </sql>\r
+ <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >\r
+ select \r
+ <include refid="Base_Column_List" />\r
+ from ns\r
+ where ID = #{id,jdbcType=VARCHAR}\r
+ </select>\r
+ <select id="getAllNs" resultMap="BaseResultMap" parameterType="java.util.Map">\r
+ select\r
+ <include refid="Base_Column_List" />\r
+ from vnf\r
+ <where>\r
+ <if test="id != null">\r
+ AND ID = #{id,jdbcType=VARCHAR}\r
+ </if>\r
+ </where>\r
+ </select>\r
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >\r
+ delete from ns\r
+ where ID = #{id,jdbcType=VARCHAR}\r
+ </delete>\r
+ <insert id="insert" parameterType="org.onap.vfc.nfvo.resmanagement.service.entity.NsEntity" >\r
+ insert into ns (ID, NAME, NSD_ID, \r
+ DESCRIPTION, STATUS, CTEATE_TIME, \r
+ LAST_UPDATE)\r
+ values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{nsdId,jdbcType=VARCHAR}, \r
+ #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{cteateTime,jdbcType=VARCHAR}, \r
+ #{lastUpdate,jdbcType=VARCHAR})\r
+ </insert>\r
+ <insert id="insertSelective" parameterType="org.onap.vfc.nfvo.resmanagement.service.entity.NsEntity" >\r
+ insert into ns\r
+ <trim prefix="(" suffix=")" suffixOverrides="," >\r
+ <if test="id != null" >\r
+ ID,\r
+ </if>\r
+ <if test="name != null" >\r
+ NAME,\r
+ </if>\r
+ <if test="nsdId != null" >\r
+ NSD_ID,\r
+ </if>\r
+ <if test="description != null" >\r
+ DESCRIPTION,\r
+ </if>\r
+ <if test="status != null" >\r
+ STATUS,\r
+ </if>\r
+ <if test="cteateTime != null" >\r
+ CTEATE_TIME,\r
+ </if>\r
+ <if test="lastUpdate != null" >\r
+ LAST_UPDATE,\r
+ </if>\r
+ </trim>\r
+ <trim prefix="values (" suffix=")" suffixOverrides="," >\r
+ <if test="id != null" >\r
+ #{id,jdbcType=VARCHAR},\r
+ </if>\r
+ <if test="name != null" >\r
+ #{name,jdbcType=VARCHAR},\r
+ </if>\r
+ <if test="nsdId != null" >\r
+ #{nsdId,jdbcType=VARCHAR},\r
+ </if>\r
+ <if test="description != null" >\r
+ #{description,jdbcType=VARCHAR},\r
+ </if>\r
+ <if test="status != null" >\r
+ #{status,jdbcType=VARCHAR},\r
+ </if>\r
+ <if test="cteateTime != null" >\r
+ #{cteateTime,jdbcType=VARCHAR},\r
+ </if>\r
+ <if test="lastUpdate != null" >\r
+ #{lastUpdate,jdbcType=VARCHAR},\r
+ </if>\r
+ </trim>\r
+ </insert>\r
+ <update id="updateByPrimaryKeySelective" parameterType="org.onap.vfc.nfvo.resmanagement.service.entity.NsEntity" >\r
+ update ns\r
+ <set >\r
+ <if test="name != null" >\r
+ NAME = #{name,jdbcType=VARCHAR},\r
+ </if>\r
+ <if test="nsdId != null" >\r
+ NSD_ID = #{nsdId,jdbcType=VARCHAR},\r
+ </if>\r
+ <if test="description != null" >\r
+ DESCRIPTION = #{description,jdbcType=VARCHAR},\r
+ </if>\r
+ <if test="status != null" >\r
+ STATUS = #{status,jdbcType=VARCHAR},\r
+ </if>\r
+ <if test="cteateTime != null" >\r
+ CTEATE_TIME = #{cteateTime,jdbcType=VARCHAR},\r
+ </if>\r
+ <if test="lastUpdate != null" >\r
+ LAST_UPDATE = #{lastUpdate,jdbcType=VARCHAR},\r
+ </if>\r
+ </set>\r
+ where ID = #{id,jdbcType=VARCHAR}\r
+ </update>\r
+ <update id="updateByPrimaryKey" parameterType="org.onap.vfc.nfvo.resmanagement.service.entity.NsEntity" >\r
+ update ns\r
+ set NAME = #{name,jdbcType=VARCHAR},\r
+ NSD_ID = #{nsdId,jdbcType=VARCHAR},\r
+ DESCRIPTION = #{description,jdbcType=VARCHAR},\r
+ STATUS = #{status,jdbcType=VARCHAR},\r
+ CTEATE_TIME = #{cteateTime,jdbcType=VARCHAR},\r
+ LAST_UPDATE = #{lastUpdate,jdbcType=VARCHAR}\r
+ where ID = #{id,jdbcType=VARCHAR}\r
+ </update>\r
+</mapper>
\ No newline at end of file