List of usage examples for org.apache.commons.lang3 StringUtils capitalize
public static String capitalize(final String str)
Capitalizes a String changing the first letter to title case as per Character#toTitleCase(char) .
From source file:org.apache.olingo.fit.V4Demo.java
@GET @Path("/$metadata") @Produces(MediaType.APPLICATION_XML)//from w w w .j a v a 2 s. co m @Override public Response getMetadata() { return super.getMetadata( "demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA))); }
From source file:org.apache.olingo.fit.V4OpenType.java
public V4OpenType() throws IOException { super(new Metadata(FSManager.instance(ODataServiceVersion.V40).readRes( "openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)), Accept.XML), ODataServiceVersion.V40)); }
From source file:org.apache.olingo.fit.V4OpenType.java
/** * Provide sample large metadata./*from w ww . j a va 2 s . co m*/ * * @return metadata. */ @GET @Path("/$metadata") @Produces(MediaType.APPLICATION_XML) @Override public Response getMetadata() { return super.getMetadata( "openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA))); }
From source file:org.apache.openejb.config.CleanEnvEntries.java
private Class<?> getType(final ClassLoader loader, final InjectionTarget target) { try {/* w w w . j ava 2 s . c o m*/ final Class<?> clazz = loader.loadClass(target.getInjectionTargetClass()); try { final Field field = clazz.getDeclaredField(target.getInjectionTargetName()); return field.getType(); } catch (final NoSuchFieldException e) { // no-op } // TODO Technically we should match by case final String bestName = "set" + StringUtils.capitalize(target.getInjectionTargetName()); final String name = "set" + target.getInjectionTargetName().toLowerCase(); Class<?> found = null; for (final Method method : clazz.getDeclaredMethods()) { if (method.getParameterTypes().length == 1) { if (method.getName().equals(bestName)) { return method.getParameterTypes()[0]; } else if (method.getName().toLowerCase().equals(name)) { found = method.getParameterTypes()[0]; } } } if (found != null) { return found; } } catch (final Throwable e) { // no-op } return Object.class; }
From source file:org.apache.stratos.cli.RestClient.java
public void undeployEntity(String serviceEndpoint, String entityName, String entityId) { try {//from ww w . j a va 2 s . c o m int responseCode = executeDelete(serviceEndpoint, entityId); if (responseCode == 404) { System.out.println(String.format("%s not found", StringUtils.capitalize(entityName))); } else if (responseCode == 204) { System.out.println(String.format("Successfully un-deployed %s", entityName)); } } catch (Exception e) { String message = String.format("Error in un-deploying %s", entityName); System.out.println(message); logger.error(message, e); } }
From source file:org.apache.stratos.cli.RestClient.java
public void updateEntity(String serviceEndpoint, String entityBody, String entityName) { try {/* www . j a va 2s . c o m*/ int responseCode = executePut(serviceEndpoint, entityBody); if (responseCode == 404) { System.out.println(String.format("%s not found", StringUtils.capitalize(entityName))); } else if (responseCode == 201) { System.out.println(String.format("Successfully updated %s", entityName)); } } catch (Exception e) { String message = String.format("Error in updating %s", entityName); System.out.println(message); logger.error(message, e); } }
From source file:org.apache.stratos.cli.RestClient.java
public void deleteEntity(String serviceEndpoint, String identifier, String entityName) { try {// w w w . j a v a 2s. c o m int responseCode = executeDelete(serviceEndpoint, identifier); if (responseCode == 404) { System.out.println(String.format("%s not found", StringUtils.capitalize(entityName))); } else if (responseCode == 200) { System.out.println(String.format("Successfully deleted %s", entityName)); } } catch (Exception e) { String message = String.format("Error in deleting %s", entityName); System.out.println(message); logger.error(message, e); } }
From source file:org.apache.syncope.client.console.panels.SAML2IdPsDirectoryPanel.java
@Override public ActionsPanel<SAML2IdPTO> getActions(final IModel<SAML2IdPTO> model) { final ActionsPanel<SAML2IdPTO> panel = super.getActions(model); panel.add(new ActionLink<SAML2IdPTO>() { private static final long serialVersionUID = -7978723352517770645L; @Override// w w w . j ava2 s . c o m public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) { SAML2IdPTO object = restClient.read(model.getObject().getKey()); metadataModal.header(Model.of(object.getName() + " - Metadata")); metadataModal.setContent(new XMLEditorPanel(metadataModal, Model.of(new String(Base64.decodeBase64(object.getMetadata()))), true, pageRef)); metadataModal.show(true); target.add(metadataModal); } }, ActionLink.ActionType.HTML, SAML2SPEntitlement.IDP_READ); panel.add(new ActionLink<SAML2IdPTO>() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) { SAML2IdPTO object = restClient.read(model.getObject().getKey()); send(SAML2IdPsDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<>(object, target)); } }, ActionLink.ActionType.EDIT, SAML2SPEntitlement.IDP_UPDATE); panel.add(new ActionLink<SAML2IdPTO>() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) { final SAML2IdPTO object = restClient.read(model.getObject().getKey()); UserTemplateWizardBuilder builder = new UserTemplateWizardBuilder(object.getUserTemplate(), new AnyTypeRestClient().read(AnyTypeKind.USER.name()).getClasses(), new UserFormLayoutInfo(), pageRef) { private static final long serialVersionUID = -7978723352517770634L; @Override protected Serializable onApplyInternal(final AnyWrapper<UserTO> modelObject) { object.setUserTemplate(modelObject.getInnerObject()); restClient.update(object); return modelObject; } }; templateModal.header(Model.of(StringUtils.capitalize( new StringResourceModel("template.title", SAML2IdPsDirectoryPanel.this).getString()))); templateModal.setContent(builder.build(BaseModal.CONTENT_ID)); templateModal.show(true); target.add(templateModal); } }, ActionLink.ActionType.TEMPLATE, SAML2SPEntitlement.IDP_UPDATE); panel.add(new ActionLink<SAML2IdPTO>() { private static final long serialVersionUID = -5467832321897812767L; @Override public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) { try { restClient.delete(model.getObject().getKey()); SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); target.add(container); } catch (SyncopeClientException e) { LOG.error("While deleting object {}", model.getObject().getKey(), e); SyncopeConsoleSession.get() .error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage()); } ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); } }, ActionLink.ActionType.DELETE, SAML2SPEntitlement.IDP_DELETE, true); return panel; }
From source file:org.apache.syncope.client.console.rest.UserRestClient.java
public BulkActionResult suspend(final String etag, final String userKey, final List<StatusBean> statuses) { StatusPatch statusPatch = StatusUtils.buildStatusPatch(statuses, false); statusPatch.setKey(userKey);/*from ww w . j a v a 2 s . co m*/ statusPatch.setType(StatusPatchType.SUSPEND); BulkActionResult result; synchronized (this) { result = new BulkActionResult(); Map<String, BulkActionResult.Status> res = result.getResults(); UserService service = getService(etag, UserService.class); @SuppressWarnings("unchecked") ProvisioningResult<UserTO> provisions = (ProvisioningResult<UserTO>) service.status(statusPatch) .readEntity(ProvisioningResult.class); if (statusPatch.isOnSyncope()) { res.put(StringUtils.capitalize(Constants.SYNCOPE), "suspended".equalsIgnoreCase(provisions.getEntity().getStatus()) ? BulkActionResult.Status.SUCCESS : BulkActionResult.Status.FAILURE); } for (PropagationStatus status : provisions.getPropagationStatuses()) { res.put(status.getResource(), BulkActionResult.Status.valueOf(status.getStatus().name())); } resetClient(UserService.class); } return result; }
From source file:org.apache.syncope.client.console.rest.UserRestClient.java
public BulkActionResult reactivate(final String etag, final String userKey, final List<StatusBean> statuses) { StatusPatch statusPatch = StatusUtils.buildStatusPatch(statuses, true); statusPatch.setKey(userKey);/*w w w.ja v a 2 s.c o m*/ statusPatch.setType(StatusPatchType.REACTIVATE); BulkActionResult result; synchronized (this) { result = new BulkActionResult(); Map<String, BulkActionResult.Status> res = result.getResults(); UserService service = getService(etag, UserService.class); @SuppressWarnings("unchecked") ProvisioningResult<UserTO> provisions = (ProvisioningResult<UserTO>) service.status(statusPatch) .readEntity(ProvisioningResult.class); if (statusPatch.isOnSyncope()) { res.put(StringUtils.capitalize(Constants.SYNCOPE), "active".equalsIgnoreCase(provisions.getEntity().getStatus()) ? BulkActionResult.Status.SUCCESS : BulkActionResult.Status.FAILURE); } for (PropagationStatus status : provisions.getPropagationStatuses()) { res.put(status.getResource(), BulkActionResult.Status.valueOf(status.getStatus().name())); } resetClient(UserService.class); } return result; }