List of usage examples for java.io Serializable toString
public String toString()
From source file:com.codecrate.shard.search.ObjectIndexer.java
private void removeDocuments(Serializable id) { IndexReader reader = null;/*from www.jav a 2 s.com*/ try { reader = IndexReader.open(directory); int numDeleted = reader.delete(new Term("id", id.toString())); if (0 < numDeleted) { LOG.debug("Removed " + numDeleted + " documents from index " + directory); } } catch (IOException e) { LOG.error("Error removing documents for " + id + " from index " + directory, e); } finally { closeReader(reader); } }
From source file:com.adito.policyframework.PrincipalCache.java
/** * @return principal names/*from w ww . j a va 2 s.co m*/ */ public final synchronized Collection<String> retrievePrincipalNames() { Serializable[] keysForGroup = principalCache.getKeysForGroup(cacheType); Collection<String> principalNames = new ArrayList<String>(keysForGroup.length); for (Serializable principalName : keysForGroup) { principalNames.add(principalName.toString()); } return principalNames; }
From source file:org.opencron.server.service.SchedulerService.java
public void pause(Serializable jobId) throws SchedulerException { if (exists(jobId)) { TriggerKey triggerKey = TriggerKey.triggerKey(jobId.toString()); quartzScheduler.pauseTrigger(triggerKey); }/*from w w w. ja va2s .com*/ }
From source file:org.opencron.server.service.SchedulerService.java
public void resume(Serializable jobId) throws SchedulerException { if (exists(jobId)) { TriggerKey triggerKey = TriggerKey.triggerKey(jobId.toString()); quartzScheduler.resumeTrigger(triggerKey); } else {/*from w w w .jav a 2 s .c om*/ //skip..... } }
From source file:org.opencron.server.service.SchedulerService.java
public void remove(Serializable jobId) throws SchedulerException { if (exists(jobId)) { TriggerKey triggerKey = TriggerKey.triggerKey(jobId.toString()); quartzScheduler.pauseTrigger(triggerKey);// ?? quartzScheduler.unscheduleJob(triggerKey);// ? quartzScheduler.deleteJob(JobKey.jobKey(jobId.toString()));// logger.info("opencron: removed, triggerKey:{},", triggerKey); }/*from w ww. j a v a2 s . co m*/ }
From source file:org.alfresco.integrations.google.docs.webscripts.IsLatestRevision.java
@Override protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) { getGoogleDocsServiceSubsystem();// w w w . j a va 2 s . c om Map<String, Object> model = new HashMap<String, Object>(); /* Get the nodeRef to test */ String param_nodeRef = req.getParameter(PARAM_NODEREF); NodeRef nodeRef = new NodeRef(param_nodeRef); log.debug("Comparing Node Revision Id from Alfresco and Google: " + nodeRef); /* The revision Id persisted on the node */ String currentRevision = null; /* The latest revision Id from Google for the file */ String latestRevision = null; try { /* The node needs the editingInGoogle aspect if not then tell return 412 */ if (nodeService.hasAspect(nodeRef, GoogleDocsModel.ASPECT_EDITING_IN_GOOGLE)) { Credential credential = googledocsService.getCredential(); /* get the nodes revision Id null if not found */ Serializable property = nodeService.getProperty(nodeRef, GoogleDocsModel.PROP_REVISION_ID); currentRevision = property != null ? property.toString() : null; log.debug("currentRevision: " + currentRevision); /* get the latest revision Id null if not found */ Revision revision = googledocsService.getLatestRevision(credential, nodeRef); latestRevision = revision != null ? revision.getId() : null; log.debug("latestRevision: " + latestRevision); /* compare the revision Ids */ if (currentRevision != null && latestRevision != null) { isLatestRevision = currentRevision.equals(latestRevision); } model.put(MODEL_IS_LATEST_REVISION, isLatestRevision); } else { throw new WebScriptException(HttpStatus.SC_PRECONDITION_FAILED, "Node: " + nodeRef.toString() + " has no revision Ids."); } } catch (GoogleDocsAuthenticationException gdae) { throw new WebScriptException(HttpStatus.SC_BAD_GATEWAY, gdae.getMessage()); } catch (GoogleDocsServiceException gdse) { if (gdse.getPassedStatusCode() > -1) { throw new WebScriptException(gdse.getPassedStatusCode(), gdse.getMessage()); } else { throw new WebScriptException(gdse.getMessage()); } } catch (GoogleDocsRefreshTokenException gdrte) { throw new WebScriptException(HttpStatus.SC_BAD_GATEWAY, gdrte.getMessage()); } catch (IOException ioe) { throw new WebScriptException(HttpStatus.SC_INTERNAL_SERVER_ERROR, ioe.getMessage()); } return model; }
From source file:org.addsimplicity.anicetus.hibernate.TelemetryInterceptor.java
/** * This method is called by Hibernate prior to an entity being deleted. *///w w w. j ava 2 s . c o m @Override public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { HibernateEntity he = new HibernateEntity(entity.getClass().getName(), id.toString(), HibernateOperation.Delete); getTelemetry().addHibernateEntity(he); }
From source file:org.addsimplicity.anicetus.hibernate.TelemetryInterceptor.java
/** * This method is called prior to an object being loaded from the database. *//*from w w w . j a v a 2 s. co m*/ @Override public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { HibernateEntity he = new HibernateEntity(entity.getClass().getName(), id.toString(), HibernateOperation.Load); getTelemetry().addHibernateEntity(he); return false; }
From source file:ddf.catalog.validation.impl.validator.RangeValidator.java
@Override public Optional<AttributeValidationReport> validate(final Attribute attribute) { Preconditions.checkArgument(attribute != null, "The attribute cannot be null."); final String name = attribute.getName(); for (final Serializable value : attribute.getValues()) { final BigDecimal bdValue; if (value instanceof Number) { bdValue = new BigDecimal(value.toString()); } else {/*from w w w. j a v a2 s. com*/ continue; } if (!checkRange(bdValue)) { final String violationMessage = String.format("%s must be between %s and %s", name, min.toPlainString(), max.toPlainString()); final AttributeValidationReportImpl report = new AttributeValidationReportImpl(); report.addViolation( new ValidationViolationImpl(Collections.singleton(name), violationMessage, Severity.ERROR)); return Optional.of(report); } } return Optional.empty(); }
From source file:org.openhie.openempi.report.impl.AbstractReportGenerator.java
private String convertParamValueToString(ReportParameter reportParameter, Serializable value) throws ApplicationException { int dataType = reportParameter.getParameterDatatype(); if (dataType == ReportParameter.STRING_DATATYPE) { return "'" + value.toString() + "'"; } else if (dataType == ReportParameter.NUMERIC_DATATYPE) { return value.toString(); } else if (dataType == ReportParameter.DATE_DATATYPE) { return "'" + value.toString() + "'"; }//from ww w . j ava 2 s. c o m log.error("Unable to convert request parameter value of an unknown data type : " + reportParameter.getName() + ":" + reportParameter.getReport().getName()); throw new ApplicationException("The request parameter is of an unknown data type."); }