예제 #1
1
    protected void doDownload(String url, String filename) {
      // String url = "url you want to download";
      DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
      request.setDescription(filename);
      request.setTitle("Stream Downloader");

      // in order for this if to run, you must use the android 3.2 to compile your app
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        request.allowScanningByMediaScanner();
        request.setNotificationVisibility(
            DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
      }
      request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);

      // get download service and enqueue file
      DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
      manager.enqueue(request);
    }
예제 #2
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   Intent intent = getIntent();
   Uri uri = intent.getData();
   if (uri != null) {
     MainActivity.addLink(this, uri.toString());
     Uri newUri = Uri.parse("view-source:" + uri.toString());
     startChrome(newUri);
   }
   if (Intent.ACTION_SEND.equals(intent.getAction())) {
     Bundle extras = intent.getExtras();
     if (extras != null) {
       String text = extras.getString(Intent.EXTRA_TEXT);
       Pattern pattern = Pattern.compile(URL_PATTERN);
       if (text != null) {
         Matcher m = pattern.matcher(text);
         if (m.find()) {
           String url = m.group(1);
           MainActivity.addLink(this, url);
           Uri newUri = Uri.parse("view-source:" + url);
           startChrome(newUri);
         }
       }
     }
   }
   this.finish();
 }
예제 #3
0
 /**
  * @Method: shareToWeiBo @Description: ����ͼƬ��΢��
  *
  * @param path ͼƬ��·��
  */
 private void shareToWeiBo(String path) {
   Log.d("���?΢�� -ͼƬ��ַ : ", path);
   Intent intent = new Intent(Intent.ACTION_SEND);
   // imagePath:����·����Ҫ���ļ���չ��
   String url = "file:///" + path;
   intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
   intent.setType("image/jpeg");
   intent.putExtra(Intent.EXTRA_TITLE, "���?΢��");
   intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
   startActivity(Intent.createChooser(intent, "���?ʽ"));
 }
예제 #4
0
    @Override
    protected void onActivityResult(int requestCode, int resultCode,
            Intent data) {
        switch (requestCode) {
            case MenuHelper.RESULT_COMMON_MENU_CROP:
                if (resultCode == RESULT_OK) {
                    // The CropImage activity passes back the Uri of the
                    // cropped image as the Action rather than the Data.
                    mSavedUri = Uri.parse(data.getAction());

                    // if onStart() runs before, then set the returned
                    // image as currentImage.
                    if (mAllImages != null) {
                        IImage image = mAllImages.getImageForUri(mSavedUri);
                        // image could be null if SD card is removed.
                        if (image == null) {
                            finish();
                        } else {
                            mCurrentPosition = mAllImages.getImageIndex(image);
                            setImage(mCurrentPosition, false);
                        }
                    }
                }
                break;
        }
    }
예제 #5
0
파일: Docs.java 프로젝트: phspaelti/basex
 /**
  * Performs the doc function.
  *
  * @param qc query context
  * @return result
  * @throws QueryException query exception
  */
 ANode doc(final QueryContext qc) throws QueryException {
   final Item it = exprs[0].item(qc, info);
   if (it == null) return null;
   final byte[] in = toToken(it);
   if (!Uri.uri(in).isValid()) throw INVDOC_X.get(info, in);
   return qc.resources.doc(new QueryInput(string(in)), sc.baseIO(), info);
 }
예제 #6
0
	public void facebookClick(View view) {
		try {
			if (ShareDialog.canShow(ShareLinkContent.class)) {
				ShareLinkContent linkContent = new ShareLinkContent.Builder()
				.setContentTitle("I just scored " + score + "!")
				.setContentDescription(
					"Beat my score on Android!")
				.setContentUrl(Uri.parse("http://www.example.com"))
				.setImageUrl(Uri.parse("http://www.example.com"))
				.build();
				shareDialog.show(linkContent);
			}
		} catch (Exception e) {
			Toast.makeText(getApplicationContext(), "Error Sharing with Facebook.", Toast.LENGTH_LONG).show();
		}
	}
예제 #7
0
 void copyIntent() {
   ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
   Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
   ClipData clip = ClipData.newIntent("intent", intent);
   cm.setPrimaryClip(clip);
   Toast.makeText(this, "Intent Copied", 0).show();
 }
예제 #8
0
 public DocumentReference copy() {
   DocumentReference dst = new DocumentReference();
   dst.masterIdentifier = masterIdentifier == null ? null : masterIdentifier.copy();
   dst.identifier = new ArrayList<Identifier>();
   for (Identifier i : identifier) dst.identifier.add(i.copy());
   dst.subject = subject == null ? null : subject.copy();
   dst.type = type == null ? null : type.copy();
   dst.subtype = subtype == null ? null : subtype.copy();
   dst.author = new ArrayList<ResourceReference>();
   for (ResourceReference i : author) dst.author.add(i.copy());
   dst.custodian = custodian == null ? null : custodian.copy();
   dst.authenticator = authenticator == null ? null : authenticator.copy();
   dst.created = created == null ? null : created.copy();
   dst.indexed = indexed == null ? null : indexed.copy();
   dst.status = status == null ? null : status.copy();
   dst.docStatus = docStatus == null ? null : docStatus.copy();
   dst.supercedes = supercedes == null ? null : supercedes.copy();
   dst.description = description == null ? null : description.copy();
   dst.confidentiality = confidentiality == null ? null : confidentiality.copy();
   dst.primaryLanguage = primaryLanguage == null ? null : primaryLanguage.copy();
   dst.mimeType = mimeType == null ? null : mimeType.copy();
   dst.format = format == null ? null : format.copy();
   dst.size = size == null ? null : size.copy();
   dst.hash = hash == null ? null : hash.copy();
   dst.location = location == null ? null : location.copy();
   dst.service = service == null ? null : service.copy(dst);
   dst.context = context == null ? null : context.copy(dst);
   return dst;
 }
 private static Object tryConvertValue(String value, Uri datatype) {
   try {
     return RdfUtil.getRealValue(datatype.getUriAsString(), value);
   } catch (ParseException e) {
     throw new RuntimeException(e);
   }
 }
예제 #10
0
파일: Docs.java 프로젝트: phspaelti/basex
  /**
   * Returns a collection.
   *
   * @param qc query context
   * @return collection
   * @throws QueryException query exception
   */
  Value collection(final QueryContext qc) throws QueryException {
    // return default collection
    final Item it = exprs.length == 0 ? null : exprs[0].atomItem(qc, info);
    if (it == null) return qc.resources.collection(info);

    // check if reference is valid
    final byte[] in = toToken(it);
    if (!Uri.uri(in).isValid()) throw INVCOLL_X.get(info, in);
    return qc.resources.collection(new QueryInput(string(in)), sc.baseIO(), info);
  }
예제 #11
0
 public Coding copy() {
   Coding dst = new Coding();
   dst.system = system == null ? null : system.copy();
   dst.version = version == null ? null : version.copy();
   dst.code = code == null ? null : code.copy();
   dst.display = display == null ? null : display.copy();
   dst.primary = primary == null ? null : primary.copy();
   dst.valueSet = valueSet == null ? null : valueSet.copy();
   return dst;
 }
예제 #12
0
 public void startChrome(Uri uri) {
   Intent it = new Intent(Intent.ACTION_VIEW);
   it.setData(uri);
   it.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
   it.setClassName("com.android.chrome", "com.google.android.apps.chrome.Main");
   try {
     startActivity(it);
   } catch (ActivityNotFoundException ex) {
     Intent intent =
         new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?id=com.android.chrome"));
     startActivity(intent);
   }
 }
  @Override
  public void onActivityStartup() {
    AndroidOsService androidService =
        getSpaceEnvironment().getServiceRegistry().getService(AndroidOsService.SERVICE_NAME);

    try {
      Intent browserIntent = new Intent(Intent.ACTION_VIEW);
      browserIntent.setData(Uri.parse("https://www.smartspaces.io/"));
      browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      androidService.getAndroidContext().getApplicationContext().startActivity(browserIntent);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
예제 #14
0
 public static Contribution fromCursor(Cursor cursor) {
   // Hardcoding column positions!
   Contribution c = new Contribution();
   c.contentUri = ContributionsContentProvider.uriForId(cursor.getInt(0));
   c.filename = cursor.getString(1);
   c.localUri = TextUtils.isEmpty(cursor.getString(2)) ? null : Uri.parse(cursor.getString(2));
   c.imageUrl = cursor.getString(3);
   c.timestamp = cursor.getLong(4) == 0 ? null : new Date(cursor.getLong(4));
   c.state = cursor.getInt(5);
   c.dataLength = cursor.getLong(6);
   c.dateUploaded = cursor.getLong(7) == 0 ? null : new Date(cursor.getLong(7));
   c.transferred = cursor.getLong(8);
   c.source = cursor.getString(9);
   c.description = cursor.getString(10);
   c.creator = cursor.getString(11);
   c.isMultiple = cursor.getInt(12) == 1;
   return c;
 }
예제 #15
0
 public Device copy() {
   Device dst = new Device();
   dst.type = type == null ? null : type.copy();
   dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
   dst.model = model == null ? null : model.copy();
   dst.version = version == null ? null : version.copy();
   dst.expiry = expiry == null ? null : expiry.copy();
   dst.identity = identity == null ? null : identity.copy(dst);
   dst.owner = owner == null ? null : owner.copy();
   dst.assignedId = new ArrayList<Identifier>();
   for (Identifier i : assignedId) dst.assignedId.add(i.copy());
   dst.location = location == null ? null : location.copy();
   dst.patient = patient == null ? null : patient.copy();
   dst.contact = new ArrayList<Contact>();
   for (Contact i : contact) dst.contact.add(i.copy());
   dst.url = url == null ? null : url.copy();
   return dst;
 }
예제 #16
0
 @Override
 public void onClick(View v) {
   // TODO Auto-generated method stub
   Intent intent;
   String parentPN; // 蹂댄샇���꾪솕踰덊샇
   /** 媛�踰꾪듉蹂꾨줈 �댁빞���쇱쓣 梨꾩썙�k뒗�� */
   switch (v.getId()) {
     case R.id.mystatbtn:
       intent = new Intent(Menus.this, Mystat.class);
       startActivity(intent);
       break;
     case R.id.noticebtn:
       intent = new Intent(Menus.this, Notice.class);
       startActivity(intent);
       break;
     case R.id.requestbtn:
       intent = new Intent(Menus.this, RequestTalk.class);
       startActivity(intent);
       break;
     case R.id.hospitalinfobtn:
       intent = new Intent(Menus.this, Hospitalinfo.class);
       startActivity(intent);
       break;
     case R.id.qrreadbtn:
       intent = new Intent(Menus.this, QRread.class);
       startActivity(intent);
       break;
     case R.id.parentcallbtn:
       parentPN = "01193699621"; // 蹂댄샇���꾪솕踰덊샇 DB�먯꽌 媛�졇��빞 ��
       intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + parentPN));
       startActivity(intent);
       break;
     case R.id.emergencybtn:
       // 蹂묒썝��湲닿툒肄�
       ((Button) findViewById(R.id.emergencybtn)).setBackgroundColor(Color.GREEN);
       ((Button) findViewById(R.id.emergencybtn)).setText("�좉퀬 �꾨즺");
       break;
   }
 }
    protected Boolean doInBackground(ArrayList... params) {
      download_photos.this.runOnUiThread(
          new Runnable() {
            public void run() {
              mtext.setText(
                  getText(R.string.download_textview_message_1) + " " + path.toString() + ". ");
            }
          });

      if (resume_file.exists()) {
        initial_value = readProgress()[0];
      } else {
        initial_value = 1;
      }

      for (int i = initial_value - 1; i < links.size(); i++) {
        // asynctask expects more than one ArrayList<String> item, but we are sending only one,
        // which is params[0]
        Uri imageuri = Uri.parse(params[0].get(i).toString());
        URL imageurl = null;
        HttpURLConnection connection = null;
        total_files_to_download = links.size();
        completed_downloads = i + 1;
        try {
          imageurl = new URL(params[0].get(i).toString());
          connection = (HttpURLConnection) imageurl.openConnection();
          connection.connect();
        } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

        // extracts the real file name of the photo from url
        path_segments = imageuri.getPathSegments();
        int total_segments = path_segments.size();
        file_name = path_segments.get(total_segments - 1);

        path.mkdirs();

        // if(i==0)
        //	first_image = path.toString() + "/" + file_name;

        InputStream input;
        OutputStream output;
        try {
          input = new BufferedInputStream(imageurl.openStream());
          fully_qualified_file_name = new File(path, file_name);
          output = new BufferedOutputStream(new FileOutputStream(fully_qualified_file_name));
          byte data[] = new byte[1024];
          int count;
          while ((count = input.read(data)) != -1) {
            output.write(data, 0, count);
          }
          output.flush();
          output.close();
          input.close();
          connection.disconnect();

          new folder_scanner(getApplicationContext(), fully_qualified_file_name);

          publishProgress(completed_downloads, total_files_to_download);
          if (this.isCancelled()) {
            writeProgress(completed_downloads, total_files_to_download);
            break;
          }

        } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

        // creates required folders and subfolders if they do not exist already
        // boolean success = path.mkdirs();

        // makes request to download photos
        // DownloadManager.Request request = new DownloadManager.Request(imageuri);

        // set path for downloads
        // request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES,sub_path);

        // request.setDescription("Downloaded using Facebook Album Downloader");

        // DownloadManager dm = (DownloadManager)getSystemService(DOWNLOAD_SERVICE);

        // download is enqueue in download list. it returns unique id for each download
        // download_id = dm.enqueue(request);

      }
      // returns the unique id. we are not using this id
      return true;
    }
예제 #18
0
	public Uri saveImageUri(Context context, Bitmap bitmap) {
		ByteArrayOutputStream bytes = new ByteArrayOutputStream();
		bitmap.compress(Bitmap.CompressFormat.PNG, 100, bytes);
		String path = MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, "ImageTitle", null);
		return Uri.parse(path);
	}
  public List<Item> fetchItemForHoldings(int holdingsId) throws Exception {
    List<Item> itemList = new ArrayList<Item>();
    Map<String, Item> itemHashMap = new HashMap<>();
    itemPreparedStatement.setInt(1, holdingsId);
    ResultSet resultSet = itemPreparedStatement.executeQuery();
    Set<String> highDensityStorageSet = null;
    Set<String> donorNoteSet = null;
    Set<String> itemNoteSet = null;
    Set<String> statisticalSearchSet = null;
    org.kuali.ole.docstore.common.document.content.instance.Item itemObj = null;

    while (resultSet.next()) {
      String id = resultSet.getString("ITEM_ID");
      if (itemHashMap.containsKey(id)) {
        itemObj =
            (org.kuali.ole.docstore.common.document.content.instance.Item)
                itemHashMap.get(id).getContentObject();
      } else {
        itemObj = new org.kuali.ole.docstore.common.document.content.instance.Item();
        Item item = new Item();
        itemList.add(item);
        item.setId("wio-" + resultSet.getString("ITEM_ID"));
        item.setContentObject(itemObj);
        Location location =
            getLocationDetails(
                resultSet.getString("LOCATION"), resultSet.getString("LOCATION_LEVEL"));
        itemObj.setLocation(location);
        CallNumber callNumber = new CallNumber();
        callNumber.setNumber(resultSet.getString("CALL_NUMBER"));
        callNumber.setPrefix(resultSet.getString("CALL_NUMBER_PREFIX"));
        ShelvingOrder shelvingOrder = new ShelvingOrder();
        if (resultSet.getString("SHELVING_ORDER") != null
            && !"null".equals(resultSet.getString("SHELVING_ORDER"))) {
          shelvingOrder.setCodeValue(resultSet.getString("SHELVING_ORDER"));
          shelvingOrder.setFullValue(resultSet.getString("SHELVING_ORDER"));
        }
        callNumber.setShelvingOrder(shelvingOrder);
        ShelvingScheme shelvingScheme = new ShelvingScheme();
        if (callNumberType.get(resultSet.getString("CALL_NUMBER_TYPE_ID")) != null) {
          String[] strings =
              callNumberType.get(resultSet.getString("CALL_NUMBER_TYPE_ID")).split("[|]");
          shelvingScheme.setCodeValue(strings[0]);
          shelvingScheme.setFullValue(strings[1]);
        }
        callNumber.setShelvingScheme(shelvingScheme);
        itemObj.setCallNumber(callNumber);
        itemObj.setBarcodeARSL(resultSet.getString("BARCODE_ARSL"));
        itemObj.setEnumeration(resultSet.getString("ENUMERATION"));
        itemObj.setChronology(resultSet.getString("CHRONOLOGY"));
        itemObj.setCopyNumber(resultSet.getString("COPY_NUMBER"));
        AccessInformation accessInformation = new AccessInformation();
        accessInformation.setBarcode(resultSet.getString("BARCODE"));
        Uri uri = new Uri();
        uri.setValue(resultSet.getString("URI"));
        accessInformation.setUri(uri);
        itemObj.setAccessInformation(accessInformation);
        itemObj.setPurchaseOrderLineItemIdentifier(
            resultSet.getString("PURCHASE_ORDER_LINE_ITEM_ID"));
        itemObj.setVendorLineItemIdentifier(resultSet.getString("VENDOR_LINE_ITEM_ID"));
        itemObj.setFund(resultSet.getString("FUND"));
        itemObj.setPrice(resultSet.getString("PRICE"));
        itemObj.setItemStatusEffectiveDate(
            convertDateFormat(resultSet.getString("ITEM_STATUS_DATE_UPDATED")));
        if (resultSet.getString("FAST_ADD") != null) {
          itemObj.setFastAddFlag(
              resultSet.getString("FAST_ADD").equalsIgnoreCase("Y") ? Boolean.TRUE : Boolean.FALSE);
        }
        itemObj.setCheckinNote(resultSet.getString("CHECK_IN_NOTE"));
        if (resultSet.getString("CLAIMS_RETURNED") != null) {
          itemObj.setClaimsReturnedFlag(
              resultSet.getString("CLAIMS_RETURNED").equalsIgnoreCase("Y")
                  ? Boolean.TRUE
                  : Boolean.FALSE);
        }
        String claimsReturnFlagCreatedDate = resultSet.getString("CLAIMS_RETURNED_DATE_CREATED");
        itemObj.setClaimsReturnedFlagCreateDate(convertDateFormat(claimsReturnFlagCreatedDate));
        itemObj.setClaimsReturnedNote(resultSet.getString("CLAIMS_RETURNED_NOTE"));
        itemObj.setCurrentBorrower(resultSet.getString("CURRENT_BORROWER"));
        itemObj.setProxyBorrower(resultSet.getString("PROXY_BORROWER"));
        String dueDateTime = resultSet.getString("DUE_DATE_TIME");
        itemObj.setDueDateTime(convertDateFormat(dueDateTime));
        String originalDueDate = resultSet.getString("ORG_DUE_DATE_TIME");
        itemObj.setOriginalDueDate(convertDateFormat(originalDueDate));
        String checkOutDateTime = resultSet.getString("CHECK_OUT_DATE_TIME");
        itemObj.setCheckOutDateTime(convertDateFormat(checkOutDateTime));
        itemObj.setDamagedItemNote(resultSet.getString("ITEM_DAMAGED_NOTE"));
        if (resultSet.getString("ITEM_DAMAGED_STATUS") != null) {
          itemObj.setItemDamagedStatus(
              resultSet.getString("ITEM_DAMAGED_STATUS").equalsIgnoreCase("Y")
                  ? Boolean.TRUE
                  : Boolean.FALSE);
        }
        if (resultSet.getString("MISSING_PIECES") != null) {
          itemObj.setMissingPieceFlag(
              resultSet.getString("MISSING_PIECES").equalsIgnoreCase("Y")
                  ? Boolean.TRUE
                  : Boolean.FALSE);
        }
        itemObj.setMissingPiecesCount(resultSet.getString("MISSING_PIECES_COUNT"));
        itemObj.setMissingPieceFlagNote(resultSet.getString("MISSING_PIECES_NOTE"));
        itemObj.setMissingPieceEffectiveDate(resultSet.getString("MISSING_PIECES_EFFECTIVE_DATE"));
        itemObj.setNumberOfPieces(resultSet.getString("NUM_PIECES"));
        itemObj.setDescriptionOfPieces(resultSet.getString("DESC_OF_PIECES"));
        itemObj.setNumberOfRenew(resultSet.getInt("NUM_OF_RENEW"));
        highDensityStorageSet = new HashSet<>();
        itemNoteSet = new HashSet<>();
        statisticalSearchSet = new HashSet<>();
        donorNoteSet = new HashSet<>();

        ItemStatus itemStatus = new ItemStatus();
        if (itemStatusMap.containsKey(resultSet.getString("ITEM_STATUS_ID"))) {
          String[] strings = itemStatusMap.get(resultSet.getString("ITEM_STATUS_ID")).split("[|]");
          itemStatus.setCodeValue(strings[0]);
          itemStatus.setFullValue(strings[1]);
        }

        itemObj.setItemStatus(itemStatus);
        ItemType itemType = new ItemType();
        if (itemTypeMap.containsKey(resultSet.getString("ITEM_TYPE_ID"))) {
          String[] strings = itemTypeMap.get(resultSet.getString("ITEM_TYPE_ID")).split("[|]");
          itemType.setCodeValue(strings[0]);
          itemType.setFullValue(strings[1]);
        }
        itemObj.setItemType(itemType);
        ItemType tempItemType = new ItemType();
        if (itemTypeMap.containsKey(resultSet.getString("TEMP_ITEM_TYPE_ID"))) {
          String[] strings = itemTypeMap.get(resultSet.getString("TEMP_ITEM_TYPE_ID")).split("[|]");
          tempItemType.setCodeValue(strings[0]);
          tempItemType.setFullValue(strings[1]);
        }
        itemObj.setTemporaryItemType(tempItemType);
        item.setContentObject(itemObj);
        item.setCreatedBy(resultSet.getString("CREATED_BY"));
        item.setCreatedOn(resultSet.getString("DATE_CREATED"));
        if (resultSet.getString("STAFF_ONLY") != null) {
          item.setStaffOnly(
              (resultSet.getString("STAFF_ONLY").equalsIgnoreCase("Y")
                  ? Boolean.TRUE
                  : Boolean.FALSE));
        }
        item.setUpdatedBy(resultSet.getString("UPDATED_BY"));
        item.setUpdatedOn(resultSet.getString("DATE_UPDATED"));
        item.setLastUpdated(resultSet.getString("DATE_UPDATED"));
      }
      if (itemNoteSet.add(resultSet.getString("ITEM_NOTE_ID"))) {
        Note note = new Note();
        note.setValue(resultSet.getString("NOTE"));
        note.setType(resultSet.getString("TYPE"));
        itemObj.getNote().add(note);
      }
      if (resultSet.getString("STAT_SEARCH_CODE_ID") != null
          && statisticalSearchSet.add(resultSet.getString("STAT_SEARCH_CODE_ID"))) {
        String[] strings =
            statisticalSearchCodeMap.get(resultSet.getString("STAT_SEARCH_CODE_ID")).split("[|]");
        StatisticalSearchingCode statisticalSearchingCode = new StatisticalSearchingCode();
        statisticalSearchingCode.setCodeValue(strings[0]);
        statisticalSearchingCode.setFullValue(strings[1]);
        itemObj.getStatisticalSearchingCode().add(statisticalSearchingCode);
      }
      if (donorNoteSet.add(resultSet.getString("ITEM_DONOR_ID"))) {
        DonorInfo donorInfo = new DonorInfo();
        donorInfo.setDonorCode(resultSet.getString("DONOR_CODE"));
        donorInfo.setDonorNote(resultSet.getString("DONOR_NOTE"));
        donorInfo.setDonorPublicDisplay(resultSet.getString("DONOR_DISPLAY_NOTE"));
        itemObj.getDonorInfo().add(donorInfo);
      }
      if (highDensityStorageSet.add(resultSet.getString("ITEM_DONOR_ID"))) {
        HighDensityStorage highDensityStorage = new HighDensityStorage();
        highDensityStorage.setRow(resultSet.getString("HIGH_DENSITY_ROW"));
        itemObj.setHighDensityStorage(highDensityStorage);
      }
    }
    resultSet.close();
    return itemList;
  }
  public List<HoldingsTree> fetchHoldingsTreeForBib(int bibId) throws Exception {
    List<HoldingsTree> holdingsTrees = new ArrayList<HoldingsTree>();

    holdingsPreparedStatement.setInt(1, bibId);
    ResultSet resultSet = holdingsPreparedStatement.executeQuery();
    Map<String, HoldingsTree> map = new HashMap<>();
    Map<String, ExtentOfOwnership> extentOfOwnershipMap = new HashMap<>();
    Set<String> uriSet = null;
    Set<String> noteSet = null;
    Set<String> donorSet = null;
    Set<String> coverageSet = null;
    Set<String> perpetualSet = null;
    Set<String> extentOfOwnershipNoteSet = null;
    Set<String> linkSet = null;

    while (resultSet.next()) {
      String holdingsType = resultSet.getString("HOLDINGS_TYPE");
      String id = resultSet.getString("HOLDINGS_ID");
      OleHoldings oleHoldings = null;
      if (map.containsKey(id)) {
        oleHoldings = map.get(id).getHoldings().getContentObject();
      } else {
        oleHoldings = new OleHoldings();
        Location location =
            getLocationDetails(
                resultSet.getString("LOCATION"), resultSet.getString("LOCATION_LEVEL"));
        oleHoldings.setLocation(location);
        oleHoldings.setHoldingsType(holdingsType);
        CallNumber callNumber = new CallNumber();
        callNumber.setNumber(resultSet.getString("CALL_NUMBER"));
        callNumber.setPrefix(resultSet.getString("CALL_NUMBER_PREFIX"));
        ShelvingOrder shelvingOrder = new ShelvingOrder();
        if (resultSet.getString("SHELVING_ORDER") != null
            && !"null".equals(resultSet.getString("SHELVING_ORDER"))) {
          shelvingOrder.setCodeValue(resultSet.getString("SHELVING_ORDER"));
          shelvingOrder.setFullValue(resultSet.getString("SHELVING_ORDER"));
        }
        callNumber.setShelvingOrder(shelvingOrder);
        ShelvingScheme shelvingScheme = new ShelvingScheme();
        if (resultSet.getString("CALL_NUMBER_TYPE_ID") != null) {
          String[] strings =
              callNumberType.get(resultSet.getString("CALL_NUMBER_TYPE_ID")).split("[|]");
          shelvingScheme.setCodeValue(strings[0]);
          shelvingScheme.setFullValue(strings[1]);
        }
        callNumber.setShelvingScheme(shelvingScheme);
        oleHoldings.setCallNumber(callNumber);
        oleHoldings.setCopyNumber(resultSet.getString("COPY_NUMBER"));
        HoldingsTree holdingsTree = new HoldingsTree();

        Holdings holdings = null;

        if (holdingsType.equalsIgnoreCase(PHoldings.PRINT)) {
          holdings = new PHoldings();

          if (resultSet.getString("RECEIPT_STATUS_ID") != null) {
            oleHoldings.setReceiptStatus(resultSet.getString("RECEIPT_STATUS_ID"));
          }
          extentOfOwnershipNoteSet = new HashSet<>();
          donorSet = coverageSet = perpetualSet = null;
        } else {
          holdings = new EHoldings();
          oleHoldings.setAccessStatus(resultSet.getString("ACCESS_STATUS"));
          oleHoldings.setImprint(resultSet.getString("IMPRINT"));
          Platform platform = new Platform();
          platform.setPlatformName(resultSet.getString("PLATFORM"));
          platform.setAdminUrl(resultSet.getString("ADMIN_URL"));
          platform.setAdminUserName(resultSet.getString("ADMIN_USERNAME"));
          platform.setAdminPassword(resultSet.getString("ADMIN_PASSWORD"));
          oleHoldings.setPlatform(platform);

          oleHoldings.setPublisher(resultSet.getString("PUBLISHER"));
          HoldingsAccessInformation holdingsAccessInformation = new HoldingsAccessInformation();

          holdingsAccessInformation.setProxiedResource(resultSet.getString("PROXIED_RESOURCE"));
          holdingsAccessInformation.setAccessUsername(resultSet.getString("ACCESS_USERNAME"));
          holdingsAccessInformation.setAccessPassword(resultSet.getString("ACCESS_PASSWORD"));
          holdingsAccessInformation.setNumberOfSimultaneousUser(
              resultSet.getString("NUMBER_SIMULT_USERS"));
          holdingsAccessInformation.setAccessLocation(resultSet.getString("CODE"));
          holdingsAccessInformation.setAuthenticationType(
              resultSet.getString("AUTHENTICATION_TYPE_ID"));
          oleHoldings.setHoldingsAccessInformation(holdingsAccessInformation);
          String statisticalSearchId = resultSet.getString("STAT_SEARCH_CODE_ID");
          if (StringUtils.isNotEmpty(statisticalSearchId)) {
            String[] strings = statisticalSearchCodeMap.get(statisticalSearchId).split("[|]");
            StatisticalSearchingCode statisticalSearchingCode = new StatisticalSearchingCode();
            statisticalSearchingCode.setCodeValue(strings[0]);
            statisticalSearchingCode.setFullValue(strings[1]);
            oleHoldings.setStatisticalSearchingCode(statisticalSearchingCode);
          }
          oleHoldings.setLocalPersistentLink(resultSet.getString("LOCAL_PERSISTENT_URI"));
          oleHoldings.setSubscriptionStatus(resultSet.getString("SUBSCRIPTION_STATUS"));
          oleHoldings.setInterLibraryLoanAllowed(Boolean.valueOf(resultSet.getString("ALLOW_ILL")));
          coverageSet = new HashSet<>();
          perpetualSet = new HashSet<>();
          donorSet = new HashSet<>();
          ExtentOfOwnership extentOfOwnership = new ExtentOfOwnership();
          Coverages coverages = new Coverages();
          PerpetualAccesses perpetualAccesses = new PerpetualAccesses();
          extentOfOwnership.setCoverages(coverages);
          extentOfOwnership.setPerpetualAccesses(perpetualAccesses);
          oleHoldings.getExtentOfOwnership().add(extentOfOwnership);
        }
        holdings.setHoldingsType(holdingsType);
        holdings.setId("who-" + id);
        holdings.setContentObject(oleHoldings);
        holdings.setCreatedBy(resultSet.getString("CREATED_BY"));
        holdings.setCreatedOn(resultSet.getString("DATE_CREATED"));
        if (resultSet.getString("STAFF_ONLY") != null) {
          holdings.setStaffOnly(
              (resultSet.getString("STAFF_ONLY").equalsIgnoreCase("Y")
                  ? Boolean.TRUE
                  : Boolean.FALSE));
        }
        holdings.setUpdatedBy(resultSet.getString("UPDATED_BY"));
        holdings.setUpdatedOn(resultSet.getString("DATE_UPDATED"));
        holdings.setLastUpdated(resultSet.getString("DATE_UPDATED"));

        uriSet = new HashSet<>();
        noteSet = new HashSet<>();
        linkSet = new HashSet<>();
        List<Item> itemList = fetchItemForHoldings(Integer.parseInt(id));
        holdingsTree.setHoldings(holdings);
        holdingsTree.getItems().addAll(itemList);

        map.put(id, holdingsTree);

        holdingsTrees.add(holdingsTree);
      }

      if (StringUtils.isNotEmpty(holdingsType) && holdingsType.equalsIgnoreCase(PHoldings.PRINT)) {
        if (uriSet.add(resultSet.getString("HOLDINGS_URI_ID"))) {
          Uri uri = new Uri();
          uri.setValue(resultSet.getString("TEXT"));
          oleHoldings.getUri().add(uri);
        }
        ExtentOfOwnership extentOfOwnership = null;
        if (extentOfOwnershipMap.containsKey(resultSet.getString("EXT_OWNERSHIP_ID"))) {
          extentOfOwnership = extentOfOwnershipMap.get(resultSet.getString("EXT_OWNERSHIP_ID"));
        } else {
          extentOfOwnership = new ExtentOfOwnership();
          if (StringUtils.isNotEmpty(resultSet.getString("EXT_OWNERSHIP_TYPE_ID"))) {
            String[] strings =
                extentOfOwnershipTypeMap
                    .get(resultSet.getString("EXT_OWNERSHIP_TYPE_ID"))
                    .split("[|]");
            extentOfOwnership.setType(strings[1]);
          }
          extentOfOwnershipMap.put(resultSet.getString("EXT_OWNERSHIP_ID"), extentOfOwnership);
          oleHoldings.getExtentOfOwnership().add(extentOfOwnership);
        }
        String extOwnershipNoteId = resultSet.getString("EXT_OWNERSHIP_NOTE_ID");
        if (extentOfOwnershipNoteSet != null
            && StringUtils.isNotEmpty(extOwnershipNoteId)
            && extentOfOwnershipNoteSet.add(resultSet.getString("EXT_OWNERSHIP_NOTE_ID"))) {
          Note note = new Note();
          note.setValue(resultSet.getString(83));
          note.setType(resultSet.getString(82));

          extentOfOwnership.getNote().add(note);
        }
      } else {
        if (linkSet.add(resultSet.getString("HOLDINGS_URI_ID"))) {
          Link link = new Link();
          link.setUrl(resultSet.getString("URI"));
          link.setText(resultSet.getString("TEXT"));
          oleHoldings.getLink().add(link);
        }
        if (oleHoldings.getExtentOfOwnership() != null
            && oleHoldings.getExtentOfOwnership().size() > 0) {
          if (coverageSet != null && coverageSet.add(resultSet.getString("HOLDINGS_COVERAGE_ID"))) {
            Coverage coverage = new Coverage();
            coverage.setCoverageStartIssue(resultSet.getString("COVERAGE_START_ISSUE"));
            coverage.setCoverageStartDate(resultSet.getString("COVERAGE_START_DATE"));
            coverage.setCoverageStartVolume(resultSet.getString("COVERAGE_START_VOLUME"));
            coverage.setCoverageEndIssue(resultSet.getString("HOLDINGS_COVERAGE_ID"));
            coverage.setCoverageEndDate(resultSet.getString("COVERAGE_END_DATE"));
            coverage.setCoverageEndVolume(resultSet.getString("COVERAGE_END_VOLUME"));
            oleHoldings.getExtentOfOwnership().get(0).getCoverages().getCoverage().add(coverage);
          }

          if (perpetualSet != null
              && perpetualSet.add(resultSet.getString("HOLDINGS_PERPETUAL_ACCESS_ID"))) {
            PerpetualAccess perpetualAccess = new PerpetualAccess();
            perpetualAccess.setPerpetualAccessStartDate(
                resultSet.getString("PERPETUAL_ACCESS_START_DATE"));
            perpetualAccess.setPerpetualAccessStartIssue(
                resultSet.getString("PERPETUAL_ACCESS_START_ISSUE"));
            perpetualAccess.setPerpetualAccessStartVolume(
                resultSet.getString("PERPETUAL_ACCESS_START_VOLUME"));
            perpetualAccess.setPerpetualAccessEndDate(
                resultSet.getString("PERPETUAL_ACCESS_END_DATE"));
            perpetualAccess.setPerpetualAccessEndVolume(
                resultSet.getString("PERPETUAL_ACCESS_END_VOLUME"));
            perpetualAccess.setPerpetualAccessEndIssue(
                resultSet.getString("PERPETUAL_ACCESS_END_ISSUE"));
            oleHoldings
                .getExtentOfOwnership()
                .get(0)
                .getPerpetualAccesses()
                .getPerpetualAccess()
                .add(perpetualAccess);
          }
        }
        if (donorSet != null && donorSet.add(resultSet.getString("HOLDINGS_DONOR_ID"))) {
          DonorInfo donorInfo = new DonorInfo();
          donorInfo.setDonorCode(resultSet.getString("DONOR_CODE"));
          donorInfo.setDonorNote(resultSet.getString("DONOR_NOTE"));
          donorInfo.setDonorPublicDisplay(resultSet.getString("DONOR_DISPLAY_NOTE"));
          oleHoldings.getDonorInfo().add(donorInfo);
        }
      }

      if (noteSet.add(resultSet.getString("HOLDINGS_NOTE_ID"))) {
        Note note = new Note();
        note.setValue(resultSet.getString("NOTE"));
        note.setType(resultSet.getString("TYPE"));
        oleHoldings.getNote().add(note);
      }
    }
    resultSet.close();
    return holdingsTrees;
  }
예제 #21
0
 @Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
   final ANode node = toEmptyNode(arg(0, qc), qc);
   final QNm qname = node != null ? node.qname() : null;
   return qname != null ? Uri.uri(qname.uri(), false) : Uri.EMPTY;
 }
예제 #22
0
파일: Geo.java 프로젝트: runeengh/basex
 /**
  * Returns the name of the geometry type in the GML namespace, or the empty sequence.
  *
  * @param node xml element containing gml object(s)
  * @return integer value of CRS of the geometry
  * @throws QueryException query exception
  */
 @Deterministic
 public Uri srid(final ANode node) throws QueryException {
   return Uri.uri(token(checkGeo(node).getSRID()));
 }
예제 #23
0
        public void onClick(View v) {
          ContentResolver cr = getContentResolver();
          switch (v.getId()) {
              // 전부 읽기
            case R.id.readall:
              Cursor cursor = cr.query(Uri.parse(WORDURI), null, null, null, null);

              String Result = "";
              while (cursor.moveToNext()) {
                String eng = cursor.getString(0);
                String han = cursor.getString(1);
                Result += (eng + " = " + han + "\n");
              }

              if (Result.length() == 0) {
                mText.setText("Empyt Set");
              } else {
                mText.setText(Result);
              }
              cursor.close();
              break;
              // 하나만 읽기
            case R.id.readone:
              Cursor cursor2 = cr.query(Uri.parse(WORDURI + "/boy"), null, null, null, null);

              String Result2 = "";
              if (cursor2.moveToFirst()) {
                String eng = cursor2.getString(0);
                String han = cursor2.getString(1);
                Result2 += (eng + " = " + han + "\n");
              }

              if (Result2.length() == 0) {
                mText.setText("Empyt Set");
              } else {
                mText.setText(Result2);
              }
              cursor2.close();
              break;
              // 삽입
            case R.id.insert:
              ContentValues row = new ContentValues();
              row.put("eng", "school");
              row.put("han", "학교");

              cr.insert(Uri.parse(WORDURI), row);
              mText.setText("Insert Success");
              break;
              // 삭제
            case R.id.delete:
              cr.delete(Uri.parse(WORDURI), null, null);
              mText.setText("Delete Success");
              break;
              // 수정
            case R.id.update:
              ContentValues row2 = new ContentValues();
              row2.put("han", "핵교");
              cr.update(Uri.parse(WORDURI + "/school"), row2, null, null);
              mText.setText("Update Success");
              break;
          }
        }