From a7683a75a70d221a186830a575a85b3af1de64ad Mon Sep 17 00:00:00 2001 From: tenusha Date: Thu, 28 Mar 2019 20:07:03 +0530 Subject: [PATCH] release 1.0 --- MedicinePublisherV1/.classpath | 7 - MedicinePublisherV1/.project | 28 ---- .../.settings/org.eclipse.jdt.core.prefs | 7 - .../.settings/org.eclipse.pde.core.prefs | 3 - MedicinePublisherV1/META-INF/MANIFEST.MF | 11 -- .../medicinepublisher/MedicineActivator.class | Bin 2255 -> 0 bytes .../medicinepublisher/MedicinePublish.class | Bin 235 -> 0 bytes .../MedicinePublishImpl.class | Bin 5251 -> 0 bytes MedicinePublisherV1/build.properties | 4 - .../medicinepublisher/MedicineActivator.java | 46 ------ .../medicinepublisher/MedicinePublish.java | 15 -- .../MedicinePublishImpl.java | 133 ------------------ 12 files changed, 254 deletions(-) delete mode 100644 MedicinePublisherV1/.classpath delete mode 100644 MedicinePublisherV1/.project delete mode 100644 MedicinePublisherV1/.settings/org.eclipse.jdt.core.prefs delete mode 100644 MedicinePublisherV1/.settings/org.eclipse.pde.core.prefs delete mode 100644 MedicinePublisherV1/META-INF/MANIFEST.MF delete mode 100644 MedicinePublisherV1/bin/sa/assignment1/medicinepublisher/MedicineActivator.class delete mode 100644 MedicinePublisherV1/bin/sa/assignment1/medicinepublisher/MedicinePublish.class delete mode 100644 MedicinePublisherV1/bin/sa/assignment1/medicinepublisher/MedicinePublishImpl.class delete mode 100644 MedicinePublisherV1/build.properties delete mode 100644 MedicinePublisherV1/src/sa/assignment1/medicinepublisher/MedicineActivator.java delete mode 100644 MedicinePublisherV1/src/sa/assignment1/medicinepublisher/MedicinePublish.java delete mode 100644 MedicinePublisherV1/src/sa/assignment1/medicinepublisher/MedicinePublishImpl.java diff --git a/MedicinePublisherV1/.classpath b/MedicinePublisherV1/.classpath deleted file mode 100644 index eca7bdb..0000000 --- a/MedicinePublisherV1/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/MedicinePublisherV1/.project b/MedicinePublisherV1/.project deleted file mode 100644 index 6bc3522..0000000 --- a/MedicinePublisherV1/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - MedicinePublisherV1 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/MedicinePublisherV1/.settings/org.eclipse.jdt.core.prefs b/MedicinePublisherV1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 0c68a61..0000000 --- a/MedicinePublisherV1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/MedicinePublisherV1/.settings/org.eclipse.pde.core.prefs b/MedicinePublisherV1/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index f29e940..0000000 --- a/MedicinePublisherV1/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -pluginProject.extensions=false -resolve.requirebundle=false diff --git a/MedicinePublisherV1/META-INF/MANIFEST.MF b/MedicinePublisherV1/META-INF/MANIFEST.MF deleted file mode 100644 index 38dddfe..0000000 --- a/MedicinePublisherV1/META-INF/MANIFEST.MF +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: MedicinePublisher -Bundle-SymbolicName: MedicinePublisher -Bundle-Version: 1.0.1.qualifier -Bundle-Activator: sa.assignment1.medicinepublisher.MedicineActivator -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Import-Package: org.osgi.framework;version="1.3.0", - sa.assignment1.DatabaseService -Bundle-ActivationPolicy: lazy -Export-Package: sa.assignment1.medicinepublisher diff --git a/MedicinePublisherV1/bin/sa/assignment1/medicinepublisher/MedicineActivator.class b/MedicinePublisherV1/bin/sa/assignment1/medicinepublisher/MedicineActivator.class deleted file mode 100644 index 6ccbff90f83e77adfb44f8825e79e486806ac8da..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2255 zcmb7Fe{&O66g@9ZyKS=C5@^**Y65~uTDnl{4@@nE77$5GC0GPSeMuf+G1<-RzEt=w zehD3gDb6_l?T2zWn`}01jh*z5WOv`*ciy@8oO}15e_#CtU>VXtOkl~Emh^qQ?lhI7 zFIi1hv#YkFTJ1{1_Ma%v+6-5&R<*q=wd)y(3rszgyV7b%r*7S;JXKX~U`*hQ>(wpS zuiMsRPd3%huJ@C5t?kqrD%veD8)BE0w`*6`T~)Vz?MZFBjzF$70AfI7QDCA>)>5}U zB``naww1yvcTV}eqaQ0zIaLCjI}#ual_e##U^{)~f;|x%`emeBG_71V)fD z@g^n(CQGdIR=ZhI-aT1qkVLBFR%K&HdUo&}F2?l}+ZR|a9bYN(9rd;JH1iusysOQ+ z>uB{%7Xy}w>(8pH6=>lbcvs+LU+3tJfwVy35SNfQEqqCzdYz%9yih-Z+JOA_xha&gyVBNn!`iSpFI`7^&#C!Q&gf6S zVqmk92?OISZMEB#9IAu1A8Su66d_AhM)(^=j2}*l!}|%|#gO1XXF~M+MkkKLohws(XYnd{ z9WA`XiC;TgPV#@OvzWvw-Upi*fN9L|D)1KGCh$AFkMn7^1M>^t$GNgrm`|O4fw?`r zAHyFg%olz~VGj#2{Eds7zhNo$=?i@JC)OS;yu`IFMqg+21+j;lamL^7Gngd@@RUiO zkj81&GR=`Thbzc*SQWbGg{*ioHnBxMX`IC!Y?I+4QuqpYI|-KuaDK#?pj_#I);-c9 t*V}vG7bax=Z4CGOgi@UY^Q>(FCooS+3mqaeU66=KIwT_S1HohX@in7=cf$Yx diff --git a/MedicinePublisherV1/bin/sa/assignment1/medicinepublisher/MedicinePublish.class b/MedicinePublisherV1/bin/sa/assignment1/medicinepublisher/MedicinePublish.class deleted file mode 100644 index 438bb89affd0af148e689eeb008beeab43d684a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 235 zcmZ9GO$x#=5QQhz{#X@UcnIAX1yA5Ya3KnU`!pG9N*bkU1+V7919&KLf?2tF58j){ zH}B8$1psRprw}n%I>Ci=y0kUgcExK{T55~8t}xnNu;KfV9Dhj)eFl?C+yytnmi$mu zC|d?Sp%m$CerAv;RGkkqZDoVPAvGmZkSjFU;^wiVpe4Nv Y5EC|r1Uxoh z1e&CzTS}J{NL$*_Gz|^LhBi&tv}wBU`;xX_e?*(~yjkS2<&P47pQV}m-n;MKbI-Z& z>5aE9y$WCz{uM?@!YWH?Q7lUv(le@V-`J8-Q(98f)ogActyu?Dv!%zgY{B7+XfD*Njr>E2`k^NKMCdjo?VI|p)oPdLziMJ1B#{gspg25RP*t0 zcDsaG{^A}ZrKTlRC7iHwww7+$qF4udlq_eJ^)W%k&Y7x&wS_a*xh5xvRkI9>u{4Y&Qy9=UYT0T=#tm2|A*AUN=C}xIMoYJz&Dn%iRWj{SEW!!_ zK%Io@6*Eo|s4PZov%<2GhO6eO$(?&0bt$TiOrbmf^Mcu!%nx{^`-Y}?`ybV`u@NP9UJ!N$TxDb-4v zTGrMKJuVh)COH10uF0_ox(nAH$|<_7*`s1pv34t2;IG}`jR}ByWb|U2gs=dpTYyWt zcSo@UePQhMY2^UTQFTZ)W$eNoMASB11&VTX2XXL(8Nu$tuyRyooK;K`4H4EJN?zDl z>m)_D2=A5gKHSARig>yVwlbECA$3LZekft=pTcH$f{189gwZu)7%2%-yc~l#5XO*% z`m1kSGBg}yN3fI;MiKKE;j}E#uIlziz)lwL@fvTOT2xbUE0;{FmNl45r$^(pwY3hn zbs2`BaM+=6T94q6ghhRZX^zG%Bcrkn=tJ?tZ0+&Grol(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IrQlGutAg{V@9Lk=EsH{877Qh7Xfdw7VPWrY5Vt!~bXneaFK zgr$>ASg3C-kgzAjN%g%(y@~8y^?l2Io2ovC4nm0zGMgF;M7Y1Tn8s=HBY&I*)h00h z&J@^|2Vtuz5$Mj0n=8qk?AgFDaZ3}o3`L?7yDTMnh~hBG35(Lm5y!)1+7Y5VN;L20 z=)Jg~f_#jhPvb#6gNN`Ue~DbcqX9XNp3ckhxx5@t publishServiceRegistration; - - ServiceReference serviceReference; - - /* - * (non-Javadoc) - * - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework. - * BundleContext) - */ - public void start(BundleContext context) throws Exception { - - serviceReference = context.getServiceReference(MedicineDao.class.getName()); - MedicineDao medicineDao = (MedicineDaoImpl) context.getService(serviceReference); - - System.out.println("Medicine Publisher Started !!!"); - MedicinePublish publisherService = new MedicinePublishImpl(medicineDao); - publishServiceRegistration = context.registerService(MedicinePublish.class.getName(), publisherService, null); - - } - - /* - * (non-Javadoc) - * - * @see - * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - System.out.println("Medicine Publisher Stoped !!!"); - publishServiceRegistration.unregister(); - context.ungetService(serviceReference); - } - -} diff --git a/MedicinePublisherV1/src/sa/assignment1/medicinepublisher/MedicinePublish.java b/MedicinePublisherV1/src/sa/assignment1/medicinepublisher/MedicinePublish.java deleted file mode 100644 index 3c16839..0000000 --- a/MedicinePublisherV1/src/sa/assignment1/medicinepublisher/MedicinePublish.java +++ /dev/null @@ -1,15 +0,0 @@ -package sa.assignment1.medicinepublisher; - -public interface MedicinePublish { - - public void add(); - - public void deduct(); - - public void increase(); - - public void get(); - - public void deleteById(); - -} diff --git a/MedicinePublisherV1/src/sa/assignment1/medicinepublisher/MedicinePublishImpl.java b/MedicinePublisherV1/src/sa/assignment1/medicinepublisher/MedicinePublishImpl.java deleted file mode 100644 index 2966cd3..0000000 --- a/MedicinePublisherV1/src/sa/assignment1/medicinepublisher/MedicinePublishImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -package sa.assignment1.medicinepublisher; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Scanner; - -import sa.assignment1.DatabaseService.MedicineDao; - -public class MedicinePublishImpl implements MedicinePublish { - - MedicineDao medicineDao = null; - HashMap medicineModel = new HashMap<>(); - - public MedicinePublishImpl(MedicineDao medicineDao) { - this.medicineDao = medicineDao; - } - - @Override - public void add() { - Scanner scanner = new Scanner(System.in); - System.out.print("Enter medicine id : "); - medicineModel.put("medicineId", scanner.nextLine()); - System.out.print("Enter medicine name : "); - medicineModel.put("medicineName", scanner.nextLine()); - System.out.print("Enter medicine description : "); - medicineModel.put("medicineDescription", scanner.nextLine()); - System.out.print("Enter medicine quantity : "); - medicineModel.put("medicineQuantity", Integer.toString(scanner.nextInt())); - System.out.print("Enter medicine unit price : "); - medicineModel.put("unitPrice", Double.toString(scanner.nextDouble())); - - System.out.print(" "); - if (medicineDao.save(medicineModel)) { - System.out.println("Medicine added successfully !!! "); - } else { - System.out.println("Sorry something went wrong !!! "); - } - } - - @Override - public void deduct() { - Map data = new HashMap<>(); - Scanner scanner = new Scanner(System.in); - int currentQuantity = 0; - int newQuantity = 0; - - System.out.print("Enter medicine id : "); - String id = scanner.nextLine(); - System.out.print("Enter medicine quantity to reduce : "); - int quantity = scanner.nextInt(); - - data = medicineDao.findById(id); - - if (Objects.nonNull(data)) { - currentQuantity = Integer.parseInt(data.get("medicineQuantity")); - if (currentQuantity >= quantity) { - newQuantity = currentQuantity - quantity; - } - data.put("medicineQuantity", Integer.toString(newQuantity)); - - if (medicineDao.save(data)) { - System.out.println("New deduced sucessfully !"); - System.out.println(""); - } - } else { - System.out.println("No medicine record found !!!"); - System.out.println(""); - } - - } - - @Override - public void get() { - System.out.println("Enter medicine id: "); - Scanner scanner = new Scanner(System.in); - - String id = scanner.nextLine(); - Map data = medicineDao.findById(id); - - if (Objects.nonNull(data)) { - data.forEach((key, value) -> System.out.println(key + ":" + value)); - System.out.println(""); - } else { - System.out.println("No medicine record found !!!"); - System.out.println(""); - } - } - - @Override - public void deleteById() { - Scanner scanner = new Scanner(System.in); - System.out.print("Enter medicine id: "); - String id = scanner.nextLine(); - - if (medicineDao.deleteById(id)) { - System.out.println("Medicine id:" + id + " removed sucessfully !"); - System.out.println(""); - } else { - System.out.println("Medicine id:" + id + " not found !"); - System.out.println(""); - } - } - - @Override - public void increase() { - Scanner scanner = new Scanner(System.in); - Map data = new HashMap<>(); - int currentQuantity = 0; - int newQuantity = 0; - - System.out.print("Enter medicine id : "); - String id = scanner.nextLine(); - System.out.print("Enter medicine quantity to increase: "); - int quantity = scanner.nextInt(); - - data = medicineDao.findById(id); - - if (medicineDao.deleteById(id)) { - currentQuantity = Integer.parseInt(data.get("medicineQuantity")); - newQuantity = currentQuantity + quantity; - data.put("medicineQuantity", Integer.toString(newQuantity)); - - if (medicineDao.save(data)) { - System.out.println("New increased sucessfully !"); - System.out.println(""); - } - } else { - System.out.println("Medicine id:" + id + " not found !"); - System.out.println(""); - } - } -}