Package org.sakaiproject.entitybus.exception

Examples of org.sakaiproject.entitybus.exception.EntityException


            if (entityExists(ref.getId())) {
                return new WorkflowEntity(ref.getId(), context);
            }
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } finally {
            removeConn(context);
        }
        throw new IllegalArgumentException("Invalid id:" + ref.getId());
    }
View Full Code Here


                entities.add(new WorkflowEntity(wfi, context));
            }

            return entities;
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } finally {
            removeConn(context);
        }
    }
View Full Code Here

            }


            return ePerson != null ? true : false;
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } catch (AuthorizeException ex) {
            throw new EntityException("Forbidden", "Forbidden", 403);
        } finally {
            removeConn(context);
        }
    }
View Full Code Here

            if (entityExists(ref.getId())) {
                return new UserEntity(ref.getId(), context);
            }
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } finally {
            removeConn(context);
        }
        throw new IllegalArgumentException("Invalid id:" + ref.getId());
    }
View Full Code Here

                entities.add(new UserEntity(c, context, uparams));
            }

            return entities;
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } finally {
            removeConn(context);
        }
    }
View Full Code Here

                    collection.setMetadata("provenance_description", provenance);
                    collection.setLicense(licence);
                    collection.update();
                    return String.valueOf(collection.getID());
                } else {
                    throw new EntityException("Internal server error", "Could not create collection", 500);
                }
            } else {
                throw new EntityException("Internal server error", "Could not create collection", 500);
            }
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } catch (AuthorizeException ex) {
            throw new EntityException("Forbidden", "Forbidden", 403);
        }
    }
View Full Code Here

                if (introductoryText != null) collection.setMetadata("introductory_text", introductoryText);
                if (provenance != null) collection.setMetadata("provenance_description", provenance);
                if (licence != null) collection.setLicense(licence);
                collection.update();
            } else {
                throw new EntityException("Internal server error", "Could not update collection", 500);
            }
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } catch (AuthorizeException ae) {
            throw new EntityException("Forbidden", "Forbidden", 403);
        } catch (NumberFormatException ex) {
            throw new EntityException("Bad request", "Could not parse input", 400);
        }
    }
View Full Code Here

                for (Community community : communities) {
                    community.removeCollection(collection);
                }
            }
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } catch (AuthorizeException ae) {
            throw new EntityException("Forbidden", "Forbidden", 403);
        } catch (IOException ie) {
            throw new EntityException("Internal server error", "SQL error, cannot remove collection", 500);
        } catch (NumberFormatException ex) {
            throw new EntityException("Bad request", "Could not parse input", 400);
        }
    }
View Full Code Here

        Context context;
        try {
            context = new Context();
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        }

        refreshParams(context);

        List<Object> stat = new ArrayList<Object>();
        File reportDir = new File(ConfigurationManager.getProperty("log.dir"));

        ReportGenerator rg = new ReportGenerator();
        // iterate through files in report directory and load each
        File[] reports = reportDir.listFiles();
        try {
            for (File report : reports) {
                Matcher genMatcher = analysisGeneralPattern.matcher(report.getName());
                Matcher monMatcher = analysisMonthlyPattern.matcher(report.getName());
                StatReport statReport = new StatReport();
                if (genMatcher.matches()) {
                    statReport.setType("general");
                    rg.processReport(context, statReport, report.getAbsolutePath());
                    stat.add(statReport);
                } else if (monMatcher.matches()) {
                    statReport.setType("monthly");
                    rg.processReport(context, statReport, report.getAbsolutePath());
                    stat.add(statReport);
                }
            }

            removeConn(context);
            return stat;
        } catch (SQLException ex) {
            throw new EntityException("Internal Server Error", "SQL Problem", 500);
        } catch (Exception ex) {
            throw new EntityException("Internal Server Error", "Log file Problem", 500);
        }
    }
View Full Code Here

                    }
                    default:
                        return null;
                }
            } else {
                throw new EntityException("Not found", "Entity not found", 404);
            }
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } catch (AuthorizeException ae) {
            throw new EntityException("Forbidden", "Forbidden", 403);
        } catch (NumberFormatException ex) {
            throw new EntityException("Bad request", "Could not parse input", 400);
        }
    }
View Full Code Here

TOP

Related Classes of org.sakaiproject.entitybus.exception.EntityException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.