List of usage examples for org.hibernate LockMode READ
LockMode READ
To view the source code for org.hibernate LockMode READ.
Click Source Link
From source file:org.archiviststoolkit.model.Resources.java
License:Open Source License
public static void initResourcesLookupList() { try {/*from w w w . j a va2s. c om*/ resourcesEventList.addAll(new ResourcesDAO().findAll(LockMode.READ)); resourcesGlazedList = new SortedList(resourcesEventList); } catch (LookupException e) { new ErrorDialog("", StringHelper.getStackTrace(e)).showDialog(); } }
From source file:org.archiviststoolkit.mydomain.DigitalObjectDAO.java
License:Open Source License
/** * Method to find a parent digital object by the METS identifier * * @param digitalObject The digital object whose identifer to use to do the look up * @param session The session to use to find the digital object * @param closeSession Whether to close the session after using it * @return The Digital Object that was found or null otherwise * @throws LookupException Throws this exception is there was a problem finding the digital object *//* w ww . ja va2 s .co m*/ public DigitalObjects findByMetsIdentifierCommon(DigitalObjects digitalObject, boolean closeSession, Session session) throws LookupException { String metsID = digitalObject.getMetsIdentifier(); if (metsID != null && metsID.trim().length() > 0) { Collection foundDigitalObjects = findAllCommon(LockMode.READ, session, closeSession, Restrictions.eq("metsIdentifier", metsID)); if (!foundDigitalObjects.isEmpty()) { Object[] objects = foundDigitalObjects.toArray(); return (DigitalObjects) objects[0]; } else { return null; } } else { return null; } }
From source file:org.archiviststoolkit.mydomain.DomainTableWorkSurface.java
License:Open Source License
public final void onFindAll() { Thread performer = new Thread(new Runnable() { public void run() { InfiniteProgressPanel monitor = ATProgressUtil .createModalProgressMonitor(ApplicationFrame.getInstance(), 0); monitor.start("Finding All Records..."); DomainAccessObject access = null; try { access = DomainAccessObjectFactory.getInstance().getDomainAccessObject(clazz); humanReadableSearchString = "list all"; updateListWithNewResultSet(access.findAll(LockMode.READ)); filterField.setText(""); } catch (PersistenceException e) { monitor.close();// w w w .ja v a2s .c o m new ErrorDialog(ApplicationFrame.getInstance(), "Error finding all.", e).showDialog(); } catch (LookupException e) { monitor.close(); new ErrorDialog(ApplicationFrame.getInstance(), "Error finding all.", e).showDialog(); } finally { monitor.close(); } } }, "FindAll"); performer.start(); }
From source file:org.archiviststoolkit.structure.ATFieldInfo.java
License:Open Source License
public static void loadFieldList() { fieldList = new Hashtable<String, ATFieldInfo>(); tableList = new TreeSet<String>(); fieldsByTableLookup = new Hashtable<String, TreeSet<DatabaseFields>>(); tableByTableNameLookup = new Hashtable<String, DatabaseTables>(); // DomainAccessObject access = new DomainAccessObjectImpl(DatabaseTables.class); try {// ww w . j a va 2s .c o m DomainAccessObject access = DomainAccessObjectFactory.getInstance() .getDomainAccessObject(DatabaseTables.class); DatabaseTables table; String tableName; TreeSet<DatabaseFields> fieldsByTable; for (Object o : access.findAll(LockMode.READ)) { table = (DatabaseTables) o; // need to check the class name to make sure we don't try // to load any classes which are none core AT 2.0 String className = table.getClassName(); if (className.contains("org.archiviststoolkit")) { tableName = table.getClazz().getSimpleName(); tableByTableNameLookup.put(tableName, table); tableList.add(tableName); fieldsByTable = new TreeSet<DatabaseFields>(); fieldsByTableLookup.put(tableName, fieldsByTable); addFieldInfo(table, fieldsByTable); } } } catch (LookupException e) { new ErrorDialog("Error loading field list", StringHelper.getStackTrace(e)).showDialog(); } catch (PersistenceException e) { new ErrorDialog("Error loading field list", StringHelper.getStackTrace(e)).showDialog(); } }
From source file:org.archiviststoolkit.structure.DefaultValues.java
License:Open Source License
public static void initDefaultValueLookup() { repositoryDefaultValues = new Hashtable<Repositories, Hashtable<String, ArrayList<DefaultValues>>>(); repositoryNotesDefaultValues = new Hashtable<Repositories, Hashtable<NotesEtcTypes, RepositoryNotesDefaultValues>>(); try {//from w w w . ja v a 2s .co m DomainAccessObject access = new DomainAccessObjectImpl(DefaultValues.class); DefaultValues defaultValue; Repositories repository; Hashtable<String, ArrayList<DefaultValues>> tableLookup; ArrayList<DefaultValues> defaultValueList; for (Object o : access.findAll(LockMode.READ)) { defaultValue = (DefaultValues) o; // check to the table class name to make sure only AT related default values // values are loaded String className = defaultValue.getAtField().getDatabaseTable().getClassName(); if (!className.contains("org.archiviststoolkit")) { continue; } repository = defaultValue.getRepository(); tableLookup = repositoryDefaultValues.get(repository); if (tableLookup == null) { tableLookup = new Hashtable<String, ArrayList<DefaultValues>>(); repositoryDefaultValues.put(repository, tableLookup); } defaultValueList = tableLookup.get(defaultValue.getTableName()); if (defaultValueList == null) { defaultValueList = new ArrayList<DefaultValues>(); tableLookup.put(defaultValue.getTableName(), defaultValueList); } defaultValue.setReadWriteMethodFromField(); defaultValueList.add(defaultValue); } access = new DomainAccessObjectImpl(RepositoryNotesDefaultValues.class); RepositoryNotesDefaultValues repositoryNoteDefaultValue; Hashtable<NotesEtcTypes, RepositoryNotesDefaultValues> noteLookup; for (Object o : access.findAll(LockMode.READ)) { repositoryNoteDefaultValue = (RepositoryNotesDefaultValues) o; repository = repositoryNoteDefaultValue.getRepository(); noteLookup = repositoryNotesDefaultValues.get(repository); if (noteLookup == null) { noteLookup = new Hashtable<NotesEtcTypes, RepositoryNotesDefaultValues>(); repositoryNotesDefaultValues.put(repository, noteLookup); } noteLookup.put(repositoryNoteDefaultValue.getNoteType(), repositoryNoteDefaultValue); } } catch (LookupException e) { new ErrorDialog("Error loading default values", StringHelper.getStackTrace(e)).showDialog(); } catch (IntrospectionException e) { new ErrorDialog("Error loading default values", StringHelper.getStackTrace(e)).showDialog(); } }
From source file:org.archiviststoolkit.util.InLineTagsUtils.java
License:Open Source License
public static boolean loadInLineTags() { try {/*from w w w . ja v a2s . com*/ DomainAccessObject access = DomainAccessObjectFactory.getInstance() .getDomainAccessObject(InLineTags.class); inLineTagList = new TreeSet<InLineTags>(); InLineTags inLineTag; for (Object o : access.findAll(LockMode.READ)) { inLineTag = (InLineTags) o; inLineTagList.add(inLineTag); } inLineTagListMap = new HashMap<String, TreeSet<InLineTags>>(); inLineTagListMap.put(NotesEtcTypes.CANNONICAL_NAME_GENERAL_PHYSICAL_DESCRIPTION, getRestrictedList(restrictedTagList1)); inLineTagListMap.put(NotesEtcTypes.CANNONICAL_NAME_PHYSICAL_FACET, getRestrictedList(restrictedTagList1)); inLineTagListMap.put(TITLE, getRestrictedList(restrictedTagList1)); inLineTagListMap.put(NotesEtcTypes.CANNONICAL_NAME_ABSTRACT, getRestrictedList(restrictedTagList2)); inLineTagListMap.put(NotesEtcTypes.CANNONICAL_NAME_LANGUAGE_OF_MATERIALS, getRestrictedList(restrictedTagList2)); inLineTagListMap.put(NotesEtcTypes.CANNONICAL_NAME_DIMENSIONS, getRestrictedList(restrictedTagList2)); inLineTagListMap.put(NotesEtcTypes.CANNONICAL_NAME_LOCATION_NOTE, getRestrictedList(restrictedTagList2)); inLineTagListMap.put(NotesEtcTypes.CANNONICAL_NAME_MATERIAL_SPECIFIC_DETAILS, getRestrictedList(restrictedTagList2)); inLineTagListMap.put(NotesEtcTypes.CANNONICAL_NAME_LEGAL_STATUS_NOTE, getRestrictedList(restrictedTagListLegalStatusNote)); inLineTagListMap.put(BIB_ITEM_VALUE, getRestrictedList(restrictedTagBibItemValue)); inLineTagListMap.put(ALL, getRestrictedList(allTagsList)); } catch (LookupException e) { new ErrorDialog("There is a problem loading in-line tags.", StringHelper.getStackTrace(e)).showDialog(); return false; } catch (PersistenceException e) { new ErrorDialog("There is a problem loading in-line tags.", StringHelper.getStackTrace(e)).showDialog(); return false; } return true; }
From source file:org.archiviststoolkit.util.LocationsUtils.java
License:Open Source License
public static void initLocationLookupList() { try {/*w w w. j a v a 2 s .c o m*/ // clear the event list so we done get duplicates if this // method is called more than once locationEventList.clear(); DomainAccessObject dao = DomainAccessObjectFactory.getInstance().getDomainAccessObject(Locations.class); locationEventList.addAll(dao.findAll(LockMode.READ)); locationsGlazedList = new SortedList(locationEventList); } catch (LookupException e) { new ErrorDialog("", e).showDialog(); } catch (PersistenceException e) { new ErrorDialog("", e).showDialog(); } }
From source file:org.archiviststoolkit.util.LookupListUtils.java
License:Open Source License
public static boolean loadLookupLists() { try {//from www. j a v a 2 s. c o m DomainAccessObject access = DomainAccessObjectFactory.getInstance() .getDomainAccessObject(LookupList.class); lookupListList = new ArrayList<String>(); for (Object o : access.findAll(LockMode.READ)) { addLookupList((LookupList) o); } } catch (LookupException e) { new ErrorDialog(ApplicationFrame.getInstance(), "There is a problem loading lookup lists.", e) .showDialog(); return false; } catch (PersistenceException e) { new ErrorDialog(ApplicationFrame.getInstance(), "There is a problem loading lookup lists.", e) .showDialog(); return false; } return true; }
From source file:org.archiviststoolkit.util.NoteEtcTypesUtils.java
License:Open Source License
public static boolean loadNotesEtcTypes() { try {//from ww w .ja va 2 s . c o m DomainAccessObject access = DomainAccessObjectFactory.getInstance() .getDomainAccessObject(NotesEtcTypes.class); notesEtcTypesList = new Hashtable<String, NotesEtcTypes>(); notesEtcTypesByCannonicalNameList = new Hashtable<String, NotesEtcTypes>(); digitalObjectsNotesTypesValues = new TreeSet<NotesEtcTypes>(); notesEtcTypesValues = new TreeSet<NotesEtcTypes>(); notesOnlyTypesValues = new TreeSet<NotesEtcTypes>(); notesEmbededTypesValues = new TreeSet<NotesEtcTypes>(); NotesEtcTypes noteEtcType; for (Object o : access.findAll(LockMode.READ)) { noteEtcType = (NotesEtcTypes) o; notesEtcTypesList.put(noteEtcType.getNotesEtcLabel(), noteEtcType); notesEtcTypesByCannonicalNameList.put(noteEtcType.getNotesEtcName(), noteEtcType); if (!noteEtcType.getEmbeded()) { notesEtcTypesValues.add(noteEtcType); } else { notesEmbededTypesValues.add(noteEtcType); } if (noteEtcType.getRepeatingDataType().equalsIgnoreCase(NotesEtcTypes.DATA_TYPE_NOTE) && !noteEtcType.getEmbeded()) { notesOnlyTypesValues.add(noteEtcType); if (noteEtcType.getIncludeInDigitalObjects()) { digitalObjectsNotesTypesValues.add(noteEtcType); } } } } catch (LookupException e) { new ErrorDialog("There is a problem loading lookup lists.", StringHelper.getStackTrace(e)).showDialog(); return false; } catch (PersistenceException e) { new ErrorDialog("There is a problem loading lookup lists.", StringHelper.getStackTrace(e)).showDialog(); return false; } return true; }
From source file:org.archiviststoolkit.util.RDEFactory.java
License:Open Source License
public boolean loadRDEs() { try {// w w w . j a v a 2 s . c o m DomainAccessObject dao = DomainAccessObjectFactory.getInstance().getDomainAccessObject(RDEScreen.class); panelContainers = new ArrayList<RdePanelContainer>(); RDEScreen thisScreen; for (Object o : dao.findAll(LockMode.READ)) { thisScreen = (RDEScreen) o; if (RDEUtils.canUseRDEScreen(thisScreen)) { RdePanelContainer container = new RdePanelContainer(thisScreen.getRdeScreenName()); for (RDEScreenPanels panel : thisScreen.getScreenPanels()) { try { container.addSubPanel(panel.getRDEPanel(container)); } catch (RDEPanelCreationException e) { new ErrorDialog("Error adding subpanels", e).showDialog(); return false; } } container.initComponents(); panelContainers.add(container); } } } catch (PersistenceException e) { new ErrorDialog("There is a problem loading Rapid Data Entry Screens", e).showDialog(); return false; } catch (LookupException e) { new ErrorDialog("There is a problem loading Rapid Data Entry Screens", e).showDialog(); return false; } return true; }