use of org.geosdi.geoplatform.core.model.GPOrganization in project geo-platform by geosdi.
the class UserService method insertUser.
@Override
public Long insertUser(IGPUserManageDetail userDetail, String organization, HttpServletRequest httpServletRequest, boolean checkUserSession, boolean sendEmail) throws GeoPlatformException {
if (checkUserSession) {
this.getCheckLoggedUser(httpServletRequest);
}
logger.debug("\nUser to INSERT (of the organization \"{}\"):\n{}", organization, userDetail);
Long iserId = null;
try {
GPUser user = this.dtoUserConverter.convertToGPUser(userDetail);
user.setOrganization(new GPOrganization(organization));
iserId = geoPlatformServiceClient.insertAccount(new InsertAccountRequest(user, sendEmail));
} catch (IllegalParameterFault ipf) {
throw new GeoPlatformException(ipf.getMessage());
}
return iserId;
}
use of org.geosdi.geoplatform.core.model.GPOrganization in project geo-platform by geosdi.
the class GPServerDAOImpl method searchPagebleServers.
/**
* @param page
* @param size
* @param organizationName
* @param titleOrAliasName
* @return {@link List<GeoPlatformServer>}
* @throws GPDAOException
*/
@Override
public List<GeoPlatformServer> searchPagebleServers(Integer page, Integer size, String organizationName, GPCapabilityType type, String titleOrAliasName) throws GPDAOException {
checkArgument((organizationName != null) && !(organizationName.trim().isEmpty()), "The Parameter organizationName must not ne null or an empty string.");
checkArgument(type != null, "The Parameter type must not ne null.");
try {
CriteriaBuilder builder = super.criteriaBuilder();
CriteriaQuery<GeoPlatformServer> criteriaQuery = super.createCriteriaQuery();
Root<GeoPlatformServer> root = criteriaQuery.from(this.persistentClass);
criteriaQuery.select(root);
List<Predicate> predicates = Lists.newArrayList();
if ((titleOrAliasName != null) && !(titleOrAliasName.trim().isEmpty())) {
predicates.add(builder.or(builder.like(builder.lower(root.get("title")), titleOrAliasName.toLowerCase()), builder.like(builder.lower(root.get("aliasName")), titleOrAliasName.toLowerCase())));
}
Join<GeoPlatformServer, GPOrganization> join = root.join("organization");
predicates.add(builder.equal(join.get("name"), organizationName));
predicates.add(builder.equal(root.get("serverType"), type));
criteriaQuery.where(predicates.stream().toArray(Predicate[]::new)).orderBy(builder.asc(root.get("aliasName")));
TypedQuery<GeoPlatformServer> typedQuery = this.entityManager.createQuery(criteriaQuery);
Integer firstResult = (page == 0) ? 0 : ((page * size));
typedQuery.setFirstResult(firstResult);
typedQuery.setMaxResults(size);
return typedQuery.getResultList();
} catch (Exception ex) {
ex.printStackTrace();
throw new GPDAOException(ex);
}
}
use of org.geosdi.geoplatform.core.model.GPOrganization in project geo-platform by geosdi.
the class CSWServiceDelegate method getAllCSWServers.
/**
* @see {@link GeoPlatformCSWService#getAllCSWServers(String)} ()}
*/
@Override
public List<ServerCSWDTO> getAllCSWServers(String organizationName) throws ResourceNotFoundFault {
GPOrganization organization = organizationDao.findByName(organizationName);
if (organization == null) {
throw new ResourceNotFoundFault("Organization with name " + organizationName + "was not found.");
}
List<GeoPlatformServer> found = serverDao.findAll(organization.getId(), GPCapabilityType.CSW);
return convertServerList(found);
}
use of org.geosdi.geoplatform.core.model.GPOrganization in project geo-platform by geosdi.
the class GPAclDelegate method saveRole.
@Override
public Boolean saveRole(WSSaveRoleRequest saveRoleReq) throws IllegalParameterFault {
if (saveRoleReq == null) {
throw new IllegalParameterFault("The WSSaveRoleRequest must not " + "be null.");
}
String organization = saveRoleReq.getOrganization();
String role = saveRoleReq.getRole();
AclSid sid = sidDao.findBySid(role, false, organization);
if (sid != null) {
throw new IllegalParameterFault("Authority (Role) \"" + role + "\" already exist");
}
GPOrganization org = organizationDao.findByName(organization);
if (org == null) {
throw new IllegalParameterFault("Organization \"" + organization + "\" not found");
}
sid = new AclSid(false, role, org);
sidDao.persist(sid);
return true;
}
use of org.geosdi.geoplatform.core.model.GPOrganization in project geo-platform by geosdi.
the class GPServerDelegate method getAllServers.
@Override
public ServerDTOContainer getAllServers(String organizationName) throws ResourceNotFoundFault {
GPOrganization organization = organizationDao.findByName(organizationName);
if (organization == null) {
throw new ResourceNotFoundFault("Organization with name " + organizationName + "was not found.");
}
List<GeoPlatformServer> found = serverDao.findAll(organization.getId(), WMS);
return new ServerDTOContainer(convertToServerList(found));
}
Aggregations