Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

gefunden Dokumente als liste ausgeben

Empfohlene Antworten

Veröffentlicht

Hi

Also mich beschäftig gerade ein Problem, wo ich einfach nicht hinterkomme.

Ich habe ein Webservice mit einer Suchfunktion ausgestattet. Diese durchsucht

alle Dokumente nach das eingegebene schlagwort.

Nun sollen alle gefunden Dokumente als Liste ausgegeben werden, die man dann theoretisch

öffnen könnte. Sie müssen glaube ich in Arrays oder so umgeandelt werde.

Ich hoffe ihr könnt mri helfen.

Hier ist die Suchfunktio


@SuppressWarnings("unchecked")

	public List<Document> searchInDocumentFieldsForSimpleSearch(

			final String and_search, final Long userId) {


		final List<Long> documentIds = new ArrayList<Long>(0);

		final List<Long> visibledocumentsForUser_ids = new ArrayList<Long>(0);

		final List<Document> documents = new ArrayList<Document>(0);


		final Session session = sf.openSession();

		final FullTextSession fullTextSession = Search

				.createFullTextSession(session);


		// determine visible documents by user

		visibledocumentsForUser_ids.addAll(dfl

				.getVisibleDocumentsByUser(userId));


		final String newSearch = and_search.trim();

		final Query luceneQuery = createInputFieldQuery(newSearch,

				BooleanClause.Occur.MUST, false);


		final org.hibernate.Query fullTextQuery = fullTextSession

				.createFullTextQuery(luceneQuery, Document.class);

		final Iterator it = fullTextQuery.iterate();


		// while (it.hasNext()) {

		// final DocumentField df = (DocumentField) it.next();

		// if (df != null) {

		// if (!documentIds.contains(df.getDocumentId())

		// && (visibledocumentsForUser_ids

		// .contains(df.getDocumentId()))) {

		// final Document dd = df.getDocument();

		// if(dd!=null){

		// if(Hibernate.isInitialized(dd)==false){

		// Hibernate.initialize(dd);

		// }

		// documentIds.add(dd.getId());

		// documents.add(dd);

		// }

		// }

		// }

		// }


		while (it.hasNext()) {

			final Document d = (Document) it.next();

			if (d != null) {

				if (!documentIds.contains(d.getId())

						&& (visibledocumentsForUser_ids.contains(d.getId()))) {

					documentIds.add(d.getId());

					documents.add(d);

				}

			}

		}


		/*

		 * visibledocumentsForUser_ids.addAll(dfl

		 * .getVisibleDocumentsByUser(userId));

		 * 

		 * Iterator is = documentFields.iterator(); while (is.hasNext()) {

		 * DocumentField df = (DocumentField) is.next(); if(df!=null){ Document

		 * dd = df.getDocument(); dd.getAuthors(); if

		 * (!documentIds.contains(dd.getId()) &&

		 * (visibledocumentsForUser_ids.contains(dd.getId()))) {

		 * 

		 * documentIds.add(dd.getId()); documents.add(dd); // System.out //

		 * .println("###### Document " + dd.getName() + " " // +

		 * dd.getCreationDate() + " " // + dd.getModificationDate()); // hier

		 * implemantation für die categorien anzeige ?? } } }

		 */

		return documents;


	}


	/*

	 * (non-Javadoc)

	 * 

	 * @seede.ejb.search.SearchLocal#

	 * getAllDocumentsByUserCommunitiesAndByReleaseStatus(java.lang.Long)

	 */

Hier ist die funktion Reingeladen in den Webservice. Da brauche ich nun den return wo er die Liste wiedergibt.

@WebMethod

 	public void searchInDocumentFieldsForSimpleSearch(final String and_search, final Long userId)

 		{

 		return;

 		}

hat niemand eine Idee?

Kann es sein das du hier wild Code aneinander schiebst ohne zu verstehen was du das genau machst? Müssen denn nun Arrays übertragen werden oder nicht?



List list = new ArrayList(2);


Object[] array = list.toArray(new Object[list.size()]);


Bearbeitet von Schiller256

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.