Example usage for java.sql Date Date

List of usage examples for java.sql Date Date

Introduction

In this page you can find the example usage for java.sql Date Date.

Prototype

public Date(long date) 

Source Link

Document

Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.

Usage

From source file:com.sfs.whichdoctor.dao.ProjectDAOImpl.java

/**
 * Save the project bean./*from  w  w  w .ja  v  a2s .  co m*/
 *
 * @param project the project
 * @param checkUser the check user
 * @param privileges the privileges
 * @param action the action
 * @return the int
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
private int save(final ProjectBean project, final UserBean checkUser, final PrivilegesBean privileges,
        final String action) throws WhichDoctorDaoException {

    /* Check required information within Projectbean is present */
    if (project.getReferenceGUID() == 0) {
        throw new WhichDoctorDaoException("Project requires a valid Reference GUID number");
    }
    if (!privileges.getPrivilege(checkUser, "projects", action)) {
        throw new WhichDoctorDaoException("Insufficient user credentials to " + action + " project entry");
    }

    int assessmentTypeId = 0, projectTypeId = 0, projectStatusId = 0, specialtyTypeId = 0;

    try {
        ObjectTypeBean object = this.getObjectTypeDAO().load("Project Assessment Type", "",
                project.getAssessmentType());
        assessmentTypeId = object.getObjectTypeId();
    } catch (Exception e) {
        dataLogger.error("Error loading objecttype for assessment type: " + e.getMessage());
        throw new WhichDoctorDaoException("The project requires a valid assessment type");
    }

    try {
        ObjectTypeBean object = this.getObjectTypeDAO().load("Project Type", "", project.getProjectType());
        projectTypeId = object.getObjectTypeId();
    } catch (Exception e) {
        dataLogger.info("Error loading objecttype for project type: " + e.getMessage());
    }

    try {
        ObjectTypeBean object = this.getObjectTypeDAO().load("Project Status", "", project.getStatus());
        projectStatusId = object.getObjectTypeId();
    } catch (Exception e) {
        dataLogger.error("Error loading objecttype for project status: " + e.getMessage());
        throw new WhichDoctorDaoException("The project requires a valid status");
    }

    try {
        ObjectTypeBean object = this.getObjectTypeDAO().load("Training Program", project.getTrainingProgram(),
                project.getTrainingOrganisation());
        specialtyTypeId = object.getObjectTypeId();
    } catch (Exception e) {
        dataLogger.info("Error loading objecttype for specialty: " + e.getMessage());
    }

    int projectId = 0;

    Timestamp sqlTimeStamp = new Timestamp(Calendar.getInstance().getTimeInMillis());
    Date submitted = null;
    Date resubmitted = null;
    if (project.getSubmitted() != null) {
        submitted = new Date(project.getSubmitted().getTime());
    }
    if (project.getResubmitted() != null) {
        resubmitted = new Date(project.getResubmitted().getTime());
    }

    int assessorId1 = 0, assessorId2 = 0, assessorId3 = 0;
    if (project.getAssessor1() != null) {
        PersonBean person = project.getAssessor1();
        assessorId1 = person.getGUID();
    }
    if (project.getAssessor2() != null) {
        PersonBean person = project.getAssessor2();
        assessorId2 = person.getGUID();
    }
    if (project.getAssessor3() != null) {
        PersonBean person = project.getAssessor3();
        assessorId3 = person.getGUID();
    }

    ArrayList<Object> parameters = new ArrayList<Object>();
    parameters.add(project.getReferenceGUID());
    parameters.add(assessmentTypeId);
    parameters.add(projectTypeId);
    parameters.add(projectStatusId);
    parameters.add(specialtyTypeId);
    parameters.add(project.getTitle());
    parameters.add(project.getMemo());
    parameters.add(submitted);
    parameters.add(resubmitted);
    parameters.add(project.getYear());
    parameters.add(project.getAllOfProgram());
    parameters.add(assessorId1);
    parameters.add(assessorId2);
    parameters.add(assessorId3);
    parameters.add(project.getActive());
    parameters.add(sqlTimeStamp);
    parameters.add(checkUser.getDN());
    parameters.add(project.getLogMessage(action));

    try {
        Integer[] result = this.performUpdate("project", project.getGUID(), parameters, "Project", checkUser,
                action);
        /* Set the returned guid and id values */
        project.setGUID(result[0]);
        projectId = result[1];

        if (projectId > 0) {
            // Rebuild the training status for this person
            this.trainingStatusDAO.calculate(project.getReferenceGUID());
        }
    } catch (Exception e) {
        dataLogger.error("Error processing project record: " + e.getMessage());
        throw new WhichDoctorDaoException("Error processing project record: " + e.getMessage());
    }

    return projectId;
}

From source file:com.sinet.gage.tasklets.DominFullImportTasklet.java

private Date getDateFormat(String dateString) {
    Date formattedDate = null;/*from   ww  w .  ja  va 2  s  .c om*/
    try {
        if (StringUtils.hasLength(dateString)) {
            formattedDate = new Date(dateFormat.parse(dateString).getTime());
        }
    } catch (ParseException e) {
        logger.error("Invalid date format: " + e.getMessage());
    }
    return formattedDate;
}

From source file:com.microsoftopentechnologies.azchat.web.dao.UserPreferenceDAOImpl.java

/**
 * This method populates Prepared Statement from userPreferenceEntity
 * object./*from w  w w.  jav  a2  s.  c  o  m*/
 * 
 * @param preparedStatement
 * @param userPreferenceEntity
 * @return
 * @throws SQLException
 */
public PreparedStatement generatePreparedStatement(PreparedStatement preparedStatement,
        UserPreferenceEntity userPreferenceEntity) throws SQLException {
    preparedStatement.setInt(1, userPreferenceEntity.getUserId());
    preparedStatement.setInt(2, userPreferenceEntity.getPreferenceId());
    preparedStatement.setDate(3, new Date(userPreferenceEntity.getDateCreated().getTime()));
    preparedStatement.setDate(4, new Date(userPreferenceEntity.getCreatedBy().getTime()));
    preparedStatement.setDate(5, new Date(userPreferenceEntity.getDateModified().getTime()));
    preparedStatement.setDate(6, new Date(userPreferenceEntity.getModifiedBy().getTime()));
    return preparedStatement;
}

From source file:gov.nih.nci.integration.caaers.CaAERSAdverseEventStrategyTest.java

private ServiceInvocationMessage prepareServiceInvocationMessage(Long referenceMessageId, String message,
        Date startTime, StrategyIdentifier strategyIdentifier) {
    final ServiceInvocationMessage serviceInvocationMessage = new ServiceInvocationMessage();
    serviceInvocationMessage.setStrategyIdentifier(strategyIdentifier);
    final IHubMessage iHubMessage = new IHubMessage();
    iHubMessage.setStartTime(startTime);
    iHubMessage.setEndTime(new Date(new java.util.Date().getTime()));
    iHubMessage.setRequest(message);/*from ww  w.  j  a v  a2  s  .  co m*/
    iHubMessage.setReferenceMessageId(referenceMessageId);
    serviceInvocationMessage.setReferenceMessageId(referenceMessageId);
    serviceInvocationMessage.setMessage(iHubMessage);
    return serviceInvocationMessage;
}

From source file:org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCache.java

public void doUpdate(ICacheElement ce) {
    incrementUpdateCount();//from  w ww.  j  a va  2 s  .  c o  m

    if (log.isDebugEnabled()) {
        log.debug("updating, ce = " + ce);
    }

    Connection con;
    try {
        con = poolAccess.getConnection();
    } catch (SQLException e) {
        log.error("Problem getting conenction.", e);
        return;
    }

    try {
        // TEST
        Statement sStatement = null;
        try {
            sStatement = con.createStatement();
            alive = true;
        } catch (SQLException e) {
            log.error("Problem creating statement.", e);
            alive = false;
        } finally {
            try {
                sStatement.close();
            } catch (SQLException e) {
                log.error("Problem closing statement.", e);
            }
        }

        if (!alive) {
            if (log.isInfoEnabled()) {
                log.info("Disk is not alive, aborting put.");
            }
            return;
        }

        if (log.isDebugEnabled()) {
            log.debug("Putting [" + ce.getKey() + "] on disk.");
        }

        byte[] element;

        try {
            element = serialize(ce);
        } catch (IOException e) {
            log.error("Could not serialize element", e);
            return;
        }

        boolean exists = false;

        // First do a query to determine if the element already exists
        if (this.getJdbcDiskCacheAttributes().isTestBeforeInsert()) {
            exists = doesElementExist(ce);
        }

        // If it doesn't exist, insert it, otherwise update
        if (!exists) {
            try {
                String sqlI = "insert into " + getJdbcDiskCacheAttributes().getTableName()
                        + " (CACHE_KEY, REGION, ELEMENT, MAX_LIFE_SECONDS, IS_ETERNAL, CREATE_TIME, CREATE_TIME_SECONDS, SYSTEM_EXPIRE_TIME_SECONDS) "
                        + " values (?, ?, ?, ?, ?, ?, ?, ?)";

                PreparedStatement psInsert = con.prepareStatement(sqlI);
                psInsert.setString(1, (String) ce.getKey());
                psInsert.setString(2, this.getCacheName());
                psInsert.setBytes(3, element);
                psInsert.setLong(4, ce.getElementAttributes().getMaxLifeSeconds());
                if (ce.getElementAttributes().getIsEternal()) {
                    psInsert.setString(5, "T");
                } else {
                    psInsert.setString(5, "F");
                }
                Date createTime = new Date(ce.getElementAttributes().getCreateTime());
                psInsert.setDate(6, createTime);

                long now = System.currentTimeMillis() / 1000;
                psInsert.setLong(7, now);

                long expireTime = now + ce.getElementAttributes().getMaxLifeSeconds();
                psInsert.setLong(8, expireTime);

                psInsert.execute();
                psInsert.close();
            } catch (SQLException e) {
                if (e.toString().indexOf("Violation of unique index") != -1
                        || e.getMessage().indexOf("Violation of unique index") != -1
                        || e.getMessage().indexOf("Duplicate entry") != -1) {
                    exists = true;
                } else {
                    log.error("Could not insert element", e);
                }

                // see if it exists, if we didn't already
                if (!exists && !this.getJdbcDiskCacheAttributes().isTestBeforeInsert()) {
                    exists = doesElementExist(ce);
                }
            }
        }

        // update if it exists.
        if (exists) {
            String sqlU = null;
            try {
                sqlU = "update " + getJdbcDiskCacheAttributes().getTableName()
                        + " set ELEMENT  = ?, CREATE_TIME = ?, CREATE_TIME_SECONDS = ?, "
                        + " SYSTEM_EXPIRE_TIME_SECONDS = ? " + " where CACHE_KEY = ? and REGION = ?";
                PreparedStatement psUpdate = con.prepareStatement(sqlU);
                psUpdate.setBytes(1, element);

                Date createTime = new Date(ce.getElementAttributes().getCreateTime());
                psUpdate.setDate(2, createTime);

                long now = System.currentTimeMillis() / 1000;
                psUpdate.setLong(3, now);

                long expireTime = now + ce.getElementAttributes().getMaxLifeSeconds();
                psUpdate.setLong(4, expireTime);

                psUpdate.setString(5, (String) ce.getKey());
                psUpdate.setString(6, this.getCacheName());
                psUpdate.execute();
                psUpdate.close();

                if (log.isDebugEnabled()) {
                    log.debug("ran update " + sqlU);
                }
            } catch (SQLException e2) {
                log.error("e2 sql [" + sqlU + "] Exception: ", e2);
            }
        }
    } finally {
        try {
            con.close();
        } catch (SQLException e) {
            log.error("Problem closing connection.", e);
        }
    }

    if (log.isInfoEnabled()) {
        if (updateCount % LOG_INTERVAL == 0) {
            // TODO make a log stats method
            log.info("Update Count [" + updateCount + "]");
        }
    }
}

From source file:com.sfs.whichdoctor.dao.AccreditationDAOImpl.java

/**
 * Save.// ww w  .ja  va2  s .co  m
 *
 * @param accreditation the accreditation
 * @param checkUser the check user
 * @param privileges the privileges
 * @param action the action
 *
 * @return the int
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
private int save(final AccreditationBean accreditation, final UserBean checkUser,
        final PrivilegesBean privileges, final String action) throws WhichDoctorDaoException {

    // Check required information within accreditation bean is present
    if (accreditation.getReferenceGUID() == 0) {
        throw new WhichDoctorDaoException("Accreditation requires a valid Reference GUID");
    }
    if (!privileges.getPrivilege(checkUser, "accreditations", action)) {
        throw new WhichDoctorDaoException("Insufficient user credentials to " + action + " accreditation");
    }

    // Variable for holding result
    int accreditationId = 0;

    int accreditationTypeId = 0;
    int specialtyTypeId = 0;
    try {
        ObjectTypeBean object = this.getObjectTypeDAO().load("Accreditation Type",
                accreditation.getAccreditationType(), accreditation.getAccreditationClass());
        accreditationTypeId = object.getObjectTypeId();
    } catch (Exception e) {
        dataLogger.error("Error loading objecttype for accreditation type: " + e.getMessage());
    }
    try {
        ObjectTypeBean object = this.getObjectTypeDAO().load("Accredited Specialty",
                accreditation.getSpecialtySubType(), accreditation.getSpecialtyType());
        specialtyTypeId = object.getObjectTypeId();
    } catch (Exception e) {
        dataLogger.error("Error loading objecttype for accredited specialty: " + e.getMessage());
    }

    // Get accreditation SQL Date object and timestamp
    Date accreditationDate = null;
    if (accreditation.getAccreditationDate() != null) {
        accreditationDate = new Date(accreditation.getAccreditationDate().getTime());
    }
    Timestamp sqlTimeStamp = new Timestamp(Calendar.getInstance().getTimeInMillis());

    ArrayList<Object> parameters = new ArrayList<Object>();
    parameters.add(accreditation.getReferenceGUID());
    parameters.add(accreditation.getCore());
    parameters.add(accreditationTypeId);
    parameters.add(specialtyTypeId);
    parameters.add(accreditation.getWeeksApproved());
    parameters.add(accreditation.getWeeksCertified());
    parameters.add(accreditation.getNote());
    parameters.add(accreditationDate);
    parameters.add(accreditation.getActive());
    parameters.add(sqlTimeStamp);
    parameters.add(checkUser.getDN());
    parameters.add(accreditation.getLogMessage(action));

    try {
        Integer[] result = this.performUpdate("accreditation", accreditation.getGUID(), parameters,
                "Accreditation", checkUser, action);
        /* Set the returned guid and id values */
        accreditation.setGUID(result[0]);
        accreditationId = result[1];
    } catch (Exception e) {
        dataLogger.error("Error processing accreditation record: " + e.getMessage());
        throw new WhichDoctorDaoException("Error processing accreditation record: " + e.getMessage());
    }

    if (accreditationId > 0) {
        updateIndeces(accreditation.getReferenceGUID(), checkUser, privileges);
    }
    return accreditationId;
}

From source file:gov.nih.nci.integration.invoker.CaTissueSpecimenStrategyTest.java

/**
 * Tests updateSpecimens using the ServiceInvocationStrategy class for the failure scenario
 * //from   ww w  .j a v  a 2s.  c  o m
 * @throws IntegrationException - IntegrationException
 * @throws JAXBException - JAXBException
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void updateSpecimensFailure() throws IntegrationException, JAXBException {
    final Date stTime = new Date(new java.util.Date().getTime());

    xsltTransformer.transform(null, null, null);
    EasyMock.expectLastCall().andAnswer(new IAnswer() {

        public Object answer() {
            return getSpecimenXMLStr();
        }
    }).anyTimes();

    final ServiceInvocationResult clientResult = new ServiceInvocationResult();
    clientResult.setDataChanged(false);
    clientResult.setOriginalData(getSpecimenXMLStr());
    final IntegrationException ie = new IntegrationException(IntegrationError._1085, new Throwable( // NOPMD
            "Available Quantity cannot be greater than the Initial Quantity"),
            "Available Quantity cannot be greater than the Initial Quantity");
    clientResult.setInvocationException(ie);

    EasyMock.expect(caTissueSpecimenClient.updateSpecimens((String) EasyMock.anyObject()))
            .andReturn(clientResult);
    EasyMock.replay(caTissueSpecimenClient);
    final ServiceInvocationMessage serviceInvocationMessage = prepareServiceInvocationMessage(REFMSGID,
            getSpecimenXMLStr(), stTime, caTissueUpdateSpecimenStrategy.getStrategyIdentifier());
    final ServiceInvocationResult strategyResult = caTissueUpdateSpecimenStrategy
            .invoke(serviceInvocationMessage);
    Assert.assertNotNull(strategyResult);
}

From source file:com.xumpy.thuisadmin.dao.BedragenDaoTest.java

@Test
@Transactional(value = "jpaTransactionManager")
public void testSomBedragDatum() throws ParseException {
    startDate = new Date(dt.parse("2015-02-18").getTime());
    endDate = new Date(dt.parse("2015-02-23").getTime());

    BigDecimal somBedrag = bedragenDao.somBedragDatum(rekening.getPk_id(), startDate);

    assertEquals(new BigDecimal(1550), somBedrag);
}

From source file:com.evolveum.midpoint.web.security.MidPointAuthenticationProvider.java

private Authentication authenticateUserPassword(MidPointPrincipal principal, String password)
        throws BadCredentialsException {
    if (StringUtils.isBlank(password)) {
        throw new BadCredentialsException("web.security.provider.access.denied");
    }/*w  w w  .  ja  v  a2s.c o m*/

    if (principal == null || principal.getUser() == null || principal.getUser().getCredentials() == null) {
        throw new BadCredentialsException("web.security.provider.invalid");
    }

    if (!principal.isEnabled()) {
        throw new BadCredentialsException("web.security.provider.disabled");
    }

    UserType userType = principal.getUser();
    CredentialsType credentials = userType.getCredentials();

    PasswordType passwordType = credentials.getPassword();
    int failedLogins = passwordType.getFailedLogins() != null ? passwordType.getFailedLogins() : 0;
    if (maxFailedLogins > 0 && failedLogins >= maxFailedLogins) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(MiscUtil.asDate(passwordType.getLastFailedLogin().getTimestamp()).getTime());
        calendar.add(Calendar.MINUTE, loginTimeout);
        long lockedTill = calendar.getTimeInMillis();

        if (lockedTill > System.currentTimeMillis()) {
            throw new BadCredentialsException("web.security.provider.locked");
        }
    }

    ProtectedStringType protectedString = passwordType.getValue();
    if (protectedString == null) {
        throw new BadCredentialsException("web.security.provider.password.bad");
    }

    if (StringUtils.isEmpty(password)) {
        throw new BadCredentialsException("web.security.provider.password.encoding");
    }

    Collection<Authorization> authorizations = principal.getAuthorities();
    if (authorizations == null || authorizations.isEmpty()) {
        throw new BadCredentialsException("web.security.provider.access.denied");
    }

    for (Authorization auth : authorizations) {
        if (auth.getAction() == null || auth.getAction().isEmpty()) {
            throw new BadCredentialsException("web.security.provider.access.denied");
        }
    }

    try {
        String decoded;
        if (protectedString.getEncryptedDataType() != null) {
            decoded = protector.decryptString(protectedString);
        } else {
            LOGGER.warn("Authenticating user based on clear value. Please check objects, "
                    + "this should not happen. Protected string should be encrypted.");
            decoded = protectedString.getClearValue();
        }
        if (password.equals(decoded)) {
            // Good password
            if (failedLogins > 0) {
                passwordType.setFailedLogins(0);
            }
            XMLGregorianCalendar systemTime = MiscUtil
                    .asXMLGregorianCalendar(new Date(System.currentTimeMillis()));
            LoginEventType event = new LoginEventType();
            event.setTimestamp(systemTime);
            event.setFrom(getRemoteHost());

            passwordType.setPreviousSuccessfulLogin(passwordType.getLastSuccessfulLogin());
            passwordType.setLastSuccessfulLogin(event);

            userProfileService.updateUser(principal);
            UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(principal,
                    password, principal.getAuthorities());
            return token;
        } else {
            // Bad password               
            passwordType.setFailedLogins(++failedLogins);
            XMLGregorianCalendar systemTime = MiscUtil
                    .asXMLGregorianCalendar(new Date(System.currentTimeMillis()));
            LoginEventType event = new LoginEventType();
            event.setTimestamp(systemTime);
            event.setFrom(getRemoteHost());
            passwordType.setLastFailedLogin(event);
            userProfileService.updateUser(principal);

            throw new BadCredentialsException("web.security.provider.invalid");
        }
    } catch (EncryptionException ex) {
        throw new AuthenticationServiceException("web.security.provider.unavailable", ex);
    }
}

From source file:eionet.meta.imp.VocabularyImportBaseHandler.java

/**
 * This method searches for a related concept in database or in cache.
 *
 * @param relatedConceptUri// w  w  w. j ava 2s . c  om
 *            uri of related concept
 * @return found concept or null
 */
protected VocabularyConcept findRelatedConcept(String relatedConceptUri) {
    VocabularyConcept foundRelatedConcept = null;
    String relatedConceptIdentifier;

    if (StringUtils.startsWith(relatedConceptUri, this.folderContextRoot)) {
        // it is a self reference to a concept in this vocabulary.
        // if it is in found concept then we are lucky. but it may be not created yet... and also wont be created at all...
        relatedConceptIdentifier = relatedConceptUri.replace(this.folderContextRoot, "");
        if (StringUtils.contains(relatedConceptIdentifier, "/")
                || !Util.isValidIdentifier(relatedConceptIdentifier)) {
            return null;
        }
        int index = getPositionIn(this.concepts, relatedConceptIdentifier);
        if (index < this.concepts.size()) {
            return this.concepts.get(index);
        }

        index = getPositionIn(this.toBeUpdatedConcepts, relatedConceptIdentifier);
        if (index < this.toBeUpdatedConcepts.size()) {
            return this.toBeUpdatedConcepts.get(index);
        }

        // concept not seen yet.
        index = getPositionIn(this.notSeenConceptsYet, relatedConceptIdentifier);
        if (index < this.notSeenConceptsYet.size()) {
            return this.notSeenConceptsYet.get(index);
        }

        // so create it
        foundRelatedConcept = new VocabularyConcept();
        foundRelatedConcept.setId(--this.numberOfCreatedConcepts);
        foundRelatedConcept.setIdentifier(relatedConceptIdentifier);
        foundRelatedConcept.setStatus(StandardGenericStatus.VALID);
        foundRelatedConcept.setStatusModified(new Date(System.currentTimeMillis()));
        foundRelatedConcept.setAcceptedDate(new Date(System.currentTimeMillis()));
        List<List<DataElement>> newConceptElementAttributes = new ArrayList<List<DataElement>>();
        foundRelatedConcept.setElementAttributes(newConceptElementAttributes);
        this.notSeenConceptsYet.add(foundRelatedConcept);
        return foundRelatedConcept;
    }

    try {
        // extract related concept base uri and related concept identifier
        int lastDelimiterIndex = Math.max(relatedConceptUri.lastIndexOf("/"),
                Math.max(relatedConceptUri.lastIndexOf("#"), relatedConceptUri.lastIndexOf(":"))) + 1;
        String relatedConceptBaseUri = relatedConceptUri.substring(0, lastDelimiterIndex);
        relatedConceptIdentifier = relatedConceptUri.substring(lastDelimiterIndex);
        if (StringUtils.isNotEmpty(relatedConceptBaseUri) && StringUtils.isNotEmpty(relatedConceptIdentifier)) {
            // check cache first
            foundRelatedConcept = this.relatedConceptCache.get(relatedConceptUri);
            // && !this.notFoundRelatedConceptCache.contains(relatedConceptUri)
            if (foundRelatedConcept == null) {
                // not found in cache search in database
                // search for vocabularies with base uri.
                VocabularyFolder foundVocabularyFolder = null;
                VocabularyFilter vocabularyFilter = new VocabularyFilter();
                vocabularyFilter.setWorkingCopy(false);
                vocabularyFilter.setUsePaging(false);
                vocabularyFilter.setBaseUri(relatedConceptBaseUri);
                // first search for vocabularies, to find correct concept and to make searching faster for concepts
                VocabularyResult vocabularyResult = this.vocabularyService.searchVocabularies(vocabularyFilter);
                if (vocabularyResult != null && vocabularyResult.getTotalItems() > 0) {
                    // get the first found item, since base uri kinda unique
                    foundVocabularyFolder = vocabularyResult.getList().get(0);
                    // folder found, so go on for concept search
                    VocabularyConceptFilter filter = new VocabularyConceptFilter();
                    filter.setUsePaging(false);
                    filter.setIdentifier(relatedConceptIdentifier);
                    filter.setVocabularyFolderId(foundVocabularyFolder.getId());
                    // search for concepts now
                    VocabularyConceptResult results = this.vocabularyService.searchVocabularyConcepts(filter);
                    // if found more than one, how can system detect which one is searched for!
                    if (results != null && results.getFullListSize() == 1) {
                        foundRelatedConcept = results.getList().get(0);
                        this.relatedConceptCache.put(relatedConceptUri, foundRelatedConcept);
                    }
                }
            }
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    }

    return foundRelatedConcept;
}