Java 类javax.xml.bind.ValidationException 实例源码
项目:spring-boot-sandbox
文件:DemoApplication.java
@PostMapping("/")
@ResponseBody
ResponseEntity<StreamingResponseBody> post(@RequestPart final MultipartFile file)
throws Exception {
if (file.isEmpty()) {
throw new ValidationException("file was empty");
}
final HttpHeaders headers = new HttpHeaders();
headers.setContentDispositionFormData("filename", "sample.txt");
final StreamingResponseBody body = out -> out.write(file.getBytes());
return ResponseEntity.ok()
.headers(headers)
.contentType(MediaType.valueOf("application/force-download"))
.body(body);
}
项目:Planchester
文件:CreateNonMusicalEventController.java
@FXML
@Override
public void insertEventDuty() throws ValidationException {
if(validate()) {
EventDutyDTO eventDutyDTO = new EventDutyDTO();
eventDutyDTO.setName(name.getText());
eventDutyDTO.setDescription(description.getText());
eventDutyDTO.setStartTime(DateHelper.mergeDateAndTime(date.getValue(), startTime.getValue()));
eventDutyDTO.setEndTime(endTime.getValue() == null ? DateHelper.mergeDateAndTime(date.getValue(), startTime.getValue().plusHours(2)) : DateHelper.mergeDateAndTime(date.getValue(), endTime.getValue()));
eventDutyDTO.setEventType(EventType.NonMusicalEvent);
eventDutyDTO.setEventStatus(EventStatus.Unpublished);
eventDutyDTO.setLocation(eventLocation.getText());
eventDutyDTO.setPoints((points.getText() == null || points.getText().isEmpty()) ? null : Double.valueOf(points.getText()));
eventDutyDTO = EventScheduleManager.createEventDuty(eventDutyDTO);
EventScheduleController.addEventDutyToGUI(eventDutyDTO); // add event to agenda
EventScheduleController.setDisplayedLocalDateTime(eventDutyDTO.getStartTime().toLocalDateTime()); // set agenda view to week of created event
EventScheduleController.resetSideContent(); // remove content of sidebar
EventScheduleController.setSelectedAppointment(eventDutyDTO); // select created appointment
}
}
项目:Planchester
文件:EditNonMusicalEventController.java
@FXML
@Override
protected void save() throws ValidationException {
if(validate()) {
Agenda.Appointment selectedAppointment = EventScheduleController.getSelectedAppointment();
EventDutyDTO oldEventDutyDTO = EventScheduleController.getEventForAppointment(selectedAppointment);
EventScheduleController.removeSelectedAppointmentFromCalendar(selectedAppointment);
EventDutyDTO eventDutyDTO = new EventDutyDTO();
eventDutyDTO.setEventDutyId(oldEventDutyDTO.getEventDutyId());
eventDutyDTO.setName(name.getText());
eventDutyDTO.setDescription(description.getText());
eventDutyDTO.setStartTime(DateHelper.mergeDateAndTime(date.getValue(), startTime.getValue()));
eventDutyDTO.setEndTime(DateHelper.mergeDateAndTime(date.getValue(), endTime.getValue()));
eventDutyDTO.setEventType(EventType.NonMusicalEvent);
eventDutyDTO.setEventStatus(EventStatus.Unpublished);
eventDutyDTO.setLocation(eventLocation.getText());
eventDutyDTO.setPoints(((points.getText() == null || points.getText().isEmpty()) ? null : Double.valueOf(points.getText())));
EventScheduleManager.updateEventDuty(eventDutyDTO, initEventDutyDTO);
EventScheduleController.addEventDutyToGUI(eventDutyDTO);
EventScheduleController.setDisplayedLocalDateTime(eventDutyDTO.getStartTime().toLocalDateTime()); // set agenda view to week of created event
EventScheduleController.resetSideContent(); // remove content of sidebar
}
}
项目:Planchester
文件:EventDutyModel.java
public void validate() throws ValidationException {
Validator.validateMandatoryString(name, 255);
Validator.validateString(description, 255);
Validator.validateMandatoryTimestamp(startTime);
Validator.validateTimestampAfterToday(startTime);
Validator.validateMandatoryTimestamp(endTime);
Validator.validateTimestampAfterToday(endTime);
Validator.validateTimestamp1BeforeTimestamp2(startTime, endTime);
if(eventType == null || !EventType.contains(eventType.toString())) {
throw new ValidationException("Eventtype wrong");
}
if(eventStatus == null || !EventStatus.contains(eventStatus.toString())) {
throw new ValidationException("Eventstatus wrong");
}
Validator.validateString(conductor, 25);
Validator.validateString(location, 255);
Validator.validateDouble(defaultPoints, 0, Double.MAX_VALUE);
}
项目:Planchester
文件:EventScheduleManager.java
public static EventDutyDTO createEventDuty(EventDutyDTO eventDutyDTO) throws ValidationException {
EventDutyModel eventDutyModel = createEventDutyModel(eventDutyDTO);
eventDutyModel.validate();
EventDutyEntity eventDutyEntity = createEventDutyEntity(eventDutyModel);
eventDutyEntity = eventDutyEntityPersistanceFacade.put(eventDutyEntity);
// create connection between event duty and musical work
if(eventDutyDTO.getMusicalWorks() != null) {
for(MusicalWorkDTO musicalWorkDTO : eventDutyDTO.getMusicalWorks()) {
if(musicalWorkDTO != null) {
createEventDutyMusicalWorks(eventDutyEntity, musicalWorkDTO);
}
}
}
HashMap<String, Integer> musicanCapacityMap = CalculateMusicianCapacity.checkCapacityInRange(eventDutyModel.getStartTime(), eventDutyModel.getEndTime());
if(!musicanCapacityMap.isEmpty()) {
MessageHelper.showWarningMusicianCapacityMessage(musicanCapacityMap, eventDutyDTO);
}
eventDutyDTO.setEventDutyId(eventDutyEntity.getEventDutyId());
return eventDutyDTO;
}
项目:spring4-understanding
文件:Jaxb2Marshaller.java
/**
* Convert the given {@code JAXBException} to an appropriate exception from the
* {@code org.springframework.oxm} hierarchy.
* @param ex {@code JAXBException} that occured
* @return the corresponding {@code XmlMappingException}
*/
protected XmlMappingException convertJaxbException(JAXBException ex) {
if (ex instanceof ValidationException) {
return new ValidationFailureException("JAXB validation exception", ex);
}
else if (ex instanceof MarshalException) {
return new MarshallingFailureException("JAXB marshalling exception", ex);
}
else if (ex instanceof UnmarshalException) {
return new UnmarshallingFailureException("JAXB unmarshalling exception", ex);
}
else {
// fallback
return new UncategorizedMappingException("Unknown JAXB exception", ex);
}
}
项目:Panela-Fit-Oficial
文件:MateriaPrimaPaneController.java
private void validateAttributes(MateriaPrima mp) throws ValidationException {
String returnMs = "";
Integer quantidade = mp.getQuantidade();
Integer codigo = mp.getCodigo();
Double preco = mp.getPreco();
if (mp.getNome() == null || mp.getNome().isEmpty()) {
returnMs += "'Nome' ";
}
if (quantidade.toString() == null || quantidade.toString().isEmpty()) {
returnMs += "'Quantidade' ";
}
if (mp.toString() == null || preco.toString().isEmpty()) {
returnMs += "'Preco' ";
}
if (codigo.toString() == null || codigo.toString().isEmpty()) {
returnMs += "'Codigo' ";
}
if (!returnMs.isEmpty()) {
throw new ValidationException(
String.format("Os argumento[%s] obrigatorios estao nulos ou com valores invalidos", returnMs));
}
}
项目:Panela-Fit-Oficial
文件:FornecedorPaneController.java
private void validateAttributes(Fornecedor fornecedor) throws ValidationException {
String returnMs = "";
Integer codigo = fornecedor.getCodigo();
if (fornecedor.getNomeFornecedor() == null || fornecedor.getNomeFornecedor().isEmpty()) {
returnMs += "'Nome' ";
}
if (fornecedor.getEnderecoFornecedor() == null || fornecedor.getEnderecoFornecedor().isEmpty()) {
returnMs += "'Endereço' ";
}
if (fornecedor.getTelefone() == null || fornecedor.getTelefone().isEmpty()) {
returnMs += "'Telefone' ";
}
if (codigo.toString() == null || codigo.toString().isEmpty()) {
returnMs += "'Codigo' ";
}
if (!returnMs.isEmpty()) {
throw new ValidationException(
String.format("Os argumento[%s] obrigatorios estao nulos ou com valores invalidos", returnMs));
}
}
项目:Panela-Fit-Oficial
文件:VendaPaneController.java
private void validateAttributes(Venda venda) throws ValidationException {
String returnMs = "";
Integer codigo = venda.getCodigo();
if (venda.getCliente() == null) {
returnMs += "'Cliente' ";
}
if (venda.getFuncionario() == null) {
returnMs += "'Funcionario '";
}
if (codigo.toString() == null) {
returnMs += "'Codigo'";
}
if (venda.getListaItensDeVenda() == null) {
returnMs += "'ListaItensDeVenda' ";
}
if (venda.getDataDaVenda() == null) {
returnMs += "'DataVenda' ";
}
if (!returnMs.isEmpty()) {
throw new ValidationException(
String.format("Os arumentos[%s] obrigatorios estao nulos ou com valores invalidos", returnMs));
}
}
项目:laverca
文件:JaxbDeserializer.java
/**
* Attempt to get the most informative detail from the given exception
* @param e Exception to dig
* @return Detail String
*/
protected String getDetail(final Exception e) {
if (e == null) return null;
if (e instanceof ValidationException || e instanceof MarshalException) {
Throwable t = e.getCause();
if (t != null) {
while (t.getCause() != null) {
t = t.getCause();
}
return t.getMessage();
}
}
if (e instanceof IllegalArgumentException) {
return "Unable to parse XML: " + e.getMessage();
}
return e.getMessage();
}
项目:class-guard
文件:Jaxb2Marshaller.java
/**
* Convert the given {@code JAXBException} to an appropriate exception from the
* {@code org.springframework.oxm} hierarchy.
* @param ex {@code JAXBException} that occured
* @return the corresponding {@code XmlMappingException}
*/
protected XmlMappingException convertJaxbException(JAXBException ex) {
if (ex instanceof ValidationException) {
return new ValidationFailureException("JAXB validation exception", ex);
}
else if (ex instanceof MarshalException) {
return new MarshallingFailureException("JAXB marshalling exception", ex);
}
else if (ex instanceof UnmarshalException) {
return new UnmarshallingFailureException("JAXB unmarshalling exception", ex);
}
else {
// fallback
return new UncategorizedMappingException("Unknown JAXB exception", ex);
}
}
项目:iapi-automator
文件:Validator.java
public static List<String> validateSource(String source, String del) throws ValidationException
{
List<String> results = null;
String[] splittedElements = source.split(del);
results = new ArrayList<String>();
for(String element:splittedElements)
{
if(isValidCommand(element))
results.add(element);
else
throw new ValidationException(String.format("{0} is not a valid command!",element));
}
return results;
}
项目:iapi-automator
文件:Interpreter.java
public Interpreter(String program){
_commands = null;
_logger = Logger.getLogger(Interpreter.class.getName());
try
{
_commands = Validator.validateSource(program);
set_creationFailed(false);
_json = new ResultJSON();
_resultJson = new Gson();
_supportedInputs = new ArrayList<String>(Arrays.asList("text:","password:","reset:","image:","file:","checkbox:","radiobutton:","button:","image:","hidden:","submit"));
_logger.log(Level.INFO,"creation successful");
}
catch (ValidationException ex)
{
_logger.log(Level.SEVERE, "Invalid source, check syntax");
set_creationFailed(true);
}
}
项目:opennmszh
文件:RequisitionRestService.java
/**
* Updates or adds a complete requisition with foreign source "foreignSource"
*
* @param requisition a {@link org.opennms.netmgt.provision.persist.requisition.Requisition} object.
* @return a {@link javax.ws.rs.core.Response} object.
*/
@POST
@Consumes(MediaType.APPLICATION_XML)
@Transactional
public Response addOrReplaceRequisition(final Requisition requisition) {
try {
requisition.validate();
} catch (final ValidationException e) {
LogUtils.debugf(this, e, "error validating incoming requisition with foreign source '%s'", requisition.getForeignSource());
throw getException(Status.BAD_REQUEST, e.getMessage());
}
debug("addOrReplaceRequisition: Adding requisition %s (containing %d nodes)", requisition.getForeignSource(), requisition.getNodeCount());
m_accessService.addOrReplaceRequisition(requisition);
return Response.seeOther(getRedirectUri(m_uriInfo, requisition.getForeignSource())).build();
}
项目:cakupan-maven-plugin
文件:XslTransformationTestCase.java
@Test
public void testTransformation() throws TransformerException {
XslTransformer transformer = new XslTransformer(getTransformationFile());
Document transformedXml = transformer.transform(getXmlInputFile());
checkResult(transformedXml);
XslTransformer transformer2 = new XslTransformer(getTransformationFile());
Document transformedXml2 = transformer2.transform(getXmlInputFile());
checkResult(transformedXml2);
XslTransformer transformer3 = new XslTransformer(getTransformationFile());
Document transformedXml3 = transformer3.transform(getXmlInputFile());
checkResult(transformedXml3);
File schemaFile = getTargetSchemaFile();
if (schemaFile != null) {
String xml = DomUtil.documentToString(transformedXml);
try {
new XsdValidator(schemaFile, getResourceResolver()).validate(xml);
} catch (ValidationException e) {
errorCollector.addError(e);
}
}
}
项目:OpenNMS
文件:RequisitionRestService.java
/**
* Updates or adds a complete requisition with foreign source "foreignSource"
*
* @param requisition a {@link org.opennms.netmgt.provision.persist.requisition.Requisition} object.
* @return a {@link javax.ws.rs.core.Response} object.
*/
@POST
@Consumes(MediaType.APPLICATION_XML)
@Transactional
public Response addOrReplaceRequisition(final Requisition requisition) {
writeLock();
try {
try {
requisition.validate();
} catch (final ValidationException e) {
LogUtils.debugf(this, e, "error validating incoming requisition with foreign source '%s'", requisition.getForeignSource());
throw getException(Status.BAD_REQUEST, e.getMessage());
}
debug("addOrReplaceRequisition: Adding requisition %s", requisition.getForeignSource());
m_pendingForeignSourceRepository.save(requisition);
return Response.ok(requisition).build();
} finally {
writeUnlock();
}
}
项目:Parallator
文件:MainController.java
public List<Chapter> validate() {
try {
return feelChapters(file);
} catch (ValidationException e) {
return null;
}
}
项目:jdk8u-jdk
文件:SupplierValidator.java
/**
* Validates the supplier.
*
* @param supplier - Supplier that needs to be validated.
* @return true if supplier has passed validation check. False otherwise.
*/
public static boolean validate(Supplier<?> supplier) {
for (Validate annotation
: supplier.getClass().getAnnotationsByType(Validate.class)) {
try {
annotation.value().validate(supplier);
} catch (ValidationException e) {
System.out.println(annotation.description());
e.printStackTrace();
return false;
}
}
return true;
}
项目:devoxx-2017
文件:User.java
public User(long id,
UUID uuid,
String name,
String key) throws ValidationException {
this.id = id;
this.uuid = uuid;
this.name = name;
this.key = getHash(key);
}
项目:devoxx-2017
文件:User.java
@JsonProperty
public void setKey(String key) throws ValidationException {
if (key.isEmpty()) {
this.key = "";
} else {
this.key = getHash(key);
}
}
项目:devoxx-2017
文件:User.java
public static String getHash(String password) throws ValidationException {
try {
return PasswordStorage.createHash(password);
} catch (PasswordStorage.CannotPerformOperationException e) {
throw new ValidationException("Unable to set encrypted password");
}
}
项目:Planchester
文件:CreateTourController.java
@FXML
@Override
protected void insertEventDuty() throws ValidationException {
if (validate()) {
EventDutyDTO eventDutyDTO = new EventDutyDTO();
eventDutyDTO.setName(name.getText());
eventDutyDTO.setDescription(description.getText());
eventDutyDTO.setStartTime(Timestamp.valueOf(date.getValue().atStartOfDay()));
eventDutyDTO.setEndTime(Timestamp.valueOf(endDate.getValue().atTime(23, 59, 59)));
eventDutyDTO.setEventType(EventType.Tour);
eventDutyDTO.setEventStatus(EventStatus.Unpublished);
eventDutyDTO.setConductor(conductor.getText());
eventDutyDTO.setLocation(eventLocation.getText());
eventDutyDTO.setMusicalWorks(musicalWorks);
eventDutyDTO.setPoints(((points.getText() == null || points.getText().isEmpty()) ? null : Double.valueOf(points.getText())));
eventDutyDTO.setInstrumentation(null);
eventDutyDTO.setRehearsalFor(null);
eventDutyDTO = EventScheduleManager.createEventDuty(eventDutyDTO);
EventScheduleController.addEventDutyToGUI(eventDutyDTO); // add event to agenda
for(EventDutyDTO eventD : rehearsalList){
eventD.setRehearsalFor(eventDutyDTO.getEventDutyId());
EventScheduleManager.createEventDuty(eventD);
EventScheduleController.addEventDutyToGUI(eventD);
}
rehearsalList.clear();
EventScheduleController.setDisplayedLocalDateTime(eventDutyDTO.getStartTime().toLocalDateTime()); // set agenda view to week of created event
EventScheduleController.resetSideContent(); // remove content of sidebar
EventScheduleController.setSelectedAppointment(eventDutyDTO); // select created appointment
}
EventScheduleController.reload();
}
项目:Planchester
文件:EditTourController.java
@FXML
@Override
protected void save() throws ValidationException {
if(validate()) {
Agenda.Appointment selectedAppointment = EventScheduleController.getSelectedAppointment();
EventDutyDTO oldEventDutyDTO = EventScheduleController.getEventForAppointment(selectedAppointment);
EventScheduleController.removeSelectedAppointmentFromCalendar(selectedAppointment);
EventDutyDTO eventDutyDTO = new EventDutyDTO();
eventDutyDTO.setEventDutyId(oldEventDutyDTO.getEventDutyId());
eventDutyDTO.setName(name.getText());
eventDutyDTO.setDescription(description.getText());
eventDutyDTO.setStartTime(DateHelper.mergeDateAndTime(date.getValue(), LocalTime.MIDNIGHT));
eventDutyDTO.setEndTime(DateHelper.mergeDateAndTime(endDate.getValue(), LocalTime.MAX));
eventDutyDTO.setEventType(EventType.Tour);
eventDutyDTO.setEventStatus(EventStatus.Unpublished);
eventDutyDTO.setConductor(conductor.getText());
eventDutyDTO.setLocation(eventLocation.getText());
eventDutyDTO.setMusicalWorks(musicalWorks);
eventDutyDTO.setPoints(((points.getText() == null || points.getText().isEmpty()) ? null : Double.valueOf(points.getText())));
eventDutyDTO.setInstrumentation(null);
eventDutyDTO.setRehearsalFor(null);
EventScheduleManager.updateEventDuty(eventDutyDTO, initEventDutyDTO);
EventScheduleController.addEventDutyToGUI(eventDutyDTO);
updateRehearsal(eventDutyDTO);
EventScheduleController.setDisplayedLocalDateTime(eventDutyDTO.getStartTime().toLocalDateTime()); // set agenda view to week of created event
EventScheduleController.resetSideContent(); // remove content of sidebar
}
}
项目:Planchester
文件:EditRehearsalController.java
@FXML
@Override
protected void save() throws ValidationException {
if(validate()) {
Agenda.Appointment selectedAppointment = EventScheduleController.getSelectedAppointment();
EventDutyDTO oldEventDutyDTO = EventScheduleController.getEventForAppointment(selectedAppointment);
EventScheduleController.removeSelectedAppointmentFromCalendar(selectedAppointment);
EventDutyDTO eventDutyDTO = new EventDutyDTO();
eventDutyDTO.setEventDutyId(oldEventDutyDTO.getEventDutyId());
eventDutyDTO.setName(name.getText());
eventDutyDTO.setDescription(description.getText());
eventDutyDTO.setStartTime(DateHelper.mergeDateAndTime(date.getValue(), startTime.getValue()));
eventDutyDTO.setEndTime(endTime.getValue() == null ? DateHelper.mergeDateAndTime(date.getValue(), startTime.getValue().plusHours(2)) : DateHelper.mergeDateAndTime(date.getValue(), endTime.getValue()));
eventDutyDTO.setEventType(EventType.Rehearsal);
eventDutyDTO.setEventStatus(EventStatus.Unpublished);
eventDutyDTO.setConductor(conductor.getText());
eventDutyDTO.setLocation(eventLocation.getText());
eventDutyDTO.setMusicalWorks(null);
eventDutyDTO.setPoints(((points.getText() == null || points.getText().isEmpty()) ? null : Double.valueOf(points.getText())));
eventDutyDTO.setInstrumentation(null);
eventDutyDTO.setRehearsalFor(initEventDutyDTO.getRehearsalFor());
EventScheduleManager.updateEventDuty(eventDutyDTO, initEventDutyDTO);
EventScheduleController.addEventDutyToGUI(eventDutyDTO);
EventScheduleController.setDisplayedLocalDateTime(eventDutyDTO.getStartTime().toLocalDateTime()); // set agenda view to week of created event
EventScheduleController.resetSideContent(); // remove content of sidebar
}
}
项目:Planchester
文件:CreateController.java
@FXML
protected void insertEventDuty() throws ValidationException {
if(validate()) {
EventDutyDTO eventDutyDTO = new EventDutyDTO();
eventDutyDTO.setName(name.getText());
eventDutyDTO.setDescription(description.getText());
eventDutyDTO.setStartTime(DateHelper.mergeDateAndTime(date.getValue(), startTime.getValue()));
eventDutyDTO.setEndTime(endTime.getValue() == null ? DateHelper.mergeDateAndTime(date.getValue(), startTime.getValue().plusHours(2)) : DateHelper.mergeDateAndTime(date.getValue(), endTime.getValue()));
eventDutyDTO.setEventType(eventType);
eventDutyDTO.setEventStatus(EventStatus.Unpublished);
eventDutyDTO.setConductor(conductor.getText());
eventDutyDTO.setLocation(eventLocation.getText());
eventDutyDTO.setMusicalWorks(musicalWorks);
eventDutyDTO.setPoints((points.getText() == null || points.getText().isEmpty()) ? null : Double.valueOf(points.getText()));
eventDutyDTO.setInstrumentation(null);
eventDutyDTO.setRehearsalFor(null);
eventDutyDTO = EventScheduleManager.createEventDuty(eventDutyDTO);
EventScheduleController.addEventDutyToGUI(eventDutyDTO); // add event to agenda
for(EventDutyDTO eventD : rehearsalList){
eventD.setRehearsalFor(eventDutyDTO.getEventDutyId());
eventD = EventScheduleManager.createEventDuty(eventD);
EventScheduleController.addEventDutyToGUI(eventD);
}
rehearsalList.clear();
EventScheduleController.setDisplayedLocalDateTime(eventDutyDTO.getStartTime().toLocalDateTime()); // set agenda view to week of created event
EventScheduleController.resetSideContent(); // remove content of sidebar
EventScheduleController.setSelectedAppointment(eventDutyDTO); // select created appointment
}
EventScheduleController.reload();
}
项目:Planchester
文件:EditController.java
@FXML
protected void save() throws ValidationException {
if(validate()) {
Agenda.Appointment selectedAppointment = EventScheduleController.getSelectedAppointment();
EventScheduleController.removeSelectedAppointmentFromCalendar(selectedAppointment);
EventDutyDTO eventDutyDTO = new EventDutyDTO();
eventDutyDTO.setEventDutyId(initEventDutyDTO.getEventDutyId());
eventDutyDTO.setName(name.getText());
eventDutyDTO.setDescription(description.getText());
eventDutyDTO.setStartTime(DateHelper.mergeDateAndTime(date.getValue(), startTime.getValue()));
eventDutyDTO.setEndTime(endTime.getValue() == null ? DateHelper.mergeDateAndTime(date.getValue(), startTime.getValue().plusHours(2)) : DateHelper.mergeDateAndTime(date.getValue(), endTime.getValue()));
eventDutyDTO.setEventType(initEventDutyDTO.getEventType());
eventDutyDTO.setEventStatus(initEventDutyDTO.getEventStatus());
eventDutyDTO.setConductor(conductor.getText());
eventDutyDTO.setLocation(eventLocation.getText());
eventDutyDTO.setMusicalWorks(musicalWorks);
eventDutyDTO.setPoints(((points.getText() == null || points.getText().isEmpty()) ? null : Double.valueOf(points.getText())));
eventDutyDTO.setInstrumentation(null);
eventDutyDTO.setRehearsalFor(null);
EventScheduleManager.updateEventDuty(eventDutyDTO, initEventDutyDTO);
//Add added Rehearsal to EventDuty
updateRehearsal(eventDutyDTO);
EventScheduleController.addEventDutyToGUI(eventDutyDTO);
EventScheduleController.setDisplayedLocalDateTime(eventDutyDTO.getStartTime().toLocalDateTime()); // set agenda view to week of created event
EventScheduleController.resetSideContent(); // remove content of sidebar
}
}
项目:Planchester
文件:EditController.java
protected void updateRehearsal(EventDutyDTO eventDutyDTO) throws ValidationException {
for(EventDutyDTO rehearsalFromNew : newRehearsalList) {
if(rehearsalFromNew.getEventDutyId() == null) {
rehearsalFromNew.setRehearsalFor(eventDutyDTO.getEventDutyId());
EventScheduleManager.createEventDuty(rehearsalFromNew);
EventScheduleController.addEventDutyToGUI(rehearsalFromNew);
}
}
actualRehearsalList.clear();
newRehearsalList.clear();
}
项目:Planchester
文件:PublishEventSchedule.java
public static EventDutyDTO publish(Year year, Month month) {
EventDutyModel eventDutyModel;
List<EventDutyEntity> dutiesInRange = eventDutyEntityPersistanceFacade.list(
p -> p.getStarttime().toLocalDateTime().getMonth().equals(month)
&& p.getStarttime().toLocalDateTime().getYear() == year.getValue()
&& p.getEventStatus().equals(EventStatus.Unpublished.toString()));
for(EventDutyEntity evt : dutiesInRange){
eventDutyModel = EventScheduleManager.createEventDutyModel(evt);
try{
eventDutyModel.validate();
} catch (ValidationException val){
MessageHelper.showErrorAlertMessage("Please complete event " + evt.getEventType() + ", " + evt.getStarttime() +
"\n" + val.getMessage() );
return EventScheduleManager.createEventDutyDTO(eventDutyModel);
}
if(!hardValid(evt)) {
return EventScheduleManager.createEventDutyDTO(eventDutyModel);
}
}
for(EventDutyEntity eventDutyEntity: dutiesInRange) {
eventDutyEntity.setEventStatus(EventStatus.Published.toString());
eventDutyEntityPersistanceFacade.put(eventDutyEntity);
}
EventScheduleController.reload();
MessageHelper.showInformationMessage("All events of the month " + month.toString().toLowerCase() + " have been published");
return null;
}
项目:openjdk9
文件:SupplierValidator.java
/**
* Validates the supplier.
*
* @param supplier - Supplier that needs to be validated.
* @return true if supplier has passed validation check. False otherwise.
*/
public static boolean validate(Supplier<?> supplier) {
for (Validate annotation
: supplier.getClass().getAnnotationsByType(Validate.class)) {
try {
annotation.value().validate(supplier);
} catch (ValidationException e) {
System.out.println(annotation.description());
e.printStackTrace();
return false;
}
}
return true;
}
项目:jdk8u_jdk
文件:SupplierValidator.java
/**
* Validates the supplier.
*
* @param supplier - Supplier that needs to be validated.
* @return true if supplier has passed validation check. False otherwise.
*/
public static boolean validate(Supplier<?> supplier) {
for (Validate annotation
: supplier.getClass().getAnnotationsByType(Validate.class)) {
try {
annotation.value().validate(supplier);
} catch (ValidationException e) {
System.out.println(annotation.description());
e.printStackTrace();
return false;
}
}
return true;
}
项目:lookaside_java-1.8.0-openjdk
文件:SupplierValidator.java
/**
* Validates the supplier.
*
* @param supplier - Supplier that needs to be validated.
* @return true if supplier has passed validation check. False otherwise.
*/
public static boolean validate(Supplier<?> supplier) {
for (Validate annotation
: supplier.getClass().getAnnotationsByType(Validate.class)) {
try {
annotation.value().validate(supplier);
} catch (ValidationException e) {
System.out.println(annotation.description());
e.printStackTrace();
return false;
}
}
return true;
}
项目:Panela-Fit-Oficial
文件:ClientePaneController.java
private void validateAttributes(Cliente cliente) throws ValidationException {
String returnMs = "";
Integer idade = cliente.getIdade();
Integer codigo = cliente.getCodigo();
if (cliente.getNome() == null || cliente.getNome().isEmpty()) {
returnMs += "'Nome' ";
}
if (cliente.getCpf() == null || cliente.getCpf().isEmpty()) {
returnMs += "'CPF' ";
}
if (idade.toString() == null || idade.toString().isEmpty()) {
returnMs += "'Idade' ";
}
if (cliente.getEndereco() == null || cliente.getEndereco().isEmpty()) {
returnMs += "'Endereço' ";
}
if (cliente.getTelefone() == null || cliente.getTelefone().isEmpty()) {
returnMs += "'Telefone' ";
}
if (codigo.toString() == null || codigo.toString().isEmpty()) {
returnMs += "'Codigo' ";
}
if (!returnMs.isEmpty()) {
throw new ValidationException(
String.format("Os argumento[%s] obrigatorios estao nulos ou com valores invalidos", returnMs));
}
}
项目:Panela-Fit-Oficial
文件:ProdutoPaneController.java
private void validateAttributes(Produto produto) throws ValidationException {
String returnMs = "";
Integer codigo = produto.getCodigo();
Float peso = produto.getPeso();
Integer calorias = produto.getCalorias();
Integer quantEstoque = produto.getQuantEstoque();
Double preco = produto.getPreco();
if (produto.getNome() == null || produto.getNome().isEmpty()) {
returnMs += "'Nome' ";
}
if (peso.toString() == null || peso.toString().isEmpty()) {
returnMs += "'Peso' ";
}
if (calorias.toString() == null || calorias.toString().isEmpty()) {
returnMs += "'Calorias '";
}
if (quantEstoque.toString() == null || quantEstoque.toString().isEmpty()) {
returnMs += "'QuantidadeEstoque' ";
}
if (preco.toString() == null || preco.toString().isEmpty()) {
returnMs += "'Preco' ";
}
if (codigo.toString() == null || codigo.toString().isEmpty()) {
returnMs += "'Codigo' ";
}
if (produto.getDataFabricacao() == null) {
returnMs += "'DataFabricacao' ";
}
if (produto.getDataValidade() == null) {
returnMs += "'DataValidade' ";
}
if (!returnMs.isEmpty()) {
throw new ValidationException(
String.format("Os arumentos[%s] obrigatorios estao nulos ou com valores invalidos", returnMs));
}
}
项目:Panela-Fit-Oficial
文件:FuncionarioPaneController.java
private void validateAttributes(Funcionario funcionario) throws ValidationException {
String returnMs = "";
Integer idade = funcionario.getIdade();
Integer codigo = funcionario.getCodigo();
Integer nivel = funcionario.getNivel();
if (funcionario.getNome() == null || funcionario.getNome().isEmpty()) {
returnMs += "'Nome' ";
}
if (funcionario.getCpf() == null || funcionario.getCpf().isEmpty()) {
returnMs += "'CPF' ";
}
if (idade.toString() == null || idade.toString().isEmpty()) {
returnMs += "'Idade' ";
}
if (funcionario.getEndereco() == null || funcionario.getEndereco().isEmpty()) {
returnMs += "'Endereço' ";
}
if (funcionario.getTelefone() == null || funcionario.getTelefone().isEmpty()) {
returnMs += "'Telefone' ";
}
if (nivel.toString() == null || nivel.toString().isEmpty()) {
returnMs += "'Nivel' ";
}
if (codigo.toString() == null || codigo.toString().isEmpty()) {
returnMs += "'Codigo' ";
}
if (!returnMs.isEmpty()) {
throw new ValidationException(
String.format("Os argumento[%s] obrigatorios estao nulos ou com valores invalidos", returnMs));
}
}
项目:idea-php-spryker-plugin
文件:FormValidator.java
private void validateFileSelectionItems(SprykerFileCreatorForm form) throws ValidationException {
for (ClassSelectionItem fileSelectionItem : form.getClassSelectionItems()) {
if (fileSelectionItem.isSelected()) {
return;
}
}
throw new ValidationException("blub");
}
项目:idea-php-spryker-plugin
文件:SprykerFileCreatorForm.java
private void handleForm(Project project) {
try {
this.formValidator.validate(this);
this.formHandler.handle(this);
dispose();
} catch (ValidationException exception) {
validationError.setText(exception.getMessage());
validationError.setVisible(true);
}
}
项目:eleme-hackathon
文件:HttpUtil.java
public static String getStrOrDie(JSONObject jsonObject, String key) throws ValidationException {
if (jsonObject.containsKey(key)) {
String value = jsonObject.getString(key);
if (StrUtil.isBlank(value)) {
throw new ValidationException("param " + key + " is empty");
}
return value;
} else {
throw new ValidationException("param " + key + " is null");
}
}
项目:eleme-hackathon
文件:HttpUtil.java
public static int getIntOrDie(JSONObject jsonObject, String key) throws ValidationException {
try {
return Integer.valueOf(jsonObject.getString(key));
} catch (Exception e) {
throw new ValidationException("param " + key + " is empty");
}
}
项目:bank
文件:TestCategoValidation.java
@Test
public void testCategoLength3() throws ValidationException, SQLException {
Operation op = new Operation();
op.setDebit(new BigDecimal("120"));
catego.validate(op, "REMB");
}
项目:infobip-open-jdk-8
文件:SupplierValidator.java
/**
* Validates the supplier.
*
* @param supplier - Supplier that needs to be validated.
* @return true if supplier has passed validation check. False otherwise.
*/
public static boolean validate(Supplier<?> supplier) {
for (Validate annotation
: supplier.getClass().getAnnotationsByType(Validate.class)) {
try {
annotation.value().validate(supplier);
} catch (ValidationException e) {
System.out.println(annotation.description());
e.printStackTrace();
return false;
}
}
return true;
}