Example usage for org.jfree.util Log error

List of usage examples for org.jfree.util Log error

Introduction

In this page you can find the example usage for org.jfree.util Log error.

Prototype

public static void error(final Object message) 

Source Link

Document

A convenience method for logging an 'error' message.

Usage

From source file:org.gaixie.micrite.car.dao.hibernate.CarfileDAOImpl.java

private void desidedExpiredFlag(List<Carfile> list) {
    int days = dictionaryDAO.get(IDictionaryService.EXPIRED_PERMISSION_ID).getValue();

    Date now = null;//from ww w.j  a  v  a2  s . c o m
    try {
        now = CalendarUtil.df.parse(CalendarUtil.df.format(new Date()));
    } catch (Exception e) {
        // TODO: handle exception
        Log.error(e);
    }
    for (int i = 0; i < list.size(); i++) {
        _setExpiredFlag(list.get(i), now, days);
    }
}

From source file:org.gaixie.micrite.car.dao.hibernate.CarfileDAOImpl.java

@Override
public void desidedExpiredFlag(Carfile car) {
    int days = dictionaryDAO.get(IDictionaryService.EXPIRED_PERMISSION_ID).getValue();

    Date now = null;//from  w w w.  j a  v a2  s  .c  o m
    try {
        now = CalendarUtil.df.parse(CalendarUtil.df.format(new Date()));
    } catch (Exception e) {
        // TODO: handle exception
        Log.error(e);
    }
    _setExpiredFlag(car, now, days);
}

From source file:org.loklak.susi.SusiPhrase.java

/**
 * Create a phrase using a json data structure containing the phrase description.
 * The json must contain at least two properties:
 *   type: the name of the phrase type which means: what language is used for the pattern
 *   expression: the pattern string using either regular expressions or simple patterns
 * @param json the phrase description/*from ww  w  . ja  v a2s. c  om*/
 * @throws PatternSyntaxException
 */
public SusiPhrase(JSONObject json) throws PatternSyntaxException {
    if (!json.has("expression"))
        throw new PatternSyntaxException("expression missing", "", 0);
    String expression = json.getString("expression").toLowerCase();
    Type t = Type.pattern;
    if (json.has("type"))
        try {
            t = Type.valueOf(json.getString("type"));
        } catch (IllegalArgumentException e) {
            Log.error("type value is wrong: " + json.getString("type"));
            t = expression.indexOf(".*") >= 0 ? Type.regex
                    : expression.indexOf('*') >= 0 ? Type.pattern : Type.minor;
        }

    expression = normalizeExpression(expression);
    if ((t == Type.minor || t == Type.prior) && expression.indexOf(".*") >= 0)
        t = Type.regex;
    if ((t == Type.minor || t == Type.prior) && expression.indexOf('*') >= 0)
        t = Type.pattern;
    if (t == Type.pattern)
        expression = parsePattern(expression);
    this.pattern = Pattern.compile(expression);
    this.type = expression.equals("(.*)") ? Type.minor : t;
    this.hasCaptureGroups = expression.replaceAll("\\(\\?", "").indexOf('(') >= 0;

    // measure the meat size
    this.meatsize = Math.min(99, extractMeat(expression).length());
}

From source file:org.n52.oxf.sos.adapter.SOSRequestBuilder_200.java

protected void processProcedureDescriptionFormat(DescribeSensorType descSensor, ParameterShell shell) {
    if (shell == null) {
        Log.error("Missing shell parameter '" + DESCRIBE_SENSOR_PROCEDURE_DESCRIPTION_FORMAT + "'.");
        return; // throwing OXFException would break interface
    }/* ww  w .j  ava 2 s  .  c  om*/
    descSensor.setProcedureDescriptionFormat((String) shell.getSpecifiedValue());
}

From source file:org.pentaho.di.core.refinery.publish.agilebi.ModelServerPublish.java

/**
 * Jersey call to add or update connection
 *
 * @param connection/*from  w w  w . j a  va2 s  .c  om*/
 * @param update
 * @return
 */
protected boolean updateConnection(DatabaseConnection connection, boolean update) {
    String storeDomainUrl;
    try {
        if (update) {
            storeDomainUrl = biServerConnection.getUrl() + PLUGIN_DATA_ACCESS_API_CONNECTION_UPDATE;
        } else {
            storeDomainUrl = biServerConnection.getUrl() + PLUGIN_DATA_ACCESS_API_CONNECTION_ADD;
        }
        WebResource resource = getClient().resource(storeDomainUrl);
        Builder builder = resource.type(MediaType.APPLICATION_JSON).entity(connection);

        ClientResponse resp = httpPost(builder);
        if (resp == null || resp.getStatus() != 200) {
            return false;
        }
    } catch (Exception ex) {
        Log.error(ex.getMessage());
        return false;
    }
    return true;
}

From source file:org.pentaho.di.core.refinery.publish.agilebi.ModelServerPublish.java

/**
 * Jersey call to use the put service to load a mondrain file into the Jcr repsoitory
 *
 * @param mondrianFile// ww  w .  j a v a 2s. co m
 * @param catalogName
 * @param datasourceInfo
 * @param overwriteInRepos
 * @throws Exception
 */
public int publishMondrianSchema(InputStream mondrianFile, String catalogName, String datasourceInfo,
        boolean overwriteInRepos) throws Exception {
    String storeDomainUrl = biServerConnection.getUrl() + MONDRIAN_POST_ANALYSIS_URL;
    WebResource resource = getClient().resource(storeDomainUrl);
    String parms = "Datasource=" + datasourceInfo + ";retainInlineAnnotations=true";
    int response = PUBLISH_FAILED;
    FormDataMultiPart part = new FormDataMultiPart();
    part.field("parameters", parms, MediaType.MULTIPART_FORM_DATA_TYPE)
            .field("uploadAnalysis", mondrianFile, MediaType.MULTIPART_FORM_DATA_TYPE)
            .field("catalogName", catalogName, MediaType.MULTIPART_FORM_DATA_TYPE)
            .field("overwrite", overwriteInRepos ? "true" : "false", MediaType.MULTIPART_FORM_DATA_TYPE)
            .field("xmlaEnabledFlag", "true", MediaType.MULTIPART_FORM_DATA_TYPE);

    addAclToRequest(part);

    // If the import service needs the file name do the following.
    part.getField("uploadAnalysis").setContentDisposition(
            FormDataContentDisposition.name("uploadAnalysis").fileName(catalogName).build());
    try {
        Builder builder = resourceBuilder(resource, part);
        ClientResponse resp = httpPost(builder);
        String entity = null;
        if (resp != null && resp.getStatus() == 200) {
            entity = resp.getEntity(String.class);
            if (entity.equals(String.valueOf(PUBLISH_CATALOG_EXISTS))) {
                response = PUBLISH_CATALOG_EXISTS;
            } else {
                response = Integer.parseInt(entity);
            }
        } else {
            Log.info(resp);
        }
    } catch (Exception ex) {
        Log.error(ex.getMessage());
    }
    return response;
}

From source file:org.pentaho.di.core.refinery.publish.agilebi.ModelServerPublish.java

/**
 * Jersey call to use the put service to load a metadataFile file into the Jcr repsoitory
 *
 * @param metadataFile//  w  w  w  .  j a va 2 s . co  m
 * @param domainId     is fileName
 * @throws Exception return code to detrmine next step
 */
public int publishMetaDataFile(InputStream metadataFile, String domainId) throws Exception {
    String storeDomainUrl = biServerConnection.getUrl() + "plugin/data-access/api/metadata/import";
    WebResource resource = getClient().resource(storeDomainUrl);

    int response = PUBLISH_FAILED;
    FormDataMultiPart part = new FormDataMultiPart();
    part.field("domainId", domainId, MediaType.MULTIPART_FORM_DATA_TYPE).field("metadataFile", metadataFile,
            MediaType.MULTIPART_FORM_DATA_TYPE);

    if (this.isForceOverwrite()) {
        part.field("overwrite", this.isForceOverwrite() + "", MediaType.MULTIPART_FORM_DATA_TYPE);
    }

    addAclToRequest(part);

    part.getField("metadataFile")
            .setContentDisposition(FormDataContentDisposition.name("metadataFile").fileName(domainId).build());
    try {
        Builder builder = resourceBuilder(resource, part);
        ClientResponse resp = httpPut(builder);
        if (resp != null && resp.getStatus() == 200) {
            if (resp.getEntity(String.class).equals(PUBLISH_SUCCESS + "")) {
                response = PUBLISH_SUCCESS;
            }
        }
    } catch (Exception ex) {
        Log.error(ex.getMessage());
    }
    return response;
}

From source file:org.pentaho.di.core.refinery.publish.agilebi.ModelServerPublish.java

public int publishDsw(InputStream metadataFile, String domainId) throws Exception {
    if (!StringUtils.endsWith(domainId, ".xmi")) {
        throw new IllegalArgumentException("Domain ID for DSW must end in .xmi");
    }/*from w  w w .j av  a  2s .  c om*/

    final String publishDswUrl = biServerConnection.getUrl() + "plugin/data-access/api/datasource/dsw/import";
    WebResource resource = getClient().resource(publishDswUrl);

    FormDataMultiPart part = new FormDataMultiPart();
    part.field("domainId", domainId, MediaType.MULTIPART_FORM_DATA_TYPE).field("metadataFile", metadataFile,
            MediaType.MULTIPART_FORM_DATA_TYPE);
    if (this.isForceOverwrite()) {
        part.field("overwrite", Boolean.toString(this.isForceOverwrite()), MediaType.MULTIPART_FORM_DATA_TYPE);
    }
    addAclToRequest(part);

    // TODO do we want this?
    part.field("checkConnection", Boolean.TRUE.toString(), MediaType.MULTIPART_FORM_DATA_TYPE);

    try {
        Builder builder = resourceBuilder(resource, part);
        ClientResponse resp = httpPut(builder);
        if (resp != null) {
            // TODO: we can get more info from the response;
            switch (ClientResponse.Status.fromStatusCode(resp.getStatus())) {
            case OK:
            case CREATED:
                return PUBLISH_SUCCESS;
            default:
                return PUBLISH_FAILED;
            }
        }
    } catch (Exception ex) {
        Log.error(ex.getMessage());
    }
    return PUBLISH_FAILED;
}

From source file:org.pentaho.di.core.refinery.publish.agilebi.ModelServerPublish.java

public DatabaseConnection connectionNameExists(String connectionName) {

    if (StringUtils.isBlank(connectionName)) {
        return null;
    }//from   w  w  w  .j a v  a 2s . co m

    try {
        String storeDomainUrl = biServerConnection.getUrl() + DATA_ACCESS_API_CONNECTION_GET + REST_NAME_PARM
                + connectionName;
        storeDomainUrl = URIUtil.encodeQuery(storeDomainUrl);
        WebResource resource = getClient().resource(storeDomainUrl);
        Builder builder = resource.type(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_XML);
        ClientResponse response = httpGet(builder);
        if (response != null && response.getStatus() == 200) {

            String payload = response.getEntity(String.class);
            DatabaseConnection connection = JAXBUtils.unmarshalFromJson(payload, DatabaseConnection.class);

            return connection;
        }
    } catch (Exception ex) {
        Log.error(ex.getMessage());
    }

    return null;
}

From source file:org.projectforge.business.user.UserRightServiceImpl.java

private void initUserRightIds() {

    ServiceLoader<RightRightIdProviderService> serviceLoader = ServiceLoader
            .load(RightRightIdProviderService.class);
    for (RightRightIdProviderService service : serviceLoader) {
        String cname = service.getClass().getName();
        for (IUserRightId uid : service.getUserRightIds()) {
            if (userRightIds.containsKey(uid.getId()) == true) {
                Log.error("Duplicated UserId: " + uid.getId());
            }//from   w  ww  . j  a v  a2  s. c om
            userRightIds.put(uid.getId(), uid);
        }
    }

}