-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes the namedqueries used by categories
- Loading branch information
valeriovinciarelli
authored and
valeriovinciarelli
committed
May 31, 2023
1 parent
d93bfb4
commit 148d95d
Showing
3 changed files
with
67 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,57 @@ | ||
package tests; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.epos.eposdatamodel.Category; | ||
import org.epos.eposdatamodel.CategoryScheme; | ||
import org.epos.eposdatamodel.DataProduct; | ||
import org.epos.eposdatamodel.Identifier; | ||
import org.epos.eposdatamodel.State; | ||
import org.epos.handler.dbapi.dbapiimplementation.CategoryDBAPI; | ||
import org.epos.handler.dbapi.dbapiimplementation.CategorySchemeDBAPI; | ||
import org.epos.handler.dbapi.dbapiimplementation.DataProductDBAPI; | ||
import org.epos.handler.dbapi.model.EDMIspartofCategory; | ||
|
||
|
||
|
||
public class Tests { | ||
|
||
public static void main(String[] args) { | ||
|
||
CategorySchemeDBAPI scheme = new CategorySchemeDBAPI(); | ||
System.out.println(scheme.getAll()); | ||
|
||
CategoryDBAPI cat = new CategoryDBAPI(); | ||
System.out.println(cat.getAll()); | ||
|
||
CategoryDBAPI cats = new CategoryDBAPI(); | ||
List<Category> categoriesList = cats.getAll(); | ||
|
||
Tests.recursivePrint(categoriesList, null); | ||
|
||
|
||
} | ||
|
||
public static void recursivePrint(List<Category> categoriesList, String id) { | ||
if(id==null) { | ||
for(Category cat : categoriesList) { | ||
System.out.println("---------- NODE -------- "); | ||
System.out.println("UID "+cat.getUid()); | ||
System.out.println("NAME "+cat.getName()); | ||
System.out.println("DESCRIPTION "+cat.getDescription()); | ||
|
||
if(cat.getBroader()!=null) { | ||
System.out.println("--------- BROADER ----------"); | ||
recursivePrint(categoriesList, cat.getBroader()); | ||
System.out.println("--------- END BROADER ----------"); | ||
} | ||
if(cat.getNarrower()!=null) { | ||
System.out.println("---------- NARROWERS -------- "); | ||
for(String uid : cat.getNarrower()) { | ||
recursivePrint(categoriesList, uid); | ||
} | ||
System.out.println("----------END NARROWERS -------- "); | ||
} | ||
} | ||
}else { | ||
for(Category cat : categoriesList) { | ||
if(cat.getInstanceId().equals(id)) { | ||
System.out.println("---------- SUBNODE -------- "); | ||
System.out.println("UID "+cat.getUid()); | ||
System.out.println("NAME "+cat.getName()); | ||
System.out.println("DESCRIPTION "+cat.getDescription()); | ||
System.out.println("---------- END SUBNODE -------- "); | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
} |