revert-70aa11f8
kamidu 8 years ago
commit 2ec2600471

@ -18,154 +18,154 @@
font-family: "Roboto";
font-style: italic;
font-weight: 100;
src: local("Roboto Thin Italic"), local("Roboto-ThinItalic"), url(../fonts/Roboto/Roboto-ThinItalic.woff2) format("woff2"), url(../fonts/Roboto/Roboto-ThinItalic.woff) format("woff"), url(../fonts/Roboto/Roboto-ThinItalic.ttf) format("truetype"), url(../fonts/Roboto/Roboto-ThinItalic.eot), url(../fonts/Roboto/Roboto-ThinItalic.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-ThinItalic.svg#Roboto) format("svg");
src: local("Roboto Thin Italic"), local("Roboto-ThinItalic"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-ThinItalic-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-ThinItalic-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-ThinItalic-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-ThinItalic-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-ThinItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-ThinItalic-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "Roboto";
font-style: italic;
font-weight: 300;
src: local("Roboto Light Italic"), local("Roboto-LightItalic"), url(../fonts/Roboto/Roboto-LightItalic.woff2) format("woff2"), url(../fonts/Roboto/Roboto-LightItalic.woff) format("woff"), url(../fonts/Roboto/Roboto-LightItalic.ttf) format("truetype"), url(../fonts/Roboto/Roboto-LightItalic.eot), url(../fonts/Roboto/Roboto-LightItalic.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-LightItalic.svg#Roboto) format("svg");
src: local("Roboto Light Italic"), local("Roboto-LightItalic"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-LightItalic-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-LightItalic-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-LightItalic-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-LightItalic-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-LightItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-LightItalic-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "Roboto";
font-style: italic;
font-weight: 400;
src: local("Roboto Italic"), local("Roboto-Italic"), url(../fonts/Roboto/Roboto-Italic.woff2) format("woff2"), url(../fonts/Roboto/Roboto-Italic.woff) format("woff"), url(../fonts/Roboto/Roboto-Italic.ttf) format("truetype"), url(../fonts/Roboto/Roboto-Italic.eot), url(../fonts/Roboto/Roboto-Italic.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-Italic.svg#Roboto) format("svg");
src: local("Roboto Italic"), local("Roboto-Italic"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Italic-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Italic-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Italic-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Italic-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Italic-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Italic-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "Roboto";
font-style: italic;
font-weight: 500;
src: local("Roboto Medium Italic"), local("Roboto-MediumItalic"), url(../fonts/Roboto/Roboto-MediumItalic.woff2) format("woff2"), url(../fonts/Roboto/Roboto-MediumItalic.woff) format("woff"), url(../fonts/Roboto/Roboto-MediumItalic.ttf) format("truetype"), url(../fonts/Roboto/Roboto-MediumItalic.eot), url(../fonts/Roboto/Roboto-MediumItalic.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-MediumItalic.svg#Roboto) format("svg");
src: local("Roboto Medium Italic"), local("Roboto-MediumItalic"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-MediumItalic-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-MediumItalic-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-MediumItalic-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-MediumItalic-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-MediumItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-MediumItalic-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "Roboto";
font-style: italic;
font-weight: 700;
src: local("Roboto Bold Italic"), local("Roboto-BoldItalic"), url(../fonts/Roboto/Roboto-BoldItalic.woff2) format("woff2"), url(../fonts/Roboto/Roboto-BoldItalic.woff) format("woff"), url(../fonts/Roboto/Roboto-BoldItalic.ttf) format("truetype"), url(../fonts/Roboto/Roboto-BoldItalic.eot), url(../fonts/Roboto/Roboto-BoldItalic.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-BoldItalic.svg#Roboto) format("svg");
src: local("Roboto Bold Italic"), local("Roboto-BoldItalic"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BoldItalic-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BoldItalic-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BoldItalic-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BoldItalic-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BoldItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BoldItalic-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "Roboto";
font-style: italic;
font-weight: 900;
src: local("Roboto Black Italic"), local("Roboto-BlackItalic"), url(../fonts/Roboto/Roboto-BlackItalic.woff2) format("woff2"), url(../fonts/Roboto/Roboto-BlackItalic.woff) format("woff"), url(../fonts/Roboto/Roboto-BlackItalic.ttf) format("truetype"), url(../fonts/Roboto/Roboto-BlackItalic.eot), url(../fonts/Roboto/Roboto-BlackItalic.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-BlackItalic.svg#Roboto) format("svg");
src: local("Roboto Black Italic"), local("Roboto-BlackItalic"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BlackItalic-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BlackItalic-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BlackItalic-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BlackItalic-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BlackItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-BlackItalic-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 100;
src: local("Roboto Thin"), local("Roboto-Thin"), url(../fonts/Roboto/Roboto-Thin.woff2) format("woff2"), url(../fonts/Roboto/Roboto-Thin.woff) format("woff"), url(../fonts/Roboto/Roboto-Thin.ttf) format("truetype"), url(../fonts/Roboto/Roboto-Thin.eot), url(../fonts/Roboto/Roboto-Thin.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-Thin.svg#Roboto) format("svg");
src: local("Roboto Thin"), local("Roboto-Thin"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Thin-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Thin-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Thin-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Thin-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Thin-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Thin-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 300;
src: local("Roboto Light"), local("Roboto-Light"), url(../fonts/Roboto/Roboto-Light.woff2) format("woff2"), url(../fonts/Roboto/Roboto-Light.woff) format("woff"), url(../fonts/Roboto/Roboto-Light.ttf) format("truetype"), url(../fonts/Roboto/Roboto-Light.eot), url(../fonts/Roboto/Roboto-Light.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-Light.svg#Roboto) format("svg");
src: local("Roboto Light"), local("Roboto-Light"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Light-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Light-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Light-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Light-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Light-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Light-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 400;
src: local("Roboto Regular"), local("Roboto-Regular"), url(../fonts/Roboto/Roboto-Regular.woff2) format("woff2"), url(../fonts/Roboto/Roboto-Regular.woff) format("woff"), url(../fonts/Roboto/Roboto-Regular.ttf) format("truetype"), url(../fonts/Roboto/Roboto-Regular.eot), url(../fonts/Roboto/Roboto-Regular.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-Regular.svg#Roboto) format("svg");
src: local("Roboto Regular"), local("Roboto-Regular"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Regular-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Regular-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Regular-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Regular-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Regular-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Regular-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 500;
src: local("Roboto Medium"), local("Roboto-Medium"), url(../fonts/Roboto/Roboto-Medium.woff2) format("woff2"), url(../fonts/Roboto/Roboto-Medium.woff) format("woff"), url(../fonts/Roboto/Roboto-Medium.ttf) format("truetype"), url(../fonts/Roboto/Roboto-Medium.eot), url(../fonts/Roboto/Roboto-Medium.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-Medium.svg#Roboto) format("svg");
src: local("Roboto Medium"), local("Roboto-Medium"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Medium-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Medium-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Medium-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Medium-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Medium-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Medium-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 700;
src: local("Roboto Bold"), local("Roboto-Bold"), url(../fonts/Roboto/Roboto-Bold.woff2) format("woff2"), url(../fonts/Roboto/Roboto-Bold.woff) format("woff"), url(../fonts/Roboto/Roboto-Bold.ttf) format("truetype"), url(../fonts/Roboto/Roboto-Bold.eot), url(../fonts/Roboto/Roboto-Bold.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-Bold.svg#Roboto) format("svg");
src: local("Roboto Bold"), local("Roboto-Bold"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Bold-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Bold-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Bold-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Bold-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Bold-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Bold-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 900;
src: local("Roboto Black"), local("Roboto-Black"), url(../fonts/Roboto/Roboto-Black.woff2) format("woff2"), url(../fonts/Roboto/Roboto-Black.woff) format("woff"), url(../fonts/Roboto/Roboto-Black.ttf) format("truetype"), url(../fonts/Roboto/Roboto-Black.eot), url(../fonts/Roboto/Roboto-Black.eot?#iefix) format("embedded-opentype"), url(../fonts/Roboto/Roboto-Black.svg#Roboto) format("svg");
src: local("Roboto Black"), local("Roboto-Black"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Black-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Black-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Black-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Black-webfont.eot), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Black-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/Roboto/Roboto-Black-webfont.svg#Roboto) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "OpenSans";
font-style: italic;
font-weight: 100;
src: local("OpenSans Light"), local("OpenSans-LightItalic-webfont"), url(../fonts/OpenSans/OpenSans-LightItalic-webfont.woff2) format("woff2"), url(../fonts/OpenSans/OpenSans-LightItalic-webfont.woff) format("woff"), url(../fonts/OpenSans/OpenSans-LightItalic-webfont.ttf) format("truetype"), url(../fonts/OpenSans/OpenSans-LightItalic-webfont.eot), url(../fonts/OpenSans/OpenSans-LightItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../fonts/OpenSans/OpenSans-LightItalic-webfont.svg#OpenSans) format("svg");
src: local("OpenSans Light"), local("OpenSans-LightItalic-webfont"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-LightItalic-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-LightItalic-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-LightItalic-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-LightItalic-webfont.eot), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-LightItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-LightItalic-webfont.svg#OpenSans) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "OpenSans";
font-style: italic;
font-weight: 300;
src: local("OpenSans Regular"), local("OpenSans-RegularItalic-webfont"), url(../fonts/OpenSans/OpenSans-RegularItalic-webfont.woff2) format("woff2"), url(../fonts/OpenSans/OpenSans-RegularItalic-webfont.woff) format("woff"), url(../fonts/OpenSans/OpenSans-RegularItalic-webfont.ttf) format("truetype"), url(../fonts/OpenSans/OpenSans-RegularItalic-webfont.eot), url(../fonts/OpenSans/OpenSans-RegularItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../fonts/OpenSans/OpenSans-RegularItalic-webfont.svg#OpenSans) format("svg");
src: local("OpenSans Regular"), local("OpenSans-RegularItalic-webfont"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-RegularItalic-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-RegularItalic-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-RegularItalic-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-RegularItalic-webfont.eot), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-RegularItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-RegularItalic-webfont.svg#OpenSans) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "OpenSans";
font-style: italic;
font-weight: 400;
src: local("OpenSans Semi Bold"), local("OpenSans-SemiboldItalic-webfont"), url(../fonts/OpenSans/OpenSans-SemiboldItalic-webfont.woff2) format("woff2"), url(../fonts/OpenSans/OpenSans-SemiboldItalic-webfont.woff) format("woff"), url(../fonts/OpenSans/OpenSans-SemiboldItalic-webfont.ttf) format("truetype"), url(../fonts/OpenSans/OpenSans-SemiboldItalic-webfont.eot), url(../fonts/OpenSans/OpenSans-SemiboldItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../fonts/OpenSans/OpenSans-SemiboldItalic-webfont.svg#OpenSans) format("svg");
src: local("OpenSans Semi Bold"), local("OpenSans-SemiboldItalic-webfont"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-SemiboldItalic-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-SemiboldItalic-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-SemiboldItalic-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-SemiboldItalic-webfont.eot), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-SemiboldItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-SemiboldItalic-webfont.svg#OpenSans) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "OpenSans";
font-style: italic;
font-weight: 500;
src: local("OpenSans Bold"), local("OpenSans-BoldItalic-webfont"), url(../fonts/OpenSans/OpenSans-BoldItalic-webfont.woff2) format("woff2"), url(../fonts/OpenSans/OpenSans-BoldItalic-webfont.woff) format("woff"), url(../fonts/OpenSans/OpenSans-BoldItalic-webfont.ttf) format("truetype"), url(../fonts/OpenSans/OpenSans-BoldItalic-webfont.eot), url(../fonts/OpenSans/OpenSans-BoldItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../fonts/OpenSans/OpenSans-BoldItalic-webfont.svg#OpenSans) format("svg");
src: local("OpenSans Bold"), local("OpenSans-BoldItalic-webfont"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-BoldItalic-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-BoldItalic-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-BoldItalic-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-BoldItalic-webfont.eot), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-BoldItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-BoldItalic-webfont.svg#OpenSans) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "OpenSans";
font-style: italic;
font-weight: 700;
src: local("OpenSans Extra Bold"), local("OpenSans-ExtraBoldItalic-webfont"), url(../fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.woff2) format("woff2"), url(../fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.woff) format("woff"), url(../fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.ttf) format("truetype"), url(../fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.eot), url(../fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.svg#OpenSans) format("svg");
src: local("OpenSans Extra Bold"), local("OpenSans-ExtraBoldItalic-webfont"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.eot), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.svg#OpenSans) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "OpenSans";
font-style: normal;
font-weight: 100;
src: local("OpenSans Light"), local("OpenSans-Light-webfont"), url(../fonts/OpenSans/OpenSans-Light-webfont.woff2) format("woff2"), url(../fonts/OpenSans/OpenSans-Light-webfont.woff) format("woff"), url(../fonts/OpenSans/OpenSans-Light-webfont.ttf) format("truetype"), url(../fonts/OpenSans/OpenSans-Light-webfont.eot), url(../fonts/OpenSans/OpenSans-Light-webfont.eot?#iefix) format("embedded-opentype"), url(../fonts/OpenSans/OpenSans-Light-webfont.svg#OpenSans) format("svg");
src: local("OpenSans Light"), local("OpenSans-Light-webfont"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Light-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Light-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Light-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Light-webfont.eot), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Light-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Light-webfont.svg#OpenSans) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "OpenSans";
font-style: normal;
font-weight: 300;
src: local("OpenSans Regular"), local("OpenSans-Regular-webfont"), url(../fonts/OpenSans/OpenSans-Regular-webfont.woff2) format("woff2"), url(../fonts/OpenSans/OpenSans-Regular-webfont.woff) format("woff"), url(../fonts/OpenSans/OpenSans-Regular-webfont.ttf) format("truetype"), url(../fonts/OpenSans/OpenSans-Regular-webfont.eot), url(../fonts/OpenSans/OpenSans-Regular-webfont.eot?#iefix) format("embedded-opentype"), url(../fonts/OpenSans/OpenSans-Regular-webfont.svg#OpenSans) format("svg");
src: local("OpenSans Regular"), local("OpenSans-Regular-webfont"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Regular-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Regular-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Regular-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Regular-webfont.eot), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Regular-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Regular-webfont.svg#OpenSans) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "OpenSans";
font-style: normal;
font-weight: 400;
src: local("OpenSans Semi Bold"), local("OpenSans-Semibold-webfont"), url(../fonts/OpenSans/OpenSans-Semibold-webfont.woff2) format("woff2"), url(../fonts/OpenSans/OpenSans-Semibold-webfont.woff) format("woff"), url(../fonts/OpenSans/OpenSans-Semibold-webfont.ttf) format("truetype"), url(../fonts/OpenSans/OpenSans-Semibold-webfont.eot), url(../fonts/OpenSans/OpenSans-Semibold-webfont.eot?#iefix) format("embedded-opentype"), url(../fonts/OpenSans/OpenSans-Semibold-webfont.svg#OpenSans) format("svg");
src: local("OpenSans Semi Bold"), local("OpenSans-Semibold-webfont"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Semibold-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Semibold-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Semibold-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Semibold-webfont.eot), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Semibold-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Semibold-webfont.svg#OpenSans) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "OpenSans";
font-style: normal;
font-weight: 500;
src: local("OpenSans Bold"), local("OpenSans-Bold-webfont"), url(../fonts/OpenSans/OpenSans-Bold-webfont.woff2) format("woff2"), url(../fonts/OpenSans/OpenSans-Bold-webfont.woff) format("woff"), url(../fonts/OpenSans/OpenSans-Bold-webfont.ttf) format("truetype"), url(../fonts/OpenSans/OpenSans-Bold-webfont.eot), url(../fonts/OpenSans/OpenSans-Bold-webfont.eot?#iefix) format("embedded-opentype"), url(../fonts/OpenSans/OpenSans-Bold-webfont.svg#OpenSans) format("svg");
src: local("OpenSans Bold"), local("OpenSans-Bold-webfont"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Bold-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Bold-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Bold-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Bold-webfont.eot), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Bold-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Bold-webfont.svg#OpenSans) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
@font-face {
font-family: "OpenSans";
font-style: normal;
font-weight: 700;
src: local("OpenSans Extra Bold"), local("OpenSans-ExtraBold-webfont"), url(../fonts/OpenSans/OpenSans-ExtraBold-webfont.woff2) format("woff2"), url(../fonts/OpenSans/OpenSans-ExtraBold-webfont.woff) format("woff"), url(../fonts/OpenSans/OpenSans-ExtraBold-webfont.ttf) format("truetype"), url(../fonts/OpenSans/OpenSans-ExtraBold-webfont.eot), url(../fonts/OpenSans/OpenSans-ExtraBold-webfont.eot?#iefix) format("embedded-opentype"), url(../fonts/OpenSans/OpenSans-ExtraBold-webfont.svg#OpenSans) format("svg");
src: local("OpenSans Extra Bold"), local("OpenSans-ExtraBold-webfont"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBold-webfont.woff2) format("woff2"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBold-webfont.woff) format("woff"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBold-webfont.ttf) format("truetype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBold-webfont.eot), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBold-webfont.eot?#iefix) format("embedded-opentype"), url(../lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBold-webfont.svg#OpenSans) format("svg");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */

@ -20,13 +20,16 @@ package org.wso2.carbon.policy.mgt.core.dao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.IllegalTransactionStateException;
import org.wso2.carbon.device.mgt.common.UnsupportedDatabaseEngineException;
import org.wso2.carbon.policy.mgt.core.config.datasource.DataSourceConfig;
import org.wso2.carbon.policy.mgt.core.config.datasource.JNDILookupDefinition;
import org.wso2.carbon.policy.mgt.core.dao.impl.FeatureDAOImpl;
import org.wso2.carbon.policy.mgt.core.dao.impl.MonitoringDAOImpl;
import org.wso2.carbon.policy.mgt.core.dao.impl.PolicyDAOImpl;
import org.wso2.carbon.policy.mgt.core.dao.impl.ProfileDAOImpl;
import org.wso2.carbon.policy.mgt.core.dao.impl.feature.GenericFeatureDAOImpl;
import org.wso2.carbon.policy.mgt.core.dao.impl.feature.SQLServerFeatureDAOImpl;
import org.wso2.carbon.policy.mgt.core.dao.util.PolicyManagementDAOUtil;
import javax.sql.DataSource;
@ -38,15 +41,26 @@ import java.util.List;
public class PolicyManagementDAOFactory {
private static DataSource dataSource;
private static String databaseEngine;
private static final Log log = LogFactory.getLog(PolicyManagementDAOFactory.class);
private static ThreadLocal<Connection> currentConnection = new ThreadLocal<>();
public static void init(DataSourceConfig config) {
dataSource = resolveDataSource(config);
try {
databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
} catch (SQLException e) {
log.error("Error occurred while retrieving config.datasource connection", e);
}
}
public static void init(DataSource dtSource) {
dataSource = dtSource;
try {
databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
} catch (SQLException e) {
log.error("Error occurred while retrieving config.datasource connection", e);
}
}
public static PolicyDAO getPolicyDAO() {
@ -58,7 +72,20 @@ public class PolicyManagementDAOFactory {
}
public static FeatureDAO getFeatureDAO() {
return new FeatureDAOImpl();
if (databaseEngine != null) {
switch (databaseEngine) {
case DeviceManagementConstants.DataBaseTypes.DB_TYPE_MSSQL:
return new SQLServerFeatureDAOImpl();
case DeviceManagementConstants.DataBaseTypes.DB_TYPE_ORACLE:
case DeviceManagementConstants.DataBaseTypes.DB_TYPE_POSTGRESQL:
case DeviceManagementConstants.DataBaseTypes.DB_TYPE_H2:
case DeviceManagementConstants.DataBaseTypes.DB_TYPE_MYSQL:
return new GenericFeatureDAOImpl();
default:
throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
}
}
throw new IllegalStateException("Database engine has not initialized properly.");
}
public static MonitoringDAO getMonitoringDAO() {

@ -1,22 +1,22 @@
/*
* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.policy.mgt.core.dao.impl;
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* you may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.policy.mgt.core.dao.impl.feature;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -40,9 +40,12 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class FeatureDAOImpl implements FeatureDAO {
/**
* Abstract implementation of FeatureDAO which holds generic SQL queries.
*/
public abstract class AbstractFeatureDAO implements FeatureDAO {
private static final Log log = LogFactory.getLog(FeatureDAOImpl.class);
private static final Log log = LogFactory.getLog(AbstractFeatureDAO.class);
@Override
public ProfileFeature addProfileFeature(ProfileFeature feature, int profileId) throws FeatureManagerDAOException {
@ -51,59 +54,13 @@ public class FeatureDAOImpl implements FeatureDAO {
@Override
public ProfileFeature updateProfileFeature(ProfileFeature feature, int profileId) throws
FeatureManagerDAOException {
FeatureManagerDAOException {
return null;
}
@Override
public List<ProfileFeature> addProfileFeatures(List<ProfileFeature> features, int profileId) throws
FeatureManagerDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet generatedKeys = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
try {
conn = this.getConnection();
String query = "INSERT INTO DM_PROFILE_FEATURES (PROFILE_ID, FEATURE_CODE, DEVICE_TYPE, CONTENT, " +
"TENANT_ID) VALUES (?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(query, new String[] {"id"});
for (ProfileFeature feature : features) {
stmt.setInt(1, profileId);
stmt.setString(2, feature.getFeatureCode());
stmt.setString(3, feature.getDeviceType());
// if (conn.getMetaData().getDriverName().contains("H2")) {
// stmt.setBytes(4, PolicyManagerUtil.getBytes(feature.getContent()));
// } else {
stmt.setBytes(4, PolicyManagerUtil.getBytes(feature.getContent()));
//}
stmt.setInt(5, tenantId);
stmt.addBatch();
//Not adding the logic to check the size of the stmt and execute if the size records added is over 1000
}
stmt.executeBatch();
generatedKeys = stmt.getGeneratedKeys();
int i = 0;
while (generatedKeys.next()) {
features.get(i).setId(generatedKeys.getInt(1));
i++;
}
} catch (SQLException | IOException e) {
throw new FeatureManagerDAOException("Error occurred while adding the feature list to the database.", e);
} finally {
PolicyManagementDAOUtil.cleanupResources(stmt, generatedKeys);
}
return features;
}
@Override
public List<ProfileFeature> updateProfileFeatures(List<ProfileFeature> features, int profileId) throws
FeatureManagerDAOException {
FeatureManagerDAOException {
Connection conn;
PreparedStatement stmt = null;
@ -112,7 +69,7 @@ public class FeatureDAOImpl implements FeatureDAO {
try {
conn = this.getConnection();
String query = "UPDATE DM_PROFILE_FEATURES SET CONTENT = ? WHERE PROFILE_ID = ? AND FEATURE_CODE = ? AND" +
" TENANT_ID = ?";
" TENANT_ID = ?";
stmt = conn.prepareStatement(query);
for (ProfileFeature feature : features) {
@ -209,7 +166,7 @@ public class FeatureDAOImpl implements FeatureDAO {
try {
conn = this.getConnection();
String query = "SELECT ID, PROFILE_ID, FEATURE_CODE, DEVICE_TYPE, CONTENT FROM DM_PROFILE_FEATURES " +
"WHERE TENANT_ID = ?";
"WHERE TENANT_ID = ?";
stmt = conn.prepareStatement(query);
stmt.setInt(1, tenantId);
resultSet = stmt.executeQuery();
@ -270,8 +227,8 @@ public class FeatureDAOImpl implements FeatureDAO {
try {
conn = this.getConnection();
String query = "SELECT f.ID ID, f.NAME NAME, f.CODE CODE, f.DEVICE_TYPE DEVICE_TYPE," +
" f.EVALUATION_RULE EVALUATION_RULE FROM DM_FEATURES f INNER JOIN DM_DEVICE_TYPE d " +
"ON d.ID=f.DEVICE_TYPE WHERE d.NAME = ?";
" f.EVALUATION_RULE EVALUATION_RULE FROM DM_FEATURES f INNER JOIN DM_DEVICE_TYPE d " +
"ON d.ID=f.DEVICE_TYPE WHERE d.NAME = ?";
stmt = conn.prepareStatement(query);
stmt.setString(1, deviceType);
resultSet = stmt.executeQuery();
@ -286,7 +243,7 @@ public class FeatureDAOImpl implements FeatureDAO {
}
} catch (SQLException e) {
throw new FeatureManagerDAOException("Unable to get the list of the features related device type " +
"from database.", e);
"from database.", e);
} finally {
PolicyManagementDAOUtil.cleanupResources(stmt, resultSet);
}
@ -304,7 +261,7 @@ public class FeatureDAOImpl implements FeatureDAO {
try {
conn = this.getConnection();
String query = "SELECT ID, FEATURE_CODE, DEVICE_TYPE, CONTENT FROM DM_PROFILE_FEATURES " +
"WHERE PROFILE_ID = ? AND TENANT_ID = ?";
"WHERE PROFILE_ID = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(query);
stmt.setInt(1, profileId);
stmt.setInt(2, tenantId);
@ -372,7 +329,7 @@ public class FeatureDAOImpl implements FeatureDAO {
return false;
} catch (SQLException e) {
throw new FeatureManagerDAOException("Unable to delete the feature " + featureId + " (Feature ID) " +
"from database.", e);
"from database.", e);
} finally {
PolicyManagementDAOUtil.cleanupResources(stmt, null);
}
@ -381,5 +338,4 @@ public class FeatureDAOImpl implements FeatureDAO {
private Connection getConnection() throws FeatureManagerDAOException {
return PolicyManagementDAOFactory.getConnection();
}
}

@ -0,0 +1,93 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* you may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.policy.mgt.core.dao.impl.feature;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.policy.mgt.common.ProfileFeature;
import org.wso2.carbon.policy.mgt.core.dao.FeatureManagerDAOException;
import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory;
import org.wso2.carbon.policy.mgt.core.dao.util.PolicyManagementDAOUtil;
import org.wso2.carbon.policy.mgt.core.util.PolicyManagerUtil;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
/**
* FeatureDAO implementation for DB engines with ANSI SQL support.
*/
public final class GenericFeatureDAOImpl extends AbstractFeatureDAO {
private static final Log log = LogFactory.getLog(GenericFeatureDAOImpl.class);
@Override
public List<ProfileFeature> addProfileFeatures(List<ProfileFeature> features, int profileId) throws
FeatureManagerDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet generatedKeys = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
try {
conn = this.getConnection();
String query = "INSERT INTO DM_PROFILE_FEATURES (PROFILE_ID, FEATURE_CODE, DEVICE_TYPE, CONTENT, " +
"TENANT_ID) VALUES (?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(query, new String[] {"id"});
for (ProfileFeature feature : features) {
stmt.setInt(1, profileId);
stmt.setString(2, feature.getFeatureCode());
stmt.setString(3, feature.getDeviceType());
// if (conn.getMetaData().getDriverName().contains("H2")) {
// stmt.setBytes(4, PolicyManagerUtil.getBytes(feature.getContent()));
// } else {
stmt.setBytes(4, PolicyManagerUtil.getBytes(feature.getContent()));
//}
stmt.setInt(5, tenantId);
stmt.addBatch();
//Not adding the logic to check the size of the stmt and execute if the size records added is over 1000
}
stmt.executeBatch();
generatedKeys = stmt.getGeneratedKeys();
int i = 0;
while (generatedKeys.next()) {
features.get(i).setId(generatedKeys.getInt(1));
i++;
}
} catch (SQLException | IOException e) {
throw new FeatureManagerDAOException("Error occurred while adding the feature list to the database.", e);
} finally {
PolicyManagementDAOUtil.cleanupResources(stmt, generatedKeys);
}
return features;
}
private Connection getConnection() throws FeatureManagerDAOException {
return PolicyManagementDAOFactory.getConnection();
}
}

@ -0,0 +1,94 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* you may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.policy.mgt.core.dao.impl.feature;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.policy.mgt.common.ProfileFeature;
import org.wso2.carbon.policy.mgt.core.dao.FeatureManagerDAOException;
import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory;
import org.wso2.carbon.policy.mgt.core.dao.util.PolicyManagementDAOUtil;
import org.wso2.carbon.policy.mgt.core.util.PolicyManagerUtil;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
/**
* FeatureDAO implementation for MSSQL DB engine.
*/
public final class SQLServerFeatureDAOImpl extends AbstractFeatureDAO {
private static final Log log = LogFactory.getLog(SQLServerFeatureDAOImpl.class);
@Override
public List<ProfileFeature> addProfileFeatures(List<ProfileFeature> features, int profileId) throws
FeatureManagerDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet generatedKeys = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
try {
conn = this.getConnection();
String query = "INSERT INTO DM_PROFILE_FEATURES (PROFILE_ID, FEATURE_CODE, DEVICE_TYPE, CONTENT, " +
"TENANT_ID) VALUES (?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(query, new String[] {"id"});
for (ProfileFeature feature : features) {
stmt.setInt(1, profileId);
stmt.setString(2, feature.getFeatureCode());
stmt.setString(3, feature.getDeviceType());
// if (conn.getMetaData().getDriverName().contains("H2")) {
// stmt.setBytes(4, PolicyManagerUtil.getBytes(feature.getContent()));
// } else {
stmt.setBytes(4, PolicyManagerUtil.getBytes(feature.getContent()));
//}
stmt.setInt(5, tenantId);
stmt.addBatch();
//Not adding the logic to check the size of the stmt and execute if the size records added is over 1000
}
stmt.executeBatch();
// This logic has been commented out due to getGeneratedKeys method is not supported in MSSQL.
// generatedKeys = stmt.getGeneratedKeys();
// int i = 0;
//
// while (generatedKeys.next()) {
// features.get(i).setId(generatedKeys.getInt(1));
// i++;
// }
} catch (SQLException | IOException e) {
throw new FeatureManagerDAOException("Error occurred while adding the feature list to the database.", e);
} finally {
PolicyManagementDAOUtil.cleanupResources(stmt, generatedKeys);
}
return features;
}
private Connection getConnection() throws FeatureManagerDAOException {
return PolicyManagementDAOFactory.getConnection();
}
}
Loading…
Cancel
Save