// given an exact paper name and get all the publication details public Article getPaperByTitle(String title) { Article article = new Article(); article = myDatabase.getExactPaper(myDatabase.returnArticleID(title)); System.out.println("Paper Searched: "); System.out.println(article); System.out.println("--------------------------"); return article; }
// given an author name and find all the publication details public ArrayList<Article> getAllPublications(String author) { ArrayList<Article> res = myDatabase.getAllPaper(myDatabase.returnAllArticleID(author)); for (Article temp : res) { System.out.println("Publications: "); System.out.println(temp); } System.out.println("--------------------------"); return res; }
public SpecQuery() throws Exception { ArrayList<Article> res = MyDOMParser.MyParser(); myDatabase = new DatabaseOperations(); myDatabase.openConnection(); myDatabase.createTables(); for (Article temp : res) { myDatabase.addArticle(temp); } }
// given an author and get all his or her co-author public ArrayList<String> getCoAuthor(String author) { ArrayList<String> res = new ArrayList<String>(); int[] articleID = myDatabase.returnAllArticleID(author); res = myDatabase.getAllAuthor(articleID); System.out.println("Co-authors : "); for (String temp : res) { System.out.println(temp); } System.out.println("--------------------------"); return res; }
/** * Method for the button OK * * @param evt */ private void jButton4ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton4ActionPerformed int getOK; try { BigDecimal firstPayment = new BigDecimal(tfGetFirstPaymentAmount.getText()); BigDecimal saleAmount = new BigDecimal(tfGetSaleAmount.getText()); Date date = boxSaleDate.getSelectedDate().getTime(); setSale(date, saleAmount, firstPayment, customer); confirmSale(); Object[] options = {"Onayla", "Geri"}; getOK = JOptionPane.showOptionDialog( this, "Satışı Onaylıyor musunuz?\n" + sale.printRecipe(), "Satış Onay", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (getOK == 0) { // Payment Confirmed by the user DatabaseOperations.saveSale(sale); JOptionPane.showMessageDialog(this, "Satış işlemi başarıyla gerçekleştirildi."); this.dispose(); } } catch (NumberFormatException ex) { JOptionPane.showMessageDialog(this, "Ödeme tutarı hatalı!\nLütfen kontrol ediniz."); } catch (SQLException ex) { JOptionPane.showMessageDialog(this, "İşlem gerçekleştirelemedi!!"); } } // GEN-LAST:event_jButton4ActionPerformed
// given an keyword and find all related publications public ArrayList<String> searchKeyWord(String keyWord) { ArrayList<String> res = myDatabase.getRelatedPaper(keyWord); for (String temp : res) { System.out.println("Related Paper: " + temp); } System.out.println("--------------------------"); return res; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); dBHelper = new DatabaseOperations(ctxt); dBHelper.getWritableDatabase(); setContentView(R.layout.activity_teaming); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE); Studname = sharedpreferences.getString("Studname", ""); studnm = (TextView) findViewById(R.id.studname); studnm.setText("Student: " + Studname); next = (Button) findViewById(R.id.button4); Bundle bundle = getIntent().getExtras(); user_name = bundle.getString("TesterName"); SKIP = (Button) findViewById(R.id.buttonkskip); final AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); skip_pressed = false; txt1 = (TextView) findViewById(R.id.teaming); txt2 = (TextView) findViewById(R.id.teaming2); rgrp1 = (RadioGroup) findViewById(R.id.rgrp1); rgrp2 = (RadioGroup) findViewById(R.id.rgrp2); Intent intent = getIntent(); String activity = intent.getStringExtra("activity"); if (activity == null || activity.length() == 0) { } else if ((activity.equals("nextteaming")) || (activity.equals("prevteaming"))) { SharedPreferences.Editor editor = sharedpreferences.edit(); editor = sharedpreferences.edit(); String check = sharedpreferences.getString("Teamingskipped", ""); if (check.equals("skipped")) { SKIP.setEnabled(false); skip_pressed = true; txt1.setEnabled(false); txt1.setTextColor(Color.GRAY); txt2.setEnabled(false); txt2.setTextColor(Color.GRAY); for (int i = 0; i < rgrp1.getChildCount(); i++) { ((RadioButton) rgrp1.getChildAt(i)).setEnabled(false); ((RadioButton) rgrp1.getChildAt(i)).setTextColor(Color.GRAY); ((RadioButton) rgrp1.getChildAt(i)).setChecked(false); } for (int i = 0; i < rgrp2.getChildCount(); i++) { ((RadioButton) rgrp2.getChildAt(i)).setEnabled(false); ((RadioButton) rgrp2.getChildAt(i)).setTextColor(Color.GRAY); ((RadioButton) rgrp2.getChildAt(i)).setChecked(false); } } else { int value1 = sharedpreferences.getInt("teamingidround1", 0); int value2 = sharedpreferences.getInt("teamingidround2", 0); rgrp1 = (RadioGroup) findViewById(R.id.rgrp1); rgrp1.check(value1); rgrp2 = (RadioGroup) findViewById(R.id.rgrp2); rgrp2.check(value2); skip_pressed = false; } } SKIP.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.setMessage("Are you sure you want to skip this activity ?"); alertDialog.setPositiveButton( "YES", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { SKIP.setEnabled(false); skip_pressed = true; txt1.setEnabled(false); txt1.setTextColor(Color.GRAY); txt2.setEnabled(false); txt2.setTextColor(Color.GRAY); for (int i = 0; i < rgrp1.getChildCount(); i++) { ((RadioButton) rgrp1.getChildAt(i)).setEnabled(false); ((RadioButton) rgrp1.getChildAt(i)).setTextColor(Color.GRAY); ((RadioButton) rgrp1.getChildAt(i)).setChecked(false); } for (int i = 0; i < rgrp2.getChildCount(); i++) { ((RadioButton) rgrp2.getChildAt(i)).setEnabled(false); ((RadioButton) rgrp2.getChildAt(i)).setTextColor(Color.GRAY); ((RadioButton) rgrp2.getChildAt(i)).setChecked(false); } SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString("Radiobuttonteaming1", "NA"); editor.putString("Radiobuttonteaming2", "NA"); editor.putString("Teamingskipped", "skipped"); editor.commit(); } }); alertDialog.setNegativeButton( "NO", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Intent loginintent = new Intent(getBaseContext(), // LoginSuccessActivity.class); // startActivity(loginintent); } }); alertDialog.show(); } }); }